Skip to content

Instantly share code, notes, and snippets.

View jbnunn's full-sized avatar
:octocat:

Jeff Nunn jbnunn

:octocat:
View GitHub Profile
@jbnunn
jbnunn / gist:3743541
Created September 18, 2012 14:50
Clean Install – Mountain Lion OS X 10.8 DP3
@jbnunn
jbnunn / setting_up_active_admin_on_heroku.md
Created October 25, 2012 02:56 — forked from wrburgess/setting_up_active_admin_on_heroku.md
Rails App with ActiveAdmin on Heroku #rails #ruby #activeadmin #heroku
@jbnunn
jbnunn / VagrantUbuntuSetup.md
Created December 4, 2012 02:35
Spinning up an Ubuntu Box with Vagrant
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@jbnunn
jbnunn / gist:6236753
Created August 14, 2013 23:20
Gemfile for app where Rails Panel isn't showing log info
source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'unicorn'
gem "mongoid", "~> 2.4"
gem "bson_ext", "~> 1.5"
gem 'jquery-rails'
gem 'sorcery'
gem 'cancan'
gem 'twitter-bootstrap-rails', :git => 'http://github.com/seyhunak/twitter-bootstrap-rails.git'
@jbnunn
jbnunn / mysql.php
Last active December 21, 2015 11:09
PHP MySQL Class for easy operations on a MySQL database
<?
class MySQL {
/**
* The DB Host to connect to
*
* @var string
*/
protected $host;
@jbnunn
jbnunn / gist:7102350
Created October 22, 2013 15:05
Using an in-memory database for Play! framework testing
class TestCountriesSpec extends Specification {
val appWithMemoryDatabase = FakeApplication(additionalConfiguration = inMemoryDatabase())
abstract class WithDbData extends WithApplication(appWithMemoryDatabase) {
override def around[T: AsResult](t: => T): Result = super.around {
setupData()
t
}
@jbnunn
jbnunn / writesql.py
Last active January 1, 2016 06:59
Creates an SQL inserts file based off of a CSV
#! /usr/bin/python
import argparse, getopt, sys
parser = argparse.ArgumentParser(description='Writes SQL inserts based off a CSV file. Assumes values are strings.')
parser.add_argument('file', help='name and location of the file to parse')
parser.add_argument('table', help='table name on which inserts will be based')
parser.add_argument('cols', help='comma-separated value of the columns to write')
args = parser.parse_args()
require 'rubygems'
require 'twitter'
# see https://github.com/sferik/twitter
def twitter_client
Twitter::REST::Client.new do |config|
config.consumer_key = "XXXXXX"
config.consumer_secret = "XXXXXX"
config.access_token = "XXXXXX"
@jbnunn
jbnunn / git-pull
Created June 4, 2014 17:57
Git 2.0 pull file for Mac OS X 10.10 Yosemite
#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#
# Fetch one or more remote refs and merge it/them into the current HEAD.
USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff|--ff-only] [--[no-]rebase|--rebase=preserve] [-s strategy]... [<fetch-options>] <repo> <head>...'
LONG_USAGE='Fetch one or more remote refs and integrate it/them with the current HEAD.'
SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=