brew update
rvm get stable
rvm requirements
rvm install 2.0.0
rvm use --default 2.0.0
rvm gemset create piron
rvm gemset use piron
gem install rails
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
| alias ng="npm list -g --depth=0 2>/dev/null" | |
| alias nl="npm list --depth=0 2>/dev/null" |
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
| # Get External IP / local IPs | |
| alias ip="curl ipinfo.io/ip" | |
| alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" | |
| ## other get external ip methods | |
| # dig +short myip.opendns.com @resolver1.opendns.com | |
| # curl echoip.com | |
| # curl ifconfig.me |
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
| if defined? Rails | |
| $LOAD_PATH << "/Users/peng/.rvm/gems/ruby-1.9.3-p194@global/gems/awesome_print-1.1.0/lib" | |
| end | |
| begin | |
| require 'awesome_print' | |
| AwesomePrint.irb! | |
| rescue LoadError | |
| end |
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
| sentence = "there is a wild rose" | |
| letters = sentence.gsub(' ','').split(//) |
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
| def get_payment_token | |
| # Simulate the JavaScript bridge we would use in production | |
| params = { | |
| 'transaction.mode' => 'CONNECTOR_TEST', | |
| 'channel.id' => APP_CONFIG[:paymill_pub_key], | |
| 'jsonPFunction' => 'function', | |
| 'account.number' => '4111111111111111', | |
| 'account.expiry.month' => '02', | |
| 'account.expiry.year' => '2014', | |
| 'account.verification' => '111', |
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
| cd /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/ | |
| ./lsregister -kill -domain local -domain system -domain user |
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
| //--------------------------------------------------------------------------------------------- | |
| // PLACEHOLDER | |
| //--------------------------------------------------------------------------------------------- | |
| if(!Modernizr.input.placeholder){ | |
| $('[placeholder]').focus(function() { | |
| var input = $(this); | |
| if (input.val() == input.attr('placeholder')) { | |
| input.val(''); |
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
| class CssCompressor | |
| def compress(css) | |
| #define formatting around the characters | |
| colon = ':' | |
| semicolon = ';' | |
| comma = ',' | |
| open_brace = '{' | |
| close_brace = '}' | |
| #one block per line |
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
| namespace :db do | |
| desc 'Seed database from db/seed.sql file instead of the traditional db/seed.rb' | |
| namespace :seed do | |
| config = Rails::Configuration.new.database_configuration[RAILS_ENV] | |
| seed_sql = File.expand_path(File.dirname(__FILE__) + '/../../db/seed.sql') | |
| if !File.exists?(seed_sql) | |
| puts "Missing RAILS_ROOT/db/seed.sql" |