Skip to content

Instantly share code, notes, and snippets.

@tlwalker
tlwalker / Custom.4.0.binds
Last active May 19, 2021 20:32
E:D Odyssey keybinds
<?xml version="1.0" encoding="UTF-8" ?>
<Root PresetName="Custom" MajorVersion="4" MinorVersion="0">
<KeyboardLayout>en-US</KeyboardLayout>
<MouseXMode Value="" />
<MouseXDecay Value="0" />
<MouseYMode Value="" />
<MouseYDecay Value="0" />
<MouseReset>
<Primary Device="{NoDevice}" Key="" />
<Secondary Device="{NoDevice}" Key="" />
@tlwalker
tlwalker / closure.js
Created April 23, 2013 17:05
Envoy in Javascript - Closure
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 April 23, 2013 15:53
Envoy in Javascript - Function as Object
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 December 7, 2012 06:05 — forked from f6p/robot.js
NecroBadger
// helpers
function areEnemies(robot, sighted) {
var sightedIsChild = (robot.id == sighted.parentId);
var sightedIsParent = (robot.parentId == sighted.id);
return !(sightedIsChild || sightedIsParent);
};
function baseStep(robot) {
(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 January 20, 2011 19:11
iterator block gotcha sample code - F# equivalent
// 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