Public Gists by joshuaclayton

Gravatar
Tue Nov 03 08:40:03 -0800 2009
1
2
3
def time_distance(seconds = 0)
  days, hours, minutes = 0,0,0
  in_days = seconds / (60*60*24)
Gravatar
Sat Oct 31 07:24:22 -0700 2009
1
2
3
# new IRB session, memcached 1.4.1 - looks like it marshalled the data incorrectly?
>> gem "memcache-client", "1.7.4"
=> true
Gravatar
Thu Oct 29 06:26:55 -0700 2009
1
2
3
class Person
  def self.region(str, &blk)
    self.class_eval(&blk)
Gravatar
Fri Oct 23 08:06:16 -0700 2009
1
2
3
module Ahoy
  def self.included(base)
    base.public_instance_methods.select {|m| m.to_s =~ /ar/ }.each do |method_name|
Gravatar
Thu Sep 17 13:59:01 -0700 2009
1
2
3
module GeoKit
  module Geocoders
    class FakeGeocoder < Geocoder
Gravatar
Wed Sep 09 10:14:27 -0700 2009
1
2
3
/Users/joshuaclayton/.rvm/ruby-1.8.6-p383/bin/ruby -I"lib:test" "/Users/joshuaclayton/.rvm/gems/ruby/1.8.6/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/aaws_test.rb" "test/unit/category_test.rb" "test/unit/helpers/item_helper_test.rb" "test/unit/item_listing_test.rb" "test/unit/item_test.rb" "test/unit/presenters/categories_presenter_test.rb" "test/unit/presenters/category_presenter_test.rb" "test/unit/presenters/items_presenter_test.rb" "test/unit/presenters/user_presenter_test.rb" "test/unit/presenters/users_presenter_test.rb" "test/unit/user_sentinel_test.rb" "test/unit/user_test.rb" -v
Loaded suite /Users/joshuaclayton/.rvm/gems/ruby/1.8.6/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
Gravatar
Wed Aug 26 03:48:09 -0700 2009
1
2
3
blueprint/screen.css
30:h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
32:h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
Gravatar
Fri Aug 14 12:12:44 -0700 2009
1
2
3
class ListItemPresenter
  delegate :id, :class, :errors, :to_param, :new_record?, :respond_to?, :is_a?,
            :to => :@list_item
Gravatar
Wed Aug 12 10:45:26 -0700 2009
1
2
3
module Admin::CustomerHelper
  def customer_breadcrumbs(customer)
    link_to(h(customer.name), [:edit, :admin, customer]) + " &#187; "
Gravatar
Mon Aug 10 11:41:37 -0700 2009
1
2
3
Factory.define(:product) do |product|
  product.association :creator, :factory => :product_admin_user
  product.association :product_template
Gravatar
Fri Jul 31 06:26:51 -0700 2009
1
2
3
require "hmac"
require "hmac-sha2"
 
Gravatar
Mon Jul 27 20:08:52 -0700 2009
1
2
3
module GitCommands
  class ShellError < RuntimeError; end
 
Gravatar
Thu Jul 23 06:49:58 -0700 2009
1
2
3
# Rakefile
 
task :stats => "stats:stats_fix"
Gravatar
Thu Jul 16 09:00:29 -0700 2009
1
2
3
# not all callbacks should be put in an observer, just things not directly associated with the model itself:
 
class UserObserver < ActiveRecord::Observer
Gravatar
Wed Jul 15 14:17:34 -0700 2009
1
2
3
class UserTest < ActiveSupport::TestCase
  should_belong_to :customer
 
Gravatar
Wed Jul 15 07:20:47 -0700 2009
1
2
3
namespace :test do
  task :double do
    Rake::Task["rake:test:units"].invoke
Gravatar
Mon Jul 06 08:02:26 -0700 2009
1
2
3
body { min-width: 950px; }
.cucumber {
  background: #f4f4f4;
Gravatar
Tue Jun 30 09:50:51 -0700 2009
1
2
3
module PercentBase
  def self.included(base)
    base.extend ClassMethods
Gravatar
Thu Jun 25 05:50:30 -0700 2009
1
2
3
# autocompletion for ruby_test
# # works with tu/tf aliases
# # see also ~/bin/ruby_test.rb
Gravatar
Wed Jun 24 07:52:51 -0700 2009
1
2
3
# This allows generation of "codes"... namely for part-numbers and unique identifiers for records
# It's especially effective with FactoryGirl's sequences.
#