Skip to content

Instantly share code, notes, and snippets.

View zgramana's full-sized avatar

Zachary Gramana zgramana

View GitHub Profile
@zgramana
zgramana / ToNSDictionary.cs
Created October 2, 2013 20:33
Quick n dirty function to convert a System.Json.JsonValue to an NSDictionary.
using System.Json;
...
var response = "{ \"foo\": \"bar\" }";
var jsonValue = JsonValue.Parse (response) as JsonObject;
// Split the lambda declaration and initialization
// so that we can do recursion;
Func<JsonValue, NSDictionary> toNSDictionary;
toNSDictionary = (obj)=> {
@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

  • clone rocksdb from https://github.com/facebook/rocksdb.

  • edit MakeFile inside rocksdb. Search for Platform-specific compilation around line 1122. Make th next few lines to look like this:

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 / connect.sh
Last active January 4, 2016 20:19
Test Node + Express server.
curl http://localhost:3000/socket.io/1
@zgramana
zgramana / gist:8362306
Created January 10, 2014 20:49
Selected MonoDevelope/Xamarin Studio ProjectTypeGuids.
<DotNetProjectSubtype
guid="{e613f3a2-fe9c-494f-b74e-f63bcb86fea6}"
type="MonoDevelop.IPhone.IPhoneProject"
migrationHandler="MonoDevelop.IPhone.IPhoneProjectMigrationHandler" />
<DotNetProjectSubtype
guid="{6bc8ed88-2882-458c-8e55-dfd12b67127b}"
type="MonoDevelop.IPhone.IPhoneProject" />
<DotNetProjectSubtype
guid="{f5b4f3bc-b597-4e2b-b552-ef5d8a32436f}"
type="MonoDevelop.IPhone.IPhoneBindingProject"
If you want to debug your Xamarin app using LLDB to get a backtrace, then do the following:
1) Clone https://github.com/zgramana/ios-deploy (or download https://www.dropbox.com/s/8fl1t1qc5fdg5tn/ios-deploy)
2) Run `make` inside that folder.
3) Run `./ios-deploy -d -b path/to/bin/iPhone/Debug/MyFoo.app`
This will install your app and start it will lldb attached.
From the lldb prompt:
@zgramana
zgramana / make_copy_ctor.cs
Last active December 18, 2015 03:19
makes copy ctor
// References:
// - MyPreviouslyAdded.dll
// - MyGacced.dll
// Imports:
// - My.Namespace.Bitches
// - My.Other.Namespace
P("public Version(Version item)");
P("{");
var t = typeof(Version);
var props = t.GetProperties();