hero {
name
friends {
name
}
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
import sqlite3 | |
import collections | |
import math | |
import re | |
RE_SPLIT = re.compile(r'[^A-Za-z0-9_]+') | |
def tokenize(s): | |
# this is super basic and should be replaced with a real tokenizer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
CONTAINER="$(pwd | sha256sum | awk '{print $1}')" | |
if docker inspect "$CONTAINER" 2> /dev/null > /dev/null; | |
then | |
docker start "$CONTAINER" -ai | |
else | |
docker run --name="$CONTAINER" -v $(pwd):/root -w /root -ti ubuntu bash | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FSWatcher } from "chokidar"; | |
import { Project, ProjectOptions } from "ts-morph"; | |
import invariant from "invariant"; | |
interface TsMorphWatcherFsEvent { | |
type: "add" | "unlink" | "change"; | |
path: string; | |
} | |
type TsMorphWatcherEvent = TsMorphWatcherFsEvent | { type: "ready" }; |
I hereby claim:
- I am petehunt on github.
- I am petehunt (https://keybase.io/petehunt) on keybase.
- I have a public key whose fingerprint is 576E 36CB DFD3 E7B8 727F DFD0 EF59 1C35 8D68 A67F
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
class Bucket(object): | |
def __init__(self, max_amount, refill_time, refill_amount): | |
self.max_amount = max_amount | |
self.refill_time = refill_time | |
self.refill_amount = refill_amount | |
self.reset() | |
def _refill_count(self): |
To be clear we continue to run many Redis services in our production environment. It’s a great tool for prototyping and small workloads. For our use case however, we believe the cost and complexity of our setup justifies urgently finding alternate solutions.
- Each of our Redis servers are clearly numbered with a current leader in one availability zone, and a follower in another zone.
- The servers run ~16 different individual Redis processes. This helps us utilize CPUs (as Redis is single-threaded) but it also means we only need an extra 1/16th memory in order to safely perform a BGSAVE (due to copy-on-write), though in practice it’s closer to 1/8 because it’s not always evenly balanced.
- Our leaders do not every run BGSAVE unless we’re bringing up a new slave which is carefully done manually. Since issues with the slave should not affect the leader and new slave connections might trigger an unsafe BGSAVE on the leader, slave Redis processes are set to not automatically rest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var React = require('react'); | |
var emptyFunction = require('../../jslib/emptyFunction'); | |
var throttle = require('lodash.throttle'); | |
var listening = false; | |
var instances = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeStyle(defaults, tagName) { | |
tagName = tagName || 'div'; | |
var Style = React.createClass({ | |
getDefaultProps: function() { | |
return assign({}, defaults); | |
}, | |
render: function() { | |
var style = assign({}, this.props); | |
delete style.children; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Style = React.createClass({ | |
render: function() { | |
var style = assign({}, this.props); | |
delete style.children; | |
return React.createElement( | |
'div', | |
{style: style, children: this.props.children} | |
); | |
} |
NewerOlder