Skip to content

Instantly share code, notes, and snippets.

View mneedham's full-sized avatar

Mark Needham mneedham

View GitHub Profile
public string SomeMethod(int value)
{
return (value + 2).ToString();
}
public string SomeMethod2(int value)
{
return (value + 3).ToString();
}
Number.prototype.times = function(f) {
for(var i =0; i < this; ++i) {
f();
}
return this;
};
10.times(function() { console.log("mark"); });
> SyntaxError: missing ; before statement
Playing with some code to understand overriding.
This works:
function Foo() {}
Foo.prototype = {
bar : function() {
console.log("original bar");
}
}
Array.prototype.foldLeft = function(seed, f) {
var accumulation = seed;
for(var i=0; i < this.length; ++i) {
accumulation = f(accumulation, this[i]);
}
return accumulation;
}
Number.prototype.times = function(f) {
Screw.Unit(function() {
describe("bowling game scorecard", function() {
var bowlingGame;
before(function() {
bowlingGame = new BowlingGame();
});
function gutterBall() {
bowlingGame.roll(0);
mneedham@markneedham.local ~/SandBox$ ssh -v mneedham@github.com
OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/mneedham/.ssh/identity type -1
debug1: identity file /Users/mneedham/.ssh/id_rsa type 1
debug1: identity file /Users/mneedham/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
mneedham@markneedham.local ~/SandBox$ ssh -v git@github.com
OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/mneedham/.ssh/identity type -1
debug1: identity file /Users/mneedham/.ssh/id_rsa type 1
debug1: identity file /Users/mneedham/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: channel 0: free: client-session, nchannels 1
Read from remote host github.com: Operation timed out
Connection to github.com closed.
Transferred: sent 2832, received 2616 bytes, in 511.7 seconds
Bytes per second: sent 5.5, received 5.1
debug1: Exit status -1
mneedham@markneedham.local ~/SandBox$ touch /tmp/blank-config; ssh -v -f /tmp/blank-config -i ~/.ssh/id_rsa git@github.com
OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
ssh: Could not resolve hostname /tmp/blank-config: nodename nor servname provided, or not known
mneedham@markneedham.local ~/SandBox$ touch /tmp/blank-config; ssh -v -F /tmp/blank-config -i ~/.ssh/id_rsa git@github.com
OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /tmp/blank-config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/mneedham/.ssh/id_rsa type 1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1