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
(defn average | |
[numbers] | |
(if (empty? numbers) | |
0 | |
(/ (reduce + numbers) (count numbers)))) |
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
function Scope() { | |
var self = this; | |
self.$$watchers = []; | |
self.$watch = function(watcherFn, listenerFn) { | |
self.$$watchers.push({ | |
watcherFn: watcherFn, | |
listenerFn: listenerFn | |
}); |
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
App = (function() { | |
var bindings = {}; | |
return { | |
make: make, | |
bind: bind | |
}; | |
function bind(type, object) { | |
bindings[type] = object; |
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
Locate the section for your github remote in the `.git/config` file. It looks like this: | |
``` | |
[remote "origin"] | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
url = git@github.com:joyent/node.git | |
``` | |
Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: |
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
Array.prototype.filter = function(callback) { | |
var result = []; | |
var length = this.length; | |
for (var i = 0; i < length; i++) { | |
if (callback(this[i])) { | |
result.push(this[i]); | |
} | |
} |
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
<?php | |
/** | |
* SplClassLoader implementation that implements the technical interoperability | |
* standards for PHP 5.3 namespaces and class names. | |
* | |
* http://groups.google.com/group/php-standards/web/final-proposal | |
* | |
* // Example which loads classes for the Doctrine Common package in the | |
* // Doctrine\Common namespace. |
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 'sinatra' | |
require 'uri' | |
require 'mongo_mapper' | |
mongo_url = ENV['MONGOHQ_URL'] || 'mongodb://localhost/dbname' | |
MongoMapper.connection = Mongo::Connection.from_uri mongo_url | |
MongoMapper.database = URI.parse(mongo_url).path.gsub(/^\//, '') #Extracts 'dbname' from the uri |