Skip to content

Instantly share code, notes, and snippets.

Avatar

Rajan Agaskar ragaskar

View GitHub Profile
@ragaskar
ragaskar / spec_helper.js
Created Nov 3, 2011
Fuzzy output matcher (untested)
View spec_helper.js
beforeEach(function() {
this.addMatchers({
toEqualSomethingIn : function toEqualSomethingIn(possibleOutputs) {
this.message = function() {
return [
"Expected " + this.actual + " to be one of the following: "+ possibleOutputs,
"Expected " + this.actual + " not to be one of the following: "+ possibleOutputs + ", but it was"
];
};
return (possibleOutputs.indexOf(this.actual) != -1)
View gist:1156753
/*
We have two classes: resultRenderer and dbQuery
resultRenderer will ask dbQuery to perform a database query, and asyncronously receives the results
*/
function resultRenderer(query) { this._query = query }
resultRenderer.prototype = {
queryResultsAndRender: function () {
this._query.runQueryAsync(this.renderResults.bind(this));
@ragaskar
ragaskar / show-branch-info
Created Aug 5, 2011
Show Remote Branch info
View show-branch-info
#!/bin/sh
for k in `git branch -r|awk '{print $1}'`;do echo `git show --pretty=format:"%Cgreen%ci %Cblue%cr %Cred%cn %Creset" $k|head -n 1`\\t$k;done|sort -r
echo "If you're unable to remove a branch, it may already be gone from the remote. Try git remote prune origin (git remote prune --dry-run origin) to see what remote branch references will be deleted"
@ragaskar
ragaskar / spec.rake
Created Jul 2, 2011
Kill spork when running rake spec (place in lib/tasks)
View spec.rake
task :kill_spork do
spork_processes = `ps aux | grep spork | egrep -v grep | awk '{print $2}'`.split("\n")
spork_processes.each do |process|
system("kill #{process}")
end
end
task :spec => [:kill_spork, :cucumber]
@ragaskar
ragaskar / GameSpec.js
Created Jun 30, 2011 — forked from infews/BasketballSpec.js
Refactored Baseketball and Football specs
View GameSpec.js
describe("games", function() {
subject("game", function() { game });
describe("Basketball Game", function() {
given(game, function() { new BasketballGame(); });
its("fieldGoal.points", function() { expect.toEqual(2); });
})
describe("Football Game", function() {
given(game, function() { new FootballGame(); });
its("fieldGoal.points", function() { expect.toEqual(3); });
});
You can’t perform that action at this time.