Skip to content

Instantly share code, notes, and snippets.

View kirbysayshi's full-sized avatar

Drew Petersen kirbysayshi

View GitHub Profile
@kirbysayshi
kirbysayshi / bothparsers.js
Created March 25, 2011 04:07
jsdom appears to favor its default parser vs another when they are used in the same script?
var jsdom = require('jsdom@0.2.0')
,fs = require('fs')
,testHtml = fs.readFileSync(__dirname + '/british_throne.html', 'utf8')
,html5 = require('html5')
,window
,document
,start = +new Date()
,end;
@kirbysayshi
kirbysayshi / app.js
Created April 22, 2011 23:38
troubleshooting spine.js
$(function(){
App = Spine.Controller.create({
el: $('body')
,elements: {
'#home': '$home'
,'#step-1': '$step1'
,'#step-2': '$step2'
@kirbysayshi
kirbysayshi / example.js
Created May 19, 2011 19:24
Detect if Flash is blocked (On-Demand) in Chrome
flashAvail({ waitFor: 10000 })
.done( function(result){
if(result.flashBlocked === false){
// do whatever you need flash for
} else {
// flash is installed but blocked. present messaging
alert('Oops!',
'It appears that Flash is being blocked. \
Flash is required for Grill Circle and Facebook. \
Please enable it and refresh the page.');
@kirbysayshi
kirbysayshi / main.cpp
Created June 9, 2011 04:14
attempt at using node-ffi, but node-ffi cannot find the symbols
#include <stdint.h>
#include <QtCore/QtGlobal>
#if defined(MYSHAREDLIB_LIBRARY)
# define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
#else
# define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
#endif
MYSHAREDLIB_EXPORT uint64_t factorial(int max) {
@kirbysayshi
kirbysayshi / StreamConsumer.js
Created June 10, 2011 22:25
consume twitter's public firehose using nodejs
var events = require('events')
,util = require('util')
,_ = require('underscore')
,http = require('http')
function StreamConsumer(options){
events.EventEmitter.call(this);
this.reEot = /.+\r\n/gm;
this.req = null;
@kirbysayshi
kirbysayshi / README.markdown
Created June 13, 2011 04:40
quick nodejs script to combine, possibly minify, scripts, as well as precompile templates:

This is a quick example of taking a config file (example.js), and running jscombine.js. It will bundle up regular scripts as well as templates (hard coded to use doT). Compiled templates are automatically added to a "templates" property on the given namespace (ns key in the example file), keyed by a slightly transformed version of their filename.

@kirbysayshi
kirbysayshi / meyerish.css
Created June 14, 2011 19:12
Various css resets in one location
/*********** Resets */
div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6,
pre, form, fieldset, input, textarea, p, blockquote, th, td { margin: 0; padding: 0; }
fieldset, img { border: 0; }
table { border-collapse: collapse; border-spacing: 0; }
ol, ul { list-style: none; }
address, caption, cite, code, dfn, em, strong, th, var { font-weight: normal; font-style: normal; }
caption, th { text-align: left; }
h1, h2, h3, h4, h5, h6 { font-weight: normal; font-size: 100%;}
q:before, q:after { content: ''; }
@kirbysayshi
kirbysayshi / csslinttest.css
Created June 15, 2011 22:11
css lint test css
@font-face {
font-family: 'NevisBold';
src: url('../font/nevis-webfont.eot');
src: url('../font/nevis-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/nevis-webfont.woff') format('woff'),
url('../font/nevis-webfont.ttf') format('truetype'),
url('../font/nevis-webfont.svg#nevisBold') format('svg');
font-weight: normal;
font-style: normal;
}
@kirbysayshi
kirbysayshi / LICENSE.txt
Created August 4, 2011 21:44 — forked from 140bytes/LICENSE.txt
when: Easily fire a callback when all deferreds are complete
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Andrew Petersen <http://kirbysayshi.github.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@kirbysayshi
kirbysayshi / LICENSE
Created August 6, 2011 05:35 — forked from kriskowal/LICENSE
Nano-promises
Copyright 2011 Kristopher Michael Kowal. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.