Skip to content

Instantly share code, notes, and snippets.

que beleza
const y = 2;
const f = (x) => x |> (y => y + 3 |> (b => y + b))
// | expected |
// | |
// ------------|---------------
// y = 1, f(1) = 5
// const f = (x) => x |> (y => y + 3 |> (b => y + b))
// | | | | ||
// | --|-- ------|-----|
@thiagoarrais
thiagoarrais / README.md
Created February 21, 2019 12:25
I can't transform typescript decorators with jscodeshift

I'm trying to transform a TypeScript decorator with jscodeshift with no success. Don't know if this is a bug or if I'm doing something wrong. I suspect the latter, of course.

I'm running my transform like this:

jscodeshift -t decorator.transform.js --parser=ts decorator.ts

The sample input code is this:

Por favor, reinvente a roda

Da esquerda para a direita: roda de pedra, roda de madeira, roda com aro, roda com pneu de câmara, roda com pneu sem câmara

Tenho certeza de que você já ouviu a frase feita “não reinvente a roda”. Parece um bom conselho a princípio, certo? Devemos reutilizar o que temos a nossa disposição ao invés de reconstruirmos nós mesmos algo com a mesma finalidade.

Não faz muito tempo, descobri o httpie. Ele é um cliente HTTP para linha de comando. Algo como o curl ou o wget.

Mas… Peraí… Para que fizeram o httpie se já temos não só um mas dois clientes HTTP de linha de comando? Não faz sentido! Não reinvente a roda, certo?

For those requirements, a good starting point would be having a SELLERS and PRODUCTS tables.
create table sellers (
id integer,
paid_up_to timestamp
);
create table products (
id integer,
seller_id integer,
@thiagoarrais
thiagoarrais / eval.js
Created December 26, 2018 16:30
trying to understand js eval
'use strict';
var f = '(function() { return this; })()';
var e = eval;
console.log(eval(f)); // undefined
console.log(e(f)); // not undefined
console.log((0, eval)(f)); // not undefined (alternatively)
# TEST_ONLY=parser make test-only
BABEL_ENV=test ./scripts/test.sh
PASS packages/babel-parser/test/plugin-options.js
PASS packages/babel-parser/test/expressions.js
PASS packages/babel-parser/test/estree-throws.js (73.707s)
FAIL packages/babel-parser/test/index.js (73.312s)
● experimental/pipeline operator/proposal smart topic style, await
SyntaxError: experimental/pipeline-operator/proposal-smart-topic-style,-await/input.js: Unexpected token, expected ";" (1:17)
it("should work", function() {
const program = "const identifier = 1";
const node = parse(program, {
filename: fixture("input.js"),
cwd: fixture(),
});
expect(node.program.body[0].declarations[0].id.name).toBe("identifier");
expect(node).not.toBeNull();
transformFromAst(node, program, {
filename: fixture("input.js"),

Cheat Sheet babel.js

Linkar versões de desenvolvimento:

cd babel/packages/babel-cli
yarn link
cd babel/packages/babel-core
yarn link

Anotações sobre emoji-tetra

Call stack simplificada:

  • LambdaRequestHandler.handleRequest
    • Player.play
      • Database.readGameState <- DynamoDB
      • Player.readPreviousPollAndPostNewTweet
        • Player.postTweets
  • Referee.determineElectedMove