This file contains 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/env escript | |
%% -*- erlang -*- | |
-include_lib("kernel/include/file.hrl"). | |
-compile(export_all). | |
-define(LOG(S), io:format(S)). | |
-define(LOG(S,A), io:format(S,A)). | |
main(Dirs) -> | |
CodePath = case os:getenv("RIAK_LIB") of |
This file contains 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 :ci do | |
task :copy_yml do | |
sh "cp #{Rails.root}/config/example_database.yml #{Rails.root}/config/database.yml" | |
end | |
desc "Prepare for CI and run entire test suite" | |
task :build do | |
ENV["RACK_ENV"] = "test" | |
Rake::Task['db:migrate'].invoke | |
Rake::Task['db:test:prepare'].invoke |
This file contains 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/sh | |
# Best To-Do List. Ever. | |
# | |
# Usage: | |
# 1. Add a new item to list: `todo This needs to be fixed` | |
# 2. Edit the to-do list: `todo -e` | |
# 3. Show the current to-do's: `todo` | |
if [[ $1 ]]; then | |
if [ $1 = "-e" ]; then |
This file contains 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 Rack | |
module Test | |
module Session | |
attr_reader :last_response | |
attr_reader :last_request | |
alias_method :response, :last_response | |
alias_method :request, :last_request | |
def initialize(app) |
This file contains 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 Foo < Sinatra::Base | |
host_name "sinatrarb.com" | |
user_agent /Mosaic/ | |
provides :xml | |
get '/' do | |
"Welcome!" | |
end | |
get '/' do | |
"You are not to be welcomed!" |
This file contains 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/env ruby | |
# -*- ruby -*- | |
# twitter command line client | |
# That's What I Call Lame | |
# 09nov2008 +chris+ | |
require 'json' | |
require 'open-uri' |
This file contains 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
# Meh, I went overboard. Usage: | |
# | |
# To tweet, write in channel: | |
# nancie, tweet this: some nice thing about sinatra and stuff | |
# To give permissions, private message: | |
# /msg nancie allow awesome_user | |
# | |
# Additional extensions are welcome. | |
require 'rubygems' |
This file contains 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
# A Sinatra App as a Rails Plugin | |
# | |
# In your Edge Rails app: | |
# | |
# ruby script/plugin install git://gist.github.com/50625.git | |
require 'sinatra/base' | |
class SinatraRailsPlugin < Sinatra::Base |
This file contains 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 '/:id' do | |
@vent = Vent.get(params[:id]) | |
erb :show | |
end | |
# show post | |
get '/:id.xml' do | |
@vent = Vent.get(params[:id]) | |
builder :show | |
end |
This file contains 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
=begin | |
Shooter | |
<http://gist.github.com/25886> | |
Harry Vangberg <http://trueaffection.net> | |
Simon Rozet <http://purl.org/net/sr/> | |
EXAMPLE | |
IRC.shoot('irc://irc.freenode.net:6667/integrity', :as => "IntegrityBot") do |channel| |
NewerOlder