Hegwin.Me

The hydra-universe twisting its body scaled in stars.

Half Marathon in Liupanshui, And Excerpts of Hashiru Koto Nituite by Haruki Murakami

六盘水半程马拉松,以及读《当我谈跑步时我谈些什么》

This year, I experienced a very unpleasant layoff; I was once unable to sleep at night, living in a reversed day-night cycle, constantly wondering if there was something wrong with me. In order to relax, today, a few months later, I arranged for myself to travel alone for more than ten days. One of my target cities is Liupanshui, Guizhou,...

How to Deploy with Capistrano after Repo URL changed?

修改Repo地址后Capistrano部署问题

We are using Capistrano to deploy our project and recently migrated the project repository from BitBucket to Github. I thought I could just simply change `set :repo_url` in `config/deploy.rb`, but that's not the case. When I executed the deployment with Cap, I saw that the code in the log was still taken from the BitBucket repo, and all the changes...

Implement HTTP Long Polling in Rails with Action Controller Live

在Rails中实现HTTP Long Polling

By using ActionController::Live, we can achieve real-time Push communication. The official documentation is here http://edgeapi.rubyonrails.org/classes/ActionController/Live.html, but I always feel that this documentation is too abbreviated for learning. The main techniques used here are these: When the HTTP/1.1 Header is specified as Transfer-Encoding: chunked, the data will be chunked and returned continuously

How to undo a git reset hard and branch delete

Git 找回reset --hard的代码及删除的分支

People make mistakes all the time. I remember the first time I used `git reset --hard` + `git push -f` was in early 2013. I thought it was just a small commit, but I ended up pushing a bunch of useless code to github. What should I do? At this time, some seniors came out and told me that even...

My First Full Marathon

人生第一个全程马拉松

A full marathon, 42.195km, is a distance I never dared to imagine I could complete two years ago. However, just last weekend, December 11, 2016, I completed the first full marathon of my life in Guangzhou. Net time of 5 hours and 12 minutes, not a very good time (mainly due to lack of training for long distances and having...

Things you need to know on Microsoft Exam 70-480 Programming in HTML5 with JavaScript and CSS3

微软考试70-480知识点整理

New semantic tags in HTML5: section, article, heade, footer, aside, nav, figure & figcaption, main, time. Web Worker and Workers communication, WebSockets, localStorage, SVG &/vs. Canvas, Video navigator.geolocation, navigator.online

Install Japanese input methed on ubuntu 16.04

在Ubuntu16.04上安装日语输入法

I personally think that it is necessary to install the corresponding input method on PC/Mobile/Mac if you are learning a new foreign language. Usually, our foreign language teachers, in general, will only teach us the language itself, and not too much to teach you how to install input methods. As for the installation of Japanese input methods, we realized that...

Testing Strategies for React Applications

测试React应用程序

Main things: * [mocha](https://github.com/mochajs/mocha) - Test Frame * [chai](https://github.com/chaijs/chai) - provides TDD/BDD syntax (`should`, `expect` ) for testing * [enzyme](https://github.com/airbnb/enzyme) - procides component renderer such as `shallow` and `mount`, and DOM manipulation and traversal * [sinon](https://github.com/sinonjs/sinon) - provides mocks and spies

Learn New Features in ES 2015 Part 4

学习ES2015 Part 4

## New Features of Object ## Shorthand syntax ES2015 has such a syntactic sugar that when a new Object is generated, it can have a shorthand when the key name is the same as the variable name. See the following example for exactly how to write it. In the past, we needed to write it like this: ```js function buildUser(first,...

Learn New Features in ES 2015 Part 3

学习ES2015 Part 3

## New Features of Array ## Array Destructing It feels like a way to learn from Ruby or similar languages. In ES5, we didn't have a way to directly assign individual values of an array to multiple variables at once, but now we can, assuming we have such an array: ```js let users = [ 'Hegwin', 'Jason', 'Ken' ]; ```...