Michael's bibliography has moved to a repo. Find the new version here: https://github.com/mgroeneman/bibliography
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
var Q = function(f, g){ | |
return function(x, y){ | |
return f(x, y) > g(x, y) | |
} | |
} | |
var addition = function(a, b) { return a + b } | |
var subtraction = function(a, b) { return a - b } | |
var isAddingGreaterThanSubtracting = Q(addition, subtraction) | |
var result = isAddingGreaterThanSubtracting(1, 2) |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
class Hash | |
def mega_map(key_transform, value_transform) | |
new_keys = keys.map(&key_transform) | |
new_values = values.map(&value_transform) | |
Hash[new_keys.zip(new_values)] | |
end | |
end | |
hash = {"succeeded"=>"node2", "flagged"=>"node3"} | |
transform = ->(v){v.to_sym} |
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
it "guards against stale objects by checking a fresh instance before creating a duplciate account" do | |
@d = Dummy.create | |
# Hey, I somehow have an extra instance of this object! | |
@d2 = Dummy.find(@d.id) | |
# And I set up an account by calling from my original instance | |
d1s_account = @d.account(AC_AR) | |
# My original instance got the account back and stored it just fine | |
d1s_account.id.should_not be_nil | |
@d.account_id(AC_AR).should eq(d1s_account) | |
# If I create a new instance now, it'll have the account ID as we expect |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type='text/javascript' src='http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js'></script> | |
<script type="text/javascript"> | |
function viewModel() { | |
var self=this; | |
this.someText = ko.observable('I am a string'); | |
this.observableBoolean = ko.observable(false); | |
}; |