Skip to content

Instantly share code, notes, and snippets.

View zgramana's full-sized avatar

Zachary Gramana zgramana

View GitHub Profile
@zgramana
zgramana / Install.md
Created January 7, 2017 00:16 — forked from chirag04/Install.md
compile rocksdb as backend for asyncstorage

Credits

All credit to @sahrens for sharing fb's internal implementation.

Setup

ifeq ($(PLATFORM), IOS)
# For iOS, create universal object files to be used on both the simulator and
@zgramana
zgramana / word2vec.fsx
Created September 22, 2016 22:43 — forked from mathias-brandewinder/word2vec.fsx
Word2Vec experiment
#I "../packages/"
#r @"FSharp.Data/lib/net40/FSharp.Data.dll"
#r @"StemmersNet/lib/net20/StemmersNet.dll"
#r @"FSharp.Collections.ParallelSeq/lib/net40/FSharp.Collections.ParallelSeq.dll"
#load "Utilities.fs"
open FSharp.Data
@zgramana
zgramana / LICENSE
Created July 12, 2016 21:50 — forked from kerryrodden/.block
Sequences sunburst
Copyright 2013 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@zgramana
zgramana / auto-merge.cs
Created April 12, 2016 20:18
Auto-merging conflicting revisions in C# using LINQ
Dictionary<string, object> mergedProps;
try
{
mergedProps = doc.ConflictingRevisions
.SelectMany(rev => rev.UserProperties)
.Distinct()
.ToDictionary(
kvp => kvp.Key,
kvp => kvp.Value
@zgramana
zgramana / swagger.json
Last active January 26, 2016 03:04
Init POC of generated Swagger spec
{
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
@zgramana
zgramana / package.sh
Created August 11, 2015 22:56
Creates a standalone OSX executable of our cp-replicate .NET app.
#!/bin/sh
export AS="as -arch i386”
export CC="cc -framework CoreFoundation -lobjc -liconv -arch i386”
mkbundle --deps --static -o cb-replicate cbreplicate.exe *.dll
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig
export LD_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/
cd /Users/zgramana/Source/cb-replicate/bin/Release/
mkbundle--deps --static -o cb-replicate cbreplicate.exe *.dll
@zgramana
zgramana / get_changes.go
Created May 23, 2015 00:39
Gets the changes feed and prints the results.
package main
import "fmt"
import "io/ioutil"
import "net/http"
func main() {
// Changes Feed (GET http://127.0.0.1:4984/db/_changes?feed=longpoll&limit=50&heartbeat=300000&style=all_docs&since=1&include_docs=false)
@zgramana
zgramana / couchbase-lite-demo.csx
Last active August 29, 2015 14:19
Simple first script to create a bunch of docs and replicate them.
// Run `scriptcs -install Couchbase.Lite` to fetch Couchbase Lite from Nuget.
#r Couchbase.Lite.dll
using Couchbase.Lite;
var db = Manager.SharedInstance.GetDatabase("scriptcs");
db.RunInTransaction(()=>
{
@zgramana
zgramana / TaskExtensions.cs
Last active August 29, 2015 14:16
Task.Delay backport
using System;
using System.Threading.Tasks;
using System.Threading;
namespace Couchbase.Lite.Shared
{
public static class TaskExtensions
{
static int CheckTimeout (TimeSpan timeout)
{
@zgramana
zgramana / info_swap.js
Created December 9, 2014 17:32
Sync Function Snippets
if (doc.type == "contactexchange") {
// trade access to each user's contact channel
access(doc.userId, "contact-" + doc.localUserId);
access(doc.localUserId, "contact-" + doc.userId);
}