Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
class TaxCode | |
GENERATORS = { | |
:us => lambda { |id| "US-#{id}" }, | |
:br => lambda { |id| "#{id + 9}-BRA" }, | |
} | |
def self.generate(code, id) | |
gen = GENERATORS[code] || raise ArgumentError, "No generator for country #{code}" | |
gen.call(id) | |
end |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
namespace :db do | |
require "sequel" | |
Sequel.extension :migration | |
DB = Sequel.connect(ENV['DATABASE_URL']) | |
desc "Prints current schema version" | |
task :version do | |
version = if DB.tables.include?(:schema_info) | |
DB[:schema_info].first[:version] | |
end || 0 |
(I guarantee nothing. No warranty I am not responsible blah blah blah. Seems to work great for me so far. Thanks to Tyler Bird who I forked this from.)
This installs a patched ruby 1.9.3-p448 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets
This installs a patched ruby 1.9.3-p392 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets
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.
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY! | |
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
# | |
# Deployment structure | |
# | |
# SERVER: | |
# /etc/init.d/nginx (1. nginx) | |
# /home/app/public_html/app_production/current (Capistrano directory) | |
# |
require File.expand_path('../boot', __FILE__) # etc. | |
module Example | |
class Application < Rails::Application | |
# Helper for loading deeply nested environment config. | |
def load_env(context, key, value) | |
if value.is_a?(Hash) | |
options = begin | |
context.send(key) || ActiveSupport::OrderedOptions.new | |
rescue |