Skip to content

Instantly share code, notes, and snippets.

set :deploy_via, :copy
set :copy_cache, true
set :copy_exclude, [".git/*", ".svn/*"]
set :copy_strategy, :export
set :repository, Dir.pwd
@tomlea
tomlea / gist:60830
Created February 9, 2009 15:39
TextMate whitespace error highlighting.
{ scopeName = 'source';
comment = '
You will need to add a { include = "source"; } within the patterns = (...) segment of each of your languages.
Eugh!
';
patterns = (
{ name = 'source.invalid.trailing-whitespace';
match = '\S(\s{1,})$';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
},
{ scopeName = 'source';
patterns = (
{ name = 'source.invalid.trailing-whitespace';
match = '\S(\s{1,})$';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
},
{ name = 'source.invalid.just-whitespace';
match = '^(\s{1,})$';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
@tomlea
tomlea / bean-bandit.rb
Created February 4, 2009 14:34
Bean Bandit: Puts beanz on ze queue.
#!/usr/bin/env ruby
require "rubygems"
gem "beanstalk-client"
require "beanstalk-client"
port = ARGV.last or raise "GIVE ME A PORT NEXT TIME!"
beanstalk = Beanstalk::Pool.new(["0.0.0.0:#{port}"])
@tomlea
tomlea / beanstalker-the-debeaning.rb
Created January 30, 2009 14:19
Beanstalker is back, and it's hungry for beans!
#!/usr/bin/env ruby
require "rubygems"
gem "beanstalk-client"
require "beanstalk-client"
port = ARGV.last or raise "GIVE ME A PORT NEXT TIME!"
beanstalk = Beanstalk::Pool.new(["0.0.0.0:#{port}"])
<<-BUMBLEBEE
The bumblebee hovers around an object,
looking for a flower with some pollen.
It goes from flower to flower,
trying each method in order,
and when it finds one that isn't empty,
it returns it to the hive.
namespace :deployment do
desc "Mark the deployment as locked, preventing further deployments (until deployment:unlock)"
task :lock, :roles => :app do
run "touch -f #{shared_path}/locked"
end
desc "Unmark the deployment as locked, allowing further deployments (until deployment:lock)"
task :unlock, :roles => :app do
run "rm #{shared_path}/locked"
end
@tomlea
tomlea / github-backup.rb
Created January 13, 2009 17:38
Command line app to backup all your github repos. You can then use the local path just like a remote one when github goes down.
#!/usr/bin/env ruby
gem 'mbleigh-ruby-github'
require "ruby-github"
unless username = ARGV.first and username =~ /[a-zA-Z0-9]+/
puts "Usage: #{$0} <github_username>"
exit(1)
end
BASE_PATH=File.expand_path("./repos")
# t(:foo) now looks for admin.blog_controller.foo, then if not found it then goes for admin.foo, then finally just foo.
def ApplicationController.has_controler_specific_translation_helper_fu
def t(key, options = {})
controller_name = self.controller_name + "_controller"
defaults = [[:admin, controller_name, key], [:admin, key], [key]].map{|a| a.join(".").to_sym}
key, defaults = *defaults
options[:default] = defaults
I18n.t(key, options)
end
helper_method :t
require 'drb'
module RemoteRunner
module Runner
def eval(code)
Kernel.eval(code)
end
end
def load_app(app)