This file contains hidden or 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
| using System; | |
| public interface ISparrow | |
| { | |
| double GetAirspeed() => 1.0; | |
| } | |
| public class AfricanSparrow : ISparrow | |
| { | |
| public double GetAirspeed() => 2.0; |
This file contains hidden or 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
| // Autoclicker for Cookie Clicker, Cookie Clicker is at http://orteil.dashnet.org/cookieclicker/ | |
| // Run it in the debug console | |
| var clicky = function() { ($(".shimmer") || $("#bigCookie")).click(); setTimeout(clicky, 30); }; | |
| clicky(); |
This file contains hidden or 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
| Experiment code: | |
| var emitter = new Subject<string>(); | |
| var schedulers = new[] | |
| { | |
| new KeyValuePair<string, IScheduler>("EventLoop", new EventLoopScheduler()), | |
| new KeyValuePair<string, IScheduler>("RxApp.MainThreadScheduler", RxApp.MainThreadScheduler), | |
| new KeyValuePair<string, IScheduler>("RxApp.TaskpoolScheduler", RxApp.TaskpoolScheduler), | |
| }; |
This file contains hidden or 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
| <<someHypthoticalScriptCS command: inherit from GivenWhenThenFixture override Specify>> | |
| var someDllPath = arrange(() => GetPathOfBinDeployed("SomeTestLibrary.dll")); | |
| expect(() => File.Exists(someDllPath)); | |
| given("an AppDomain wrapper for a test DLL", delegate() | |
| { | |
| var appDomainWrapper = arrange(() => new AppDomainWrapper(someDllPath)); | |
This file contains hidden or 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 remix(recording, frameSwitches) { | |
| var keyRanges = []; | |
| var lastRecordingId = null; | |
| var lastTimeRange = Number.MIN_VALUE; | |
| frameSwitches.switches.forEach(function(frameSwitch) { | |
| if (lastRecordingId !== null) { |
This file contains hidden or 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.prototype.apply(thisArg[, argsArray]) | |
| Function.prototype.call(thisArg[, arg1[, arg2[, ...]]]) | |
| Q.nfcall(FS.readFile, "foo.txt", "utf-8"); | |
| Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]); | |
| Q.ninvoke(FS, "readFile", "foo.txt", "utf-8"); | |
| Q.npost(FS, "readFile", ["foo.txt", "utf-8"]); | |
| Q.nbind(FS.readFile, FS)("foo.txt", "utf-8"); |
This file contains hidden or 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 input = "e299a5205765204d616b652054756d6d792048617070792120e299a5" | |
| var output = new Buffer(input.length / 2); | |
| for(var i = 0; i < input.length / 2; i++) { | |
| output[i] = parseInt(input.slice(i*2, i*2 + 2), 16); | |
| } | |
| console.log(output.toString('utf8')); |
This file contains hidden or 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 FeedParser = require('feedparser'), request = require('request'), endpoint = require('endpoint'); | |
| function runOne(url) { | |
| console.log("starting " + url); | |
| request(url, function(error, response, body) { | |
| if (error !== null) { | |
| console.log("error A " + error); | |
| console.log("done with " + url); |
This file contains hidden or 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 = require("q"); | |
| var phantom=require('node-phantom'); | |
| function promisify(nodeAsyncFn, context, modifier) { | |
| return function() { | |
| var args = args = Array.prototype.slice.call(arguments); | |
| var defer = Q.defer() | |
| args.push(function(err, val) { |
This file contains hidden or 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
| // SinonJS's XHR support is great for unit testing code that makes | |
| // AJAX requests. But you can also use it to measure AJAX requests | |
| // made from production code if you insert the below code snippet. | |
| // full docs here: http://sinonjs.org/docs/#server | |
| sinon.useFakeXMLHttpRequest(); | |
| sinon.FakeXMLHttpRequest.useFilters = true; | |
| sinon.FakeXMLHttpRequest.addFilter(function (method, url, async, username, password) { |
NewerOlder