avatar
BestXTools
好工具周刊(第 12 期): Hoppscotch, Blob Animation, Svg Wave, Array Builder, MBTI, ...
发现并分享有趣,有创意,免费、好用的工具,每周四发布。由 BestXTools 创作。 上一期内容 | 下一期内容 | 往期内容 | RSS 订阅 | 邮箱订阅 | 微信订阅 | 工具推荐 | 评论 Image from Pixabay 大家好,两周前,好工具周刊迎来第一个里程碑,周刊第 10 期更新了,在那一期简单写下了对于这个周刊的思考。 今天又迎来了第二个里程碑,截止 2022/5/11 23:59:59,好工具周刊在竹白平台的订阅数破 1000 了 🎉…
avatar
HackerPie
解读Rails(系列翻译)
解读Rails系列文章原文来自Reading Rails,我将尽我所能完成此系列所有文章的翻译。以下部分为原文系列对应翻译: 在我们的工作中,我们的大部分时间都是在使用各种各样的工具,但是你知不知道它们是如何工作的呢? 在这个系列里,我们通过阅读Ruby on Rails的源码去探索其内部的工作机制。我们将不仅仅只是学到与Rails有关的知识,我们也将见识到Ruby里边一些有趣的功能,以及一些有用的新技巧。 解读Rails - 适配器模式…
avatar
HackerPie
在Ruby中使用WebSocket
声明 : 此文翻译自WebSockets in Ruby, 限于本人才疏学浅,其中有翻译不当之处,敬请指出,感激不尽! 在我的主要工作中,需要构建一个一直占用相当大CPU时间片的数据系统。这个任务主要用于在地理编码以及local reference system(本地地理系统?)之间进行编码以及解码。举个例子,这个工作将帮助我们在系统中标记一条对应于街道上某个地点的记录,并且可以知道本地地理位置所对应的坐标。 在第一次的尝试中,我开发了一个用于地理编码的Ruby库以及一个…
avatar
HackerPie
DIY an interesting timer through terminal-notifier and crontab under Mac OS X
Today I will show you how to DIY an intersting notifier automatically running per hour under the Mac OS X 10.8 and higher, all we need are a terminal-notifier and the system built-in command line program named crontab. 1. Install the terminal-notifier terminal-notifier is a program written in the awesome Ruby program language, we can visit the releases page and download the newest version of terminal-notifier. Steps to install it: Please click the green button such as “ terminal-notifier-1.5.0.zip ” and select a path wherever you love to save the zip…
avatar
HackerPie
Split logs automatically every day
Related resource(s): “linuxcommand: logrotate”:http://linuxcommand.org/man\_pages/logrotate8.html logrotate is designed to ease administration of systems that generate large numbers of log files. Normally, logrotate is run as a daily cron job. Some important knowledges: Any number of config files may be given. Later config files may override the options given in earlier files, so the order in which the logrotate config files are listed in is important. Normally, a single config file which includes any other config files which are needed should be used. If a directory is given, every file in that directory is…
avatar
HackerPie
Backup database and other attachments in ROR
Related Resources rsync :http://rsync.samba.org/ Crontab :http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5 “Linux Crontab 定时任务 命令详解” :http://blog.csdn.net/tianlesoftware/article/details/5315039 [rubygem]“backup”:https://github.com/meskyanichi/backup [rubygem]“whenever”:https://github.com/javan/whenever Automatically backup on the remote server: Let’s firstly assumpt: You have a site named “ example.com ”; You can login to it through a username “ deploy ”, and its password is “ password ”; You located the contents of your site in /var/www/example/; Your database server is Mysql , and the database for your site is example…
avatar
HackerPie
Write css codes distinct from different pages
In rails, there is normally a view corresponding to an action. So if you want to do some special styles based on different pages, you can render controller name and action name in your layout file like this: <body class="#{controller_name} #{action_name}"> <!-- Render something --> </body> Let’s assumpt that your current page controller is ProductsController, and your action is index, then you can write your style codes like: .products.index { /* some styles */ }
avatar
HackerPie
Failed to stop or restart Nginx server through serevice command
Many people are accustomed to start a Nginx web server through init scripts and then they can control the state of the server through service command, such as sudo service nginx restart. But sometimes unobvious config error makes the scripts failed to work. Here I will show an error related to pid directive in the config file of nginx, which defaultly located at /opt/nginx/conf/nginx.conf. As ignored by many people, some init scripts assump there is a pid file of nginx located at /var/run/nginx.pid, but in the fact, the default pid file for nginx…
avatar
HackerPie
export/import datas to/from a csv file
今天需要给客户的网站做支持产品数据导出并且更新的功能,所以就涉及到了数据的导入导出了。在经过一番对比之下,果断使用csv格式文件作为数据导入导出的载体。 导出csv文件 与csv文件主要相关的类是CSV,此类在ruby的标准库中被定义,所以只要在代码开头引入相关文件即可: require 'csv' 接着需要创建csv文件,并在其中写入数据: CSV.open "path/to/csv/file", "wb", :col_sep => '|' do |csv| csv << ["one…
avatar
HackerPie
Rails HTTP Status Code to Symbol Mapping
Sometimes you might need to set the HTTP response head with different status to specify the different handled results. You can do this in Rails by add a :status to a rails method such as #respond_with. Here list all the maps: https://gist.github.com/ktkaushik/2405434 Addtionally, you can view all these on your local machine by installing the gem cheat, and see all status codes using command cheat status_codes. All these informations come from internet, the codes file comes from ktkaushik’s gist and other information comes from Cody Fauser’s post
avatar
HackerPie
Delete multiple git remote branches by prefixing all refs with a colon
This article shows how to delete multiple remote branches in Git. git push origin :branch-1 :branch-2 [:other-branches] Remember the colon :
avatar
BestXTools
好工具周刊(第 13 期): uiverse.io, Neumorphism, cssbuttons, AutoDraw, 网名在线生成器, ...
发现并分享有趣,有创意,免费、好用的工具,每周四发布。由 BestXTools 创作。 上一期内容 | 下一期内容 | 往期内容 | RSS 订阅 | 邮箱订阅 | 微信订阅 | 工具推荐 | 评论 Image from Pixabay 🌈 在线工具 uiverse.io - Universe of UI elements made with HTML & CSS 非常好看的 UI 组件库,全部由 HTML & CSS 制作,代码可以免费复制拿去使用。原名 cssbuttons.io 链接: https://uiverse.io/ Neumorphism/Soft UI CSS shadow generator 新拟物风格 (Neumorphism) CSS 生成器。了解更…
avatar
HackerPie
保持高效与专注的 5 个习惯
日常工作中,可能由于各种各样的信息干扰和诱惑,人在保持高效工作与专注上要面对的挑战其实不小。回顾我自己的一些工作经验和体会,我总结了 5 个能帮助我保持专注和高效的习惯: 拒绝注意力迷宫——不要在电脑上登录微信等常用的 IM 工具,关闭手机通知提醒 异步沟通——直接留言与文档协作 延迟学习——意外的发现放进 Todo list 劳逸结合——让身体舒展,让脑子清理 佩戴耳机,聆听音乐 1. 拒绝注意力迷宫——不要在电脑…
avatar
遇见
1Link.Fun, 第一期: 新的开始
- 在线游戏,找到隐藏的牛  这游戏我很久之前就玩过,这几天又被推到我的信息流里了。 规则很简单,点击开始游戏之后,鼠标(或者手指)在页面上滑动,当你离隐藏的牛的位置越近,牛叫的声音越大。看看你能不能通过听牛的叫声来找到牛的隐藏位置。 - 人民币图样库  中钞(中国印钞造币集团有限公司)官网上列出了从人民币第一套到第五套的高清图样, …
avatar
BestXTools
好工具周刊(第 14 期): GitHub Profile Page Creator, CodeCaptcha, Q.Link, ASCII banners
发现并分享有趣,有创意,免费、好用的工具,每周四发布。由 BestXTools 创作。 上一期内容 | 往期内容 | RSS 订阅 | 邮箱订阅 | 微信订阅 | 工具推荐 | 评论 🌈 在线工具 GitHub Profile Page Creator 一款在线帮助你生成漂亮的 GitHub 个人主页的工具。 链接: https://github-profile-page-creator.netlify.app/ 源码: https://github.com/iamsatyajit05/GitHub-Profile-Page-Creator CodeCaptcha.io 程序员专用链接分享工具,访问者必须完成随机的编程问题,才能访问你的秘密链接。分享程序员简历,活动邀请、资源…
avatar
电子芥末
tt-focus: 专门为了帮助集中注意力而设计的命令行时间记录器
Command-line time tracker to help focus. tt-focus 有两大特点: 是一个纯命令行程序 主要用途不是记录时间使用情况,而是帮助集中注意力 比如吃饭、睡觉、做运动、娱乐等的时间记录 不适合 使用本软件。 而写作、学习、编程等,就 适合 使用本软件。 安装 本软件使用了 Python 3.10 的新特性,如果你的系统中未安装 Python 3.10, Windows 用户可直接到 Python官网 下载最新版安装即可。 Linux, MacOS 推荐使用 pyenv 或 miniconda 来安装最新版本的 Python。 在有…
avatar
BestXTools
好工具周刊(第 15 期): GitHub Profile Header Generator, Curl UI, Instant Domain Search, Domcomp, 多地 ping、网络延迟测试, 巴别英语, DAREBEE
发现并分享有趣,有创意,免费、好用的工具,每周四发布。由 BestXTools 创作。 上一期内容 | 往期内容 | RSS 订阅 | 邮箱订阅 | 微信订阅 | 工具推荐 | 评论 🌈 在线工具 GitHub Profile Header Generator 一款在线制作 GitHub 个人主页图片的工具。 链接: https://leviarista.github.io/github-profile-header-generator/ 源码: https://github.com/leviarista/github-profile-header-generator Curl UI 一款在线构建 curl 命令参数的工具。 链接: https://www.webutils.app/curl-web-ui Instant Domain Search 一款方便好用的可注册…
avatar
Rei
解决 Rails 7 下 Sass 引用 Font Awesome 的问题
问题 Rails 7 引入了新的前端方案 CSS/JS bundling,让开发者更容易选择适合自己的打包工具。不过新方案要求开发者对 Assets Pipeline 的工作原理有更深的了解,不然会出现各种状况。 例如在引用 Font Awesome 的时候,可能会发生编译了 CSS,但没有编译字体文件的情况,这要怎么解决呢? 解决 假设项目已经配置了 Sass 作为 CSS bundling 方案。 参考 如何从 Webpacker 切换到 CSS/JS bundling 首先安装 Font Awesome: $ yarn add @fortawesome/fontawesome-free 然后在 config…
avatar
Rei
Propshaft 简介
有留意 Rails 更新的人应该会注意到,Rails 7 新增了一个组件选项 Propshaft。 $ rails new --help -a, [--asset-pipeline=ASSET_PIPELINE] # Choose your asset pipeline [options: sprockets (default), propshaft] # Default: sprockets Assets Pipeline 是 Rails 从 3.1 开始内置的前端文件处理机制,它内部实现的库叫做 Sprockets。过去谈论 Assets Pipeline 跟 Sprockets 几乎不做区分,因为两者几乎重叠。而 Rails 7 开始 Assets Pipeline 提供另一个实现,那就是 Propshaft。 Propshaft 的诞生 Sprockets 是一个完整的前端构建工具,它可以对 js,css…
avatar
小白
我学到的HTML(1)
2022年6月1日——2022年6月4日 响应式网页设计 HTML(超文本标记语言)用于创建内容 CSS(级联样式表)用于样式设计 HTML: <h1>开始标签 </h1>结束标签 h1 主标题 h2 副标题 h3,h4,h5,h6... p元素,段落文本的首选元素(p是paragraph) 占位符文本填充空白 lorem ipsum text 注释:<!-- , --> main元素 <main>,</main> img元素添加图片(img元素没有结束标签) src属性指向图片的地址 所有img元素必须有alt属性…
首页 搜索 登录 注册