Bradley Schaefer soulcutter

View foo_spec.rb
1 2 3 4 5 6 7 8 9
describe ActiveSupport::TimeZone do
it "has an invalid fraction, clearly" do
rub_a_dub_double = double.as_null_object
ymd = [rub_a_dub_double.year, rub_a_dub_double.month, rub_a_dub_double.day]
ActiveSupport::TimeZone['UTC'].local(*ymd) # ArgumentError: invalid fraction
Date.new(*ymd) # => ArgumentError: invalid date -- now that makes sense
end
end
View datapoint.rb
1 2 3 4 5 6 7 8 9 10
# encoding: utf-8
require 'datapoint_value'
 
class Datapoint < ActiveRecord::Base
include DatapointValue::Conversions
 
before_save :normalize_value
 
def self.upsert(params)
dp = where(token: params[:token], at: params[:at]).first
View digest_auth.rb
1 2 3 4 5 6 7 8 9 10
# -*- coding: utf-8 -*-
require 'faraday'
require 'net/http/digest_auth'
 
module Faraday
# Public: A Faraday middleware to use digest authentication. Since order of
# middlewares do care, it should be the first one of the Request middlewares
# in order to work properly (due to how digest authentication works).
#
# If some requests using the connection don't need to use digest auth you
View auto_annotate_models.rake
1 2 3 4 5 6 7 8 9 10
# NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if(Rails.env.development?)
task :set_annotation_options do
# You can override any of these by setting an environment variable of the
# same name.
Annotate.set_defaults({
'position_in_routes' => "after",
'position_in_class' => "after",
View Gruntfile.js
1 2 3 4 5 6 7 8 9 10
'use strict';
 
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
 
grunt.loadNpmTasks('grunt-contrib-watch');
 
// configurable paths
var config = {
View barator.rb
1 2 3 4 5 6 7 8 9 10
module Barator
def foo(*args)
"#{super(*args)}bar"
end
end
 
class Foo
prepend Barator
 
def foo
View Backtrace
1 2 3 4 5 6 7 8 9 10
Order rejecting an order sends reject email when status is updated
Failure/Error: Order.new.stub(:send_reject_email)
NoMethodError:
undefined method `method_defined?' for #<Order not initialized>
# /Users/matt/.rvm/gems/ruby-2.0.0-p247@uncommon-flow/gems/activemodel-4.0.0/lib/active_model/attribute_methods.rb:436:in `method_missing'
# /Users/matt/.rvm/gems/ruby-2.0.0-p247@uncommon-flow/gems/activerecord-4.0.0/lib/active_record/attribute_methods.rb:128:in `method_missing'
# /Users/matt/.rvm/gems/ruby-2.0.0-p247@uncommon-flow/gems/rspec-mocks-2.14.1/lib/rspec/mocks/instance_method_stasher.rb:34:in `method_defined_on_klass?'
# /Users/matt/.rvm/gems/ruby-2.0.0-p247@uncommon-flow/gems/rspec-mocks-2.14.1/lib/rspec/mocks/instance_method_stasher.rb:55:in `method_owned_by_klass?'
# /Users/matt/.rvm/gems/ruby-2.0.0-p247@uncommon-flow/gems/rspec-mocks-2.14.1/lib/rspec/mocks/instance_method_stasher.rb:29:in `method_defined_directly_on_klass?'
# /Users/matt/.rvm/gems/ruby-2.0
View gist:5936232
1 2 3 4 5 6 7 8 9 10
require 'active_support'
 
module TestConcern
extend ActiveSupport::Concern
 
module ClassMethods
def test_class_method
puts "I gots class!"
end
end
View .powrc
1 2 3 4 5 6 7 8
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ] ; then
source "$rvm_path/scripts/rvm"
rvm use `cat .ruby-version`@`cat .ruby-gemset`
fi
 
if [ -f "~/.oh-my-zsh/custom/openssl.zsh" ] ; then
source "~/.oh-my-zsh/custom/openssl.zsh"
fi
View gist:5346232
1 2 3 4 5 6 7 8 9 10
class Obj
def self.new_method(name, options = {})
define_method(name) { options }
end
end
 
o = Obj.new
 
options = { one: :two }
Obj.new_method('baz', options)
Something went wrong with that request. Please try again.