View tracked_let.rb
1 2 3 4 5 6 7 8 9 10
# transaction/truncation strategies won't work when you have a
# capybara feature and you must preserve what's already in the
# database
#
# Usage:
# include TrackedLet
#
# track(:foo) { User.create }
# track!(:foo) { User.create }
# specify { expect(track(User.create)).to be_persisted }
View mail_chimp.rb
1 2 3 4 5 6 7 8 9 10
require "active_support/core_ext"
require "delegate"
require "mailchimp"
require "singleton"
 
class MailingList::MailChimp
attr_reader :user, :member_info
 
def initialize(user, member_fetcher = member_info_api)
@user = user
View mailing_list.rb
1 2 3 4 5 6 7 8 9 10
require "delegate"
require "singleton"
 
module MailingList
class SafeResponse < SimpleDelegator
def self.safe_delegate(*methods)
methods.each do |method|
define_method(method, ->(*args, &block) {
value = __getobj__.send(method, *args, &block)
value ? SafeResponse.new(value) : BlackHole.instance
View timecop_helper.rb
1 2 3 4 5 6 7 8 9
RSpec.configure do |config|
config.around(:each, :timecop_freeze) do |example|
time = example.metadata[:timecop_freeze]
time = Time.current.change(usec: 0) if TrueClass === time
Timecop.freeze(time) do
example.call
end
end
end
View keybase.md

Keybase proof

I hereby claim:

  • I am soulcutter on github.
  • I am soulcutter (https://keybase.io/soulcutter) on keybase.
  • I have a public key whose fingerprint is C0D8 559D 4B50 7EF5 EE76 E036 BDEB 33DF 2145 14AC

To claim this, I am signing this object:

View gist:4c55548bd742ff26a9a0
1 2 3 4 5 6 7 8 9 10
class Digest::Jenkins
 
MAX_32_BIT = 4294967295
 
def self.digest(string)
hash = 0
 
string.each_byte do |byte|
hash += byte
hash &= MAX_32_BIT
View implicit_hashing_struct.rb
1 2 3 4 5 6 7 8 9 10
Flub = Struct.new(:foo, :bar) do
def to_hash; to_h; end
end
 
def named(foo:, bar:)
p "foo: #{foo}"
p "bar: #{bar}"
end
 
named(**Flub.new(1, 2))
View stacktrace.txt
1 2 3 4 5 6 7 8 9 10
Uncaught TypeError: Cannot read property 'shouldSupercede' of undefinedvendor.js:59348
__exports__.default.subclass.applyToHandlersvendor.js:59287
__exports__.default.subclass.applyToStatevendor.js:58713
Router.applyIntentvendor.js:39545
calculatePostTransitionStatevendor.js:39328
EmberObject.extend._hydrateUnsuppliedQueryParamsvendor.js:39269
EmberObject.extend._prepareQueryParamsvendor.js:34131
computeLinkViewHrefvendor.js:25813
ComputedPropertyPrototype.getvendor.js:31070
getvendor.js:55606
View dropdown-menu.js
1 2 3 4 5 6 7 8 9
import Ember from "ember";
 
export default Ember.Component.extend({
tagName: 'nav',
classNames: ['navDropdown'],
classNameBindings: ['isDropdownVisible:is--open'],
ariaRole: 'navigation',
 
isDropdownVisible: false,
View console.txt
1 2 3 4
git:(develop) ✗ ember g server users
version: 0.1.3
valid watchman found, version: [3.0.0]
Unknown blueprint: server
Something went wrong with that request. Please try again.