Public Gists by jsmestad

Gravatar
Thu Oct 22 14:30:45 -0700 2009
1
2
3
Warden::Manager.serialize_into_session{|user| user.id }
Warden::Manager.serialize_from_session{|id| User.get(id) }
 
Gravatar
Sat Oct 03 23:46:28 -0700 2009
1
2
3
require File.dirname(__FILE__) + '/../spec_helper'
 
# FYI this is using StaleFish, but tests should run regardless.
Gravatar
Tue Sep 22 09:50:26 -0700 2009
1
2
3
require 'rubygems'
require 'wirble'
require 'pp'
Gravatar
Mon Aug 31 08:48:56 -0700 2009
1
2
3
#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
Gravatar
Fri Aug 07 14:17:08 -0700 2009
1
2
3
>> result = client.videos_by(:query => 'audi').videos.first
=> #<YouTubeG::Model::Video:0x18db160 @video_id="http://gdata.youtube.com/feeds/api/videos/DaZExdTHHjY", @where=nil,
@author=#<YouTubeG::Model::Author:0x190ade8 @name="TopGear", @uri="http://gdata.youtube.com/feeds/api/users/topgear">,
Gravatar
Fri Jul 31 14:25:32 -0700 2009
1
2
3
                                                       |AR 2.3.3 | DM 0.9.12 | DIFF |
----------------------------------------------------------------------------------------
Model.new (instantiation) x10000 | 0.389 | 0.018 | 21.68x |
Gravatar
Tue Jul 14 10:13:41 -0700 2009
1
2
3
  def self.set_weights(power, handling, accel, fuel, pts)
    {
      :attr_power => power,
Gravatar
Tue Jul 14 09:52:46 -0700 2009
1
2
3
#source ~/.git-completion.sh
 
if [ -f /opt/local/etc/bash_completion ]; then
Gravatar
Wed Jul 08 09:20:35 -0700 2009
1
2
3
require 'nokogiri'
require 'open-uri'
require 'net/http'
Gravatar
Mon Jun 22 16:08:25 -0700 2009
1
sup dude
Gravatar
Tue Jun 16 13:29:24 -0700 2009
1
2
3
  def update
    doc = Nokogiri::XML open(feed_link)
    doc.search('//data/posts/post').each do |post|
Gravatar
Mon Jun 08 13:02:20 -0700 2009
1
2
3
def archive(tmp_file, archive_folder, output_file)
  ...
  count = 0
Gravatar
Mon Jun 01 12:55:41 -0700 2009
1
2
3
module Gripht
  class App < Sinatra::Default
    set :views, File.dirname(__FILE__) + '/views'
Gravatar
Thu May 28 19:51:01 -0700 2009
1
2
3
/*
On the page, there will be a number of tabs. Each of the tabs will correspond with a panel.
When a tab is selected, it becomes "active" -- the previously active tab becomes inactive.
Gravatar
Sat May 09 14:19:16 -0700 2009
1
2
3
<h2>Submit Post</h2>
<form action='/admin' enctype='multipart/form-data' method='post'>
  <label for='post_title'>
Gravatar
Thu May 07 14:54:19 -0700 2009
1
2
3
# See following for more information: http://www.infinitered.com/blog/?p=19
 
 
Gravatar
Thu Apr 16 14:06:09 -0700 2009
1
2
3
parse_git_branch ()
{
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# [git:\1]#'
Gravatar
Sun Apr 05 00:54:55 -0700 2009
1
2
3
before_filter :fetch_proper_params, :only => [:show]
 
def show
Gravatar
Sat Apr 04 22:06:25 -0700 2009
1
2
3
# Working example
def test &block
  bind = yield 1, 2, 3
Gravatar
Sat Apr 04 22:02:13 -0700 2009
1
2
3
    #players = select distinct(player) from actions;
    players = repository(:default).adapter.query('select distinct(player) from actions')