This file contains hidden or 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
export function renderComponent(component, query, variables) { | |
let {loading, error, data} = useQuery(query, {variables}); | |
if (loading) { | |
return null; | |
} | |
if (error) { | |
console.log(error); | |
} |
This file contains hidden or 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
class AirBookingService { | |
private final Database db; | |
private final BookingService bookings; | |
private static final Map<String, User> userCache = new HashMap<>(); | |
public AirBookingService() { | |
db = new Database(); | |
bookings = BookingServiceFactory.getService(); | |
} |
This file contains hidden or 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
$("#newDeviceForm").submit(function(e) { | |
// Don't let the browser submit automatically | |
e.preventDefault(); | |
$.ajax({ | |
type: "POST", | |
url: "http://rad8prod-env.paxsdtgzng.us-east-1.elasticbeanstalk.com/devices", | |
headers: { | |
Authorization: "dev_env_pw" | |
}, | |
data: this.serialize(), |
This file contains hidden or 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
let plugins = getPlugins() | |
.flatMap(p => p) | |
// Group plugins by consumer_id or app_id | |
.reduce((obj, p) => { | |
let id = p.consumer_id || p.api_id; | |
if (id in obj) { | |
obj[id].push(p); | |
} else { | |
obj[id] = [p]; | |
} |
This file contains hidden or 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
Shawn's Intellij Shortcuts | |
Symbols: | |
⌥ Option | |
⌘ Command | |
⇧ Shift | |
⌃ Control | |
← Left arrow | |
→ Right Arrow | |
↑ Up Arrow |
This file contains hidden or 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 http = require('http'); | |
var RX = require('rx'); | |
var request = require('request'); | |
function get(url) { | |
return RX.Observable.create(function(observer) { | |
request(url, function(err, response, body) { | |
if (err) { | |
observer.onError(err); | |
return; |
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
print "\\n".join([l.strip() for l in sys.stdin.readlines()]) |
This file contains hidden or 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
# statsd | |
sudo tcpdump -i eth0 -p -n -s 1500 -A udp port 8125 | |
# statsd flushing to graphite | |
sudo tcpdump 'port 2005 or 2009' -s0 -A | |
# collectd | |
sudo tcpdump -i eth0 -p -n -s 1500 -A udp port 25827 |
This file contains hidden or 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 | |
# Usage: $ ./install-packer.sh | |
brew install golang | |
# Create go workspace dir | |
mkdir ~/golang | |
cat << EOF > ~/.bashrc | |
# Golang | |
export GOPATH=$HOME/golang |
This file contains hidden or 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
# p4 diff by changelist | |
function p4d { | |
if [ "$1" == "" ] | |
then | |
echo "usage: p4d CL"; | |
return 1; | |
fi | |
p4 opened -c $1 | sed -e 's/#.*//' | p4 -x - diff -du | less | |
} |
NewerOlder