This file contains 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
Experiments in revision control: Curry recipe. | |
My personal recipe for Japanese curry, which has mutated over the years and is | |
now open-source thanks to github, hot damn. Some of the ingredients are not | |
very Japanese, but curry came to Japan from England which got it from India to | |
begin with, so whatever. | |
1.5 - 2 lbs. of meat, prefer thin-sliced beef (komagire), pork works, too. | |
Thin-sliced stuff is always best, but in a pinch stewing beef works. Bacon | |
works surprisingly well. Chicken will work, technically, but if you must, |
This file contains 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
#!/usr/bin/env ruby | |
# From: http://blog.infinitered.com/entries/show/5 | |
# == Synopsis | |
# This is a sample description of the application. | |
# Blah blah blah. | |
# | |
# == Examples | |
# This command does blah blah blah. |
This file contains 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
# config.gem "rspec", :lib => false, :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec')) | |
# config.gem "rspec-rails", :lib => 'spec/rails', :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails')) |
This file contains 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 :oracle do | |
desc "Check column names against the oracle reserved words" | |
task :check_column_names => [:environment] do |t| | |
if ActiveRecord::Base.connection.adapter_name =~ /oracle/i | |
found = [] | |
ActiveRecord::Base.connection.tables.each do |table_name| | |
This file contains 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 'pp' | |
# create an array of values for a sudoku grid | |
# and extract the grids as subarrays in the | |
# correct order. | |
# | |
# 4x4 = 4 grids of 4 cells | |
# 6x6 = 6 grids of 6 cells | |
# 9x9 = 9 grids of 9 cells | |
# etc |
This file contains 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 Search < ActiveRecord::Base | |
has_many :search_results | |
has_many :cars, :through => :search_results, :source => :results, :source_type => "Car" | |
has_many :dealers, :through => :search_results, :source => :results, :source_type => "Dealer" | |
# search.results gives you the list of linked records | |
has_many :results, :class_name => "SearchResult" | |
end | |
class SearchResult < ActiveRecord::Base |
This file contains 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
task :do_a_thing => :environment do | |
@zh_cn = " 联想" | |
@zh_tw = " 聯想" | |
%w( zh-cn zh-tw ).each do |chinese| | |
lang = Language.find_by_language_code(chinese) | |
LocalizedString.all(:conditions => ["language_id = ? and string_value like '%FindMe%'", lang.id]).each do |loc| | |
loc.string_value.gsub!('FindMe', instance_variable_get("@#{chinese.underscore}")) | |
loc.save_without_validation |
This file contains 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
#!/usr/bin/env ruby | |
# | |
# Update JIRA with git commit messages | |
# | |
# == Usage == | |
# | |
# To update a JIRA issue, prepend the first line of your git commit message | |
# with the issue key and a colon: | |
# | |
# $ git commit -m "GIT-1: Updates something" |
This file contains 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
# you'd obviously have more settings somewhere | |
set :scm, :git | |
set :repository, "git@github.com:defunkt/github.git" | |
set :branch, "origin/master" | |
set :migrate_target, :current | |
set :use_sudo, false | |
set :ssh_options, {:forward_agent => true} | |
set :rails_env, 'production' | |
set(:latest_release) { fetch(:current_path) } |
This file contains 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
set :unicorn_binary, "/usr/bin/unicorn" | |
set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
namespace :deploy do | |
desc "Start unicorn" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{try_sudo} bundle exec #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
end |
OlderNewer