Skip to content

Instantly share code, notes, and snippets.

View techwraith's full-sized avatar

Daniel Erickson techwraith

View GitHub Profile
Definition of “DigitalLocation”:
Instead of tracking your physical location, like GeoLocation does, DigitalLocation tracks your “Location” on the Web.
So, in short, DigitalLocation consists of a timestamp, a domain, a path, and any other meta-data that the consumer or
provider would like to attach.
Example DigitalLocation in a JSON format:
{
domain: “http://docs.google.com”,
path: “/a/techwraith.com/”,
var pFilters = [];
function togglePotatoes(pType) {
if (pFilters.indexOf(pType) > -1) {
pFilters.splice(pFilters.indexOf(pType),1);
} else {
pFilters.push(pType);
}
console.log(pFilters.join(","));
$(pFilters.join(",")).hide('fast');
app.js
var thing = require('./foo');
thing.foo(); // "Hello World"
foo.js
exports.foo = function(){console.log("Hello World");
@techwraith
techwraith / test.js
Created July 7, 2011 20:15
Testing Kue
var kue = require('kue');
var jobs = kue.createQueue();
var i = 1;
var jobInterval = setInterval(function(){
console.log("creating job " + i + ".")
jobs.create('test', {title:"This is a test", thing:"another thing.", id: i});
i++;
},2000);
setTimeout(function(){
clearInterval(jobInterval);
@techwraith
techwraith / scopage.js
Created July 27, 2011 07:20
What scope is name, foo, and bar in?
var name = 'test'
var foo = 'foo';
var bar = 'bar';
var func = function(arg1, arg2) {
console.log(arg1, arg2, this.name);
};
var obj = {
name: 'something new'
@techwraith
techwraith / gist:1223215
Created September 16, 2011 21:32
Create an express app with stylus as the default css lang
$ npm install -g express
$ express /tmp/foo -c "stylus" && cd /tmp/foo
$ npm install -d
this.toObj = function () {
var obj = {};
for (var p in this) {
// For some reason if this has more than one if statement
// or if the if is checking more than one thing via "||" it
// completely ignores it and assumes it's true
if ( (typeof this[p] != 'function') && p != 'adapter' && p != 'type') {
obj[p] = this[p];
}
var Item = function () {
this.defineProperties({
name: {type: 'string'}
});
this.findByName = function (name, callback) {
geddy.model.Item.all({name: name}, callback);
}
}
for (var i in ModelDefinition) {
if (ModelDefinition.hasOwnProperty(i)) {
defined[i] = ModelDefinition[i];
}
}
// Send a static file path
sendStaticFile = function (p) {
staticResp = new response.Response(resp);
// May be a path to a directory, with or without a trailing
// slash -- any trailing slash has already been stripped by
// this point
if (fs.statSync(p).isDirectory()) {
// TODO: Make the name of any index file configurable
<<<<<<< HEAD