Skip to content

Instantly share code, notes, and snippets.

View ForrestSutton's full-sized avatar

Forrest Sutton ForrestSutton

View GitHub Profile
@ForrestSutton
ForrestSutton / railsMongodb
Created May 25, 2013 18:48
rails and mongo db
-O, [--skip-activerecord] # Skip Active Record files
-J, [--skip-prototype] # Skip Prototype files
-T, [--skip-testunit] # Skip Test::Unit files
You can get a complete list of all the available options by running the command:
$ rails new --help
Creating the app
$ sudo gem install rails
rails new YourApp -OJT
@ForrestSutton
ForrestSutton / mysql.mysql
Last active December 4, 2019 16:52
Mysql Recipes
#split a name into three parts. you can also compare fname and mname when mname is blank
SELECT initialimport.CustomerNumber as CustNumb,
SUBSTRING_INDEX(SUBSTRING_INDEX(ContactPerson, ' ', 1), ' ', -1) as fname,
SUBSTRING_INDEX(SUBSTRING_INDEX(ContactPerson, ' ', 2), ' ', -1) as mname,
SUBSTRING_INDEX(SUBSTRING_INDEX(ContactPerson, ' ', 3), ' ', -1) as lname
FROM initialimport;
@ForrestSutton
ForrestSutton / mongodb commands
Created May 9, 2013 13:27
mongodb commands
//start mongodb
mongod --dbpath data
mongoimport --db opendata --collection atlenergy < energy_wb.json
#restore database from mongodump
mongorestore --collection col --db opendata opendata/col.bson
@ForrestSutton
ForrestSutton / git setup on ubuntu
Last active October 28, 2016 19:34
Git setup on Linux
sudo apt-get install curl git -y
sudo aptitude install git-completion
git config --global color.ui "auto"
git config --global user.name "Forrest Sutton"
git config --global user.email "<email>@gmail.com"
ssh-keygen -t dsa -C "<email>@gmail.com"
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';