Public Gists by collin

Gravatar
Mon Jun 01 05:15:12 -0700 2009
1
2
3
get 'http://github.com/githubapi'+window.location.href.match(/~(.*)/)[1]
  user.repositories.each fun repository
    $#repositories
Gravatar
Sun May 31 23:54:28 -0700 2009
1
2
3
module AbstractController
  class Base
  private
Gravatar
Sat May 30 09:27:33 -0700 2009
1
2
3
# staging specific code
git diff staging config/initializers/current_host.rb | git apply -R
# production specific code
Gravatar
Tue May 26 18:40:27 -0700 2009
1
2
3
function load_styles_jquery_tree() {
  jQuery("head").append("\
<style>\
Gravatar
Mon May 25 21:11:37 -0700 2009
1
2
3
selector = '$'
property = ':'
mixin = '+'
Gravatar
Wed May 20 21:59:57 -0700 2009
1
2
3
//Useful Error Handling for dev mode JavaScript
jQuery().ajaxError(function(event, xhr) {
  jQuery().html(xhr.responseText);
Gravatar
Thu May 07 11:18:01 -0700 2009
1
2
3
# Ended up overriding send.
# Seems a bit intense, but action-args are too awesome to not use.
 
Gravatar
Wed Apr 15 04:13:14 -0700 2009
1
2
3
class UserSession < Authlogic::Session::Base
  def self.twitter_consumer
    @twitter_consumer ||= OAuth::Consumer.new(
Gravatar
Mon Apr 06 20:16:31 -0700 2009
1
2
3
class ContentsController < ApplicationController
  def update id, content
    @content = Content.get id
Gravatar
Tue Mar 10 05:21:03 -0700 2009
1
2
3
module AssetsHelper
  def javascripts
    scripts = []
Gravatar
Fri Mar 06 04:34:37 -0800 2009
1
2
3
# Open the class to set your license id
 
class Calais; def license_id; "YOUR OPEN CALAIS KEY GOES HERE" end end
Gravatar
Fri Mar 06 04:24:50 -0800 2009
1
2
3
class Calais
  attr_accessor :hierarchy, :response
  
Gravatar
Thu Mar 05 04:58:15 -0800 2009
1
2
>> Subject.first.tweets(:time.lte => 2.weeks.ago, :limit => 1)
=> [#<Tweet:0xb651839c @data={"found_at"=>Thu Mar 05 06:36:12 -0600 2009, "profile_image_url"=>"http://s3.amazonaws.com/twitter_production/profile_images/53361951/1-Mashit-MP3-Logo_normal.png", "created_at"=>"Wed, 18 Feb 2009 18:24:28 +0000", "from_user"=>"mashit", "text"=>"Endorses Mike Quigley to replace Rahm Emanuel in Chi's 5th Dist. congressional race March 3. North Side Represent! : http://bit.ly/quigley", "to_user_id"=>nil, "id"=>1223754388, "from_user_id"=>318188, "iso_language_code"=>"en", "source"=>"&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;"}]
Gravatar
Thu Mar 05 04:55:25 -0800 2009
1
2
3
class Subject
  include DataMapper::Resource
 
Gravatar
Thu Mar 05 04:53:07 -0800 2009
1
2
3
class SubjectTweet
  include DataMapper::Resource
  
Gravatar
Thu Mar 05 04:50:47 -0800 2009
1
2
3
class Tweet
  attr_accessor :data
 
Gravatar
Thu Mar 05 04:45:45 -0800 2009
1
2
3
dependency "moneta", "0.5.0" do
  require "moneta/rufus"
end
Gravatar
Thu Mar 05 02:48:31 -0800 2009
1
2
3
require 'rubygems'
require 'benchmark'
require 'fileutils'
Gravatar
Thu Mar 05 01:32:02 -0800 2009
1
2
3
require 'rubygems'
require 'benchmark'
require 'fileutils'
Gravatar
Sun Jan 11 11:21:26 -0800 2009
1
2
3
<div id="player">
  <canvas id="levels" width="145" height="24"></canvas>
</div>