git checkout -b topic
If the branch is already in progress and already exists on the remote repo, check it out as a tracking branch
git checkout --track -b topic origin/topic
| # 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)) |
| 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} |
| :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); | |
| }); |
| //embed code for a YouTube JSAPI player | |
| swfobject.embedSWF("#{@videos.first.url}&enablejsapi=1&playerapiid=ytplayer", "ytapiplayer", "320", "265", "8", null, null, params, atts); |
| ## 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"> |
| #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 |
| -unless current_user.workouts.member?(workout) | |
| =link_to image_tag('checkin.png'), checkin_url(:workout_id => workout.id, :user_id => current_user.id) | |
| -else | |
| =image_tag('done.png') |
| #testing the speed of creating a new object via the association with mongoid | |
| c = Club.first | |
| ####### 43 seconds ####### | |
| begin | |
| 500.times do |i| | |
| c.people.create(:name => 'Jim') | |
| end | |
| end |
| #two questions -- why does .count not return the narrowed down result set size, and why does .where seem to alter variable a? | |
| a = Star.where(:brightness => 0) | |
| => #<Mongoid::Criteria:0xb6af2948 @documents=[], @options={}, @selector={:brightness=>0}, @klass=Star> | |
| a.size | |
| => 1430 | |
| a.count | |
| => 1430 |