Skip to content

Instantly share code, notes, and snippets.

View seth-macpherson's full-sized avatar

Seth MacPherson seth-macpherson

  • Appfolio
  • Hood River, OR
View GitHub Profile
@seth-macpherson
seth-macpherson / mobilehtml5.haml
Created October 14, 2011 06:18 — forked from minikomi/mobilehtml5.haml
mobile html5 boilerplate haml
<!doctype html>
/[if IEMobile 7 ] <html class="no-js iem7">
/ [if (gt IEMobile 7)|!(IEMobile)]><!
%html.no-js
/ <![endif]
%head
%meta{:charset => "utf-8"}
%title
%meta{:content => "", :name => "description"}
%meta{:content => "", :name => "author"}
@seth-macpherson
seth-macpherson / gist:2473961
Created April 23, 2012 21:24 — forked from scottburton11/gist:1479734
Ember.js tree
<html>
<head>
<script src="javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/ember.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
App = Ember.Application.extend();
App.Node = Ember.Object.extend({
name: null,
@seth-macpherson
seth-macpherson / rspec-syntax-cheat-sheet.rb
Created April 29, 2012 15:47 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@seth-macpherson
seth-macpherson / gist:2709681
Created May 16, 2012 11:30 — forked from punund/gist:1034276
Proper exception handling in Rails 3
# coding: utf-8
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from Exception, :with => :handle_exceptions
private
def handle_exceptions(e)
case e
when CanCan::AccessDenied
@seth-macpherson
seth-macpherson / upgrade_homebrew_pg.sh
Created May 30, 2012 06:36 — forked from johnpaulashenfelter/upgrade_homebrew_pg.sh
Upgrading homebrew postgres from 9.0.x to 9.1
Upgrading to homebrew postgresql 9.1.1 from 9.0.x
* Copy the old data
mv -R /usr/local/var/postgres/ /usr/local/var/postgres-901
* Create a new database using 9.1.1
/usr/local/Cellar/postgresql/9.1.1/bin/initdb /usr/local/var/postgres
@seth-macpherson
seth-macpherson / 0-readme.md
Created November 30, 2012 19:31 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@seth-macpherson
seth-macpherson / 0-readme.md
Created November 30, 2012 19:31 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@seth-macpherson
seth-macpherson / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console