I hereby claim:
- I am zapthedingbat on github.
- I am zapthedingbat (https://keybase.io/zapthedingbat) on keybase.
- I have a public key whose fingerprint is 560A 68F0 73EF 2F76 AE8C 014F 35C4 4D58 1084 3365
To claim this, I am signing this object:
| function onceMore(f) { | |
| var isWorking = false, | |
| isWaiting = false; | |
| function execute() { | |
| isWaiting = false; | |
| isWorking = true; | |
| f().then(complete); | |
| } |
| // NOTE: There is a bug in NServiceBus where registered callbacks that are not invoked remain in a static dictionary. | |
| var asyncResult = _bus.Send(message).Register(ar => { }, null); | |
| if (!asyncResult.AsyncWaitHandle.WaitOne(_timeout)) | |
| { | |
| // Signal the async result so callback threads don't remain blocked | |
| ((EventWaitHandle)asyncResult.AsyncWaitHandle).Set(); | |
| throw new OperationCanceledException(); | |
| } |
| public static class Has | |
| { | |
| public static IResolveConstraint Attribute<T>() where T : class | |
| { | |
| return new Constraints.AttributeConstraint<T>(new Dictionary<string, object>(), new object[0]); | |
| } | |
| public static IResolveConstraint Attribute<T>(IDictionary<string, object> namedConstructorArguments, params object[] constructorArguments) where T : class | |
| { | |
| return new Constraints.AttributeConstraint<T>(namedConstructorArguments, constructorArguments); |
| // Unpatch.js | |
| // Sam Greenhalgh | |
| // http://RadicalResearch.co.uk/ | |
| // Example usage | |
| // window.console.log = unpatch(window.console.log); | |
| function unpatch(method) { | |
| var _ = Function.prototype.apply; | |
| var r; |
| Function.prototype.extends=function(base){ | |
| var t = function () {} | |
| t.prototype = base.prototype; | |
| this.prototype = new t(); | |
| this.prototype.constructor = this; | |
| }; | |
| var Animal = function(){ | |
| this.isAlive = true; | |
| } |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script> | |
| window.addEventListener('unload', function(){ | |
| var origionalUrl = location.href; | |
| var newUrl = origionalUrl.replace('#.*$', '') + '#nope'; | |
| console.log('cancel navigation', newUrl); | |
| window.location.replace(newUrl); | |
| window.location.replace(origionalUrl); |
I hereby claim:
To claim this, I am signing this object:
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Text; | |
| namespace ZapTheDingbat.IO | |
| { | |
| public class CsvReader : IEnumerable<IReadOnlyList<string>>, IEnumerator<IReadOnlyList<string>> |
| const runs = 10; | |
| function run(method, runIndex) { | |
| console.time(`run ${runIndex}`); | |
| return method().then(() => { | |
| console.timeEnd(`run ${runIndex}`); | |
| if (runIndex < runs){ | |
| return run(method, runIndex+1); | |
| } | |
| }); |
| //https://en.wikipedia.org/wiki/Birthday_problem#Calculating_the_probability | |
| function p(n){ | |
| let a = 1; | |
| for(let i = 0; i < n; i++){ | |
| a *= ((365 - i) / 365); | |
| } | |
| return 1 - a; | |
| } | |
| const chance = p(parseInt(process.argv.pop())) * 100; | |
| console.log(`There is a ${chance}% chance of two people in the same team sharing the same birthday`); |