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
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
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
| module SimpleForm | |
| class FormBuilder < ActionView::Helpers::FormBuilder | |
| # You can just override the default submit button and add the functionality. | |
| # | |
| # Simple usage: | |
| # f.button :submit 'Send!', :cancel_link => root_path | |
| # | |
| def submit(*args) | |
| cancel_link = args.last.is_a?(Hash) && args.last.delete(:cancel_link) | |
| submit_button = super |
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
| # Patch to support customized request headers in your Capybara tests | |
| # when you're using the RackTest driver, based on an Aslak Hellesøy's gist: | |
| # https://gist.github.com/358664 | |
| # | |
| # Please note that some drivers don't allow access to headers, see: | |
| # https://github.com/jnicklas/capybara/issuesearch?state=closed&q=header#issue/17 | |
| class Capybara::Driver::RackTest < Capybara::Driver::Base | |
| def env |
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
| 1. Two space soft indents (fake tabs) OR tabs... BUT NEVER BOTH - DO NOT MIX | |
| 2. Whitespace, Parens, Braces, Linebreaks | |
| if/else/for/while/try always have spaces, braces and multiple lines. | |
| -------------------------------------------------------------------- | |
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
| # MySQL. Versions 4.1 and 5.0 are recommended. | |
| # | |
| # Install the MySQL driver: | |
| # gem install mysql2 | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: | |
| adapter: mysql2 | |
| encoding: utf8 |
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
| # Bulk API design | |
| # | |
| # resources :posts | |
| class PostsController < ActiveController::Base | |
| # GET /posts/1,4,50,90 | |
| # post_url([ @post, @post ]) | |
| def show_many | |
| @posts = Post.find(params[:ids]) | |
| 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
| # Simple and Stupid Ruby API for Coderwall.com | |
| # Vivien Didelot <[email protected]> | |
| require "open-uri" | |
| require "json" | |
| module CoderWall | |
| class Achievement | |
| attr_reader :name, :badge, :description |
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
| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| end | |
| 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
| # This file contains custom input method from formtastic 1.2 and their | |
| # replacement classes in 2.0 | |
| module FormtasticExtensions | |
| class WysiwygInput < Formtastic::Inputs::TextInput | |
| def input_html_options | |
| wysiwyg_type = input_options.delete(:controls) |
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
| # Some good references are: | |
| # http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x | |
| # http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ | |
| # http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 | |
| #1. Install PostgreSQL postgis and postgres | |
| brew install postgis | |
| initdb /usr/local/var/postgres | |
| pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |