Skip to content

Instantly share code, notes, and snippets.

View chrisbraddock's full-sized avatar

Chris Braddock chrisbraddock

View GitHub Profile
chris@local:/Users/chris/foo:bundle check
The Gemfile's dependencies are satisfied
chris@local:/Users/chris/foo:rails s
/Users/chris/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /Users/chris/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems.rb:248:in `activate'
from /Users/chris/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems.rb:1276:in `gem'
from /Users/chris/.rvm/gems/ruby-1.9.2-head@foo/bin/rails:18:in `<main>'
chris@local:/Users/chris/foo:
str = javascript_include_tag '/vendor/javascripts/jquery/jquery-1.6.1.js'
str += "\n"
str += javascript_include_tag '/vendor/javascripts/jquery-ujs/rails.js'
str += "\n"
str += javascript_include_tag '/vendor/javascripts/jquery-ui/jquery-ui-1.8.13.custom.min.js'
str += "\n"
str
@chrisbraddock
chrisbraddock / gist:1511475
Created December 22, 2011 19:15
Write Better Cukes
# question regarding http://blog.steveklabnik.com/2011/12/20/write-better-cukes-with-the-rel-attribute.html
#
When /^I choose to edit the article "([^"]*)"$/ do |article_name|
article = Article.find_by_name(article_name)
find("//a[@href='#{edit_article_path article}']").click
end
@chrisbraddock
chrisbraddock / gist:1817923
Created February 13, 2012 16:13
rvm get head
chris@local:/Users/chris:rvm get head
Original installed RVM version:
rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
remote: Counting objects: 371, done.
remote: Compressing objects: 100% (291/291), done.
remote: Total 371 (delta 51), reused 190 (delta 34)
Receiving objects: 100% (371/371), 860.58 KiB, done.
# http://hocuspokus.net/2009/07/add-git-and-svn-branch-to-bash-prompt/ and http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/
parse_git_branch () {
#git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#'
#git branch 2> /dev/null | grep "" | sed -e 's/*//g'
#git branch 2> /dev/null| sed -n '(^\*/s/^\* //p'
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo " (git::"${ref#refs/heads/}")"
}
# detect whether any changesets are stashed
@chrisbraddock
chrisbraddock / javascript_argument_default_value.js
Last active December 14, 2015 01:19
Set a default parameter value for a JavaScript function
// http://stackoverflow.com/questions/894860/set-a-default-parameter-value-for-a-javascript-function
function foo(a, b)
{
a = typeof a !== 'undefined' ? a : 42;
b = typeof b !== 'undefined' ? b : 'default_b';
...
}
@chrisbraddock
chrisbraddock / alphabet.js
Last active January 9, 2019 15:33
alphabet array
var alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
git remote add --track master mleung git://github.com/mleung/feather.git
@chrisbraddock
chrisbraddock / index.html
Last active December 15, 2015 08:09
basic html5 template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title></title>
<link rel="stylesheet" href="style.css"/>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
{
"asi" : false, // Require semicolons
"boss" : false, // Don't allow variable assignments in conditionals
"browser" : true, // Standard browser globals should be predefined
"curly" : true, // Require curly braces for blocks (if, else, etc)
"eqeqeq" : true, // === should be required
"eqnull" : true, // == null comparisons should be tolerated
"evil" : true, // Use of eval is ok
"indent" : 4, // 4 spaces, soft-tabs
"latedef" : true, // Prohibit use of var before definition