Skip to content

Instantly share code, notes, and snippets.

@gabehollombe
gabehollombe / debug_log.coffee
Created March 8, 2012 12:56
Helpful CoffeeScript console debugging function
d = (s) -> o = {}; o[k] = eval(k) for k in s.split(' '); console.log JSON.stringify(o, null, ' ')
# Or, the compiled JavaScript:
d = function(s) {
var k, o, _i, _len, _ref;
o = {};
_ref = s.split(' ');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
k = _ref[_i];
@torgeir
torgeir / install_redis_on_ubuntu.md
Last active August 30, 2024 08:37 — forked from lucasmazza/script.md
Redis 2.4.8 Install on Ubuntu 10.04

Installation commands:

$ wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
$ tar xvfz redis-2.4.8.tar.gz 
$ cd redis-2.4.8/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ chown -R redis:redis /opt/redis
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@scottharvey
scottharvey / show_terminal
Created March 10, 2011 08:07
Apple script to bring Terminal to the front then switch back to TextMate
tell application "Terminal"
activate
end tell
tell application "TextMate"
activate
end tell
@scottharvey
scottharvey / refresh_firefox
Created March 10, 2011 08:07
Apple script to refresh firefox then switch back to TextMate
tell application "Firefox"
activate
end tell
tell application "System Events"
tell process "Firefox"
keystroke "r" using {command down}
end tell
end tell
# Output information
watch('config/routes.rb') { system("clear; rake routes")}
# Run migrations
# watch('^db/migrate/(.*)\.rb') { |m| check_migration(m[1]) }
# # Run SASS
# watch('^app/stylesheets/(.*\.sass)') { |m| check_sass(m[1]) }
# # Run specific tests
@mrdoob
mrdoob / RequestAnimationFrame.js
Created February 22, 2011 14:50
Provides requestAnimationFrame in a cross browser way.
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||
@mwotton
mwotton / gist:709304
Created November 21, 2010 23:51
stubbing new
require 'rspec'
class Bar
def baz
puts "baz called"
end
end
class Foo
def initialize
@juliocesar
juliocesar / testing_front_end_rspec_capybara.md
Created October 21, 2010 23:51
Testing front-end for a Sinatra app with RSpec and Capybara

Testing front-end for a Sinatra app with RSpec and Capybara

I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.

A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.

So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.

Gemfile