Skip to content

Instantly share code, notes, and snippets.

@citrus
citrus / jquery.valabel.js
Created June 15, 2011 21:04
jQuery Textfield-Value Labels
// jQuery Textfield Labels
// Valabel == Value + Label
// by Spencer Steffen
// Citrus Media Group
// [email protected]
;(function($) {
var version = '0.1.0';
@citrus
citrus / nginx.conf
Created June 16, 2011 18:48
Nginx Config
worker_processes 1;
pid /usr/local/nginx/logs/nginx.pid;
events {
worker_connections 1024;
}
http {
@citrus
citrus / Error
Created June 23, 2011 23:06
spork + cucumber-rails = "undefined method `World' for main:Object (NoMethodError)"
# Error
Using Cucumber
Preloading Rails environment
Loading Spork.prefork block...
undefined method `World' for main:Object (NoMethodError)
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/cucumber-rails-1.0.0/lib/cucumber/rails/world.rb:24:in `<top (required)>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:225:in `load_dependency'
# config/initializers/config.rb
CONFIG = YAML.load(File.read(Rails.root.join("config/config.yml")))[Rails.env].symbolize_keys
@citrus
citrus / error
Created July 6, 2011 17:50
FactoryGirl - ArgumentError: Not registered: block_given?
34) Error:
test: Post should validate date time. (PostTest):
ArgumentError: Not registered: block_given?
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/registry.rb:18:in `find'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl.rb:51:in `sequence_by_name'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/syntax/methods.rb:118:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/attribute/sequence.rb:11:in `add_to'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/attribute/implicit.rb:10:in `add_to'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/factory.rb:81:in `block in run'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/factory.rb:79:in `each'
source 'http://rubygems.org'
gem 'cucumber', '>= 1.0.2'
gem 'rspec', '>= 2.6.0'
gem 'webrat', '>= 0.7.3'
gem 'mechanize', '>= 2.0.1'
@citrus
citrus / date_time_helper.rb
Created July 26, 2011 20:28
Round time to next quarter hour with ruby (00,15,30,45)
module DateTimeHelper
def time_to_next_quarter_hour(time)
array = time.to_a
quarter = ((array[1] % 60) / 15.0).ceil
array[1] = (quarter * 15) % 60
Time.local(*array) + (quarter == 4 ? 3600 : 0)
end
end
@citrus
citrus / application.rb
Created September 26, 2011 19:38
Gateway::UsaEpay
# config/application.rb
module YourApp
class Application < Rails::Application
require 'spree_site'
# ...
end
@citrus
citrus / camping-list.txt
Created October 10, 2011 23:14
Camping List
Grilling & Fire
grill rack
long tongs / poker stick
hatchet / ax
saw
wood / kindling
newspaper
hot pads or heat gloves
lighter & matches
require 'rqrcode'
require 'erb'
text = ARGV.shift
if text.nil?
puts "Please supply some text.."
exit
end