Skip to content

Instantly share code, notes, and snippets.

View mrgenixus's full-sized avatar

Ben West mrgenixus

View GitHub Profile
https://plus.google.com/hangouts/_/calendar/ZGF2aWRqYmV2ZXJpZGdlQGdtYWlsLmNvbQ.0o6bh4pin9d2d5dol1n35khrcc?authuser=1
@mrgenixus
mrgenixus / active_model_lint.rb
Created February 26, 2016 14:26 — forked from dmitriy-kiriyenko/active_model_lint.rb
ActiveModel lint tests for rspec
# put the file into spec/support
shared_examples_for "ActiveModel" do
include ActiveModel::Lint::Tests
# to_s is to support ruby-1.9
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
example m.gsub('_',' ') do
send m
end
end
@mrgenixus
mrgenixus / alternative store_store.js
Last active February 24, 2016 21:06
Proposed base store
export default FluxStore.extend({
model: 'store',
events: {
"ASSOCIATE_STORE": 'associate_store'
},
create(payload) {
return Store.create(payload.data)
},
@mrgenixus
mrgenixus / shopping_list_item_mixin.rb
Last active February 17, 2016 04:30
Extracted from ShoppingList#list_items as refactor
scope :without_removed, -> { where(arel_table[:removed].eq(nil).or(arel_table[:removed].eq(0))) }
scope :only_removed, -> { where(arel_table[:removed].not_eq(nil)).where(arel_table[:removed].not_eq(0)) }
def self.date_range start_date, end_date
includes(:event).
where(Event.arel_table[:event].gteq(start_date)).
where(Event.arel_table[:event].lteq(end_date))
end
@mrgenixus
mrgenixus / evaluate.js
Created December 8, 2015 04:20
survey_response_requirements
var survey_responses = [
{
eyes: {
color: 'blue'
},
flavors: {
favorite: 'vanilla'
}
}
var Backbone = require('backbone');
var _ = require('underscore');
var MVCObject = function MVCObject() {
if(_.isFunction(this.initialize)) {
this.initialize.apply(this, arguments);
}
};
_.extend(MVCObject.prototype, Backbone.Events);
@mrgenixus
mrgenixus / Gemfile
Last active October 28, 2015 22:56
quasi-inherited hashes
# A sample Gemfile
source "https://rubygems.org"
gem "pry"
@mrgenixus
mrgenixus / console.log short
Last active October 15, 2015 01:01 — forked from DaveVoyles/console.log short
Got tired of writing console.log everywhere
var c = console.log.bind(console); // allows you to replace console.log(message) in your code with c(message)
@mrgenixus
mrgenixus / booking_feature_helpers.rb
Last active September 18, 2015 19:10
Refactor Booking Page
module BookingFeatureHelpers
def fill_in_booking_attributes inputs = {}
attrs = booking_attributes.merge user_attributes
attrs.merge! inputs
attrs = attrs.with_indifferent_access
[:name, :email, :phone_number, :number_of_people].each do |field|
if attrs[field].present?
find("[name*=#{field.to_s}]").set attrs[field]

What's this PR do?

  • Allows a guest to book a tour

Where should the reviewer start?

spec/features/guest_book_tour_spec.rb

How should this be manually tested?

Read through and manually check the feature test for this story

Any background context you want to provide?