Skip to content

Instantly share code, notes, and snippets.

View benbabics's full-sized avatar

Ben Babics benbabics

View GitHub Profile
class ApiConstraint
attr_reader :version
def initialize(options)
@version = options.fetch(:version)
end
def matches?(request)
request
.headers
{
"data": {
"id": "79931a85-9dda-42d8-8103-fea6ba4fc4af",
"type": "client",
"attributes": {
"name": "GrubHub",
"company-id": "grubhub",
"address": "111 W Washington St, Chicago, IL 60602",
"createdAt": "2016-01-20T18:40:46.000Z",
"updatedAt": "2016-01-21T23:25:58.000Z"
@benbabics
benbabics / A-Pen-by-benbabics.markdown
Created November 8, 2013 15:56
A Pen by benbabics.
@benbabics
benbabics / A-Pen-by-benbabics.markdown
Created September 9, 2013 14:58
A Pen by benbabics.
@benbabics
benbabics / Equalize Heights
Last active December 21, 2015 12:29
function to equalize the heights of elements of a module between modules.
/*
* Helper - Equalize height of elements in a module between modules
*
* @param { string } - selector ( e.g. '.header' )
* @param { element } - context ( e.g. $('#blog') )
*/
function equalHeight(selector, context) {
var maxHeight = 0
$modules = $( selector, context );
@benbabics
benbabics / A-Pen-by-benbabics.markdown
Created August 21, 2013 12:56
A CodePen by benbabics.
@benbabics
benbabics / A-Pen-by-benbabics.markdown
Created August 21, 2013 12:56
A CodePen by benbabics.
@benbabics
benbabics / MyClass.js
Created March 6, 2013 21:12
This is in-regard to a comment someone made about having a triple nested return for "getInstance".
define([ 'utils/Singleton' ],
function(Singleton) {
'use strict';
var MyClass;
MyClass = (function() {
function MyClass() {}
@benbabics
benbabics / UI Helper Classnames
Created January 31, 2013 14:23
Fortunately Twitter Bootstrap arms us with an arsenal of classnames for components, grids and other UI-goodies. Unfortunately, they don't supply us with something as basic as layout helpers. Here's what I've used:
.margin-top {
margin-top: 20px;
}
.margin-right {
margin-right: 20px;
}
.margin-bottom {
margin-bottom: 20px;
}
.margin-left {
@benbabics
benbabics / example.js
Created January 25, 2012 13:23 — forked from doubleclickdetroit/example.js
JS Inheritance
function Person(name) {
this.name = name;
}
Person.prototype.getName = function() {
return this.name;
};
function Author(name, books) {
Author.superClass.constructor.call(this, name);
this.books = books;