Skip to content

Instantly share code, notes, and snippets.

Verifying that +jessemiller is my openname (Bitcoin username). https://onename.com/jessemiller
@jessemiller
jessemiller / banana-populator.js
Created August 8, 2011 02:24
Fifth step of test-driven javascript
// Setup a namespace to use for all our classes, we just do this to avoid conflicts with other libraries
if (typeof tdd === "undefined") {
tdd = {};
}
tdd.BananaPopulator = Class.extend({
defaults: {
ajax: $.ajax
},
@jessemiller
jessemiller / banana-populator.js
Created August 8, 2011 02:07
Fourth step of test-driven javascript
test("After /bananas returns a json struct, banana-selector should be populated", function() {
var fakeBananaJson = [{id:5, color:"yellow"},{id:2, color:"green"}]
var fakeAjax = function( params ) {
params.success( fakeBananaJson );
}
var populator = new tdd.BananaPopulator({
ajax: fakeAjax
});
equal( $('#banana-selector option').length, 2, 'There should be 2 options on the banana selector' );
});
@jessemiller
jessemiller / banana-populator.js
Created August 8, 2011 01:49
Third step of test driven javascript
// Setup a namespace to use for all our classes, we just do this to avoid conflicts with other libraries
if (typeof tdd === "undefined") {
tdd = {};
}
tdd.BananaPopulator = Class.extend({
defaults: {
ajax: $.ajax
},
@jessemiller
jessemiller / additions-to-index.html
Created August 8, 2011 01:26
Second step of test-driven javascript
<!-- Testing pairs -->
<script type="text/javascript" src="banana-populator.js"></script>
<script type="text/javascript" src="../public/javascripts/banana-populator.js"></script>
@jessemiller
jessemiller / index.html
Created August 8, 2011 00:53
Initial index.html for test-driven javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Always Be Testing</title>
<link rel="stylesheet" href="qunit.css" type="text/css"/>
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="../public/javascripts/resig.js"></script>
</head>
@jessemiller
jessemiller / Questions
Created July 12, 2011 14:55
Magma Rails Give-away
Day Job:
Cofounder of Attachments.me
Open Source contribution (if any):
Wrote and maintain HamlPy, a Haml implmentation for Django.
Tell me about your experience with Ruby/Rails:
Our entire web frontend is written in Rails. I had always played with Ruby and Rails before Attachments.me but this was my first huge project with it. Really enjoying it.
How do you use GitHub:
class Account():
def __init__(self):
self.balance = 0
self.currency = 'CAD'
self.overdraft = False
def make_deposit(self, amount):
"""imagine a boat load of business logic that would make this useful"""
pass