- Tipos de variáveis, escopo e closures (
var
,let
,const
, escoposfunction
e{}
) - Tipos e coerção (
Boolean
,null
,undefined
,Number
,String
,Object
,Symbol
e tabela de coerção) this
,prototype
s e classes- Assincronia (
event loop
,setTimeout
,setInterval
,setImmediate
,process.nextTick
,Promise
,function*
,coroutine
s easync
await
)
This file contains hidden or 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
data Alphabet = A Int | B Float | C String | |
cool :: [Alphabet] -> Bool | |
cool [] = error "Should not call `cool` with empty list" | |
cool alphabetList = case alphabetList of | |
[A] -> coolInt alphabetList | |
[B] -> coolFloat alphabetList | |
[C] -> coolString alphabetList | |
_ -> error "Shouldn't call `cool` with list of different variants" | |
This file contains hidden or 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
struct State { | |
step: Step, | |
data: Vec<u8>, | |
} | |
impl State { | |
pub fn new() -> Self { | |
Self { step: Step::Initial, data: vec![] } | |
} | |
This file contains hidden or 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 data = [ | |
{ | |
category: 'action', | |
value: 'jorgs' | |
}, | |
{ | |
category: 'comedy', | |
value: 'lucians' | |
}, | |
{ |
This file contains hidden or 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
class MyNumber extends Number implements Monoid<MyNumber> { | |
public x: Number; | |
constructor(x: Number) { | |
super(x) | |
this.x = x; | |
} | |
toString(): string { | |
return this.x.toString() | |
} |
This file contains hidden or 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
document.querySelectorAll('ul.mn-invitation-list button.artdeco-button--secondary').forEach(btn => btn.click()) |
This file contains hidden or 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 getChunk = (arr, from, size) => { | |
const clampedFrom = (from + size) > arr.length | |
// Trying to get chunk bigger than end of array. | |
// Here we reduce `from` so that the chunk size is always preserved. | |
? arr.length - size | |
: from | |
return arr.slice(clampedFrom, from + size) | |
} |
This file contains hidden or 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 assert = require('assert') | |
function test(title, fn) { | |
try { | |
fn() | |
console.log(`✅ '${title}' test passed`) | |
} catch (error) { | |
console.error(`❌ '${title}' test failed`) | |
throw error | |
} |
This file contains hidden or 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
struct In { | |
a: bool, | |
b: bool, | |
} | |
#[derive(Debug, PartialEq)] | |
struct Out { | |
out: bool, | |
} |
This file contains hidden or 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
// Cargo.toml dependencies: | |
// hex = "0.4.3" | |
// ethabi = "16.0.0" | |
use ethabi::*; | |
use ethabi::ParamType::*; | |
use ethabi::StateMutability::*; | |
fn main() { |