Skip to content

Instantly share code, notes, and snippets.

View esatterwhite's full-sized avatar
:octocat:

Eric Satterwhite esatterwhite

:octocat:
View GitHub Profile
@esatterwhite
esatterwhite / ModalForm.js
Created April 26, 2011 20:48
ExtJS User Group Modal Form Example
/**
* Base Module for Generic Components
* @module Blackjack
*/
/**
* Class for creating Modal form objects.
* Meant to work with Blackjack.FormFactory
* @extends Ext.Window
* @namespace Blackjack
@esatterwhite
esatterwhite / ModelForm.js
Created July 26, 2011 13:37
Class For rendering and validating forms in Sencha Touch
/**
* Module for General utility functions and classes
* @module utils
*
*/
Ext.ns('BlackjackM','BlackjackM.utils', 'BlackjackM.utils.forms');
/**
* A class which renders and validates a form based on a Ext.data.Model or Model instace
@esatterwhite
esatterwhite / log.js
Created August 26, 2011 18:20
AMD Style module for adding logging to existing objects
/**
*
* AMD module for logging function calls. Intended for use with require.js ( http://www.requirejs.org )
* inspired by Mootools Log ( https://github.com/mootools/mootools-more/blob/1.2x/Source/Core/Log.js )
* and js-klib ( http://code.google.com/p/js-klib/source/browse/klib.js )
* @author Eric Satterwhite
* @module log
*/
define(['require','exports','array'],function(require, exports, array){
var has_log = ( console && console.log );
@esatterwhite
esatterwhite / index.html
Created December 8, 2011 16:11
Live Twitter feed for Node.js, spark & mootools
<html>
<head>
<title>Socket.IO Example</title>
<script src="http://apollo.dyn.mke.corvisa.com:8080/static/js/mootools.js"></script>
<script src="http://apollo.dyn.mke.corvisa.com:4000/socket.io/socket.io.js"></script>
<style>
html,body{background:#888;}
h1{color:#FF9900;font-family:'Trebuchet MS',helvetica, arial, sans-serif;border-bottom:1px solid #333; padding:6px;margin-bottom:4px;text-shadow:#333 0 1px 0;}
ul{margin:0;padding:0;}
#tweets li{
@esatterwhite
esatterwhite / api.py
Created May 11, 2012 11:58
Returning data on POST request with Tastypie
'''
Generates a stupid api the illustrates returning POST data from tastypie
'''
import random
import shelve
from hashlib import md5
from datetime import datetime
from django.utils import simplejson
from tastypie.resources import Resource
from tastypie.authorization import ReadOnlyAuthorization, DjangoAuthorization, Authorization
var zmq = require("zmq")
var pub = zmq.createSocket("pub")
pub.bind("tcp://127.0.0.1:19019");
var x = 0
setInterval(function(){
console.log('publishing')
pub.send('foobar ' + ( ++x ) )
},250)
var zmq = require( "zmq" )
, xpub // xpub to redistribute messages over known port
, xsub; // xsub to recieve incomming messaes
var xpub_url = 'tcp://0.0.0.0:9999'
var xsub_url = 'tcp://0.0.0.0:9998';
var noop = function(){"use strict";}
xpub = zmq.socket( "xpub" );
xsub = zmq.socket( "xsub" );
{
"apps" : [{
"name" : "Alice",
"script" : "/home/esatterwhite/dev/js/spiritshop-api/server.js",
"instances": 3,
"port":3001,
"env": {
"logger": "stdout",
"log__stdout__prettyPrint":0,
"NODE_PATH":"/home/esatterwhite/dev/js/spiritshop-api/packages"
@esatterwhite
esatterwhite / conf.js
Created December 11, 2014 20:21
Config the everything
/*jshint node:true, laxcomma: true, smarttabs: true*/
'use strict';
/**
The conf package reads configurations options in an overriding fashion from a number of sources. In order of importance:
1. System level overrides
2. Command line arguments
3. Environment variables
4. A configuration file(s)
5. System specified defaults
<snippet>
<content><![CDATA[
/**
* Description
* @constructor
* @alias module:$TM_FILENAME
* @param {TYPE} [param]
* @param {TYPE} [?param.val=1j]
* @example var x = new require('$TM_FILENAME');
* @tutorial <tutorial-name>