Skip to content

Instantly share code, notes, and snippets.

View mattrobenolt's full-sized avatar
🤠
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔

Matt Robenolt mattrobenolt

🤠
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔
View GitHub Profile
var http = require('http');
http.createServer(function (req, res) {
var timeout = setTimeout(function() {
clearTimeout(main);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Quit!');
}, 2000);
var main = setTimeout(function() {
clearTimeout(timeout);
var MailParser = require("mailparser").MailParser;
exports.hook_queue = function (callback, connection) {
// Parse the mail first...
var mp = new MailParser({fix_smtp_escapes: 0});
var headers;
var body;
var t = this;
mp.on('header', function (h) {
(Yeah, Ah-Ah-Ah-Ah-Ah-Ark)
Oo-ooh-ooh, hoo yeah, yeah
Yeah, yeah
Yeah-ah-ah
Yeah-ah-ah
Yeah-ah-ah
Yeah-ah-ah
Yeah, yeah, yeah
7am, waking up in the morning
@mattrobenolt
mattrobenolt / sprites.jsx
Created July 27, 2011 14:07
Crude Photoshop script to import a series of images and lay them out into a sprite sheet.
const FRAME_WIDTH = 410;
const FRAME_HEIGHT = 280;
const MAX_COLUMNS = 10;
var newDocumentName = prompt("Name of new document?", "New Sprite Sheet");
var images = getFolder(),
background = getBackground(),
columns = Math.min(MAX_COLUMNS, images.length),
@mattrobenolt
mattrobenolt / gist.py
Created July 27, 2011 16:28
Django templatetag for embedding GitHub gists
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.core.cache import cache
from django.utils.hashcompat import md5_constructor
import urllib2
register = Library()
class GistNode(Node):
def __init__(self, gist_id, filename=None, *args):
$('#sprite_once').sprite({
speed: 50,
frames: 72,
columns: 9,
mode: 'once',
onStep: function(e)
{
$(this).nextAll('.status').text(e.step);
},
onComplete: function()
$fh = fopen($box->download_url('862161200'), 'r'); // Open box.net file
$tmp = tempnam(sys_get_temp_dir(), 'DOC'); // create tmp file
print_r($tmp);
echo '<br />';
$tfh = fopen($tmp, 'w');
fwrite($tfh, fread($fh, 13421772)); // write bytes from box.net file to tmp file
fseek($tfh, 0);
// Then load tmp file into ZipArchive->open() and use this function:
http://www.botskool.com/geeks/how-extract-text-docx-or-odt-files-using-php
import xbmc
import xbmcgui
METHODS = ("Director", "Genre", "TagLine", "Plot", "PictureURL", "Title", "OriginalTitle", "Votes", "Cast", "File", "Path", "IMDBNumber", "Year", "Premiered", "FirstAired", "Rating", "PlayCount", "LastPlayed")
class OpenGraphPlayer(xbmc.Player) :
def __init__ (self):
xbmc.Player.__init__(self)
def onPlayBackStarted(self):
@mattrobenolt
mattrobenolt / Redis benchmark on 256MB
Created October 13, 2011 14:41
Redis benchmarks on Rackspace Cloud servers
====== PING (inline) ======
10000 requests completed in 0.28 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.57% <= 1 milliseconds
100.00% <= 1 milliseconds
35211.27 requests per second
/*
* This is how we have to do it now.
*/
var buffers = [];
var nread = 0;
something.on('data', function(chunk) {
buffers.push(chunk);
nread += chunk.length;
});