NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| begin; | |
| create table user_ratings ( | |
| id serial primary key, | |
| user_id integer not null, | |
| rating integer not null check (rating >= 0 and rating <= 5), | |
| ratable_id integer not null | |
| ); | |
| create function random_int(max integer) returns integer as $$ |
| require 'rubygems' | |
| require 'mechanize' | |
| FIRST_NAME = 'FIRST_NAME' | |
| LAST_NAME = 'LAST_NAME' | |
| PHONE = 'PHONE' | |
| EMAIL = 'EMAIL@provider.com' | |
| PARTY_SIZE = 2 | |
| SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' } |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| module CarrierWave | |
| module MiniMagick | |
| # Rotates the image based on the EXIF Orientation | |
| # According to http://jpegclub.org/exif_orientation.html | |
| def auto_orient | |
| manipulate! do |image| | |
| case image['EXIF:Orientation'].to_i | |
| when 2 | |
| image.flop | |
| when 3 |
| # Built application files | |
| /*/build/ | |
| # Crashlytics configuations | |
| com_crashlytics_export_strings.xml | |
| # Local configuration file (sdk path, etc) | |
| local.properties | |
| # Gradle generated files |
A quick "how to" on what you need to do to both setup AND recover a single-server PostgreSQL database using WAL-E
GetObject, ListBucket and PutObject on the bucket you want to use (and that it's not public).| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "github.com/codegangsta/martini" | |
| "github.com/rainycape/magick" | |
| "io/ioutil" | |
| "log" | |
| "net/http" |
| # Rails 3.2 support for HTTP PATCH. | |
| fail "Remove this patch" if Rails::VERSION::MAJOR > 3 | |
| # see http://weblog.rubyonrails.org/2012/2/26/edge-rails-patch-is-the-new-primary-http-method-for-updates/ | |
| # https://github.com/rails/rails/pull/505 | |
| # Be very conservative not to monkey-patch any methods until | |
| # the relevant files are loaded. | |
| ActiveSupport.on_load(:action_controller) do | |
| ActionDispatch::Request.instance_eval do | |
| # Is this a PATCH request? |
| source :rubygems | |
| # We are not loading Active Record, nor Active Resources etc. | |
| # We can do this in any app by simply replacing the rails gem | |
| # by the parts we want to use. | |
| gem "actionpack", "~> 4.0" | |
| gem "railties", "~> 4.0" | |
| gem "tzinfo" | |
| # Let's use thin |
| module AsyncAwait | |
| class Task < NSOperation | |
| def self.new(&block) | |
| alloc.initWithBlock(block) | |
| end | |
| def initWithBlock(block) | |
| init.tap do |