This file contains 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
#!/usr/bin/env node | |
var fs = require("fs"); | |
const readJson = (path) => { | |
let raw = fs.readFileSync(path) | |
try { | |
return JSON.parse(raw) | |
} catch (error) { | |
return {} | |
} |
This file contains 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 subsetSum(arr, val, i = 0) { | |
let r = [] | |
while (i < arr.length) { | |
let v = arr[i] | |
if (v == val) | |
r.push(v) | |
if (v < val) | |
subsetSum(arr, val - v, i + 1).forEach((item) => { | |
r.push(v + ',' + item) | |
}) |
This file contains 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
javascript:!function(a){var b="aeiouyåäö",c="bcdfghjklmnpqrstvwxyz",d=new RegExp("["+c+b+"]+","gi"),e=new RegExp("(["+c+"]*["+b+"]*[j]?)(.*)","i");for(w=a.createTreeWalker(a.body,NodeFilter.SHOW_TEXT,null,!1);n=w.nextNode();)n.nodeValue=n.nodeValue.replace(d,function(a){return(match=a.toLowerCase().match(e))?"fi"+match[2]+" "+match[1]+"kon":a})}(document); |