Skip to content

Instantly share code, notes, and snippets.

Josh Owens queso

Block or report user

Report or block queso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
queso / gist:12015
Created Sep 22, 2008 doesn't work for automatic timezone support, but it seems does. All the documentation indicates that should work as well...
View gist:12015
## Anyone care to explain why using and result in two different times in the db?
>> e = Event.create(:title => "Test2", :url => "", :length => 60, :starts_at => +
=> #<Event id: 4, user_id: nil, title: "Test2", url: "", starts_at: "2008-09-23 16:05:14", length: 60, category_id: nil, format_id: nil, advertisment_type: nil, highlight_type: nil, created_at: "2008-09-22 20:05:14", updated_at: "2008-09-22 20:05:14", permalink: "test2", description: nil, popularity: 0.0, promoted: false>
>> +
=> Tue Sep 23 16:05:26 -0400 2008
>> e = Event.create(:title => "Test2", :url => "", :length => 60, :starts_at => +
=> #<Event id: 5, user_id: nil, title: "Test2", url: "", starts_at: "2008-09-23 20:05:43", length: 60, category_id: nil, format_id: nil, advertisment_type: nil, highlight_type: nil, created_at: "2008-09-22 20:05:43", updated_at: "2008-09-22 20:05:43", permalink: "test
View gist:16284
########## Why does the yield output outside the content_tag block?
# Method
def submit(*args)
@template.content_tag(:div, :class => "save_actions") {
super(*args) + (yield).to_s
View gist:20417
#### spec_factory.rb
require 'factory_girl'
Factory.sequence :login do |n|
Factory.sequence :email do |n|
View gist:20693
# Specs
describe "process" do
before(:each) do
@starling = mock(Starling)
@queue =
View mem_test.rb
#!/usr/bin/env ruby
def mem_usage
`ps -o rss= -p #{$$}`.to_i
count = (ARGV[0] || 5).to_i
puts "current process id is #{$$}"
puts "Memory before anything: #{mem_usage}"
View gist:22040
#!/usr/bin/env ruby
def mem_usage
`ps -o rss= -p #{$$}`.to_i
@count = (ARGV[0] || 5).to_i
puts "current process id is #{$$}"
puts "Memory before anything: #{mem_usage}"
View gist:22088
class Mailer < ActionMailer::ARMailer
def setup_template(name, email)
site = SiteSetting.find(:first)
from site.admin_email.to_s
self.mailer_name = 'shared'
self.template = 'email'
options = { 'site' => site }
yield options if block_given?
View error
NoMethodError in 'UserMailer should create a new email row when sending an email'
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.render_subject
/Users/josh/Code/HandCrafted/bootstrap/app/models/mailer.rb:16:in `setup_template'
/Users/josh/Code/HandCrafted/bootstrap/app/models/user_mailer.rb:23:in `setup_user_notification_email'
/Users/josh/Code/HandCrafted/bootstrap/app/models/user_mailer.rb:9:in `activation'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:446:in `__send__'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:446:in `create!'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:439:in `initialize'
View gist:31161
#!/usr/bin/env ruby
require 'rubygems'
require 'mysql'
require 'highline/import'
database = ARGV[0] + "_production"
username = ARGV[0] + "_dba"
password = ask("Enter the password for the new database: ") { |q| q.echo = "*" }
root_password = ask("Enter your root database password: ") { |q| q.echo = "*" }
View output.js
html = "<div id='events'>"
html += "<div class=\'vevent clearfix\'>\n <div class=\'header clearfix\'>\n <abbr class=\'dtstart\' title=\'2008-09-10\'>Wed - Feb 11, 2009 @ 01:00PM CST<\/abbr>\n <span class=\'starts_in\'>Starts in 5 days<\/span>\n <\/div>\n <div class=\'voting\'>\n <div class=\'vote_count\'>\n <span class=\'vote_number\'>1<\/span>\n <span>vote<\/span>\n <\/div>\n <div class=\'vote_action\'>\n <div class=\'voteup\'>\n <span><a href=\"http://calfeed.local/events/25-test-8/vote\">vote up<\/a><\/span>\n <\/div>\n <\/div>\n <\/div>\n <div class=\'body\'>\n <h3 class=\'summary\'>\n <a href=\"/events/25-test-8\" class=\"url\">Test<\/a>\n <\/h3>\n <div class=\'description\'>\n <p>Apple / ( &ndash; Test <a href=\"/events/25-test-8\">read more<\/a><\/p>\n <\/div>\n <div class=\'tools clearfix\'>\n <ul>\n <li class=\'comments_count\'><a href=\"/events/25-test-
You can’t perform that action at this time.