Skip to content

Instantly share code, notes, and snippets.

@nilclass
nilclass / gist:6404631
Created September 1, 2013 13:57
CouchDB design document to convert some JSON points (custom format (I think?)) into a MultiPoint GeoJSON thingy.
{
"_id": "_design/timeline",
"_rev": "25-ccec1e8c0085a9b130b5f5289ae99d4b",
"views": {
"bySavedTime": {
"map": "function (doc) {\n if(doc.data && doc.data.position && typeof(doc.data.position.timestamp) == 'number') {\n emit([doc.channel, doc.data.position.timestamp], doc);\n }\n}"
}
},
"lists": {
"multipoint": "function(head, req) { var feature = { type: 'Feature', geometry: { type: 'MultiPoint', coordinates: [] }, properties: { time: [] } }; var row; while(row = getRow()) { if(row.value.data && row.value.data.position && row.value.data.position.coords && typeof(row.value.data.position.timestamp) == 'number') { var pos = row.value.data.position; feature.geometry.coordinates.push([pos.coords.longitude, pos.coords.latitude]); feature.properties.time.push(pos.timestamp); } } start({ headers: { 'Content-Type': 'application/json' } }); send(JSON.stringify(feature)); }"
[INFO - 2013-06-26T14:13:07.058Z] [worker #2] [http] server is listening on port 10550
/// HERE I CONNECTED
[INFO - 2013-06-26T14:13:09.693Z] [worker #1] [ws] server: connection accepted [protocol: sockethub]
[DEBUG - 2013-06-26T14:13:09.693Z] [worker #1] [dispatcher:1372255989693] subscribed to channel sockethub:1372255983017:dispatcher:outgoing:1372255989693
[INFO - 2013-06-26T14:13:09.695Z] [worker #1] [session] created sid 1372255989693.
[INFO - 2013-06-26T14:13:09.756Z] [worker #1] [dispatcher:1372255989693] received message
Possibly uncaught error: Cannot read property 'screenname' of undefined
TypeError: Cannot read property 'screenname' of undefined
at http://localhost:1722/helpers.js:37:20
at Array.forEach (native)
at fill_div (http://localhost:1722/helpers.js:34:11)
at set_profile (http://localhost:1722/main.js:111:5)
at s (http://remotestoragejs.com/release/0.7.2/remotestorage.min.js:45:6501)
at http://remotestoragejs.com/release/0.7.2/remotestorage.min.js:45:7216
diff --git a/src/trie.c b/src/trie.c
index 551748f..d6c79e4 100644
--- a/src/trie.c
+++ b/src/trie.c
@@ -1,24 +1,47 @@
-
-#include "remotestorage-fuse.h"
-
-#include <assert.h>
-
#include <math.h>
int offsetX = 514, offsetY = 504;
float minX = -270, maxX = 264;
float minY = -271, maxY = 278;
void setup() {
Serial.begin(9600);
}
@nilclass
nilclass / gist:5269677
Created March 29, 2013 09:04
Combining Ember and remoteStorage.js
var CONNECTED_INDEX_ROUTE = "index";
var CONNECTED_INDEX_ROUTE = "main";
// a function to initialize remoteStorage.js.
// I would call this from the "redirect" hook of each route,
// example see below.
function initializeRemoteStorage(route) {
return remoteStorage.claimAccess({
// <module> : <mode>
@nilclass
nilclass / gist:5152051
Created March 13, 2013 13:32
This script compares the performance of constructing an object with a bunch of methods from within a function and returning it, versus using a constructor with a prototype and the 'new' keyword.
//
// This script compares the performance of constructing an object
// with a bunch of methods from within a function and returning it,
// versus using a constructor with a prototype and the 'new' keyword.
//
// My results:
//
// node, v0.8.9:
// N = 1000000
@nilclass
nilclass / gist:4500881
Created January 10, 2013 09:57
proposal: promises for teste
// WITHOUT PROMISES:
tests: [
{
desc: "My async test",
run: function(env) {
var _this = this;
doSomethingThatReturnsAPromise().
then(
var server = require('./server/nodejs-example').server;
// BEFORE EACH TEST
server.resetState();
server.addToken('dummy-token', [':rw']); // gives read-write access on the root path
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 4c9b90c..faff2dd 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -16,6 +16,7 @@ begin
require "jsmin"
require "./config/directories"
+
def clean_dir(dir)