.s
- Show the stack+
,-
,*
,mod
- Math operators/mod
- performs both / and mod
drop
and2drop
- drop a stack item (once / twice)dup
- duplicate a stack itemrot
- rotate the stack
#!/usr/bin/env node | |
var input = require("fs").readFileSync( | |
require("path").join(process.cwd(), process.argv[process.argv.length - 1]), | |
"utf8" | |
); | |
var gvars = {}; | |
function exec(input, fns, vars) { | |
(function findStrs() { | |
var inStr = false; |
#!/bin/sh | |
# on ubuntu: need some utils & dev libs | |
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev | |
# compile nginx | |
cd /tmp | |
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz | |
cd nginx* | |
./configure --with-http_ssl_module --with-http_dav_module \ |
@In((a: string, b: string) => { | |
assert(typeof a === 'string'); | |
assert(typeof b === 'string'); | |
assert(a.length > 5); | |
assert(a.length > 7); | |
}) | |
@Out((result: string) => { | |
assert(typeof result === 'string'); | |
assert(a.length > 12); | |
}) |
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
// Open (or create) the database | |
var open = indexedDB.open("MyDatabase", 1); | |
// Create the schema | |
open.onupgradeneeded = function() { | |
var db = open.result; | |
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); |
// General hints on defining types with constraints or invariants | |
// | |
// Just as in C#, use a private constructor | |
// and expose "factory" methods that enforce the constraints | |
// | |
// In F#, only classes can have private constructors with public members. | |
// | |
// If you want to use the record and DU types, the whole type becomes | |
// private, which means that you also need to provide: | |
// * a constructor function ("create"). |
const nodes = [ | |
{ | |
links: [ 1 ], // node 0 is linked to node 1 | |
visited: false | |
}, { | |
links: [ 0, 2 ], // node 1 is linked to node 0 and 2 | |
visited: false | |
}, | |
... | |
]; |
/* eslint no-param-reassign: 0 */ | |
/** | |
* JavaScript implementation of W3 DOM4 TreeWalker interface. | |
* | |
* See also: | |
* - https://dom.spec.whatwg.org/#interface-treewalker | |
* | |
* Attributes like "read-only" and "private" are ignored in this implementation | |
* due to ECMAScript 3 (as opposed to ES5) not supporting creation of such properties. |
// used to retrieve template content | |
const templates = new WeakMap; | |
// used to retrieve node updates | |
const updates = new WeakMap; | |
// hyperHTML, the nitty gritty | |
function hyperHTML(chunks, ...interpolations) { | |
// if the static chunks are unknown |
const readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
let stack = []; | |
let consts = { | |
swapd: '[[swap] dip]', | |
popd: '[[pop] dip]', |