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
const fs = require('fs') | |
const crypto = require('crypto') | |
const path2hash = p => crypto.createHash('sha256').update(p).digest('base64') | |
const basedir = process.argv.length > 2 ? process.argv[2] : process.env.PWD | |
const printout = x => process.stdout.write(x) | |
let csv = '\"hash\"\t\"path\"\t\"name\"' |
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
const multiFilter = arr => filters => Object.entries(filters).reduce( | |
(a, b) => a.filter( | |
e => e[b[0]] === b[1] | |
), arr) | |
var filtros = { | |
"at1": 1, | |
"at2": "dois" | |
} |
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
var e = [ | |
[["0a"],["0e"],["0i"],["0o"],["0u"]], | |
[["1a"],["1e"],["1i"],["1o"],["1u"]], | |
[["2a"],["2e"],["2i"],["2o"],["2u"]], | |
[["3a"],["3e"],["3i"],["3o"],["3u"]], | |
[["4a"],["4e"],["4i"],["4o"],["4u"]] | |
] | |
const yZip = e.reduce((a, b, i) => { | |
lst = a.slice(-1)[0] |
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
var alturas = [] | |
var nomes = [] | |
var menor = 0 | |
var i | |
for (i = 0; i < 3; i++) { | |
nomes.push(prompt("nome da " + (i + 1) + "º pessoa")) | |
alturas.push(prompt("qual a altuda da " + nomes[i] + "?")) | |
document.write("<p>" + nomes[i] + " tem " + alturas[i] + "cm de altura.</p>") | |
if (alturas[i] < alturas[menor]) { |
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
let i = 0 | |
self.addEventListener('install', console.dir) | |
// https://developer.mozilla.org/en-US/docs/Web/API/Clients/claim | |
self.addEventListener('activate', e => { | |
console.dir(e) | |
e.waitUntil(clients.claim()) | |
}) | |
// https://bugs.chromium.org/p/chromium/issues/detail?id=823392 |
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
const mockFetch = url => new Promise( | |
res => setTimeout( | |
x => res(`url:${url} mockFetched`) | |
, 300 | |
) | |
) | |
var arr = ["a", "e", "i", "o", "u"] | |
const serial_____Gen = fn => async function* serial (arr) { |
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
#include <stdio.h> | |
#include <stdlib.h> | |
void main() { | |
int* vet = NULL; | |
int i = 0; | |
int soma = 0; | |
vet = (int*) malloc (1 * sizeof(int)); | |
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
const partitions = arr => arr.reduce((map, obj) => Object.keys(obj).reduce((map, key) =>{ | |
if (map.has(key)) { | |
map.set(key, map.get(key) + 1) | |
} else { | |
map.set(key, 1) | |
} | |
return map | |
}, map), new Map()) | |
export default partitions |
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
var vogal = ['a', 'e', 'i', 'o', 'u'] | |
var impar = ['1', '3', '5', '7', '9'] | |
var par = ['0', '2', '4', '6', '8'] | |
var range = [par, vogal, impar] | |
function* combi(range) { | |
const total = range.reduce((a, b) => a * b.length, 1) - 1 | |
let idx = range.map(arr => 0) | |
lasti = idx.length - 1 |
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
const P = f => { | |
const LazyRight = h => ({ | |
map: f => LazyRight(() => f(h())), | |
then: (f, g) => g(h()), | |
toString: () => `Resolve(${h})`, | |
}) | |
const LazyLeft = h => ({ | |
map: f => LazyLeft(h), | |
then: (f, g) => f(h()), | |
toString: () => `Reject(${h})`, |