NodeBR 2026 | ~30-35 min | @1cadumagalhaes
O repositório: github.com/1cadumagalhaes/nodebr-streams — branch review/streaming-benchmark
De quantas formas diferentes você consegue resolver um mesmo problema? Começando com um simples: dado um determinado número, diga se ele é ímpar.
Regras:
I hereby claim:
To claim this, I am signing this object:
| #!/bin/zsh | |
| function create_venv() { | |
| if [ $# -eq 0 ]; then | |
| echo "Please provide the name of the virtual environment to create" | |
| return 1 | |
| fi | |
| venv_name="$1" | |
| venv_dir="$HOME/.venvs" | |
| if [ $# -eq 2 ]; then |
| function generateArray(numbers = 60) { | |
| return Array.from({ length: 60 }, (_, i) => i + 1) | |
| } | |
| function shuffleArray(array) { | |
| for (let i = array.length - 1; i > 0; i--) { | |
| const j = Math.floor(Math.random() * (i + 1)); | |
| const temp = array[i]; | |
| array[i] = array[j]; | |
| array[j] = temp; |
| _PIP_ADDITIONAL_REQUIREMENTS=dbt-core dbt-bigquery |
| # Copyright 2022 DP6 | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| { | |
| "$schema": "", | |
| "title": "Schema example", | |
| "array": { | |
| "$id": "#/properties/schema", | |
| "type": "array", | |
| "items": [ | |
| { | |
| "type": "object", | |
| "properties": { |
| const fs = require('fs'); | |
| const readline = require('readline'); | |
| async function processLineByLine(input, output='output.csv', callback) { | |
| let lineCount = 0; | |
| try { | |
| const fileStream = fs.createReadStream(input); | |
| const outstream = fs.createWriteStream(output); | |
| const rl = readline.createInterface({ |
Para executar:
node sorteio -s=[sorteios] -n=[numeros] -min=[minimo] -max=[maximo]Por padrão sorteios = 1, numeros = 6, min=1 e max=60.
Para instruções:
node sorteio -h