Skip to content

Instantly share code, notes, and snippets.

View natevw's full-sized avatar

Nathan Vander Wilt natevw

View GitHub Profile
function(head, req) {
// !code lib/mustache.js
// !json templates.thumbnails
//var databaseURL = "http://stravinsky.local:5984/a70_digipics/";
//var databaseURL = "http://dvorak.local:5984/temp/";
var databaseURL = "/temp/";
// requires moustache.js is_array function patched to return (a instanceof Array);
function RowArray(rowToObject) {
function(head, req) {
// !code lib/mustache.js
// !json templates.thumbnails
//var databaseURL = "http://stravinsky.local:5984/a70_digipics/";
//var databaseURL = "http://dvorak.local:5984/temp/";
var databaseURL = "/temp/";
// requires moustache.js is_array function patched to return (a instanceof Array);
function RowArray(rowToObject) {
/*
mustache.js — Logic-less templates in JavaScript
See http://mustache.github.com/ for more info.
Rewrite as parser by Nathan Vander Wilt, 2010 May 22
*/
var Mustache = function() {
// `sender` is a function to buffer or stream parsed chunks
function toDate(rfc3399) {
var parts, date, time, MA;
// TODO: ES5 conformant Date.parse can handle RFC3399 directly!
// "2010-07-28T00:00:00.5Z" to "28 Jul 2010 00:00:01 GMT"
// "2010-07-28T00:00:00.5-07:00" to "28 Jul 2010 00:00:01 GMT"
parts = rfc3399.split("T");
date = parts[0];
//
// NSDateFormatter+TLAdditions.m
// originally part of Geotagalog
//
// Created by Nathan Vander Wilt on 11/19/09.
// Copyright 2009 Calf Trail Software, LLC. Released under MIT license.
//
#import "NSDateFormatter+TLAdditions.h"
@natevw
natevw / ShutterStem iPhoto import
Created October 31, 2010 01:00
Instructions for using *a webpage* to migrate a local iPhoto library into CouchDB
My little experiment with sticking to HTML5 to import from a local iPhoto library seems to have yielded some good results. You can try it out yourself without even touching Terminal.app:
Get CouchDB setup with ShutterStem:
1. Download and launch the "CouchDBX" application from http://www.couchone.com/get
2. Go to http://localhost:5984/_utils and create a database named 'photos'
3. Go to http://localhost:5984/_utils/replicator.html and replicate from remote database http://natevw.couchone.com/shutterstem to local database 'photos' (you can leave Continuous unchecked)
Now import your iPhoto photos:
1. Go to http://localhost:5984/photos/_design/webviewer/index.html and download the importer
2. Open the downloaded ShutterStem importer **in Safari** **from the local file** (Chrome, FF, etc. won't work) and follow its instructions
@natevw
natevw / gist:749615
Created December 21, 2010 07:27
feed-test
<feed xmlns="http://www.w3.org/2005/Atom">
<title>a glob of nerdishness</title>
<id>http://www.extinguishedscholar.com/wpglob/?feed=atom</id>
<link href="" rel="self"/>
<generator>CouchApp on CouchDB</generator>
<updated>2010-11-27T16:52:00Z</updated>
<author>
<name>Nathan Vander Wilt</name>
</author>
<entry xml:base="http://rimsky-korsakov.local:5984/dev/_design/glob/_show/post/a_test_post">
@natevw
natevw / gist:849343
Created March 1, 2011 16:03
Quick-and-dirty ShutterStem installation notes

To get the basic ShutterStem installed into CouchDB:

  1. Get CouchDB running (http://couchdb.apache.org/#download)
  2. Replicate http://natevw.couchone.com/shutterstem to a database on your local CouchDB server (using http://localhost:5984/_utils/replicator.html) or couchapp push the source code

If you want to use import/export, you'll need to setup local helper:

  1. git clone -b master git://github.com/natevw/ShutterStem.git
  2. In a JavaScript console of http://localhost:5984/database_name/_design/shutterstem/index.html run the following:
@natevw
natevw / test.js
Created April 1, 2011 13:04
node.js shell executes line twice if it returns function and doesn't end in semicolon
exports.get_funky = function () {
console.log("funky");
return function () {};
}
exports.get_nuffin = function () {
console.log("nuffin");
}
/*
@natevw
natevw / +d3.js
Created July 5, 2011 00:42
Bookmarklet to add D3.js to any page (for fun. or...for profit!)
javascript:(function(s){s=document.createElement('script');s.src="http://mbostock.github.com/d3/d3.js";document.head.appendChild(s);})()