Skip to content

Instantly share code, notes, and snippets.

View mereformalities's full-sized avatar

Brant Watrous mereformalities

View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&')
.replace(/>/g,'>')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
@chrisyour
chrisyour / Folder Preferences
Created December 4, 2010 20:05
Show hidden files and hidden folders (except .git) in your TextMate project drawer
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
@valexa
valexa / editNestedDict
Created April 18, 2011 13:42
a method for changing objects inside deeply nested dictionaries
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
//create a example nested dictionary with just 4 levels
NSMutableDictionary *parent = [[[NSMutableDictionary alloc] init] autorelease];
NSDictionary *thirdChild = [NSDictionary dictionaryWithObjectsAndKeys:@"bi",@"l4",@"nar",@"l4_", nil];
NSDictionary *secondChild = [NSDictionary dictionaryWithObjectsAndKeys:thirdChild,@"l3",@"bar",@"l3_", nil];
NSDictionary *firstChild = [NSDictionary dictionaryWithObjectsAndKeys:secondChild,@"l2",secondChild,@"l2_", nil];
[parent setObject:firstChild forKey:@"l1"];
[parent setObject:firstChild forKey:@"l1_"];
@blackwatertepes
blackwatertepes / pow
Created April 28, 2011 22:35
Shell script for creating/destroying/opening .pow symlinks
#!/bin/bash
# Scripts for creating/deleting/viewing pow symlinks
# Created by Tyler J. (first ever bash!!!)
a=`pwd`
b=`basename -a $a`
create()
{
# Create a pow symlink
@larscwallin
larscwallin / jquery.elementFromPoint
Created December 28, 2011 16:35
jquery.elementFromPoint
(function ($){
var check=false, isRelative=true;
$.elementFromPoint = function(x,y)
{
if(!document.elementFromPoint) return null;
if(!check)
{
var sl;
@petervandenabeele
petervandenabeele / gist:1722491
Created February 2, 2012 09:10
rails new (with 3.2.1 in a fresh gemset)
$ rvm install ruby-1.9.3
Already installed ruby-1.9.3-p0.
To reinstall use:
rvm reinstall ruby-1.9.3-p0
$ rvm use 1.9.3
Using /home/peterv/.rvm/gems/ruby-1.9.3-p0
@mikeobrien
mikeobrien / app.coffee
Created February 21, 2012 04:49
Lazy loading backbone collection + infinite scrolling
class LazyCollection extends Backbone.Collection
indexQuerystring: 'index'
index: 1
lastLength: 0
fetch: (options) ->
options or= {}
if options.reset
@index = 1
@lastLength = 0
else
@zilkey
zilkey / ember-precompile.js
Created March 10, 2012 22:30 — forked from garth/Jakefile.js
Precompile .handlebars templates with node js
var fs = require('fs');
var vm = require('vm');
var emberjs = fs.readFileSync('public/javascripts/vendor/ember-0.9.5.min.js', 'utf8');
var templatesDir = 'templates';
var destinationDir = 'public/javascripts/templates';
function compileHandlebarsTemplate(templatesDir, fileName) {
var file = templatesDir + '/' + fileName;
@hennk
hennk / Assetfile.rb
Created May 28, 2012 11:54
rake pipeline configuration, memory leak
APPNAME = 'liquid_editor'
require 'rake-pipeline-web-filters'
require File.join(File.dirname(__FILE__), 'support/ember_strip_debug_filter/ember_strip_debug_filter')
require File.join(File.dirname(__FILE__), 'support/precompiling_handlebars_filter/precompiling_handlebars_filter')
SHOULD_UGLIFY = ENV['RAKEP_MODE'] == 'production'
output (ENV['LIQUID_EDITOR_ASSETS_OUTPUT'] || 'assets')