Skip to content

Instantly share code, notes, and snippets.

View ndbroadbent's full-sized avatar

Nathan Broadbent ndbroadbent

View GitHub Profile
@ndbroadbent
ndbroadbent / MasterViewController.swift
Created July 12, 2014 19:44
Swift Hackathon Jul 2014
//
// MasterViewController.swift
// SwiftClassTodo
//
// Created by JP Simard on 7/12/14.
// Copyright (c) 2014 Realm. All rights reserved.
//
import UIKit
@ndbroadbent
ndbroadbent / qr_code_parser.rb
Last active August 29, 2015 14:05
QR Code standard for food products
# Ruby code to parse a food product QR Code
class FoodQRParser
class << self
def parse(qr_string)
data = {}
sections = qr_string.split(';')
data[:upc] = sections[0]
data[:expiration_date] = sections[1].to_date
@ndbroadbent
ndbroadbent / gist:913766
Created April 11, 2011 16:08
Gemfile bug .. gsub in active record does not remove 'require 'sqlite3'
no such file to load -- sqlite3
/opt/rails/HabitSmash/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
generate cucumber:install --capybara --rspec
/home/ndbroadbent/.rvm/gems/ruby-1.9.2-p136@global/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require': no such file to load -- sqlite3 (LoadError)
from /home/ndbroadbent/.rvm/gems/ruby-1.9.2-p136@global/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/ndbroadbent/.rvm/gems/ruby-1.9.2-p136@global/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
from /home/ndbroadbent/.rvm/gems/ruby-1.9.2-p136@global/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `block in require'
from /home/ndbroadbent/.rvm/gems/ruby-1.9.2-p136@global/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
from /home/ndbroadbent/.rvm/gems/ruby-1.9.2-p136@global/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
sudo apt-get install -ym git-core && git clone https://github.com/ndbroadbent/ubuntu_config.git /tmp/ubuntu_config && cd /tmp/ubuntu_config && ./dev_machine_setup.sh
@ndbroadbent
ndbroadbent / gist:971255
Created May 13, 2011 20:29
Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
#!/bin/bash
#
# => $ sudo apt-get install -y --force-yes curl; sudo su - -c "bash < <(curl -sL http://is.gd/..........)"
#
# Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
# --------------------------------------------------------------------------
#
# Steps:
#
# *) Install required packages (git, postgresql, etc.)
@ndbroadbent
ndbroadbent / RVM debugging output
Created September 6, 2011 09:30
RVM broken after upgrade to 1.8.1
-----------------------------------------------------------------------------------
[master±|1.9.2p290]$ rvm debug
-----------------------------------------------------------------------------------
ruby-1.9.2-p290:
rvm 1.8.1 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
@ndbroadbent
ndbroadbent / gist:1218804
Created September 15, 2011 08:14
Increase ruby 1.9.2-p290 startup speed by a huge amount (esp w/ fat free crm)
curl https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch > /tmp/ruby-1.9.2p290.patch
rvm install ruby-1.9.2-p290 --patch /tmp/ruby-1.9.2p290.patch
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: nathan.f77@gmail.com-20110921150425-ir9m3ot05rozkttf
# target_branch: http://bazaar.launchpad.net/~inkscape.dev/inkscape\
# /trunk/
# testament_sha1: 1946394c022a88fa90e090cef6e0f7991a88d338
# timestamp: 2011-09-21 23:05:02 +0800
# base_revision_id: juca@members.fsf.org-20110919175042-\
# 532nbha31h5sb498
#
# Begin patch
@ndbroadbent
ndbroadbent / .irbrc
Created December 10, 2011 06:39 — forked from cpetschnig/.irbrc
IRB customization: load wirble, looksee and awesome_print; cheat bundler
require 'rubygems'
@irb_extensions = []
def require_with_bundler_fallback(gem_name, load_file = nil)
load_file ||= gem_name
begin
require load_file
rescue LoadError => e
gem_paths = []
@ndbroadbent
ndbroadbent / gist:1475635
Created December 14, 2011 07:35
.git.scmbrc
#
# Git File Shortcuts Config
# ------------------------------------------------------------------------------
# - Set your preferred prefix for env variable file shortcuts.
# (I chose 'e' because it is easy to slide your finger to it from '$'.)
export git_env_char="e"
# - Max changes before reverting to 'git status'. git_status_shortcuts() may slow down for lots of changes.
export gs_max_changes="99"
# - When using the git_add_shorcuts() command, automatically invoke 'git rm' to remove deleted files?
export ga_auto_remove="yes"