Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
find me on twitter: @thom_is_coding

Thom Thomazella

💭
find me on twitter: @thom_is_coding
View GitHub Profile
View machine.js
const newNoteMachine = Machine({
id: 'newNoteMachine',
type: 'parallel',
context: { id: null },
states: {
userPrompt: {
initial: 'prompting',
states: {
prompting: { on: { INPUT: { target: 'working' } }, invoke: { src: 'userPrompt_prompting' } },
working: {
@Thomazella
Thomazella / machine.js
Last active Sep 16, 2020
semaphore machine
View machine.js
const semaphore = Machine({
id: 'semaphore',
initial: 'green',
states: {
green: { on: { NEXT: { target: 'yellow' } } },
yellow: { on: { NEXT: { target: 'red' } } },
red: { on: { NEXT: { target: 'green' } } },
},
})
View c4p-draft.md

Assunto: Palestrante 2020

Raphael "Tom" Thomazella

Florianópolis - Santa Catarina

Fullstack Javascript Engineer - Freelancer

Tema: State Machines (24 👍 nos temas 2020)

View owasp-notes.md

SQL injection, injection in general

happens when user provided data is poorly or not validated at all. happens when the client is manipulated to send unexpected params to the backend. backend must avoid at all cost to use data in db requests or other operations if needed, data should be filtered and validated on the server side, better yet parametrized, or at the bare minimum, escaped properly

headers and env vars are possible vectors of attack

@Thomazella
Thomazella / typescripting-twitter-snippets-part1.ts
Last active Jul 13, 2020
Typescripting Twitter snippets part 1
View typescripting-twitter-snippets-part1.ts
/*************************************************************
* https://twitter.com/marcelcruz/status/1282005231065341953 *
*************************************************************/
/**
* original js
*/
const capitalize = ([firstLetter, ...rest]) => {
return firstLetter.toUpperCase() + rest.join('')
}
@Thomazella
Thomazella / dicas-mei-ir.js
Created Jun 29, 2020
Dicas para mei com imposto de renda
View dicas-mei-ir.js
const totalYear = /* total de ganhos no ano */;
const SERVICES_TAX_ASSUMPTION = 0.32;
const EXEMPT_AMOUNT = 28.559.70 /* valor para 2020 */;
const nonTaxable = totalYear * SERVICES_TAX_ASSUMPTION;
const taxableByPj = totalYear - nonTaxable;
const shouldSubmitIR = taxableByPj > EXEMPT_AMOUNT;
console.log({ shouldSubmitIR, taxableByPj, nonTaxable, totalYear });
/**
https://www.msn.com/pt-br/dinheiro/other/mei-precisa-declarar-imposto-de-renda/ar-BB10w1xg
@Thomazella
Thomazella / ts-repl.ts
Last active Jul 8, 2020
Awesome Typescript REPL
View ts-repl.ts
import decache from 'decache'
import { watch, FSWatcher } from 'fs'
import REPL from 'repl'
type ReloadConfig = { newline?: boolean }
type JSObject<Value = any> = Record<string, Value>
const AUTO_RELOAD = true
/**
* path to the modules you'll be developing and reloading.
View Predictions.txt
real vs dolar 2020
https://twitter.com/thom_is_coding/status/1253373908650205185
@Thomazella
Thomazella / async-await-react-native-3.js
Last active Apr 20, 2020
async-await react-native 3
View async-await-react-native-3.js
/**
* react-native
* React.FC
* loading state used for UI feedback only
* async handle attached to button with 3 awaits
* apollo mutation
* promisified calls
*/
const EmailConfirmation: React.FC<Props> = ({ navigation, dispatch, ...props }) => {
const [loading, setLoading] = useState(false)
You can’t perform that action at this time.