Skip to content

Instantly share code, notes, and snippets.

@quickredfox
quickredfox / twitter-oauth.js
Created July 26, 2012 03:28 — forked from santosh79/twitter-oauth.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('util');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = process.env['TWITTER_CONSUMER_KEY'];
var _twitterConsumerSecret = process.env['TWITTER_CONSUMER_SECRET'];
console.log("_twitterConsumerKey: %s and _twitterConsumerSecret %s", process.env['TWITTER_CONSUMER_KEY'], process.env['TWITTER_CONSUMER_SECRET']);
phantom stdout: TypeError: 'null' is not an object (evaluating 'document.getElementById("CheckList")')
phantom stdout: http://www.hoerner.ca/:619 in CheckListPDF
http://www.hoerner.ca/:622
Site: http://www.hoerner.ca
Start Time: Mon Sep 24 2012 23:17:19 GMT-0400 (EDT)
End Time: Mon Sep 24 2012 23:17:25 GMT-0400 (EDT)
Duration: 6.222s.
Pipeline = ( objects )->
unless @ instanceof Pipeline then return new Pipeline( objects )
events.EventEmitter.call pipe = @
unless objects instanceof Array then objects = [ objects ]
pipe.objects = objects
pipe.filter = ( filters, callback )->
if typeof filters is 'function'
callback = filters
filters = null
pipe.metas = []
@quickredfox
quickredfox / class.js
Created October 4, 2012 15:35
How to write a decent javascript class, without bloating it with frameworks.
// constructor
var MyClass = function( instanceOptions ){
// Make sure we're a new object (can be used without "new" constructor ie: new MyClass({}) === MyClass({}) )
if( !(this instanceof MyClass) ) return new MyClass( instanceOptions );
var myPrivateVar = "This variable cannot be accessed outside my any means whatsoever.";
this.myPublicVar = "This variable can be read and modified by anyone";
var self = this; // use this for references to "this" within callbacks and stuff.
// you can write accessors for you private vars if you need.
this.myPrivateVarAccessor = function(){ return myPrivateVar }
// Gotcha! If it's an object or array of objects it/they can be modified!!!
{
"1": {
"labels": {
"de": "Factual Orte",
"es": "Lugares Factual",
"en": "Factual Places",
"fr": "Endroits de Factual",
"it": "Luoghi Factual",
"jp": "Factual 場所",
"kr": "Factual 장소",
@quickredfox
quickredfox / color-codes.md
Created October 30, 2012 16:37
Initial Design Specs.

Need HEX color codes for:

Hero Unit

  • Yellow text: #fde46e

Badges

Orange

@quickredfox
quickredfox / app.js
Created December 4, 2012 22:55 — forked from marlun/app.js
Using stylus with Express.js
/**
* Module dependencies.
*/
var express = require('express')
, stylus = require('stylus');
var app = express.createServer();
// This must be BEFORE other app.use
@quickredfox
quickredfox / express-stylus.html
Created December 4, 2012 22:56 — forked from bentruyman/express-stylus.html
Using Stylus Middleware with Express
<!doctype html>
<html lang="en">
<head>
<title>My Web Page</title>
<meta charset="utf-8">
<link href="/stylesheets/main.css" rel="stylesheet">
</head>
<body>
</body>
</html>
@quickredfox
quickredfox / perlincanvas.js
Created December 9, 2012 17:36 — forked from donpark/perlincanvas.js
Rendering Perlin Noise Fast to HTML5 Canvas
/* Following canvas-based Perlin generation code originates from
* iron_wallaby's code at: http://www.ozoneasylum.com/30982
*/
function randomNoise(canvas, x, y, width, height, alpha) {
x = x || 0;
y = y || 0;
width = width || canvas.width;
height = height || canvas.height;
alpha = alpha || 255;
var g = canvas.getContext("2d"),
@quickredfox
quickredfox / grid-system.less
Created January 23, 2013 19:31
World's smallest .LESS grid system.
@full:960;
@half:480;
@third:320;
@fourth:240;
@eighth:120;