Skip to content

Instantly share code, notes, and snippets.

View jackfranklin's full-sized avatar

Jack Franklin jackfranklin

View GitHub Profile
Load up Terminal
use the "cd" command to get to your directory. Eg if directory is in your Sites folder:
cd ~/Sites/railsapp
~ means your home folder
Run this to install anything you need to run it:
var PostsCollection = B.Collection.extend({
model: PostModel,
url: "http://hndroidapi.appspot.com/news/format/json/page/",
fetch: function(cb) {
var ajaxReq = $.ajax({
url: this.url,
type: "GET",
dataType: "jsonp"
});
ajaxReq.done(function(d) {
@jackfranklin
jackfranklin / macvim-padding
Created July 28, 2012 13:57 — forked from meleyal/macvim-padding
Add padding to MacVim windows
defaults write org.vim.MacVim MMTextInsetTop '10'
defaults write org.vim.MacVim MMTextInsetLeft '10'
defaults write org.vim.MacVim MMTextInsetBottom '10'
defaults write org.vim.MacVim MMTextInsetRight '10'
@jackfranklin
jackfranklin / UnitTestingPresentation
Created July 7, 2012 13:02
Brief intro to unit testing JavaScript presentation
#Unit Testing your JavaScript
##About Me
* University of Bath Computer Science student
* Placement at [Kainos](http://www.kainos.com)
* [JavaScript Playground](http://www.javascriptplayground.com)
* @Jack_Franklin
## Why Test at all?
@jackfranklin
jackfranklin / gist:2994434
Created June 26, 2012 08:39
Brand new OS X work machine:
Homebrew & then: Git, Node, NPM, CoffeeScript, wget
rbenv & Ruby then gems: Bundler, Rails, Rake
Xcode
Alfred
Sublime Text 2
iTerm 2
ZSH & Oh-my-ZSH
Dropbox
Evernote
@jackfranklin
jackfranklin / rvm2rbenv.txt
Created June 21, 2012 18:42 — forked from brentertz/rvm2rbenv.txt
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@jackfranklin
jackfranklin / gist:2967678
Created June 21, 2012 18:42
Setting up Pow & MAMP Nicely
Step 1:
touch ~/.powconfig
echo 'export POW_DOMAINS=rails' >> ~/.powconfig
echo 'export POW_DST_PORT=88' >> ~/.powconfig
Then reinstall / install Pow, and then load up MAMP, add a new VHost, doesn't matter what you call it at all or where to put as the destination, go into the "Advanced" tab and under "Customised Virtual Host General Settings" add this:
ServerName pow
ServerAlias *.rails
//so before you had:
if(options.slide == 'up') { $(this).slideUp(time, options.callback);} // slide Up
else if(options.slide == 'down') { $(this).slideDown(time, options.callback);} // slide down
else if(options.slide == 'toggle') {$(this).slideToggle(time, options.callback);} // slide toggle
/**there's a pattern here
* if options.slide = up, call slideUp
* if it's down, call slideDown
* it it's toggle, call slideToggle
@jackfranklin
jackfranklin / gist:2957228
Created June 19, 2012 23:56
Python FizzBuzz
#loopy loop
def fizzBuzz(lim=100):
i = 1
while i < lim+1:
if i % 15 is 0:
print "FizzBuzz!"
elif i % 5 is 0:
print "Buzz!"
elif i % 3 is 0:
@jackfranklin
jackfranklin / gist:2944968
Created June 17, 2012 16:08
creating has_many relationships in FactoryGirl
#models/discussion.rb
has_many :posts
#models/post.rb
belongs_to :discussion
#spec/factories/discussions.rb