This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dispatch req = Http.OK (sprintf! "Hello, %s" req.url) | |
let server = Http.Server port: 8000, dispatch | |
// OR: | |
let server = Http.Server { port: 8000 }, dispatch | |
// OR: | |
let server = Http.Server { port: 8000, dispatch: dispatch } | |
async { | |
let socket = await server.socket; // alternative: *server.socket |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type id = string | |
type binop = Plus | Minus | Times | Div | |
type stm = CompoundStm of stm * stm | |
| AssignStm of id * exp | |
| PrintStm of exp list | |
and exp = IdExp of id | |
| NumExp of int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vm = require('vm'); | |
function fancyPromiseEval(code, context, file, cb) { | |
var err, result, script; | |
// first, create the Script object to check the syntax | |
try { | |
script = vm.createScript(code, { | |
filename: file, | |
displayErrors: false | |
}); | |
} catch (e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.register("let", [], function() { | |
"use strict"; | |
var __moduleName = "let"; | |
{ | |
try { | |
throw undefined; | |
} catch (x) { | |
x = 10; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @jsx React.DOM | |
*/ | |
'use strict'; | |
import {resolve} from 'bluebird'; | |
import React from 'react'; | |
import {getParam} from 'quinn'; // actually should be 'quinn-router' | |
import respond from 'quinn-respond'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mocha", | |
"version": "1.20.1", | |
"from": "mocha@^1.20.1", | |
"resolved": "https://registry.npmjs.org/mocha/-/mocha-1.20.1.tgz", | |
"dependencies": { | |
"commander": { | |
"version": "2.0.0", | |
"from": "[email protected]", | |
"resolved": "https://registry.npmjs.org/commander/-/commander-2.0.0.tgz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function each() {} | |
export function map() {} | |
export function reduce() {} | |
export function isEmpty() {} | |
export function extend() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint node:true, esnext:true */ | |
'use strict'; | |
// Run: node --harmony_proxies --harmony-collections safe-map.js | |
function createSafeObject(props) { | |
if (typeof props !== 'object' || props === null) { | |
props = {}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var http = require('http'); | |
var React = require('react'); | |
var $ = React.DOM; | |
var _ = require('lodash'); | |
var respond = require('quinn-respond'); | |
var resolveDeep = require('resolve-deep'); | |
var Promise = require('bluebird'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var entityId = 'xy'; | |
var loadEntity = cached.deferred(_.partial(myService.fetch, '/entity/' + entityId)); | |
cached('myService').getOrElse(entityId, loadEntity, function(err, entity) { | |
// 80% of time this works every time | |
}); |