Skip to content

Instantly share code, notes, and snippets.

View bnorton's full-sized avatar

Brian Norton bnorton

View GitHub Profile
@bnorton
bnorton / array.rb
Last active August 29, 2015 14:02
Convert an array to a proc that applies its members in sequence to the given item
class Array
def to_proc
->(item) do
self.each do|meth|
item = item.send meth
end
item
end
end
@bnorton
bnorton / open.js
Last active August 29, 2015 14:01
Open in App w/ iframe
var url = 'yourapp://link/305923',
iframe = '<iframe src="'+ url + '" style="display:none;"></iframe>';
$('body').append(iframe);
@bnorton
bnorton / mongoid.yml
Last active August 29, 2015 13:55
mongoid 4.0 config
## :write
# -1 : Don't verify writes and raise no network errors
# 0 : Don't verify writes and raise network errors
# 1 : Verify writes on the primary node. (default)
# n : Verify writes on n number of nodes.
#
## :read
# :primary : Will always read from a primary node. (default)
# :primary_preferred : Attempt a primary first, then secondary if none available.
# :secondary : Will always read from a secondary node.
@bnorton
bnorton / Alert.h
Last active January 2, 2016 06:09
UIAlertView subclass for block based handling of simple alert messages. Send in a title and message and specify a block to be called when the alert is dismissed.
//
// Alert.h
//
// Created by Brian Norton on 1/4/14.
// Copyright (c) 2014 Brian Norton. MIT.
//
#import <UIKit/UIKit.h>
@interface Alert : UIAlertView <UIAlertViewDelegate> {
@bnorton
bnorton / Gemfile
Created April 30, 2012 15:11
RSpec, Capybara, DatabaseCleaner
source 'http://rubygems.org'
gem 'rails'
gem 'ejs'
gem 'i18n-js', :git => 'git://github.com/fnando/i18n-js.git'
gem 'jquery-rails'
gem 'airbrake'
gem 'thin'
group :assets do