| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
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
| # Load the rails application | |
| require File.expand_path('../application', __FILE__) | |
| require 'active_record/connection_adapters/mysql2_adapter' | |
| require 'active_record/connection_adapters/postgresql_adapter' | |
| ActiveRecord::ConnectionAdapters::Mysql2Adapter::NATIVE_DATABASE_TYPES[:big_primary_key] = "BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY".freeze | |
| ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:big_primary_key] = "bigserial primary key".freeze | |
| # Initialize the rails application |
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 ~ | |
| sudo apt-get update | |
| sudo apt-get install unzip curl python-software-properties -y | |
| #sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" | |
| sudo add-apt-repository ppa:ferramroberto/java | |
| sudo apt-get update | |
| sudo apt-get install sun-java6-jre sun-java6-plugin -y | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz |
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 "digest/md5" | |
| require "resque-retry" | |
| require "resque-loner" | |
| # | |
| # Statused Worker Example: | |
| # | |
| # class MyStatusedWorker < StatusedWorker | |
| # def self.job_identity_arguments(user_id, credit_card_number, attributes = {}) | |
| # [user_id] |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script> | |
| <script> | |
| $(document).ready(function(){ | |
| function debug(str){ $("#debug").append("<p>"+str+"</p>"); }; | |
| if(typeof WebSocket === 'undefined') { | |
| alert("Your browser does not support websockets.") | |
| } |
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
| ######################################### | |
| # Very basic rack application showing how to use a router based on the uri | |
| # and how to process requests based on the HTTP method used. | |
| # | |
| # Usage: | |
| # $ rackup rack_example.ru | |
| # | |
| # $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas | |
| # $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas | |
| # $ curl localhost:9292/ideas |
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
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
I've been using this technique in most of my Ruby projects lately where Ruby versions are required:
- Create
.rbenv-versioncontaining the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far... - Create
.rvmrc(withrvm --create --rvmrc "1.9.3@myapp") and edit theenvironment_id=line to fetch the Ruby version from.rbenv-version(example below).
Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.