Skip to content

Instantly share code, notes, and snippets.

@erithmetic
erithmetic / cuke
Created February 3, 2010 15:52
cuke - a command line script for running Cucumber features tagged with @dev
#!/bin/sh
cucumber --tags @dev
@erithmetic
erithmetic / git-hub-diff
Created February 4, 2010 14:12
git hub-diff - a command line utility for generating diffs on github
#!/usr/bin/env ruby
#
# Usage:
# cd /git/project/directory
# git hub-diff 223d60f5486075e74851075fcfeb366d45c17d8b 13c86f00cbfe820c415b46bfd19268284db2a274
# Future features:
# * generate SHAs from refs
# * launchy support
require 'rubygems'
315 rvm gemset create passenger
316 rvm use 1.8.7@passenger
318 gem install rails --no-rdoc --no-ri
319 rake gems:install
...
365 rvm list
366 rvm gemset list
367 rvm 1.8.7@passenger
368 gem install rails --version 2.3.5 --no-rdoc --no-ri
369 rake gems:install
<?php
# flickr.php
public function photos() {
return ($this->_photos) ?
$this->_photos :
$this->_photos = $this->flickr()->
groups_pools_getPhotos('1362691@N20', NULL, NULL, NULL, $this->num(), 1);
}

Ruby Intro

Ruby is a program

It takes ruby code as input and runs it. => Interpreted => No compiling(*)

Other programs

  • irb
@erithmetic
erithmetic / gist:921779
Created April 15, 2011 14:22
OOP Events
// Here's the code I'm working with now:
Careplane = function() {};
Careplane.prototype.onPageLoad = function(ev) {
if(this.firstRun)
this.firstRun();
this.doc = ev.originalTarget;
this.chooseAndLoadDriver();
};
var zombie = require("zombie");
var assert = require("assert");
zombie.visit("http://www.orbitz.com/", function (err, browser, status) {
console.log(browser.window.location.href);
console.log(browser.html());
browser.
clickLink('#flightsTab', function(error, browser) {
browser.
fill("airOrigin", "DTW").
info: here is my response
info: {"timeframe":"2011-01-01/2012-01-01","emission":867.7579402033563, ... }
info: undefined
@erithmetic
erithmetic / git-amend
Created October 26, 2011 19:29
git amend
#!/bin/bash
if [ "$1" == "" ]
then
msg=`git log -n 1 --format=oneline | sed 's/^[0-9a-f]*[ ]//'`
else
msg="$1"
fi
git commit -m "$msg" --amend
Started
E
Finished in 1.012821 seconds.
1) Error:
test_0001_underscored_version_of_your_it_statement(CamelizedDescription):
MockExpectationError: expected create, {:retval=>nil, :args=>["foo", "bar", {}]}
test/my_test.rb:25:in `block (2 levels) in <main>'
1 tests, 0 assertions, 0 failures, 1 errors, 0 skips