I hereby claim:
- I am lffg on github.
- I am lffg (https://keybase.io/lffg) on keybase.
- I have a public key ASAhDDaXO6SvSmVPSiTWGq6QEfVCJdF0aohodDHD1tLtPAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| function* gen() { | |
| yield 1; | |
| yield 2; | |
| return 3; | |
| } | |
| function* withReturned(iterable) { | |
| const iterator = iterable[Symbol.iterator](); | |
| let curr; | |
| while ( |
| const data = [ | |
| { key: 'a', val: 'foo' }, | |
| { key: 'b', val: 'bar' }, | |
| { key: 'c', val: 'baz' }, | |
| { key: 'a', val: 'qux' }, | |
| { key: 'b', val: 'quxx' } | |
| ]; | |
| function groupBy(key, arr) { | |
| const result = {}; |
| const data = [ | |
| { id: 1, name: 'Foo-Dup' }, | |
| { id: 1, name: 'Foo' }, | |
| { id: 2, name: 'Bar' }, | |
| { id: 3, name: 'Baz-Dup' }, | |
| { id: 3, name: 'Baz' } | |
| ]; | |
| function dedupByKey(key, arr) { | |
| const map = new Map(); |
| let source: &str = todo!("get some string slice here"); | |
| // A função `strip_prefix` retorna `Some` contendo o resto da string sem o prefixo se ele existir. | |
| // Se não tiver o prefixo, retorna `None` (análogo ao `false` da outra função). | |
| // Ver: https://doc.rust-lang.org/std/primitive.slice.html#method.strip_prefix | |
| if let Some(tail) = source.strip_prefix(':') { | |
| let cmd: Vec<_> = tail // Agora não preciso mais utilizar um range para remover o prefixo. | |
| .split_ascii_whitespace() | |
| .filter(|s| !s.is_empty()) | |
| .collect(); |
| function* enumerate(iterable) { | |
| let i = 0; | |
| for (const item of iterable) { | |
| yield [i++, item]; | |
| } | |
| } | |
| function* withIsLast(iterable) { | |
| const iterator = iterable[Symbol.iterator](); | |
| let curr = iterator.next(); |
| // Write a script that creates an array with 10000 random words between 3 and 5 | |
| // characters, and returns the number of words that are palindromes in that | |
| // array. Notes: The code needs to be in javascript You’ll need to return just | |
| // the number of words. | |
| console.log(main()); | |
| function main() { | |
| return Array.from({ length: 10_000 }) | |
| .map(RandomAlphabeticString(3, 5)) |
| import { readdirSync } from "node:fs"; | |
| import { join } from "node:path"; | |
| import { cwd } from "node:process"; | |
| const MIGRATION_DIR = join(cwd(), "migrations"); | |
| const subDirsPaths = (path) => | |
| readdirSync(path, { withFileTypes: true }) | |
| .filter((dirEntry) => dirEntry.isDirectory()) | |
| .map((dirEntry) => join(path, dirEntry.name)); |
| experimental-features = nix-command flakes | |
| build-users-group = nixbld | |
| substituters = https://cache.nixos.org https://cachix.cachix.org https://nix-tools.cachix.org https://nix-community.cachix.org https//cache.nixos.org https://cachix.cachix.org https://nix-tools.cachix.org https://nix-community.cachix.org https://cache.nixos.org/ | |
| trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= | |
| trusted-substituters = https://cache.nixos.org https://cachix.cachix.org https://nix-tools.cachix.org https://nix-community.cachix.org | |
| use std::cmp::Ordering; | |
| pub mod printer; | |
| pub struct BinaryTree<T> { | |
| root: Option<Node<T>>, | |
| } | |
| impl<T: Ord> BinaryTree<T> { | |
| /// Creates a new binary tree. |