Skip to content

Instantly share code, notes, and snippets.

{
"1": {
"labels": {
"de": "Factual Orte",
"es": "Lugares Factual",
"en": "Factual Places",
"fr": "Endroits de Factual",
"it": "Luoghi Factual",
"jp": "Factual 場所",
"kr": "Factual 장소",
@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!!!
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 = []
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.
@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']);
@quickredfox
quickredfox / capped-object.js
Created June 20, 2012 19:35
CappedObject for Nic
var CappedObject = function( limit ){
items = {};
length = 0 ;
this.put = function( string ) {
if( items[string] ) return string;
items[string] = string;
length++;
if( length > limit ){
delete items[ Object.keys( items )[0]];
length --;
@quickredfox
quickredfox / example.sh
Created June 12, 2012 21:36
list files and directories with absolute paths in linux/unix/osx terminal
# Use this for dirs:
ls -d -1 $PWD/**
# this for files:
ls -d -1 $PWD/*.*
# this for everything:
var TermGroup;
TermGroup = function(options) {
this.name = options.name || ("termgroup-" + (new Date().getTime()));
this.terms = options.terms || [];
this.toString = function() {
return this.terms.join();
};
this.toJSON = function() {
return this.terms;
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap-Plus, from Needium</title>
<link rel="stylesheet" href="/css/bootstrap-plus.css" type="text/css" media="screen" title="no title" charset="utf-8">
<style type="text/css" media="screen">
body{padding-top:40px;}
</style>
</head>
<body data-spy="scroll">
@quickredfox
quickredfox / chest.md
Created May 4, 2012 19:24
The Github Pirates' Chest