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 ActionView::Helpers::FormBuilder | |
include ActionView::Helpers::UrlHelper | |
include ActionView::Helpers::TagHelper | |
include ActionView::Helpers::FormTagHelper | |
def tag_list(method, options={}) | |
return false unless options[:tags] | |
links = options[:tags].map do |tag| | |
link_to_function( tag.to_s, "toggle_tag('#{tag}', '#{@object.class.to_s.downcase}_#{method.to_s.pluralize.downcase}')", :class => ["tag", (@object.send(method).map(&:name).include?(tag.to_s) ? "selected" : "")].compact.join(" "), :id => tag ) | |
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
class String | |
def to_param | |
self.downcase.strip.gsub(/[\/ ]+/, "-").gsub(/[^a-z0-9\-\_]+/i, "").gsub(/\-+/,"-") | |
end | |
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
set :application, "application.url.com" | |
set :repository, "http://svn.#{application}/trunk/" | |
set :runner, ENV['LOGNAME'] | |
set :deploy_to, "/var/www/#{application}" | |
role :app, application | |
role :web, application | |
role :db, application, :primary => true | |
task :after_update_code, :roles => :app do | |
run "ln -s #{deploy_to}/shared/system/mongrel_cluster.yml #{release_path}/config/mongrel_cluster.yml" |
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
Ajax.Responders.register({ | |
onCreate: function() { | |
if($('busy') && Ajax.activeRequestCount>0) | |
Effect.Appear('busy',{duration:0.5,queue:'end'}); | |
}, | |
onComplete: function() { | |
if($('busy') && Ajax.activeRequestCount==0) | |
Effect.Fade('busy',{duration:0.5,queue:'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
class Date | |
def at_some_point(options = {}) | |
start_hour = options[:between] | |
end_hour = options[:and] | |
if start_hour && end_hour | |
hours = rand(end_hour) + start_hour | |
else | |
hours = rand(24) | |
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
#/usr/bin/ruby | |
require 'net/ftp' | |
@filename = "date-"+Time.now.strftime("%Y%m%d-%H%M")+".sql" | |
@db_user = "db6663" | |
@db_password = "PASSWORD" | |
@db_host = "my.database-server.com" | |
@database = "database" | |
@backupdir = "/path/to/backup/directory" | |
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
mysqldump --user=USER --password=PASSWORD DATABASE > ~/`date +%Y-%m-%d_%H%M`.sql |
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
sudo gem install starling memcache-client | |
sudo mkdir /var/spool/starling | |
sudo /usr/sbin/adduser --shell /sbin/nologin starling | |
sudo mkdir -p /var/spool/starling | |
sudo mkdir -p /var/run/starling | |
sudo chown starling:starling /var/spool/starling | |
sudo chown starling:starling /var/run/starling | |
sudo -u starling /usr/bin/starling --log /var/log/starling.log -v --queue_path /var/spool/starling --host 127.0.0.1 --port 15151 --pid /var/run/starling/starling.pid -d | |
/path/to/rails/app/script/workling_starling_client start |
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
desc "Push design.yml to spec files" | |
task :design do | |
require 'yaml' | |
specs = YAML::load_file './spec/design.yml' | |
specs.each_pair do |describe, specs_array| | |
spec_file = File.new("./spec/#{describe.downcase.gsub(/ /, '_')}_spec.rb", 'w') | |
spec_file.puts " | |
require File.dirname(__FILE__) + '/spec_helper' | |
describe \"#{describe}\" do |
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 :stories do | |
desc "Create Story Scaffolds" | |
task :scaffold do | |
Dir.glob("./stories/*_story.txt").each do |file| | |
filename = File.basename(file, "txt").split("_")[0].downcase.gsub(/ /, '_') | |
File.open("./stories/#{filename}_story.rb", 'w') do |f| | |
f.puts "require File.dirname(__FILE__) + '/helper'\n" | |
f.puts "with_steps_for(:#{filename}) do" | |
f.puts "\ttell '#{filename}_story', :type => RailsStory" | |
f.puts "end" |
OlderNewer