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(bees_knees). | |
| -export([tell_em/0]). | |
| tell_em () -> | |
| io:format("Tell 'em how Erlang is the bee's knees!\n"). |
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 '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}" |
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
| 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}" |
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
| print "test" |
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
| puts "foo" |
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
| 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') |
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
| #!/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] |
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
| #!/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' |
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
| 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 |