Skip to content

Instantly share code, notes, and snippets.

View hbin's full-sized avatar

Huang Bin hbin

  • China, Beijing
View GitHub Profile
@hbin
hbin / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hbin
hbin / tr.rb
Last active August 29, 2015 14:07 — forked from dominikh/tr.rb
require 'benchmark'
TIMES = 1_000_000
string = ' some weird string with spaces in it '
Benchmark.bmbm do |x|
x.report("gsub + regexp") do
TIMES.times do |t|
string.gsub(/\s+/,'-')
end

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@hbin
hbin / Install_tmux
Created November 22, 2013 03:25 — forked from simme/Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/