Skip to content

Instantly share code, notes, and snippets.

View bobzhang's full-sized avatar
🎯
Focusing

Hongbo Zhang bobzhang

🎯
Focusing
View GitHub Profile
open Format
open Dynlink
let () = try
print_endline "init";
Dynlink.init ();
print_endline "allowing unsafe modules";
Dynlink.allow_unsafe_modules true;
Dynlink.loadfile "/home1/h/hongboz/ocaml/lib/ocaml/stdlib.cma";
Dynlink.loadfile
@bobzhang
bobzhang / define-node.js
Last active August 29, 2015 14:27 — forked from neonstalwart/define-node.js
Add AMD/define() support to NodeJS
// Credit: this is derived from a combination of
// - https://gist.github.com/650000
// - https://github.com/joyent/node/pull/350
// - https://github.com/ajaxorg/cloud9/blob/master/support/requireJS-node.js
var path = require('path'),
fs = require('fs'),
defaultCompile = module.constructor.prototype._compile,
defaultResolveFilename = module.constructor._resolveFilename,
// this gives the main module a chance to use define iff it does so before any other module
// Generated CODE, PLEASE EDIT WITH CARE
'use strict';
var invalid_argument = /* tuple */[
248,
"Invalid_argument",
-3
];
var not_found = /* tuple */[
// Generated CODE, PLEASE EDIT WITH CARE
'use strict';
var invalid_argument = /* tuple */[
248,
"Invalid_argument",
-3
];
@bobzhang
bobzhang / error.log
Created July 11, 2016 02:54
error log
reason-demo>npm run build
^[[?25h
> @ build /Users/hongbozhang/git/bucklescript-addons/examples/reason-demo
> source dependencyEnv && bsc -pp ./node_modules/reason/refmt_impl.native -impl hello.re
/Users/hongbozhang/git/bucklescript-addons/examples/reason-demo/node_modules/dependency-env/.bin/dependencyEnv.js:60
packageName.replace(new RegExp("\-", "g"), function(s){return "_";}).toUpperCase() + "__";
^
TypeError: Cannot read property 'replace' of undefined
git>npm install -g https://github.com/npm-ml/merlin.git
npm ERR! addLocal Could not install /var/folders/df/dh8jkb254qv48cfc0_rhmkf00000gn/T/npm-48145-1a0fbf19/git-cache-3e4efa99/4116bf8bedbaf927784a9d7e05ccd4430bcd7990
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "https://github.com/npm-ml/merlin.git"
npm ERR! node v4.2.1
npm ERR! npm v3.10.5
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read
external to_str : 'a -> string = "js_anything_to_string"
external to_json_string : 'a -> string = "js_json_stringify"
let debug x = print_endline (to_str x )
let pprint x = print_endline (to_json_string x)
let rec fib = function
| 1 | 2 -> 1
| n -> fib (n - 1 ) + fib (n - 2)
(** Imperative style *)
let sum n =
let v = ref 0 in
let f x y = x + y

AsciiDoc User Guide

AsciiDoc is a text document format for writing notes, documentation,