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 | |
#-- | |
# Name : git_watch.rb | |
# Author : Jerod Santo | |
# Contact : "[email protected]".reverse | |
# Date : 2008 October 14 | |
# About : Checks a git repository for changes and emails provided email | |
# address if changes have been made. Schedule with cron. | |
#-- | |
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
# Easy view testing for Rails with Hpricot. | |
# | |
# Prefix 'response' with @ for Sinatra. | |
class Test::Unit::TestCase | |
# elements('h1') returns a Hpricot::Elements object with all h1-tags. | |
def elements(selector) | |
Hpricot(response.body).search(selector) | |
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
# the lil' deployment script | |
APP_PATH = '/var/webapps/ltt' | |
APP_REPO = '/home/harry/git/ltt.git' | |
APP_SERVER = 'ak' | |
def ssh(command) | |
`ssh #{APP_SERVER} sh -c '#{command.inspect}'` | |
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
require 'rubygems' | |
require 'sinatra' | |
get '/no-hidden' do | |
erb :no_hidden | |
end | |
get '/hidden' do | |
erb :hidden | |
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
Let's make a list of Sinatra-based apps! | |
Apps: | |
- http://github.com/cschneid/irclogger "Sinatra based irclogger.com" | |
- http://github.com/rtomayko/wink "minimalist blogging engine" | |
- http://github.com/foca/integrity "The easy and fun Continuous Integration server" | |
- http://github.com/sr/git-wiki "git-powered wiki" | |
- http://github.com/entp/seinfeld "Seinfeld-inspired productivity calendar to track your public github commits." | |
- http://github.com/karmi/marley "Marley, the blog engine without <textareas>." | |
- http://github.com/ichverstehe/gaze "Serve up your Markdown files with this tiny Sinatra 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
moved to ichverstehe/nancie |
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
# We start with no Content-Type, and in Response#finish it is set to text/html | |
get "/one" do | |
erb :example | |
end | |
# Start with no Content-Type, sass() sets Content-Type to text/css, Response#finish doesn't touch it, | |
# because it already has been set, and thus what should have been text/html is now text/css | |
get "/two" do | |
erb :sass_example | |
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
host "sinatrarb.com" | |
accept :xml | |
provides :xml | |
get '/' do | |
"Welcome!" | |
end | |
get '/' do | |
"You are not to be welcomed!" | |
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
1. I copy http://github.com/ichverstehe/foo/commit/17a5a5d55cb28ea1440be1f704497a588694aab3 | |
2. In jello.rb L17 pasteboard.gets sets @current = http://github.com/ichverstehe/foo/commit/17a5a5d55cb28ea1440be1f704497a588694aab3 | |
3. I have shortener enabled, so after all moulds have been ran, the pasteboard now contains http://tr.im/f7v7?github | |
4. The loop is repeated, and at jello.rb L17 pasteboard.gets sets @last to @current, which is still the original github-url, and thus pasteboard.gets (which is http://tr.im/..) != @last and the moulds are walked through once more. | |
On the other hand, if Pasteboard#puts updates @current (which is logically correct, as the current pasteboard *is* whatever #puts sets it to) each copy will only get one time through the moulds. | |
Doesn't matter much, except, for my Growl mould, where I really prefer only getting one notification :) |
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
require 'rubygems' | |
require 'sinatra' | |
get '/' do | |
@files = Dir['public/*'].map {|f| File.basename(f) } | |
erb :index | |
end | |
post '/upload' do | |
filename = params[:file][:filename] |