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 { Transform } = require('stream'); | |
| const {aStream, bStream } = require("other_file"); | |
| class Convert extends Transform { | |
| constructor() { | |
| super(); | |
| this.aStream | |
| .pipe(bStream) | |
| bStream | |
| .on('data', data => this.cb(null, this.chunk)); |
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 { Transform } = require("readable-stream"); | |
| const fs = require('fs'); | |
| class PCMTime extends Transform { | |
| constructor() { | |
| super(); | |
| this.length = 0; | |
| // bitsPerSample * samplesPerSecond * channels | |
| this.bytesPerSec = (16 * 44100 * 1) / 8; |
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
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: pg | |
| labels: | |
| name: pg | |
| spec: | |
| securityContext: | |
| fsGroup: 999 | |
| containers: |
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 session = require('express-session'), | |
| pg = require("pg"), | |
| pgSession = require('connect-pg-simple')(session); | |
| const pgConnection = { | |
| host: 'localhost', | |
| user: 'blahblah', | |
| database: 'foobar', | |
| charset: 'utf8' | |
| } |
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
| // username is a input element in the dom | |
| let userNameVal = Kefir.fromEvents(username, "blur") | |
| .map(e => $(e.target) | |
| .val()); | |
| let kUsernameValidation = username => { | |
| try { | |
| if (usernameValidation(username)) { | |
| return username; |
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
| let User = bookshelf.Model.extend({ | |
| tableName: 'user', | |
| idAttribute: 'id', | |
| hasTimestamps: ["updated_at", "created_at"], | |
| socialAccount: function() { | |
| return this.hasMany(UserSocialAccount); | |
| }, | |
| findById: function(id) { | |
| return this.where({ | |
| id: id |
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 request = require("request"); | |
| exports.foo = function(req, res) { | |
| request.get("foo.com") | |
| .on('response', function(){ | |
| if (response.statusCode === 404) { | |
| // terminate and return {"error": "not found"} | |
| // How do i do this? | |
| } | |
| }) |
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
| Vagrant.configure(2) do |config| | |
| config.vm.hostname = "docker-host" | |
| config.vm.box_check_update = false | |
| config.vm.provider "docker" do |d| | |
| d.image = "ubuntu" | |
| end | |
| config.ssh.username = 'docker' |
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 though = require("through2"), | |
| syncDB = require("../syncdb"); | |
| module.exports = function() { | |
| return through.obj(function(file, enc, cb) { | |
| console.log(file.path, enc); |
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 Promise = require("bluebird"), | |
| _ = require("underscore"); | |
| var request = Promise.promisifyAll(Promise.promisify(require("request"))); | |
| function httpWrap(fn) { | |
| return function() { | |
| let args = _.toArray(arguments); |