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
function compile(o, cx) { | |
// initial evaluation context inherits from external cx or configuration object | |
cx = new Context(cx); | |
// track initial evaluation context in quotation scope | |
const quots = [cx]; | |
// this is a reduction into a single result (a callable context) | |
return o.reduce((cx, node) => { | |
const type = node.type; | |
if (isClose(type)) { | |
// handle node close: |
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
// when applied, this function should check each of the items in s against the input arguments, | |
// and the result to r | |
// when the original is applied, this will simply return the input if valid, or throw if invalid | |
// for higher-order functions | |
// the function is not yet evaluated, but we pass a validator and wrap the function | |
// this will be inspected when provided function is called | |
const func = (s,r) => fn => { | |
const f = (...args) => { | |
const ret = fn(...args.map((a,i) => { |
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
const t = document.createTreeWalker(document.body); | |
const closers = new WeakMap(); | |
const emit = (type,n) => { | |
console.log(type,n); | |
}; | |
const isBranch = n => n.nodeType == 1 || n.nodeType == 9 || n.nodeType == 10 || n.nodeType == 11; | |
const close = n => { | |
emit("close",n); | |
if(closers.has(n)) { | |
const parent = closers.get(n); |
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
function reduceAhead(arr,fn,seed,nextSeed) { | |
const l = arguments.length; | |
seed = l < 3 ? arr.shift() : seed; | |
let tmp = { | |
out:seed, | |
entry:arr.shift(), | |
at: l < 3 ? 1 : 0 | |
}; | |
tmp = arr.reduce(function(tmp,next){ | |
tmp.out = fn.call(arr,tmp.out,tmp.entry,next,tmp.at,arr); |
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 ffi = require('ffi'); | |
var ref = require('ref'); | |
var Struct = require('ref-struct'); | |
var util = require("util"); | |
var ups_status_t = ref.types.int; | |
var ups_env_t = Struct(); | |
var ups_db_t = Struct(); |
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 input = document.createElement("input"); | |
input.id = "path"; | |
input.value = "/db/file.xml"; | |
var eXideButton = document.createElement("button"); | |
eXideButton.innerHTML = "Open in eXide"; | |
eXideButton.title = "Open in eXide Code Editor"; | |
eXideButton.addEventListener("click", function() { | |
var path = input.value; | |
window.eXide_onload = function(app){ | |
// getEditor() needs patch eXide.js |
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
.box { | |
position: relative; | |
width: 300px; | |
height: 200px; | |
border: 1px solid #cfcfcf; | |
background: #fafafa; | |
margin: 50px 5px; | |
float: left; | |
} |
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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
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
// adapted from https://github.com/persvr/perstore/blob/master/engines/node/store-engine/sql.js | |
function MysqlWrapper(params) { | |
var currentConnection; | |
return { | |
executeSql: function(query, args, callback, errback) { | |
var conn = currentConnection; | |
if(!conn) { | |
errback(new Error("No transactional context has been created")); | |
return; | |
} |