Hegwin.Me

Time doth transfix the flourish set on youth. And delves the parallels in beauty's brow.

Learn English Expressions from UN Year Review 2013

从联合国年终回顾(2013)里学习表达

At the beginning of each year, the United Nations gives a review of the past year's events, both big and small, and a speech is given. This speech is a rare material for those learning English. Official video (with script): http://webtv.un.org/watch/2013-year-in-review-english/2929587772001/ Chinese translation: http://www.un.org/zh/focus/2013/ I think there are some expressions that I can learn after going through it myself, so...

First Experience for Arduino

Arduino初体验

I knew there was such a thing as Arduino at RubyConfChina in 2012. A year later, I suddenly remembered this thing - I thought it was interesting, so why not give it a try? This article is a record of my first experience with Arduino, not really detailed, but just depicts the feeling of *I can play with electronic components...

Handle Assets with Nginx Instead of Thin

Nginx部署时Assets静态文件请求的配置

When deploying a Rails project to a production environment, I met a lot of problems with assets. For the Hegwin.me blog you're reading now, I'm using Nginx and Thin as the server for deployment. Since I don't deploy very often, I basically do it manually. During my deployment, after I execute `RAILS_ENV=production bundle exec rake assets:precompile` and start the server...

Git Squash Last Commits

Git 合并最后若干次提交

When people are working on features locally, sometimes a git commit is executed once a part of a feature is completed, which makes it easier to trace issues. But in a team, small, multiple commits are not very friendly to the rest of the team. So when we finally push code to the server or merge it into a master...

Invoke System TTS in Ruby

利用Ruby调用TTS进行文本发声阅读

I want to make a small app where I give him a set of English words and he can randomly read out the words inside. The reason why I have such an idea is that when I was learning English, I wanted to find a word dictation app, but I couldn't find the right one, so I might as well...

Manipulate DOM with jQuery

jQuery对DOM的基本操作

I have been using jQuery in my projects since two or three years ago, but I have never studied it carefully, basically searching the web and copying and pasting other people's code. Recently, I learned a little bit about jQuery's selectors and DOM operations at CodeSchool (which has since been renamed Pluralsight), and I think it's pretty useful to take...

Rails CI: RSpec+Guard+Spork

Rails项目持久集成工具:RSpec+Guard+Spork

RSpec, a testing framework in Ruby, can be used to write tests for Ruby on Rails, but also for pure Ruby projects. Guard, as the name suggests, monitors all the files in the project, and when a file changes in the project, it will start the corresponding test script according to the configuration. Spork, which can be thought of as...

Git amend last commit

Git修改上一次提交

No one is immune to mistakes. Sometimes after a git commit, you may find something missing. At this point, if we haven't already pushed, we can use amend to change the last commit more easily. If you're just modifying the commit message, you can just change the text in your editor for git and then save it to close. If...

How to develop Sinatra project

如何Sinatra部署项目

Sinatra, like Rails, is a rack-based application. Before deployment, add a config.ru file to the root of the sinatra project with the following contents require "myapp" # the main project file run Sinatra::Application # If it is a defined subclass, use the name of the class you defined directly. After this, the process is basically the same as deploying rails,...

Catch HTML elements with delayed loading

抓取JS延迟加载的页面内容

I recently wanted to do a small website (WoW-related), which requires data from other people's public database to take, but as a mainland Battlenet users, to apply for API privileges with Blizzard is very troublesome, so I intend to crawl directly from other people's ready-made database pages. Isn't it an HTML crawler? So I used open-uri and nokogiri as usual,...