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
<?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="" /> |
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 withdraw = function (){ | |
var balance = 100; | |
return function (amount) { | |
if(amount <= balance){ | |
balance = balance - amount; | |
} else { | |
throw new Error('Insufficient funds'); | |
} | |
} |
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 balance = 0; | |
var withdraw = function (amount){ | |
if(balance >= amount){ | |
balance = balance - amount; | |
} else { | |
throw new Error('Insufficient funds') | |
} | |
} | |
var deposit = function (amount) { |
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
// helpers | |
function areEnemies(robot, sighted) { | |
var sightedIsChild = (robot.id == sighted.parentId); | |
var sightedIsParent = (robot.parentId == sighted.id); | |
return !(sightedIsChild || sightedIsParent); | |
}; | |
function baseStep(robot) { |
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
(function getData(){ | |
setTimeout(function(){ | |
$.get('http://javascriptquiz.com/api/q14', function(response) { | |
//logic is not important to the demo | |
}); | |
getData(); | |
}, 30000); | |
})(); |
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
// 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 |