Skip to content

Instantly share code, notes, and snippets.

View jLouzado's full-sized avatar

Joel Louzado jLouzado

View GitHub Profile
@jLouzado
jLouzado / SketchSystems.spec
Created April 14, 2023 13:11
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
Microwave
Power Off
power switch -> Power On
Power On
Door Open
close -> Door Closed
Door Closed
Cooking
Microwave
Power Off
power switch -> Power On
Power On
Door Open
close -> Door Closed
Door Closed
Cooking
@jLouzado
jLouzado / patch.js
Created September 20, 2020 11:54 — forked from tusharmath/patch.js
Virtual DOM library in 500bytes
const typeOf = ob => ob.toString()
const forEach = (fn, l) => typeOf(l) === '[object Object]'
? forEach(k => fn(l[k], k), Object.keys(l))
: Array.from(l).forEach(fn)
export const patch = (elm, node) => {
if(elm === node) return elm
if(typeOf(elm) === '[object Text]') {
elm.textContent = node.textContent
@jLouzado
jLouzado / 1-requirement-and-mockup.ts
Last active September 16, 2020 06:25
Possible example for types-driven-development. Repl: https://www.typescriptlang.org/play
type EventsWithFilters = Record<
string,
{isSelected: boolean; filters: Filters}
> | null
type Filters = Record<string, {isSelected: boolean; values: Values}> | null
type Values = Record<string, boolean> | null
type SelectedFilters = {
event: string
interface superType {
a: string,
b: number,
}
interface subType extends superType {
c: string | number
}
declare const xs: Array<superType | null> | Array<subType>
@jLouzado
jLouzado / toggle-key-in-record.ts
Last active July 1, 2020 18:28
Ramda: Toggle Key of a Record using Lenses
type key = string
type Records = Record<key, boolean>
const records: Records = {
foo: false,
bar: false
}
// key -> ((A -> B) -> Records -> Records)
const setter = R.converge(
export const traceOutput = (fn: any, message: string = '') => (
...args: unknown[]
) => {
const result = fn(...args)
console.log(typeof fn)
console.log(message, result)
return result
}
@jLouzado
jLouzado / integrator-workflow.md
Last active September 14, 2018 12:14
Merge-Request Integration Workflow

Workflow for Merge-Request Integration

Aims

  • Manage app stability in Production
    • this means as few surprises as possible for the users
  • Improve documentation around changes being made
    • this is so that in the future it's easier to track why changes were made
  • Make it easier to test changes as they're being integrated and deployed
  • Utilize available tools as fully as possible