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
tiddlywiki ~/projects/flwiki --listen port=2999 |
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
const pattern = /[^\d.,-]|[.,]{2,}|(?<=.)-/; | |
console.log("1-1".match(pattern)); |
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
const a = { | |
CoolButton: { | |
fr: "Omelette du fromage", | |
en: "Black pudding" | |
}, | |
NotSoCoolButton: { | |
fr: "Une baguette", | |
en: "Apple pie" | |
} | |
}; |
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 decimalPlaces(value) { | |
const match = ("" + value).match(/(?:[,.](\d+))?(?:[eE]([+-]?\d+))?$/); | |
if (!match) { | |
return 0; | |
} | |
return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[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
export function* range(start, end = 0, step = 1) { | |
for (let value = start; value <= end; value += step) { | |
yield value; | |
} | |
} |
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
declare namespace Chai { | |
interface Assertion { | |
style(property: string, value?: any): Assertion; | |
} | |
} | |
declare module "chai-style" { | |
const chaiStyle: Chai.ChaiPlugin; | |
export = chaiStyle; | |
} |
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
$package = (Get-Content package.json) | ConvertFrom-Json | Select-Object -Property name,version | |
$versions = npm view $package.name versions | ConvertFrom-json | |
if ($versions[1] -split "`n" -contains $package.version) { | |
throw "Package $($package.name) already has version $($package.version) published" | |
} |
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 uniqueReducer(unique, item) { | |
return unique.includes(item) ? unique : [...unique, item]; | |
} | |
function mergeObjectsReducer(accumulator, current) { | |
return { | |
...accumulator, | |
...Object.keys(current) | |
.filter( | |
key => |
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
Start-Process "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ` | |
-ArgumentList "--remote-debugging-port=9222",` | |
"--enable-features=`"dns-over-https<DoHTrial`"",` | |
"--force-fieldtrials=`"DoHTrial/Group1`"",` | |
"--force-fieldtrial-params=`"DoHTrial.Group1:server/https%3A%2F%2F1.1.1.1%2Fdns-query/method/POST`"" |
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
import retry from "async-retry"; | |
const retryOptions = { | |
forever: true, | |
factor: 2 | |
}; | |
export default (url, options) => retry(async () => { | |
const response = await fetch(url, options); | |
if (response.status !== 200) { |