Discover gists
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
## Routes | |
map.add_person '/add_person', :controller => 'people', :action => 'new_unclaimed_person' | |
map.add '/add', :controller => 'people', :action => 'create_unclaimed_person' | |
## People Controller | |
def new_unclaimed_person | |
@person = Person.new |
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
what I did was | |
git clone git://github.com/francois/piston.git | |
cd piston | |
rake install_gem | |
this dumped a bunch of output, as it built the gem and then asked me for sudo password to install: | |
... |
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 | |
# Non-Copyright (c) 2008 Joao Paulo Camargo <github@jotape.org> | |
# | |
# moourl.rb - is a small module to get contracted urls using http://moourl.com | |
# | |
# Usage: | |
# MooUrl::milk('http://code.jotape.org') | |
# > http://moourl.com/foxvd | |
# MooUrl::moo('foxvd') | |
# > http://code.jotape.org |
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 String | |
def strimwidth(width) | |
self.split(//)[0...width].join | |
end | |
end | |
#see also http://www.ruby-lang.org/ja/man/html/Array.html#self.5bstart.2e.2eend.5d |
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 'mechanize' | |
require 'hpricot' | |
site="www.twitpic.com" | |
# Grab the highest picture number | |
agent = WWW::Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
page = agent.get("http://#{site}/public_timeline") | |
doc = Hpricot(page.body) |
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
jQuery(function(){ | |
// Cascading series of finds to focus the most likely relevant field | |
window.setTimeout(function() { | |
jQuery("div.fieldWithErrors :input:visible:enabled:first, :input:visible:enabled:first").focus(); | |
jQuery(".tabs-container").not(".tabs-hide").find("div.fieldWithErrors :input:visible:enabled:first, :input:visible:enabled:first").focus(); | |
}, 100); | |
}); |
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
hi there |
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
hi there | |
likewise |
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
def slow_each(options, &block) | |
0.step(count(options), options[:limit]) do |offset| | |
find(:all, options.merge(:offset => offset)).each(&block) | |
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
DESCRIPTION | |
select() and pselect() allow a program to monitor multiple file | |
descriptors, waiting until one or more of the file descriptors become | |
"ready" for some class of I/O operation (e.g., input possible). A file | |
descriptor is considered ready if it is possible to perform the corre‐ | |
sponding I/O operation (e.g., read(2)) without blocking. | |
The operation of select() and pselect() is identical, with three dif‐ | |
ferences: | |