Skip to content

Instantly share code, notes, and snippets.

View gist:43956
<body>
<div id="main">
<div id="header" class="">
<div class="site">
<div class="logo">
<a href="/"><img src="/images/modules/header/logo_gist.png" alt="git-hub" /></a>
</div>
<div class="actions">
<a href="/mine"><img alt
View gist:45865
<Animals>
<dog>
<name>Rufus</name>
<BReed>labrador</breed>
</dog>
<dog>
<name>Marty</name>
<BReed>whippet</breed>
</dog>
<cat name="Matilda"/>
View gist:45868
{
animals:{
dog:[
{
name:'Rufus',
breed:'labrador'
},
{
name:'Marty',
breed:'whippet'
View gist:45869
handle_data(json_data_from_twitter);
View gist:45878
<head>
<script type="text/javascript">
function handle_data(twitter_data) {
// manipulate the JSON data
// jQuery works well for this :)
}
</script>
<script type="text/javascript" src="http://search.twitter.com/trends.json?callback=handle_data"></script>
</head>
View gist:48192
pick c9205f4 Ok, so spawn doesn't work exactly right yet.
pick c770395 Added Errno::ENOTDIR to the list of errors when rmdiring
pick 49221b6 There's no reason to load anything but test for the database.yml
pick bc1af0c Removed rake/gempackagetask and the rubyforge rake task
pick 8a43c13 Added requirement for thoughtbot-shoulda >=2.0.0 in test_helper
pick 06f9b99 #47: Multipage PDFs fixed by Pete Deffendol
pick 279b757 Updated the rake task to take STI into consideration.
# Rebase 701abb0..279b757 onto 701abb0
#
View gist:84174
Bag
has_many :chips
def tastes
chips.tastes
end
Chip
has_many :tastes
belongs_to :bag
View gist:126754
"True Blood: Mine (#1.3)" (2008)
Bill Compton: I have no heart-beat. I have no need to breathe. There are no electrical impulses in my body.
What animates you no longer animates me.
Sookie Stackhouse: What does animate you then? Blood? How do you digest it then if nothing works?
Bill Compton: Magic?
Sookie Stackhouse: Oh, come on Bill! I may look naive but I'm not, and you need to remember that.
View google_scrape.rb
require 'webrat'
require 'webrat/mechanize'
session = Webrat::MechanizeSession.new
session.visit 'http://google.com'
session.fill_in 'q', :with => 'Ruby'
session.click_button 'Google Search'
# search the dom for the results
You can’t perform that action at this time.