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
# after $ mysql -u ''adminusername'' -p | |
CREATE DATABASE ''databasename''; | |
GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"@"''hostname''" IDENTIFIED BY "''password''"; | |
FLUSH PRIVILEGES; | |
EXIT | |
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
def fields_for_work_experience(work_experience, &block) | |
prefix = work_experience.new_record? ? 'new' : 'existing' | |
# uses the fields_for helper with a block that gives an extra option to the form fields preventing hash and array param clashes (also for date_selects) which | |
# would otherwise cause a server error. | |
fields_for("candidate[#{prefix}_work_experience_attributes][]", work_experience) { |wef| wef.with_options :index => "", &block } | |
end |
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
# Helper for work experience fields, adopted from Advanced Rails recipes 13 and railscasts 73-75 from Ryan Bates. | |
def fields_for_work_experience(work_experience, &block) | |
unless work_experience.new_record? | |
prefix = 'existing' | |
fields_for("candidate[#{prefix}_work_experience_attributes][]", work_experience, &block) | |
else | |
prefix = 'new' | |
# uses the fields_for helper with a block that gives an extra option to the form fields preventing hash and array param clashes (also for date_selects) which | |
# would otherwise cause a server error. | |
fields_for("candidate[#{prefix}_work_experience_attributes][]", work_experience) { |we| we.with_options :index => "", &block } |
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 'autotest/redgreen' | |
module Autotest::Growl | |
def self.growl title, msg, img, pri=0, stick="" | |
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{ msg.inspect} #{title} #{stick}" | |
end | |
Autotest.add_hook :ran_command do |autotest| | |
# We could both use test-unit and rspec which use respectively 'examples' and 'tests' as prefix. |
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
# More info on http://www.jeevidee.nl/instant_rails_application | |
# template.rb | |
in_root { run("rm public/index.html") } | |
# My plugins | |
plugin "dm_generator", :git => "git://github.com/jeroenvandijk/dm_generator.git -r amsterdam.rb" | |
plugin "dm_templates", :git => "git://github.com/jeroenvandijk/dm_templates.git -r amsterdam.rb" | |
plugin "dm_designs", :git => "git://github.com/jeroenvandijk/dm_designs.git" |
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
# template.rb | |
in_root { run("rm public/index.html") } | |
# Finalize | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" | |
run "rm public/robots.txt" | |
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 | |
# | |
# usage: script/server_restarter | |
# | |
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+ | |
# is so fast when completely reloading the server, I wrote this script to listen to the | |
# given directories, and kill/restart the server when any file is changed. | |
# | |
# It's quick, simple, and it reliably reloads your application when changes are made. | |
# |
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 | |
# | |
# usage: script/server_restarter | |
# | |
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+ | |
# is so fast when completely reloading the server, I wrote this script to listen to the | |
# given directories, and kill/restart the server when any file is changed. | |
# | |
# It's quick, simple, and it reliably reloads your application when changes are made. | |
# |
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
# TODO divide examples into groups | |
# one assertion at a time, so more intelligence to interpretation of comments | |
# TODO define state | |
# Think further of how to exploit this | |
module ObjectHooks | |
def inherited(*args) | |
# puts preceding_comments | |
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 ResourceController < ApplicationController | |
acts_as_resource | |
# Set flashes to I18n | |
create.flash { translate_flash :create } | |
create.fails.flash { translate_flash :create_fails } | |
update.flash { translate_flash :update } | |
update.fails.flash { translate_flash :update_fails } | |
destroy.flash { translate_flash :destroy } |
OlderNewer