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
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" }; |
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): |
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
/** @jsx React.DOM */ | |
var MyRootComponent = React.createClass({ | |
getInitialState: function() { | |
return {perMinute: '-', perDay: '-'}; | |
}, | |
componentDidMount: function() { | |
var socket = io.connect(this.props.url); | |
socket.on('business.clickout', this.setState.bind(this)); | |
}, | |
render: function() { |
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
/** @jsx React.DOM */ | |
var MyComponent = React.createClass({ | |
getInitialState: function() { | |
// set up the initial state. used for "logical" initialization code | |
return {perMinute: '-', perDay: '-'}; | |
}, | |
componentDidMount: function() { | |
// fired only once, when the component is added to the DOM | |
// used for initialization code that has "side effects" i.e. i/o, jquery plugins, etc | |
var socket = io.connect(this.props.url); |
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
<html> | |
<head> | |
<title>Test</title> | |
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> | |
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> | |
<script src="http://fb.me/react-0.5.1.js"></script> | |
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script> | |
</head> |
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
/** | |
* Copyright 2013 Facebook, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
NewerOlder