Skip to content

Instantly share code, notes, and snippets.

View jaredru's full-sized avatar
💭
I may be slow to respond.

Jared Russell jaredru

💭
I may be slow to respond.
  • Remitly
  • Seattle
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jaredru on github.
  • I am jaredru (https://keybase.io/jaredru) on keybase.
  • I have a public key ASDRlSq_m3TUwIuZ5yhIcInc8n73CZVxK32U23jlG6KsvQo

To claim this, I am signing this object:

@jaredru
jaredru / consistentHash.js
Created July 20, 2018 04:47
JavaScript Consistent Hash
function makeLinearCongruentialGenerator(seed) {
const m = Math.pow(2, 31) - 1;
const a = 16807;
const c = 0;
let z = seed;
return function lcg() {
z = (a * z + c) % m;
return z / m;
}
@jaredru
jaredru / git-prdifftool
Last active January 6, 2016 02:46
a git command to open pull requests in the default difftool
#!/usr/bin/env bash
set -fu -o pipefail
# prepare some help info
OPTS_SPEC="\
git prdifftool <github pull request url>
git prdifftool <github remote> <pull request number>
git prdifftool <pull request number>
git prdifftool opens a GitHub pull request in the default difftool
@jaredru
jaredru / RACSignal+ShareWhileActiveBackport.m
Last active June 30, 2017 02:09
A ReactiveCocoa 2.x `-shareWhileActive` backport
- (RACSignal *)shareWhileActive {
NSRecursiveLock *lock = [[NSRecursiveLock alloc] init];
lock.name = @"com.github.ReactiveCocoa.shareWhileActive";
// These should only be used while `lock` is held.
__block NSUInteger subscriberCount = 0;
__block RACDisposable *underlyingDisposable = nil;
__block RACReplaySubject *inflightSubscription = nil;
return [[RACSignal
@jaredru
jaredru / keybase.md
Created September 28, 2014 18:31
keybase.md

Keybase proof

I hereby claim:

  • I am fouvrai on github.
  • I am fouvrai (https://keybase.io/fouvrai) on keybase.
  • I have a public key whose fingerprint is F953 A4CC A614 C828 D445 73D9 368B D0BF 4B2F BA88

To claim this, I am signing this object: