This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.Utils = class Utils | |
| @className: (obj)-> | |
| regex = /^function\s*([^\(]+)/ | |
| fnSource = obj.constructor.toString() | |
| regex.exec(fnSource)[1] | |
| @underscore: (word) -> | |
| hanlder = (str, p, offset, s) -> | |
| l = p.toLowerCase() | |
| if offset == 0 then l else "_#{l}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rubygems" | |
| require "active_record" | |
| require "squeel" | |
| n = 5000 | |
| conn = { :adapter => 'sqlite3', :database => ':memory:' } | |
| ActiveRecord::Base.establish_connection(conn) | |
| class User < ActiveRecord::Base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/osascript | |
| # Get this from http://blog.xupeng.me/2011/09/23/precisely-adjust-volume-in-lion/ | |
| # with one fix | |
| on usage() | |
| set _usage to "Usage: adjust-volume number\n" | |
| set _usage to _usage & "For example:\n" | |
| set _usage to _usage & " adjust-volume 2\t - increase volume by 2\n" | |
| set _usage to _usage & " adjust-volume -2\t - decrease volume by 2" | |
| return _usage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ‹ruby-1.9.3@devel› $ irb | |
| ruby-1.9.3-preview1 :001 > YAML | |
| => YAML | |
| ruby-1.9.3-preview1 :002 > YAML.method(:load) | |
| => #<Method: Module(Kernel)#load> | |
| ruby-1.9.3-preview1 :003 > YAML.load "--- hello world!" | |
| NoMethodError: private method `load' called for YAML:Module | |
| from (irb):3 | |
| from /Users/kaichen/.rvm/rubies/ruby-1.9.3-preview1/bin/irb:16:in `<main>' | |
| ruby-1.9.3-preview1 :004 > require 'yaml' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" | |
| local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' | |
| local current_path='%{$terminfo[bold]$fg[blue]%}%c%{$reset_color%}' | |
| local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' | |
| local git_branch='$(git_prompt_info)%{$reset_color%}' | |
| local current_time='%{$fg[yellow]%}%D{[%I:%M:%S]}%{$reset_color%}' | |
| local arrow="%{$fg_bold[red]%}>%{$reset_color%}" | |
| PROMPT="${current_dir} ${git_branch}${arrow} " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source :rubygems | |
| gem "eventmachine", "0.12.10" | |
| gem "rack" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # use mouse on copy mode | |
| setw -g mode-mouse on | |
| # use mouse to select pane | |
| set -g mouse-select-pane on | |
| # scrollback buffer n lines | |
| set -g history-limit 8000 | |
| # listen for activity on all windows | |
| set -g bell-action any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding : utf-8 -*- | |
| set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb) | |
| namespace :deploy do | |
| namespace :assets do | |
| desc <<-DESC | |
| Run the asset precompilation rake task. You can specify the full path \ | |
| to the rake executable by setting the rake variable. You can also \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: utf-8 | |
| require 'fileutils' | |
| class MachineGun | |
| class_attribute :page_cache_extension | |
| self.page_cache_extension ||= '.html' | |
| class_attribute :page_cache_directory | |
| self.page_cache_directory ||= File.join(Rails.root, "public") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| apt-get -y update | |
| apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev | |
| cd /tmp | |
| wget http://ruby.taobao.org/mirrors/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
| tar -xvzf ruby-1.9.3-p194.tar.gz | |
| cd ruby-1.9.3-p194/ | |
| ./configure --prefix=/usr/local --disable-install-rdoc | |
| make |