Find missing code
git log -S [text] --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
function between(subject, options = {}) { | |
const {rigidity, alias} = Object.assign({ | |
rigidity: 10, | |
alias: new Map(), | |
}, options); | |
const keys = Object.keys(subject); | |
let last = Object.assign({}, subject); | |
let intended = subject; |
import { useState, useEffect, useMemo } from "react"; | |
import moment, { Moment, DurationInputArg2 as Unit } from "moment"; | |
export const useLiveTime = (unit: Unit): Moment => { | |
const initial = useMemo(moment, []); | |
const [time, setTime] = useState<Moment>(initial); | |
useEffect(() => { | |
const nextTime = time |
Find missing code
git log -S [text] --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
>>SOURCE FORMAT FREE | |
IDENTIFICATION DIVISION. | |
PROGRAM-ID. Multiplier. | |
AUTHOR. Meth Meth Method | |
*> Example program using PERFORM, ACCEPT, TIMES | |
*> collect a number of user definable integers and mulitply them | |
*> with low memory footprint and display the result. | |
DATA DIVISION. |
const fib = (n) => { | |
let a = 0, b = 1, c; | |
for (let i = 0; i < n; i++) { | |
c = a; | |
a = b + a; | |
b = c; | |
} | |
return a; | |
} |
/* | |
Creates a sticky block of rendered content. | |
Useful when you want to memoize part of the render tree and optionally rerender. | |
*/ | |
import { useMemo, useRef } from "react"; | |
export function useContentCache( | |
renderer: () => React.ReactElement | undefined, | |
deps: any[] |
git_commit := $(shell git rev-parse --short HEAD) | |
export REACT_APP_VERSION := $(git_commit) | |
.PHONY: all | |
all: install test build start | |
.PHONY: install | |
install: | |
npm install |
type Direction = "asc" | "desc"; | |
export function sortBy<T>(val: (value: T) => number) { | |
return function sort(dir: Direction) { | |
const invert = dir === "asc" ? 1 : -1; | |
return function compare(a: T, b: T) { | |
return (val(a) - val(b)) * invert; | |
}; |
This text explains why I believe we should allow and prefer the React library for frontend development for client facing applications.
This document tries to be as objective as possible, except under the opinion section. I have not brought up issues that can be solved with lint rules or are already solved with tooling. I have also taken for granted that TypeScript is a given requirement for the organisation long term.
const maxArea = Math.PI * max ** 2; | |
const pointArea = (point.intensity / max) * maxArea; | |
const value = Math.sqrt(pointArea / Math.PI); | |
const size = 8 + (value / max) * 24; |