Skip to content

Instantly share code, notes, and snippets.

View dpeek's full-sized avatar

David Peek dpeek

View GitHub Profile
@dpeek
dpeek / bif.js
Created February 28, 2018 10:38
BIF Parser
function Buffer(a) {
this.buffer = a;
this.position = 0;
}
Buffer.prototype = {
seek: function(a) {
this.position = a;
},
skip: function(a) {
this.position += a;
@dpeek
dpeek / docker-compose.yml
Created December 17, 2017 14:43
Docker Compose Dgraph
version: '3'
services:
data:
image: dgraph/dgraph:master
volumes:
- dgraph:/dgraph
zero:
image: dgraph/dgraph:master
command: dgraph zero --port_offset -2000 --my=zero:5080
///////////////////////////////////////////////////// TAKE 1
http://localhost:8080/mutate
{ set {
_:node <__typename> "Person" .
_:node <name> "Tim" .
_:node <children> _:node0 .
_:node0 <parents> _:node .
_:node0 <__typename> "Person" .
_:node0 <name> "Jerry" .
@dpeek
dpeek / dgraph.sh
Last active December 10, 2018 23:48
Install Go and Dgraph on AWS ubuntu AMI and run as service
#!/bin/bash
# install dgraph
sudo apt-get update -y
sudo apt-get install -y gcc
curl https://get.dgraph.io -sSf | bash
# create dgraph.service
sudo bash -c 'cat << EOF > /etc/systemd/system/dgraph.service
[Unit]
/* @flow */
type ErrorResponse = {
code: 'Error',
message: string
}
type ResultResponse = {}
function test (): Promise<ResultResponse | ErrorResponse> {
package haxe;
typedef Error =
#if !native_error
String;
#elseif js
js.Error;
#elseif flash
flash.errors.Error;
#elseif java
import haxe.macro.Type;
using haxe.macro.Tools;
using Lambda;
class Test
{
static function main() new Test();
function new()
{
class Test
{
static function main()
{
try nativeException() catch (e:Dynamic) trace(haxe.CallStack.exceptionStack());
try haxeException() catch (e:Dynamic) trace(haxe.CallStack.exceptionStack());
}
static function haxeException() throw 'error';
static function nativeException() sys.io.File.getContent('file-that-does-not-exist.txt');
@dpeek
dpeek / gist:7885802
Last active December 30, 2015 21:09
hscript callbacks
// compile with:
// haxe -main Test -swf test.swf -lib hscript
class Test extends flash.display.Sprite
{
static function main() flash.Lib.current.addChild(new Test());
function new()
{
super();
@dpeek
dpeek / gist:7803958
Created December 5, 2013 11:41
Building Haxe for Android
$ mkdir haxe-droid && cd haxe-droid
$ git clone https://github.com/vouillon/ocaml-android.git
$ git clone https://github.com/HaxeFoundation/haxe.git
$ http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86.tar.bz2
$ tar -vjxf android-ndk-r9b-darwin-x86.tar.bz2 && rm android-ndk-r9b-darwin-x86.tar.bz2 && mv android-ndk-r9b android-ndk
$ wget http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01.0.tar.gz
$ tar -xzf ocaml-4.01.0.tar.gz && rm ocaml-4.01.0.tar.gz && mv ocaml-4.01.0 ocaml-src