Skip to content

Instantly share code, notes, and snippets.

Avatar
🐫

Juan Lulkin joaomilho

🐫
View GitHub Profile
@joaomilho
joaomilho / upload.ts
Last active Dec 6, 2020
Type safe event handlers
View upload.ts
type Events = {
start: [];
progress: [number];
complete: [string, boolean];
};
class Uploader {
listeners: {
[key in keyof Events]: ((...params: Events[key]) => void)[];
};
@joaomilho
joaomilho / peano.ts
Created Nov 3, 2020
Fully typed arithmetics with TypeScript 😨
View peano.ts
type Nat = ["S", Nat] | ["Z"];
type Succ<N extends Nat> = ["S", N]
type S<N extends Nat> = Succ<N>
type Prev<N extends Nat> = N[1]
type Z = ["Z"]
type Zero = Z
type One = S<Z>
type Two = S<S<Z>>
@joaomilho
joaomilho / log.ts
Last active Dec 21, 2020
A printf with dependant types in TypeScript, similar to Idris (https://gist.github.com/chrisdone/672efcd784528b7d0b7e17ad9c115292)
View log.ts
type FieldType<Field> =
's' extends Field ? string :
'f' extends Field ? number :
'i' extends Field ? number :
'd' extends Field ? number :
'o' extends Field ? HTMLElement :
'O' extends Field ? object :
'c' extends Field ? string :
never;
View burp-instructions.md

burp guide

  1. Install https://portswigger.net/burp/communitydownload;

  2. Browser:

  • Chrome The Chrome browser picks up the HTTP proxy settings configured on the host computer. If you are using Chrome, you can open your computer's built-in browser and follow the instructions for configuring that. If you aren't sure where the built-in proxy settings are, open Chrome, go to the Customize menu, select Settings, click on "Show advanced settings",
@joaomilho
joaomilho / counter.js
Created Feb 26, 2017
Act's <1.0 counter
View counter.js
const view = (count) =>
['p', [
['h1', count],
['button', {click: {add: 1}}, '+'],
['button', {click: {add: -1}}, '-']
]]
const reducer = (state, {type, payload}) =>
type === 'add' ? state + payload : state
@joaomilho
joaomilho / boot.day.zip.sh
Last active Aug 1, 2016
day.zip boot script
View boot.day.zip.sh
cd /home/pi/ && git clone https://github.com/klarna/day.zip.git && cd day.zip && bash boot.sh
View bio.txt
Juan was just a regular kid until one day he bet his soul with the devil and lost. Then, he suddenly learned to play blues and started working with software development making fortunes with the dotcom bubble. He mastered many open source technologies while studying physics, where he couldn't find any evidence for, and philosophy, where he couldn't find any good argument for the existence of souls. Given an approaching deadline set by the dark lord, he decided to move to Israel and learn Hebrew, in order to read God's words and to seek atonement for his sins. Nowadays he works at Klarna Tel Aviv mainly with React and other front end technologies, since he couldn't find anything more self flagellating to do.
View loadReducer.js
const load = equals('load')
const unload = complement(load)
const loading = set(lensProp('loading'))
const loadReducer = guard([
[load, loading(true)],
[unload, loading(false)] // runs for all actions except `'load'`
])
View calculatorReducerWithGuard3.js
const calculatorReducer = guard({ add, subtract, multiply, divide })
You can’t perform that action at this time.