Assunto: Palestrante 2020
Raphael "Tom" Thomazella
Florianópolis - Santa Catarina
Fullstack Javascript Engineer - Freelancer
Tema: State Machines (24 👍 nos temas 2020)
const someMachine = Machine({ | |
id: "actionPlan", | |
initial: "view", | |
type: "parallel", | |
context: { | |
goals: [], | |
canEditCarePlan: false, | |
canEditActionPlan: false, | |
draftGoal: {}, | |
}, |
Assunto: Palestrante 2020
Raphael "Tom" Thomazella
Florianópolis - Santa Catarina
Fullstack Javascript Engineer - Freelancer
Tema: State Machines (24 👍 nos temas 2020)
foo |
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
/************************************************************* | |
* https://twitter.com/marcelcruz/status/1282005231065341953 * | |
*************************************************************/ | |
/** | |
* original js | |
*/ | |
const capitalize = ([firstLetter, ...rest]) => { | |
return firstLetter.toUpperCase() + rest.join('') | |
} |
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 |
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. |
real vs dolar 2020 | |
https://twitter.com/thom_is_coding/status/1253373908650205185 |
/** | |
* 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) |
/** | |
* react-native project | |
*/ | |
class HeartButton extends Component<Props, State> { | |
handlePress = async e => { | |
const { data } = await apolloMutation1({ | |
variables | |
}) | |
navigation.navigate('ChatScreen', { conversationId: data.conversation.id }) |