This file contains hidden or 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
| #!/bin/sh | |
| exec unshare -c -n -- $@ |
This file contains hidden or 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
| export const h=(t,m,...c)=>({...m,t,m,c}) | |
| export const render=(e,d,t=d.t||(d.t={}),m,r,c)=> | |
| // arrays | |
| [e].flat(1/0).map((e)=> | |
| // components | |
| e.t.call?(e.i=render((render.c=e).t({children:e.c,...e.m},e.s=t.s||{},t=> | |
| render((e.s={...e.s,...t})&&e,d,e)),t.i||d,t?.i||{}),e):( | |
| // create notes | |
| e.d=t.d||(e.t?document.createElement(e.t):new Text(e.m)), | |
| // diff props |
This file contains hidden or 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 dog = defaultProperties({ | |
| breed: 'Dachshund', | |
| name: 'Sam', | |
| age: 3 | |
| }, 'empty'); | |
| dog.name // 'Sam' | |
| dog.foodBowl // 'Empty' |
This file contains hidden or 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 dog = { | |
| breed: 'Labrador', | |
| name: 'Jed', | |
| age: 7 | |
| }; | |
| const dogCopy = protectProperties(dog); | |
| dog.breed = 'Poodle'; // Success - We've now got a Poodle |
This file contains hidden or 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 shape = new Proxy({}, { | |
| set: (obj, prop, value) => { | |
| if (prop === 'sides') { | |
| if (!(value > 0)) { | |
| throw Error('Property "sides" must be greater than zero'); | |
| } | |
| } | |
| // Set the value | |
| obj[prop] = value; |
This file contains hidden or 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 net = require('net') | |
| net.createServer(socket => { | |
| socket.on('data', function(data){ | |
| console.log('Echoing: %s', data.toString()) | |
| socket.write(data.toString()) | |
| }) | |
| }).listen(8001) |
This file contains hidden or 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
| export interface IPackageJSON extends Object { | |
| readonly name: string; | |
| readonly version?: string; | |
| readonly description?: string; | |
| readonly keywords?: string[]; |
This file contains hidden or 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
| export interface IBowerJSON extends Object { | |
| /** | |
| * The name of the package as stored in the registry | |
| */ | |
| readonly name: string; | |
| /** | |
| * A description of the package limited to 140 characters | |
| */ |
This file contains hidden or 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 fs = require('fs'), | |
| http = require('http'); | |
| http.createServer(function (req, res) { | |
| console.log('Incoming request'); | |
| fs.readFile('.' + req.url, function (err, file) { | |
| if (err) { | |
| res.writeHead(404, { | |
| 'Content-Type': 'text/plain' | |
| }); |