Skip to content

Instantly share code, notes, and snippets.

View jchris's full-sized avatar

Chris Anderson jchris

View GitHub Profile
@jchris
jchris / example.go
Created November 14, 2016 20:26
Executable example for FaunaDB Go release blog post
package main
import (
"fmt"
f "github.com/faunadb/faunadb-go/faunadb"
)
// I guess we can blog about how easy is to integrate your data structures with fauna using the go driver
// which, in my opinion, is one of the easiest so far.
@jchris
jchris / portfolio.md
Last active October 13, 2016 17:19
Code Portfolio

This is a non-exhaustive list of (mostly) open source work in roughly chronological order. Most of my production code is in Erlang, JavaScript, and Go, with application code in JavaScript, Objective-C, and C#. The theme that emerges is a focus on developer experience, and on pushing the envelope for edge compute.

Ruby on Rails

Apache CouchDB _users database

@jchris
jchris / _README.md
Last active September 25, 2015 13:29 — forked from brett19/_README.md

This is a listing of various examples used for the Couchbase Go SDK GA Release Blog.

Blog Post

@jchris
jchris / Couchbase Lite with React Native.md
Last active May 4, 2018 04:29
Couchbase Lite with React Native

Couchbase Lite with React Native

I went into this expecting a challenge but it was easy. Basically, Couchbase Lite has always had an optional HTTP listener that you can connect to from inside your app at http://lite.couchbase./mydatabase/. React Native has a fine XHR module and encourages using fetch so getting your app to sync can be as easy as adding some API calls to keep JSON in the database.

We haven't done a full example yet, but in the spirit of possiblity, here are quick instructions to connect Couchbase Lite iOS with a React Native app (generated from their cli).

// MARK: - Listener
func startListener() -> Bool {
if listener != nil {
return true
}
var error: NSError?
listener = CBLListener(manager: CBLManager.sharedInstance(), port: 0)
// Enable Basic Authentication
2015-02-09 13:55:51.265 TodoLite[25539:1536873] Apache Cordova native platform version 3.7.0 is starting.
2015-02-09 13:55:51.265 TodoLite[25539:1536873] Multi-tasking -> Device: YES, App: YES
2015-02-09 13:55:51.268 TodoLite[25539:1536873] Unlimited access to network resources
2015-02-09 13:55:51.271 TodoLite[25539:1536873]
Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
passes: 1176failures: 2duration: 196.48s
test.attachments.js- local:local
Many many attachments replicate ‣
AssertionError: expected '' to equal 'Zm9vYmFy'
at http://127.0.0.1:8000/tests/integration/test.attachments.js:1948:47
Many many png attachments replicate ‣
AssertionError: expected '' to equal 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAMFBMVEX+9+j+9OD+7tL95rr93qT80YD7x2L6vkn6syz5qRT4ogT4nwD4ngD4nQD4nQD4nQDT2nT/AAAAcElEQVQY002OUQLEQARDw1D14f7X3TCdbfPnhQTqI5UqvGOWIz8gAIXFH9zmC63XRyTsOsCWk2A9Ga7wCXlA9m2S6G4JlVwQkpw/YmxrUgNoMoyxBwSMH/WnAzy5cnfLFu+dK2l5gMvuPGLGJd1/9AOiBQiEgkzOpgAAAABJRU5ErkJggg=='
at http://127.0.0.1:8000/tests/integration/test.attachments.js:1987:47
test.attachments.js-http
#3074 non-live changes() ‣
AssertionError: when attachments=true: expected [ Array(5) ] to deeply equal [ Array(5) ]
at Assertion.assertEqual (http://127.0.0.1:8000/node_modules/chai/chai.js:1378:19)
at Assertion.ctx.(anonymous function) [as equal] (http://127.0.0.1:8000/node_modules/chai/chai.js:3627:25)
at http://127.0.0.1:8000/tests/integration/test.attachments.js:231:33
#3074 live changes() ‣
AssertionError: when attachments=true: expected [ Array(5) ] to deeply equal [ Array(5) ]
at Assertion.assertEqual (http://127.0.0.1:8000/node_modules/chai/chai.js:1378:19)
at Assertion.ctx.(anonymous function) [as equal] (http://127.0.0.1:8000/node_modules/chai/chai.js:3627:25)
@jchris
jchris / index.js
Created November 7, 2014 17:24
requirebin sketch
require('tap-browser-color')();
var test = require("tape");
var dbName = "safari_test2";
test("clear old", function(t) {
indexedDB.deleteDatabase(dbName).onsuccess = function(){
t.end()
}
@jchris
jchris / index.js
Created November 7, 2014 17:23
safari indexeddb bug
require('tap-browser-color')();
var test = require("tape");
var dbName = "safari_test2";
test("clear old", function(t) {
indexedDB.deleteDatabase(dbName).onsuccess = function(){
t.end()
}