Skip to content

Instantly share code, notes, and snippets.

View boertel's full-sized avatar

Benjamin Oertel boertel

View GitHub Profile
@boertel
boertel / decorator.js
Created November 17, 2014 23:20
Python Decorator
var _ = require('lodash');
function deprecated () {
var args = Array.prototype.slice.call(arguments),
func = args.shift();
console.log('[Deprecated] ' + func.name)
return func.apply(func, args);
}
var myFunction = _.wrap(myFunction, deprecated);
@boertel
boertel / panda.py
Created October 31, 2014 06:25
panda
from collections import defaultdict
lost = defaultdict(int)
# df is a dataframe
for d in df.iterrows():
if d['settle_bet'] == 'Nan':
lost[d['game_account_id']] += 1
@boertel
boertel / toggle.js
Created September 29, 2014 20:13
toggle
(function ($) {
$.fn.toggle = function (options) {
var settings = $.extend({}, options);
$(this).hide();
return this.each(function () {
var $node = $(this),
id = $node.data('action'),
state = $node.data('state'),
@boertel
boertel / grid-constructor.css
Last active August 29, 2015 14:06
Grid constructor
body {
font-family: Helvetica;
}
.controls {
margin-bottom: 20px;
}
.square {
position: relative;
@boertel
boertel / index.html
Last active June 27, 2016 22:18
Cluster
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
.underlay {
fill: #ababab;
}
.line {
@boertel
boertel / deploy.sh
Created August 13, 2014 22:28
Hub Builder
#!/bin/bash
GITROOT=`git rev-parse --show-toplevel`
NAME=`basename $GITROOT`
s3cmd ls | cut -d ' ' -f 4 | sed -e 's/s3:\/\///g' | grep $NAME || s3cmd mb s3://$NAME
echo "Deploying $NAME..."
s3cmd sync --no-preserve --delete-removed --skip-existing --rexclude='.git/' $GITROOT s3://$NAME
@boertel
boertel / snippet.js
Last active August 29, 2015 14:05
ESPN Pick'em Bot
(function () {
window._benbot = window._benbot || {};
var config = {
method: window._benbot.method || 100,
submission: window._benbot.submission || false,
diff: window._benbot.diff || 20
};
function r (n) { n = n || 35; return Math.floor(Math.random() * n) }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="//s3.amazonaws.com/punchtab-static/zzzzzz/css/punchdation.5.css">
</head>
<body>
<div class="row" data-equalizer>
<div class="large-6 columns panel" data-equalizer-watch>
u'Received: by mx-006.sjc1.sendgrid.net with SMTP id XavmtSzKqd Wed, 06 Aug 2014 20:05:28 +0000 (GMT)\nReceived: from mail-ie0-f178.google.com (mail-ie0-f178.google.com [209.85.223.178]) by mx-006.sjc1.sendgrid.net (Postfix) with ESMTPS id B2C6381FDC for <[email protected]>; Wed, 6 Aug 2014 20:05:28 +0000 (GMT)\nReceived: by mail-ie0-f178.google.com with SMTP id rd18so3388978iec.23 for <[email protected]>; Wed, 06 Aug 2014 13:05:28 -0700 (PDT)\nX-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=cR8c9pr17VRTqA4R2MlZW73a0vI83abBhHAZ60OApFg=; b=a/AEIMhisqVlpNnO3XCoPD4HdBuQ+zyro+MKAQWplSQHHdqrLBc4yw3Qk3GRG0ea/2 vrks2QmQVrrmbHXwZ1yoOU9SKM6lZ8GOxnQfgZaW2tmsdixv3WneRjrjcg07Hzlm3cs6 nNPBJvqP5tu3hpFKIegIq1JHEkq9UUhB3uV0weVsqsA6WvxnSsF+N48d67aaQuyboKOY /1uhsg6wL+8fkuhl0woius+i3vh7tGt0wspPFNANdEPn+/TyuXVWxrMJslWGNrN7D2j3 +VcTpKWpRpnfv9RbyqqIO0gnyESZ2k3y/hbvXYd237NpkEa9In49BQ48OD9GOhd0VUa
@boertel
boertel / browser
Last active August 29, 2015 14:04 — forked from defunkt/browser
#!/bin/sh -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo '<h1>hi mom!</h1>' | browser
# $ ron -5 man/rip.5.ron | browser
if [ -t 0 ]; then
if [ -n "$1" ]; then