Skip to content

Instantly share code, notes, and snippets.

View benschwarz's full-sized avatar
🏁
Making the web fast

Ben Schwarz benschwarz

🏁
Making the web fast
View GitHub Profile
@benschwarz
benschwarz / Fast textmate searching with ack
Created October 9, 2008 22:44
Use ack for textmate project searching
sudo port install p5-app-ack
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/protocool/ack-tmbundle.git Ack.tmbundle
# Then use Shift + Command + A to search at the speed that one would expect Textmate to search at
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do |r|
# RESTful routes
# resources :posts
resources :newsletters do
member :subscribe, :method => :post
member :unsubscribe, :method => :delete
end
begin
require 'minigems'
rescue LoadError
require 'rubygems'
end
require 'fusefs'
require 'flickr-rest'
require 'flickr-wrapper'
require 'openuri_memcached'
#!/usr/bin/env ruby
# Open a new tab in Terminal
# usage: tab [cmd]
# If cmd is specified, it will be run in new tab while old tab is reactivated.
# If no cmd, new tab is activated
require "rubygems"
require "appscript"
include Appscript
window = app("Terminal").windows.first
# Extend the Request class to give
# a useful method to be able to route
# to subdomains
module Merb
class Request
def subdomain
return nil if subdomains.first == "www"
return subdomains.first
end
end
# Get your commit hash from git log
git revert b899e585972342c4c33426535c30722f1f1ca14c
# Commit message if required (defaults to Created commit abe8722: Revert "YOur message")
git pull
git push
# Win.
@benschwarz
benschwarz / rubyconf_scraper.rb
Created December 2, 2008 04:31
RubyConf 2008 video scraper
%w(rubygems nokogiri open-uri fileutils).each do |r|
require r
end
BASE_URI = "http://rubyconf2008.confreaks.com/"
LOCAL_SAVE_PATH = "ruby-videos/"
FileUtils.mkdir_p LOCAL_SAVE_PATH
puts "Looking..."
*** LOCAL GEMS ***
data_objects (0.9.9)
dm-adjust (0.9.8)
dm-aggregates (0.9.8)
dm-ar-finders (0.9.8)
dm-cli (0.9.8)
dm-constraints (0.9.8)
dm-core (0.9.8)
dm-couchdb-adapter (0.9.8)
namespace :deploy do
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
end
task :symlink_gems do
run "mkdir -p #{shared_path}/gems"
run "ln -nfs #{current_path}/gems #{shared_path}/gems"
end
namespace :environment do
task :development => :environment do
raise "Development mode only, dick." unless RAILS_ENV == 'development'
end
end