Skip to content

Instantly share code, notes, and snippets.

Samuel Clay samuelclay

Block or report user

Report or block samuelclay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am samuelclay on github.
  • I am samuelclay (https://keybase.io/samuelclay) on keybase.
  • I have a public key whose fingerprint is 067A A5F2 BCFA A27D 952B 61E7 B83A 60E5 4AFB F343

To claim this, I am signing this object:

@samuelclay
samuelclay / LED Dress.ino
Last active Jan 25, 2017
For New Year's Eve 2014, my girlfriend and I went to a dance party where wearable electronics were not only encouraged but also on display from a variety of hobbyists. I decided to use this as an opportunity to combine two of my favorite hobbies: sewing and electronics. We attached six addressable LED strands from Sparkfun ($20 each) to the lini…
View LED Dress.ino
#include <Adafruit_NeoPixel.h>
#include "WS2812_Definitions.h"
#define PIN_A 9
#define PIN_B 3
#define PIN_C 2
#define PIN_D 12
#define PIN_E 10
#define PIN_F 6
#define LED_COUNT 43
View EXIF.py
class ImageOps:
"""Module that holds all image operations. Since there's no state,
everything is a classmethod."""
@classmethod
def adjust_image_orientation(cls, image):
"""Since the iPhone will store an image on its side but with EXIF
data stating that it should be rotated, we need to find that
EXIF data and correctly rotate the image before storage."""
@samuelclay
samuelclay / radix_trie.js
Created Jan 30, 2013
A Radix Trie (aka PATRICIA trie) implemented in JavaScript. Play with it at this interactive JS fiddle: http://jsfiddle.net/jCYAw/
View radix_trie.js
var RadixTrie = function(words) {
this.T = {};
this.initialize(words);
};
RadixTrie.prototype = {
initialize: function(words) {
var self = this;
words = words || [];
@samuelclay
samuelclay / radix_trie.clj
Created Jan 22, 2013
A Radix Trie (aka PATRICIA trie) implemented in Clojure. For my JavaScript implementation, see this interactive JS fiddle: http://jsfiddle.net/jCYAw/
View radix_trie.clj
(ns radix
(:require [clojure.string :as string]))
(use 'clojure.java.io)
(use 'clojure.pprint)
(println "Loading names... ")
(time (def names
(with-open
[rdr (reader
"/usr/share/dict/ProperNames")]
@samuelclay
samuelclay / entries.md
Created Mar 21, 2012
Top entries in Knight News Challenge 2012
View entries.md
@samuelclay
samuelclay / gist:1338319
Created Nov 4, 2011
The Verge RSS feed
View gist:1338319
>>> import feedfinder
>>> feedfinder.feed('http://theverge.com')
'http://theverge.com/rss/index.xml'
>>> import feedparser
>>> fp = feedparser.parse('http://theverge.com/rss/index.xml')
>>> fp
{'feed': {}, 'status': 200, 'bozo': 1, 'headers': {'status': '200 OK', 'content-length': '19383', 'via': '1.1 sbnation.com', 'content-encoding': 'deflate', 'vary': 'Accept-Encoding', 'x-runtime': '578', 'connection': 'Keep-Alive', 'etag': '"fd2f3a5b33a1a706fea1dec62ad25df3"', 'cache-control': 'private, max-age=0, must-revalidate, private, max-age=0, must-revalidate', 'date': 'Fri, 04 Nov 2011 00:06:59 GMT', 'p3p': 'CP="CAO DSP COR CURa ADMa DEVa PSAa PSDa CONi OUR IND PHY ONL UNI COM NAV INT CNT STA"', 'content-type': 'application/xml; charset=utf-8'}, 'etag': u'"fd2f3a5b33a1a706fea1dec62ad25df3"', 'href': u'http://www.theverge.com/rss/index.xml', 'entries': [], 'bozo_exception': error('Error -3 while decompressing data: incorrect header check',)}
>>> fp.entries
[]
@samuelclay
samuelclay / Monday Morning.txt
Created Sep 27, 2011
"Why live in the world when you can live in your head?"
View Monday Morning.txt
There's nothing to do so you just stay in bed / (oh / poor thing) / Why live in the world when you can live in your head? / Oh / And you can go out late from Monday / till Saturday turns into Sunday / and now you're back here at Monday / so you can do it all over again / And we go ah/ah/ah... / I want a refund / I want a light / I want a reason / to make it through the night / All right / And so you finally left school / so now what are you going to do? / Now you're so grown up / yeah / O h / ah / ah / Oh / so mature / Going out late from Monday / chuck up in the street on Sunday / you don't want to live till Monday / and have to do it all over again / And you go ah/ah/ah... / I want a refund / I want a light / I want a reason / for all this night after night after night after night / Oh / I know that it's stupid but I just can't seem to spend a night at home / 'cause my friends left town / and I'm here all alone / Oh oh / Yeah / They say the past must die / for the futur e to be born / In that case / die / l
@samuelclay
samuelclay / gist:1163547
Created Aug 22, 2011 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
View gist:1163547
  • Day job: Engineer at Tasty Labs, on a Python/Tornado stack

  • Favorite Python project: NewsBlur, my visual RSS feed reader written entirely in Python on the backend. Uses a 100% python distributed feed fetcher that makes use of celery, mongoengine, pymongo, and Django. Entirely on GitHub: http://github.com/samuelclay/NewsBlur

  • Favorite Conference: Djangocon, where everybody knows they might the right decision to go Python.

  • Python Experience Level: Somewhere between expert and way out of my element.

View gist:1141085
var someSet = Backbone.Collection.extend({
model : someModel,
constructor : function() {
this.bind('change', _.bind(function() {
onModelChange();
}, this);
}
});
someModelInstance.set('key', 'value'); // Triggers a `change` that `someSet` will see.
You can’t perform that action at this time.