Skip to content

Instantly share code, notes, and snippets.

View tcodes0's full-sized avatar
💭
What's happening?

Raphael "Thom" Thomazella tcodes0

💭
What's happening?
View GitHub Profile
@tcodes0
tcodes0 / typescripting-twitter-snippets-part1.ts
Last active July 13, 2020 20:54
Typescripting Twitter snippets part 1
/*************************************************************
* https://twitter.com/marcelcruz/status/1282005231065341953 *
*************************************************************/
/**
* original js
*/
const capitalize = ([firstLetter, ...rest]) => {
return firstLetter.toUpperCase() + rest.join('')
}
@tcodes0
tcodes0 / owasp-notes.md
Last active July 17, 2020 07:32
security notes

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

@tcodes0
tcodes0 / image-upload
Created July 29, 2020 05:32
image upload
foo
@tcodes0
tcodes0 / c4p-draft.md
Created August 5, 2020 04:24
rconf 2020 c4p

Assunto: Palestrante 2020

Raphael "Tom" Thomazella

Florianópolis - Santa Catarina

Fullstack Javascript Engineer - Freelancer

Tema: State Machines (24 👍 nos temas 2020)

@tcodes0
tcodes0 / machine.js
Last active January 19, 2021 00:25
state machine
const someMachine = Machine({
id: "actionPlan",
initial: "view",
type: "parallel",
context: {
goals: [],
canEditCarePlan: false,
canEditActionPlan: false,
draftGoal: {},
},
@tcodes0
tcodes0 / machine.js
Last active September 16, 2020 22:08
new note
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: {
@tcodes0
tcodes0 / ppi-calc
Last active November 1, 2020 16:39
ppi calc
var TO_MILIMETER = 25.4
function calc_dpi (widthPixels: number, heightPixels: number, diagonal: float) {
var x = width
var y = height
var ratio = y/x;
var xd = Math.sqrt( Math.pow(diagonal,2) / ( 1 + Math.pow(ratio, 2) ));
var yd = xd * ratio;
var pitch = TO_MILIMETER/(x/xd);
var result = {
displayDiagonalCentimeters : diagonal * 2.54,
@tcodes0
tcodes0 / mac-apfs-terminal-clone.md
Last active November 16, 2020 19:34
how to clone apfs volumes and make bootable
node -e 'var rates = new Array(130).fill(0).map((x, i) => (i+4) * 5000).map( year => ({ year, hour: (year/1920.1755589082431).toFixed(0), month: (year/12).toFixed(0) })); console.log(rates)''
@tcodes0
tcodes0 / linkedin-reject-ptbr.txt
Created April 9, 2021 21:08
como rejeitar recruiters
Oi <Nome da pessoa>,
Obrigado por entrar em contato 😊
Então, atualmente trabalho com <sua empresa>
<pq sua empresa eh boa>
O trabalho é totalmente remoto e flexível, apenas <fuso> hora de diferença de fuso horário comigo.
Trabalho em uma equipe <pq sua equipe eh boa>
Gosto muito da minha equipe e dos produtos nos quais trabalhamos.
Consigo ter um bom equilíbrio entre a vida pessoal e profissional, nunca trabalho nos fins de semana e sem horas extras.