const {PassThrough} = require('stream')
const fs = require('fs')
const d = new PassThrough()
fs.createReadStream('tt2.js').pipe(d) // can be piped from reaable stream
d.pipe(process.stdout) // can pipe to writable stream
d.on('data', console.log) // also like readable
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
<?php | |
// Use in the "Post-Receive URLs" section of your GitHub repo. | |
if ( $_POST['payload'] ) { | |
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' ); | |
} | |
?>hi |
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 express = require('express'); | |
var app = express(); | |
var bodyParser = require('body-parser'); | |
// chrome sends application/csp-report | |
// firefox sends application/json | |
// it seems chrome is doing it well: https://w3c.github.io/webappsec/specs/content-security-policy/ | |
app.use(bodyParser.json({ | |
type: ['json', 'application/csp-report'] | |
})); |
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 Peer = require('simple-peer'); | |
var io = require('socket.io-client'); | |
var debug = require('debug')('client'); | |
var socket = io.connect(); | |
var peers = {}; | |
var useTrickle = true; | |
socket.on('connect', function() { | |
debug('Connected to signalling server, Peer ID: %s', socket.id); | |
}); |