Skip to content

Instantly share code, notes, and snippets.

View garrensmith's full-sized avatar

Garren garrensmith

View GitHub Profile
require 'rubygems'
require 'sinatra'
before do
@username = session[:username]
p session
end
get '/' do
git svn clone -r[FROM REVISION NUMBER] svn:// #create git repository from svn repository
git svn rebase # get latest changes
git status # latest status of repository
git help COMMAND # get help on any command
git checkout -b BRANCH_NAME # create new branch
git branch #list branches
git checkout BRANCH_NAME #switch to branch
git merge BRANCH_NAME # merge changes from BRANCH_NAME into current branch
git add . # add all changes to staging area
git commit -m "MESSAGE" # commit changes in staging area
source 'http://rubygems.org'
gem 'sinatra', '>= 1.0'
gem "mongoid", ">=2.0.0.beta.17"
gem "bson_ext", ">=1.0.4"
require 'mongoid'
class Person
include Mongoid::Document
field :first_name
field :middle_initial
field :last_name
end
require 'rubygems'
require 'sinatra'
require 'mongoid'
configure do
Mongoid.configure do |config|
name = "demo"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.slaves = [
@garrensmith
garrensmith / module.js
Created January 31, 2011 14:28
Return object from module with required functions
var bob = module.exports = function(input) {
return { foo: "bar",
baz: "bar",
output: input
};
};
Zombie: GET http://localhost:3000/
Zombie: GET http://localhost:3000/ => 200
Zombie: GET https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
Zombie: GET http://localhost:3000/javascripts/frontpage.js
Zombie: GET http://localhost:3000/javascripts/frontpage.js => 200
Zombie: Running script from /javascripts/frontpage.js
Error
TypeError: Cannot call method 'toString' of null
at /usr/local/lib/node/.npm/zombie/0.9.1/package/lib/zombie/resources.js:25:15
at Resource.toString (/usr/local/lib/node/.npm/zombie/0.9.1/package/lib/zombie/resources.js:58:172)
(document).ready(function() {
$('#user_form').submit(function() {
alert('hello');
return true;
@garrensmith
garrensmith / rakefile.rb
Created April 11, 2011 12:55
Creates a new release branch and pushes it upstream, it also updates all the hudson jobs to build this release
require 'rexml/document'
require 'net/http'
require 'uri'
require 'rakefiles/utils'
namespace :release do
@server_url = "http://server_url"
@server_port = "8080"
@garrensmith
garrensmith / mathStuff.erl
Created January 11, 2012 15:49
Couchdb and erlang course
-module(mathStuff).
-export([perimeter/1]).
perimeter({square,Side}) ->
Side * 4;
perimeter({rectangle,A,B}) ->
(A * 2) + (B * 2);
perimeter({circle,Radius}) ->
Radius * 2 * 3.1415;