This file contains 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
// 1. Variable declaration | |
def myValue = 'value, immutable'; | |
def myObjectValue = { a: 10 }; | |
myObjectValue.b = 20; // TypeError | |
myObjectValue.a = 12; // TypeError | |
def myArrayValue = [ 10, 20 ]; | |
myArrayValue.slice(1); // is okay, slice is pure | |
myArrayValue.pop(); // TypeError | |
myArrayValue.splice(); // TypeError |
This file contains 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 net = require('net'); | |
var LineInputStream = require('line-input-stream'); | |
var END_MESSAGE = new Buffer("Thank you for using the nodejs doubling service\n"); | |
var server = net.createServer(function(socket) { | |
var processLine = function(line) { | |
if (line.trimRight() === 'end') { |
This file contains 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
> CSON.parse('a: 2\n b: 3\n c: 4') | |
Error: Syntax error on line 3: indentation is ambiguous | |
1 : a: 2 | |
2 : b: 3 | |
3 : c: 4 | |
^ :~~^ | |
at Preprocessor.Preprocessor.consumeIndentation (/Users/jankrems/Projects/itier/libs/cson-safe/node_modules/coffee-script-redux/lib/preprocessor.js:155:17) | |
at Preprocessor.Preprocessor.process (/Users/jankrems/Projects/itier/libs/cson-safe/node_modules/coffee-script-redux/lib/preprocessor.js:190:14) | |
at Function.Preprocessor.Preprocessor.process (/Users/jankrems/Projects/itier/libs/cson-safe/node_modules/coffee-script-redux/lib/preprocessor.js:22:38) | |
at Object.CoffeeScript.parse (/Users/jankrems/Projects/itier/libs/cson-safe/node_modules/coffee-script-redux/lib/module.js:47:35) |
This file contains 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
Stream.pipe = async function(source, target) { | |
let chunk; | |
// source.read() will throw if there's an error | |
// reading data | |
while (chunk = source.read()) { | |
target.write(await chunk); | |
} | |
// .end will throw when there were errors | |
return target.end(); | |
}; |
This file contains 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 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 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 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 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 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": "commander@2.0.0", | |
"resolved": "https://registry.npmjs.org/commander/-/commander-2.0.0.tgz" |
OlderNewer