Skip to content

Instantly share code, notes, and snippets.

@ryanspradlin
ryanspradlin / brent.js
Last active Apr 9, 2021
Javascript implementation of Brent's Method, a root-finding algorithm
View brent.js
/* @flow */
// Derived from: https://en.wikipedia.org/wiki/Brent%27s_method#Algorithm
// Brent's method is a hybrid root-finding algorithm that combines the
// faster/less-reliable inverse quadradic interpolation and secant methods with
// the slower/more-reliable bisection method.
export function brent(
f: (x: number) => number,
lowerBound: number,
View alldataloader.js
type BatchLoadFn<K, V> = (keys: Array<K>) => Promise<Array<V | Error>>;
type LoadAllFn<K, V> = () => Promise<Array<[K, V]>>;
type Options<K, V> = {
batch?: boolean,
cache?: boolean,
cacheMap?: CacheMap<K, Promise<V>>,
cacheKeyFn?: (key: any) => any
};
View keybase.md

Keybase proof

I hereby claim:

  • I am ryanspradlin on github.
  • I am ryanspradlin (https://keybase.io/ryanspradlin) on keybase.
  • I have a public key whose fingerprint is 1A8A CC82 73EC 6A41 CAA0 391E E457 1E77 D13D 6150

To claim this, I am signing this object:

@ryanspradlin
ryanspradlin / find_missing_lines.sh
Created Mar 25, 2011
Finds lines present in file A that are missing in file B
View find_missing_lines.sh
#!/bin/sh
FILEA=$1
FILEB=$2
grep -v -x -f $FILEB $FILEA