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:
<div id="tagme" style="height:500px;width:500px;background-color:#DDF"></div> |
/* | |
Copyright (C) 2013 Sam Greenhalgh - RadicalResearch Ltd | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH TH |
// Only executes the most recent call after the specified timeout. | |
function Debouncer() { | |
var timeout; | |
this.execute = function(callback, wait) { | |
if (timeout) { | |
clearTimeout(timeout); | |
timeout = null; | |
} |
Object.extend = function(toObj, fromObj){ | |
var p = Object.getOwnPropertyNames(fromObj), | |
i = p.length; | |
while(i--) | |
{ | |
Object.defineProperty(toObj, p[i], Object.getOwnPropertyDescriptor(fromObj, p[i])); | |
} | |
}; |
<!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`); |
console.log('bookmarklet'); |