When running tests in wallaby the setTimeout[util.promisify.custom] property is missing, which causes util.promisify to fail.
Running this gist with the command line npm test will result in a passing test.
| function getTermKey(term) { | |
| return term | |
| .normalize('NFD') | |
| .replace(/[\u0300-\u036f]/g, "") | |
| .replace(/[^\w]/g, "") | |
| .toLowerCase() | |
| }; | |
| function getTermsIn(document) { | |
| return document.split(/[\s_():.!?,;]+/) |
When running tests in wallaby the setTimeout[util.promisify.custom] property is missing, which causes util.promisify to fail.
Running this gist with the command line npm test will result in a passing test.
| Array.from(s.split(/\W+/) | |
| .map(a => a.toLowerCase()) | |
| .reduce((p, v) => p.set(v, (p.has(v)?p.get(v):0)+1), new Map()) | |
| .entries() | |
| ) | |
| .sort((a,b) => b[1]-a[1]) | |
| .forEach(a => console.log(`${a[0]}:${a[1]}`)); |
| <html> | |
| <head> | |
| <style> | |
| em:before, | |
| em:after{ | |
| content: " "; | |
| display: block; | |
| top:0; | |
| bottom: 0; |
| console.log('bookmarklet'); |
| //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`); |
| 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); | |
| } | |
| }); |
| 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>> |
I hereby claim:
To claim this, I am signing this object:
| <!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); |