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 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
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
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
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
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
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 reduce = iterable => function* reducerable (fn, s0) { | |
let acc = s0 | |
for (const i of iterable) { | |
yield acc = fn(i, acc) | |
} | |
} | |
export default reduce |
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
/* | |
https://www.youtube.com/watch?v=k7-N8R0-KY4&list=PL0zVEGEvSaeEd9hlmCXrk5yUyqUag-n84 | |
@Gegeg | |
Could you do this with reduce? | |
*/ | |
const categories = [ | |
{ id: 'a', parent: '0'}, | |
{ id: 'b', parent: '0'}, | |
{ id: 'c', parent: 'a'}, |
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
async function* asyncAnimationFrame () { | |
const h = {} | |
h.promise = new Promise(r => h.resolve = r) | |
h.flipFrame = () => { | |
h.resolve() | |
h.promise = new Promise(r => h.resolve = r) | |
} | |
try { | |
while (true) { | |
h.idAF = requestAnimationFrame(h.flipFrame) |