- Start a Sinatra server on port 4000
- GET / to that server triggers a
git pull
and mod_rails restart - Hit port 4000 locally after pushing
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
ocean-2:example gus$ pwd | |
/Users/gus/dev/pancake/example | |
ocean-2:example gus$ rackup config.ru | |
Loading Development configuration | |
^Z | |
[1]+ Stopped rackup config.ru | |
ocean-2:example gus$ bg %1 | |
[1]+ rackup config.ru & | |
ocean-2:example gus$ wget -S http://localhost:9292/foo | |
--17:13:48-- http://localhost:9292/foo |
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
ocean:E2DesktopMacSource gus$ python setup_mac.py py2app | |
running py2app | |
creating /Users/gus/E2DesktopMacSource/build | |
creating /Users/gus/E2DesktopMacSource/build/bdist.macosx-10.3-i386 | |
creating /Users/gus/E2DesktopMacSource/build/bdist.macosx-10.3-i386/python2.5-standalone | |
creating /Users/gus/E2DesktopMacSource/build/bdist.macosx-10.3-i386/python2.5-standalone/app | |
creating /Users/gus/E2DesktopMacSource/build/bdist.macosx-10.3-i386/python2.5-standalone/app/collect | |
creating /Users/gus/E2DesktopMacSource/build/bdist.macosx-10.3-i386/python2.5-standalone/app/temp | |
creating /Users/gus/E2DesktopMacSource/dist | |
creating build/bdist.macosx-10.3-i386/python2.5-standalone/app/lib-dynload |
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
// only outputs if console available and does each argument on its own line | |
function log() { | |
if (window && window.console && window.console.log) { | |
var i, len; | |
for (i=0, len=arguments.length; i<len; i++) { | |
console.log(arguments[i]); | |
} | |
} | |
} |
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 AddAccountNotes < TableMigration | |
migrates :accounts, :multi_pass => false, :create_temp_table => false, :dry_run => false | |
schema_changes.push <<-SQL | |
ALTER TABLE :new_table_name | |
ADD COLUMN `notes` VARCHAR(255) | |
SQL | |
schema_changes.push <<-SQL | |
ALTER TABLE :new_table_name |
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
# Make port 80 "real life" speeds | |
# You can also use Mongrel ports. | |
function slow_port { | |
# Set the port variable if no port inputted. Defaulted to 80 (for Passenger). | |
if [ -z "$1" ] | |
then port=80 | |
else port=$1 | |
fi | |
# Slow the ports. |
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 'lib/usher' | |
u = Usher::Interface.for(:text) do | |
on('my name is :name') { |name| | |
puts "hey #{name}, nice to meet you" | |
} | |
on('hey :first_name( :last_name)') {|first_name, last_name| | |
puts last_name ? | |
"how are you doing #{first_name} #{last_name}?" : |
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 SignupController < ActionController::Base | |
def step_two | |
@signup = Signup.find(params[:id]) | |
@signup.advance_step do |signup| | |
signup.attributes = params[:signup] | |
signup.save! | |
end | |
end | |
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
# 9 out of 10 microbenchmarks agree: implicit return smokes explicit return | |
require 'benchmark' | |
def explicit | |
return 1 | |
end | |
def implicit | |
1 | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
require 'spira' | |
require 'rack/linkeddata' | |
use Rack::LinkedData::ContentNegotiation, :default => 'text/turtle' | |
include RDF |
OlderNewer