Skip to content

Instantly share code, notes, and snippets.

View abusedmedia's full-sized avatar

Fabio Franchino abusedmedia

View GitHub Profile
@abusedmedia
abusedmedia / ember-sandbox-service.js
Created October 18, 2022 07:46 — forked from devotox/ember-sandbox-service.js
Create A Javascript sandbox to execute custom code without giving access to things like window and outer contextThey still have a `this` object they can use across multiple executions to persist data
import Service from '@ember/service';
const has = () => true;
const { console, WeakMap, Proxy, Symbol } = window;
const get = (target, key) => key === Symbol.unscopables ? undefined : target[key];
export default Service.extend({
@abusedmedia
abusedmedia / example.js
Created October 1, 2021 17:50 — forked from andrei-tofan/example.js
node.js writable buffer stream (pdfkit example)
/**
* Convert PDFDocument to Base64
*/
const PDFDocument = require('pdfkit');
const stream = require('./stream');
// crate document and write stream
let doc = new PDFDocument();
let writeStream = new stream.WritableBufferStream();
@abusedmedia
abusedmedia / .block
Created November 13, 2016 20:52 — forked from HarryStevens/.block
Basic Map Functions
license: gpl-3.0