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
namespace :db do | |
desc "abort rake if using bad memory techniques" | |
task :safety_migrate => :environment do | |
path = "#{RAILS_ROOT}/db/migrate/" | |
migration_directory = Dir.new(path) | |
proceed = true | |
migration_directory.each do |file| | |
if file != "." and file != ".." | |
migration = File.open("#{path}#{file}") | |
text = migration.read |
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
set (:stages) { Dir.glob(File.join(File.dirname(__FILE__), "deploy", "*.rb")).map {|s| File.basename(s, ".rb") }.select {|s| not s =~ /sample/} } |
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
# require 'resque/tasks' | |
# will give you the resque tasks | |
namespace :resque do | |
task :setup | |
desc "Start Resque Scheduler" | |
task :scheduler => :scheduler_setup do |t,args| | |
require 'resque' | |
require 'resque_scheduler' |
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
#content | |
.row | |
.third | |
.third | |
.third.last | |
.row | |
.half | |
.half.last | |
.row | |
.fourth |
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
class Trie | |
attr_accessor :value, :children | |
def initialize value = '' | |
@value = value | |
@children = {} | |
end | |
def [] val | |
@children[val] |
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 MVFuckit | |
def cmeth *args | |
@util_controller ||= ApplicationController.new | |
@util_controller.send(*args) | |
end | |
def hmeth *args | |
@util_helper ||= MVFuckit::Help.new | |
@util_helper.send(*args) | |
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
# Everything you need to do to get started with Rails 2.3.8 | |
# | |
# As of June 14th, 2010 @ 2:30 p.m. MST | |
# | |
# This gist now features instructions to get Rails 3 up and running with: | |
# - Ruby 1.8.7-p174 | |
# - Bundler 0.9.26 | |
# - Cucumber 0.8.0 | |
# - Rspec 1.3.0 + Rspec-Rails 1.3.2 | |
# - RVM |
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
# Our own variable where we deploy this app to | |
deploy_to = "/srv/example.com" | |
current_path = "#{deploy_to}/current" | |
shared_path = "#{deploy_to}/shared" | |
shared_bundler_gems_path = "#{shared_path}/bundler_gems" | |
# See http://unicorn.bogomips.org/Sandbox.html | |
# Helps ensure the correct unicorn_rails is used when upgrading with USR2 | |
Unicorn::HttpServer::START_CTX[0] = "#{shared_bundler_gems_path}/bin/unicorn_rails" |
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
<fieldset> | |
<legend>Add your images here!!</legend> | |
<ol> | |
<li> | |
<label for="foo">FOO</label> | |
<input name="foo" /> | |
</li> | |
</ol> | |
</fieldset> |
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
class ViewObject | |
include Enumerable | |
extend Forwardable | |
def_delegators :@views, :<<, :[], :[]=, :last, :first, :push | |
def initialize controller | |
@controller = controller | |
@views = [] | |
end |
OlderNewer