Skip to content

Instantly share code, notes, and snippets.

View MarkBennett's full-sized avatar

Mark Bennett MarkBennett

View GitHub Profile
@MarkBennett
MarkBennett / DESCRIPTION.md
Created September 22, 2012 18:29
Failing to import Go packages

I've just installed Go from the package on the golang site.

When trying to build (or run) import getting an import error, but can't figure out why:

go build world2.go

This produces the error:

# world2.go:3:8: import "world": cannot find package
@MarkBennett
MarkBennett / ruby-closure-confusion.rb
Created August 17, 2012 02:26
How do Ruby closures work?
greeting = "Hello"
def greeter
puts greeting
end
greeter
# undefined local variable or method `greeting' for main:Object (NameError)
@MarkBennett
MarkBennett / README.markdown
Created April 17, 2012 23:06
Five things you didn't know about Bundler
@MarkBennett
MarkBennett / Staging job
Created April 6, 2012 19:01
Failing specs
Started by user MarkBennett
Building in workspace /var/lib/jenkins/jobs/proj1/workspace
Checkout:workspace / /var/lib/jenkins/jobs/proj1/workspace - hudson.remoting.LocalChannel@5c57b13a
Using strategy: Default
Last Built Revision: Revision 5a57496f7256cdaad9b9a227cb1e16c6df12855c (origin/master)
Checkout:workspace / /var/lib/jenkins/jobs/proj1/workspace - hudson.remoting.LocalChannel@5c57b13a
Fetching changes from 1 remote Git repository
Fetching upstream changes from [email protected]:burmis/proj1.git
Commencing build of Revision 5a57496f7256cdaad9b9a227cb1e16c6df12855c (origin/master)
Checking out Revision 5a57496f7256cdaad9b9a227cb1e16c6df12855c (origin/master)
@MarkBennett
MarkBennett / fiddle.html
Created January 25, 2012 21:01
HTML5 Photobooth
<html>
<head>
<title>HTML5 Photo Booth</title>
</head>
<body>
<h2>HTML5 Photo Booth</h2>
<video id="live" autoplay></video>
<canvas id="snapshot" style="display:none"></canvas>
@MarkBennett
MarkBennett / LICENSE
Created January 17, 2012 21:44
Debugging JavaScript In the Trenches
Copyright (C) 2012 Mark Bennett, Paul Irish, Aicke Schulz
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@MarkBennett
MarkBennett / funtional_bam.py
Created December 9, 2011 22:56
Python functional programming
import unittest
class MyTestCase(unittest.TestCase):
@classmethod
def make_an_example_of(cls, example_name, example):
def example_test_template(self):
self.assertEqual(stuff, example)
setattr(cls, "test_an_example_of_%s" %(example_name), example_test_template)
MyTestCase.make_an_example_of("Bob")
@MarkBennett
MarkBennett / gist:1380524
Created November 20, 2011 17:18
Failing tests
/Users/mark/.rvm/gems/ree-1.8.7-2011.03@yardstick/gems/activerecord-2.3.14/lib/active_record/associations/association_proxy.rb:215: warning: default `to_a' will be obsolete
/Users/mark/.rvm/gems/ree-1.8.7-2011.03@yardstick/gems/activerecord-2.3.14/lib/active_record/associations/association_proxy.rb:215: warning: default `to_a' will be obsolete
FAIL SittingTest#test: with a cancellation deadline should be able to unbook the day of. (0.42s)
Failed assertion, no message given.
/Users/mark/.rvm/gems/ree-1.8.7-2011.03@yardstick/gems/minitest-2.6.2/lib/minitest/unit.rb:179:in `assert'
/Users/mark/versioned/yardstick/test/unit/sitting_test.rb:496:in `__bind_1321809344_83389'
/Users/mark/.rvm/gems/ree-1.8.7-2011.03@yardstick/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/mark/.rvm/gems/ree-1.8.7-2011.03@yardstick/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `test: with a cancellation deadline should be able to unbook the day of. '
/Users/mark/.rvm/gems/ree-1.8.7-2011.03@yardstick/ge
@MarkBennett
MarkBennett / Item.rb
Created August 23, 2011 13:19
Implementing ActiveRecord named scopes with a module
class Item < ActiveRecord::Base
extend SpecialScopes
end
@MarkBennett
MarkBennett / api.js
Created August 15, 2011 17:58 — forked from aaronpowell/api.js
Q6 - What's old is new
var Person = function(name) {
var global = (function() { return this; })();
if (this === global) { return new Person(name); }
this.name = name;
};
Person.prototype.sayHello = function() {
console.log('Hello, my name is ' + this.name);
};