Skip to content

Instantly share code, notes, and snippets.

View do-while.dwl
%dw 2.0
output application/json
fun while<T>(a, b: (T) -> Boolean) = do {
var r = a()
fun innerWhile(x) = do {
var r = a(x)
---
b(r) match {
case true -> [r ~ innerWhile(r)]
@menduz
menduz / Brainfuck.dwl
Created Nov 17, 2017
Brainfuck implementation written in DataWeave
View Brainfuck.dwl
%dw 2.0
output application/dw
import mergeWith from dw::core::Objects
type Stream<T> = {|
data: Array<T>,
position: Number
|}
type Machine = {|
View __inputs__payload.json
{
"message": "Hello world!"
}
View __inputs__payload.json
{
"message": "Hello world!"
}
View generator.dwl
fun generator(start: Number = 0): Array<Number> = [start ~ generator(start + 1)]
---
// This script will pick 100 numbers from
// the generator, that is also being filtered
(generator(1000) filter isEven($))[0 to 99]
View __inputs__payload.json
{
"message": "Hello world!"
}
@menduz
menduz / gist:01e37c992086e04fa11e3a667b9da6cb
Last active Jan 15, 2018 — forked from pfrazee/gist:8949363
In-Application Sandboxing with Web Workers
View gist:01e37c992086e04fa11e3a667b9da6cb

In-Application Sandboxing with Web Workers

A design rationale.

For the past fews years, the Web has been shifting control to the client. Given the limitations of remote services, developers are now looking for ways to "unhost" static applications – that is, break the dependency on remote servers while still using the Web platform.

One untapped technology for client-side control is the Web Worker Sandbox. This API lets the Page load, execute, and destroy separate Worker threads which use their own Virtual Machines. By using Worker Sandboxes to drive behavior, the Web can give users the choice of which software they run together, shifting development from a centralized SaaS model into a distributed and free (as in freedom) script-sharing model.

Worker Sandboxes can Execute Arbitrary Code

View Test command.md

ab -n 1000 -c 100 http://localhost:9615/

You can’t perform that action at this time.