Skip to content

Instantly share code, notes, and snippets.

View GraemeF's full-sized avatar

Graeme Foster GraemeF

View GitHub Profile
@GraemeF
GraemeF / Player.coffee
Created September 3, 2011 21:04
Jasmine example converted to CoffeeScript
class Player
play: (song) ->
@currentlyPlayingSong = song
@isPlaying = true
pause: ->
@isPlaying = false
resume: ->
throw new Error "song is already playing" if this.isPlaying
@GraemeF
GraemeF / Continuous-CoffeeScript.ps1
Created October 8, 2011 22:19 — forked from jfromaniello/continous-qunit.ps1
Continuously watches for .coffee file changes in a folder (and subfolders), and runs the CoffeeScript compiler against them
# watch a file changes in the current directory,
# compile when a .coffee file is changed or renamed
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = get-location
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $false
$watcher.NotifyFilter = [System.IO.NotifyFilters]::LastWrite -bor [System.IO.NotifyFilters]::FileName
while($TRUE){
@GraemeF
GraemeF / TypedFactoryTests.cs
Created November 11, 2011 11:51
Test to show that the DefaultTypedFactoryComponentSelector doesn't match parameters on dependencies of the returned type.
namespace TypedFactoryTests
{
#region Using Directives
using Castle.Facilities.TypedFactory;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Should.Fluent;
@GraemeF
GraemeF / gist:1381916
Created November 21, 2011 07:24
PowerShell script to keep running builds when stuff changes
Import-Module pswatch
Function Rebuild($message)
{
cls
Write-Host $message
Invoke-psake .\build.ps1
}
Rebuild "Starting up."
@GraemeF
GraemeF / gist:1401254
Created November 28, 2011 17:43
vows-bdd
{Feature} = require "vows-bdd"
vows = require 'vows'
assert = require 'assert'
Feature("Share stuff between steps", module)
.scenario("Set properties on given and when")
.given "A is set", ->
@A = "A"
@callback()
Feature("Character management", module)
.scenario("Create a new character")
.given(Events.Named_AreSubscribedTo "characterCreated")
.when(Character._IsCreatedWithName_ 1, 'bob')
.then(Events.ShouldDescribeTheCreationOfCharacter_Named_ 1, 'bob')
.complete()
@GraemeF
GraemeF / BrokenKnockout.html
Created December 21, 2011 18:45 — forked from garyshort/BrokenKnockout.html
Broken Knockout
<html>
<body>
<form data-bind="submit: onSubmit">
<button type="submit">Submit</button>
</form>
<script type="text/javascript" src="knockout-2.0.0.js"></script>
<script type="text/javascript">
window.onload = function () {
@GraemeF
GraemeF / x.html
Created January 2, 2012 20:47
Hello world
<p>Name: <input data-bind="value: name"/></p>
<h2>Hello, <span data-bind="text: name"> </span>!</h2>
@GraemeF
GraemeF / foo-spec.js
Created January 29, 2012 08:34
requireWithDeps
var requireWithDeps = require('./requireWithDeps');
var sinon = require('sinon');
var fakejQuery = {
doSomething: sinon.stub()
};
var Foo = requireWithDeps('./Foo.js', {'jquery': fakejQuery});
var fooToTest = new Foo();
@GraemeF
GraemeF / gist:2208386
Created March 26, 2012 18:17
Error starting cassandra in vagrant
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
[default] Generating chef JSON and uploading...
[default] Running chef-solo...
stdin: is not a tty
[Mon, 26 Mar 2012 11:15:51 -0700] INFO: *** Chef 0.10.2 ***
[Mon, 26 Mar 2012 11:15:52 -0700] INFO: Setting the run_list to ["recipe[cassandra::default]"] from JSON
[Mon, 26 Mar 2012 11:15:52 -0700] INFO: Run List is [recipe[cassandra::default]]