Skip to content

Instantly share code, notes, and snippets.

Thedric Walker tlwalker

Block or report user

Report or block tlwalker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tlwalker
tlwalker / closure.js
Created Apr 23, 2013
Envoy in Javascript - Closure
View closure.js
var withdraw = function (){
var balance = 100;
return function (amount) {
if(amount <= balance){
balance = balance - amount;
} else {
throw new Error('Insufficient funds');
}
}
@tlwalker
tlwalker / funcAsObject.js
Created Apr 23, 2013
Envoy in Javascript - Function as Object
View funcAsObject.js
var balance = 0;
var withdraw = function (amount){
if(balance >= amount){
balance = balance - amount;
} else {
throw new Error('Insufficient funds')
}
}
var deposit = function (amount) {
@tlwalker
tlwalker / robot.js
Created Dec 7, 2012 — forked from f6p/robot.js
NecroBadger
View robot.js
// helpers
function areEnemies(robot, sighted) {
var sightedIsChild = (robot.id == sighted.parentId);
var sightedIsParent = (robot.parentId == sighted.id);
return !(sightedIsChild || sightedIsParent);
};
function baseStep(robot) {
View jsquiz_q14.js
(function getData(){
setTimeout(function(){
$.get('http://javascriptquiz.com/api/q14', function(response) {
//logic is not important to the demo
});
getData();
}, 30000);
})();
@tlwalker
tlwalker / program.fs
Created Jan 20, 2011
iterator block gotcha sample code - F# equivalent
View program.fs
// Learn more about F# at http://fsharp.net
open System
let showMemory( msg : string) =
let memory = GC.GetTotalMemory(true)
Console.WriteLine("{0, -30} {1}", msg + ":", memory)
let main ()=
let source = seq {0 .. 1000000}
let query = Seq.distinct source
You can’t perform that action at this time.