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 delay = (delta) => | |
new Promise((resolve, reject) => { | |
setTimeout(() => resolve(), delta) | |
}) | |
const d1 = delay(300).then(() => { | |
console.log('1') | |
return delay(300) | |
}) |
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 { Telegraf } = require("telegraf"); | |
const mk_bot = (dao, secretPath, hostname, botToken) => { | |
const bot = new Telegraf(botToken); | |
bot.telegram.setWebhook(`https://${hostname}/${secretPath}`); | |
bot.start(async ctx => { | |
ctx.reply(`Olá ${ctx.from.username}, eu sou um caixa eletrônico`) | |
}); |
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://t.me/javascriptbrasil/284366 | |
alert("Responda as próximas perguntas com um número" | |
" ou com a letra maiúscula X uma única vez") | |
const na = prompt("valor n(A)") | |
const nb = prompt("valor n(B)"); | |
const nc = prompt("valor n(C)"); | |
const nab = prompt("valor n(A^B)"); | |
const nac = prompt("valor n(A^C)"); | |
const nbc = prompt("valor n(B^C)"); |
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 arrayzao = [ | |
'a', | |
'e', | |
'i', | |
'o', | |
'u', | |
'æ' | |
] | |
const delay = x => new Promise(res => { |
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
import { s10000 } from '@iswa/svgojs' | |
console.log(s10000) | |
// npm install | |
// npm start |
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
type Dois = { tipo: 'Dois' } | |
type Cinco = { tipo: 'Cinco' } | |
type Dez = { tipo: 'Dez' } | |
type Vinte = { tipo: 'Vinte' } | |
type Cinquenta = { tipo: 'Cinquenta' } | |
type Cem = { tipo: 'Cem' } | |
export type Cedulas = Dois | Cinco | Dez | Vinte | Cinquenta | Cem | |
type CedulasTipo = Cedulas['tipo'] |
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
module.exports = { | |
name: "produto", | |
actions: { | |
criarNovo: { | |
cache: false, | |
$$strict: true, | |
params: { | |
nome: { | |
type: "string", | |
min: 8, |
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})`, |
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 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 |