This file contains hidden or 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 User | |
has_many :workouts, :through => :checkins | |
has_many :coached_workouts, :class_name = "Workout", :foreign_key => "coach_id" | |
#class Workout | |
belongs_to :coach, class_name = "User" | |
#add coach_id column to workout table |
This file contains hidden or 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
## Explanatory screencast: http://www.youtube.com/jraines002#p/u/0/Vj5LjE4kuLM | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<Module> | |
<ModulePrefs title="My Gadget" height="30"> | |
<Require feature="wave" /> | |
<Require feature="locked-domain" /> | |
<Require feature="dynamic-height" /> | |
</ModulePrefs> | |
<Content type="html"> |
This file contains hidden or 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
//embed code for a YouTube JSAPI player | |
swfobject.embedSWF("#{@videos.first.url}&enablejsapi=1&playerapiid=ytplayer", "ytapiplayer", "320", "265", "8", null, null, params, atts); |
This file contains hidden or 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
:javascript | |
// wait for the DOM to be loaded | |
$(document).ready(function() { | |
var options = { | |
target: '#output' | |
}; | |
// bind 'myForm' and provide a simple callback function | |
$('#myForm').ajaxForm(options); | |
}); |
This file contains hidden or 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 'ferret' | |
# Create the full-text search index | |
jobs = Job.find(:all, :conditions => ["displayed = 'yes'"]) | |
index = Index::Index.new(:path => 'search_index', :create => true) | |
jobs.each do |job| | |
index << {:id => job.id, :description => job.description} |
This file contains hidden or 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
# All code in this gist is public domain and freely available for use and alteration without attribution | |
require 'rubygems' | |
require 'simple-rss' | |
require 'rss' | |
require 'open-uri' | |
feed = 'http://www.tweetlinkmonster.com/feed/jraines.atom' | |
rss = SimpleRSS.parse(open(feed)) |
NewerOlder