Skip to content

Instantly share code, notes, and snippets.

@howardr
howardr / jquery.fontavailable.js
Created February 23, 2009 23:56
fontAvailable jQuery plugin v1.1
/* fontAvailable jQuery Plugin, v1.1
*
* Copyright (c) 2009, Howard Rauscher
* Licensed under the MIT License
*/
(function($) {
var element;
$.fontAvailable = function(fontName) {
@howardr
howardr / EventManager.js
Created May 27, 2009 14:36
EventManager v1.0.1, an easy custom event manager for javascript
/* EventManager, v1.0.1
*
* Copyright (c) 2009, Howard Rauscher
* Licensed under the MIT License
*/
(function() {
function EventManager() {
this._listeners = {};
// faster dequeue
// uses and array as prototype so all array methods are available.
// "unshift" has method overridden to not re-size the array
//
// var queue = new Queue();
function Queue() {
this._i = 0;
}
Queue.prototype = [];
/*
* Create an element on page that outputs info you pass it. I use it for IE6 testing
* Returns a unique element, and also overwrites console.log. Optionally you can pass in an id
* of an element for which to insert the debug element instead of document body.
*
* Usage:
* var debug = createDebugElement();
* debug.innerHTML = 'show my message';
*
* console.log('show my message');
@howardr
howardr / setup-statsd.sh
Created March 22, 2011 20:22 — forked from collegeman/setup-statsd.sh
Minor changes to statsd installation
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
mkdir ~/src
cd ~/src
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
@howardr
howardr / varnish-jsonp.vcl
Created April 5, 2011 17:14 — forked from simonw/varnish-jsonp.vcl
Vanish JSONP hack fork
backend default {
.host = "127.0.0.1";
.port = "8000";
}
# We go BACK to varnish to get it to generate an ESI template that
# generates a JSON-P response.
backend jsonp_template_backend {
.host = "127.0.0.1";
.port = "8070";
@howardr
howardr / basic-widget.html
Created April 14, 2011 15:41
Widget Specs Presentation example
// if you are from Austin JavaScript meetup,
// you can download presentation at http://bit.ly/widget_specs
<script src="http://awsmsite.com/widget.js?acnt=2800000&poll=1">
/*
NOTE: ^^^ putting script tag here to make it easier to visualize
that code is being executed inside of a script node
*/
// create iframe
@howardr
howardr / albers.js
Created June 6, 2011 20:41 — forked from RandomEtc/albers.js
An Albers Equal Area Conic projection in javascript, for protovis.
/*
An Albers Equal Area Conic projection in javascript, for protovis.
For centering the contiguous states of the USA in a 800x400 div, I used:
var scale = pv.Geo.scale(albers(23, -96, 29.5, 45.5))
.range({ x: -365, y: -375 }, { x: 1200, y: 1200 });
http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html
@howardr
howardr / gist:1015545
Created June 8, 2011 22:03 — forked from albertsun/gist:674563
Parse GeoJSON for Raphael
var allPolygons = [];
function setPolys(geom) {
/* geom: a GeoJSON object.
Parse geom, and add it as a child to the global Raphael object, R.
*/
//geom.type either Polygon or MultiPolygon
var translationFunction = function(coords) {
var projected = Projections.contiguous.forward(coords);
var x = 217+(projected[0]*190/2400000);
<script type="text/javascript">
tweetriver.widget.ready(function(widget) {
widget.use(function() {
var element = this.elem;
function update_icons() {
// put code in here...it will update when new data comes in
}