Skip to content

Instantly share code, notes, and snippets.

View drewyeaton's full-sized avatar
💭
creating a bug

Drew Yeaton drewyeaton

💭
creating a bug
View GitHub Profile

Rodio Punch-in/out

The purpose of the punch in/punch out API is to allow an external service to update Rodio users with their on-duty status.

To comply with state and local employment law, we've built functionality to disable outbound functionality for employees that are not actively on the clock.

  • When a user is on-duty, they will get full functionality of the app along with push notifications and active status treatemnt within the UI.

  • When a user is off-duty, the app remains functional, but outbound communication is heavily curtailed.

@drewyeaton
drewyeaton / gist:2484095
Created April 24, 2012 21:39
CSV Mapper API
# manufacturer,model,year,price,condition
# BMW,M Coupe,2002,34999.95,good
# BMW,330Ci,2001,13455.36,bad
# Honda,Civic,2007,27340.10,fair
# Toyota,Corolla,2003,14003.21,bad
valid_price = lambda i: i >= 0
class Car(CsvModelBase):
@drewyeaton
drewyeaton / grui.py
Created December 23, 2011 20:51
Simple console GUI
#!/usr/local/bin/python
# coding: utf-8
from blessings import Terminal
import time
import random
class GruiWindow(object):
"""docstring for Grui"""
@drewyeaton
drewyeaton / sparkline.py
Created December 23, 2011 02:39
Simple Sparklines as Data URI
# Sparkline code from Joe Gregorio (http://bitworking.org/news/Sparklines_in_data_URIs_in_Python)
from PIL import Image, ImageDraw
import StringIO
import urllib
def plot_sparkline(results):
"""Returns a sparkline image as a data: URI.
@drewyeaton
drewyeaton / stats.py
Created December 14, 2011 05:03
Stats Class
# Original averaging code from Zed Shaw's Stats class.
# Moving average code by Drew Yeaton.
from math import sqrt
from collections import deque
class SimpleAverage(object):
def __init__(self, sum=0.0, sumsq=0.0, n=0, minimum=0, maximum=0.0):
=fancy-button-base
button
position: relative
border: 0
padding: 0
cursor: pointer
overflow: visible
&::-moz-focus-inner
border: none
<title>
<?php
$sep = ’ | ‘;
$site = get_bloginfo(‘name’);
if(get_post_meta($post->ID, ‘title’, TRUE)) {
$title = get_post_meta($post->ID, ‘title’, TRUE);
} else {
// we need this because page title isn’t shown when on homepage
if(is_front_page() || is_home())
Global setup:
Download and install Git
git config --global user.name "Drew Yeaton"
git config --global user.email xeeton@gmail.com
Next steps:
mkdir test
cd test
git init
touch README
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
#!/bin/bash
USERNAME=yourusername
PASSWORD=password
REPOSITORY=something
echo "Downloading..."
wget --post-data "login=$USERNAME&password=$PASSWORD" --cookies=on --save-cookies=cookies.txt --keep-session-cookies --no-check-certificate https://github.com/session
wget --cookies=on --load-cookies=cookies.txt --keep-session-cookies --save-cookies=cookies.txt --no-check-certificate https://github.com/$USERNAME/$REPOSITORY/tarball/master
rm *.html