Skip to content

Instantly share code, notes, and snippets.

View wfarr's full-sized avatar
:shipit:
shipping

Will Farrington wfarr

:shipit:
shipping
View GitHub Profile
-module(bees_knees).
-export([tell_em/0]).
tell_em () ->
io:format("Tell 'em how Erlang is the bee's knees!\n").
We couldn’t find that file to show.
require 'rubygems'
require 'git'
require 'net/http'
require 'uri'
GIT_CONFIG = Git.global_config
USER = GIT_CONFIG['github.user']
KEY = GIT_CONFIG['github.token']
GH_URL = "http://github.com/api/v2/yaml/repos/show/#{USER}"
get '/posts/:id/edit' do
@post = Post.find(params[:id])
haml :"posts/edit"
end
put '/posts/:id' do
@post = Post.find(params[:id])
@post.update_attributes(params)
cleanup @post
redirect "/posts/#{@post.id}"
print "test"
@wfarr
wfarr / foo.rb
Created November 21, 2009 21:47
puts "foo"
God.watch do |w|
w.name = "mongod"
w.interval = 30.seconds
w.start = "rake -f #{RAILS_ROOT}/Rakefile mongodb:start"
w.stop = "killall mongod"
w.env = { "RAILS_ENV" => "development" }
w.uid = 'rails'
w.gid = 'rails'
w.pid_file = File.join(RAILS_ROOT, 'config/mongod.lock')
#!/bin/env ruby
rbgem = `which gem`.strip
output = `#{rbgem} list --local`
output.each do |line|
matches = line.match(/([A-Z].+) \(([0-9\., ]+)\)/i)
if matches
gem_name = matches[1]
versions = matches[2].split(', ')[1..-1]
#!/opt/ree/bin/ruby
# originally from http://griffin.oobleyboo.com/archive/ruby-enterprise-edition-gem-install-script/
#
# Usage:
#
# $ sudo -s
# # OLD_GEM=/usr/bin/gem NEW_GEM=/opt/ree-whatever/bin/gem /opt/ree/bin/ruby ree_gem_reinstall.rb
# The command to run for your vanila Ruby 'gem' command
ENV['OLD_GEM'] ||= '/usr/bin/gem'
def tag
@tag = params[:tag]
- if @tag =~ /,/
- @posts = []
- @tag.split(",").each do |tag|
- @posts << Post.find(:all, :conditions => ["tags LIKE ?", "%#{tag}%"] ).map {|p| p.id }
- end
- @posts = @posts.flatten.uniq.sort.reverse
- @posts.map! {|post| Post.find(post) }
- else