This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Shows commits present only in one of the two branches. | |
import commands | |
import sys | |
def commits_in_branch(branch): | |
status, output = commands.getstatusoutput("git log --no-color --pretty=oneline %s" % branch) | |
return set(output.splitlines()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inside your beforeEach hook | |
spyOn(window, 'setTimeout').andCallFake(function(fn){ | |
fn.apply(null, [].slice.call(arguments, 2)); | |
return +new Date; | |
}); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns helloworld | |
(:gen-class) | |
(:use compojure.core | |
ring.adapter.jetty | |
clojure.contrib.command-line) | |
(:require [compojure.route :as route])) | |
(defroutes main-routes | |
(GET "/" [] "<h1>Hello World</h1>") | |
(route/not-found "<h1>Page not found</h1>")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debugPage = (page) => | |
console.log(page.evaluate -> window.location.toString()) | |
fs = require('fs') | |
fs.write('output.html', page.content, 'w') | |
page.render('output.png') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[david: compare]$ # at this point we have a stock rails app with no minitest tests and one pending rspec example | |
[david: compare]$ | |
[david: compare]$ time rake test | |
Run options: | |
# Running tests: | |
Finished tests in 0.030419s, 0.0000 tests/s, 0.0000 assertions/s. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% flash.each do |type, message| %> | |
<div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
<button class="close" data-dismiss="alert">×</button> | |
<%= message %> | |
</div> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.mixin({ | |
// ### _.objMap | |
// _.map for objects, keeps key/value associations | |
objMap: function (input, mapper, context) { | |
return _.reduce(input, function (obj, v, k) { | |
obj[k] = mapper.call(context, v, k, input); | |
return obj; | |
}, {}, context); | |
}, | |
// ### _.objFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# = require '../components/jquery/jquery' | |
# = require '../components/angular-complete/angular' | |
Controllers = angular.module 'controllers', [] | |
Controllers.controller 'PhoneListCtrl', ['$scope', ($scope)-> | |
$scope.phones = [ | |
{name: "Nexus S", snippet: "Fast just got faster with Nexus S."}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bootstrapAngular = -> | |
$('[ng-app]').each -> | |
module = $(this).attr('ng-app') | |
angular.bootstrap(this, [module]) | |
$(document).on('page:load', bootstrapAngular) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sentence = "there is a wild rose" | |
letters = sentence.gsub(' ','').split(//) |
OlderNewer