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 Sequelize = require('sequelize'); | |
| var Promise = require('bluebird'); | |
| var sequelize = new Sequelize('test', 'pmougel', '', { | |
| logging: false, | |
| dialect: 'postgres', | |
| omitNull: true | |
| }); | |
| var User = sequelize.define( |
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 charts = ["#drug", "#clinical", "#mri", "#disease", "#gd", "#relapses"].map(function (chart) { | |
| return datachart.compositeChart(chart); | |
| }); | |
| charts.push(datachart.barChart("#monthly-chart")); | |
| var svg = element.children('svg'); | |
| function compile () { $compile(svg)(scope); }; | |
| charts.map(function (chart) { chart.on('postRender', compile); }); |
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 Hapi = require('hapi'); | |
| var plugins = { | |
| yar: { | |
| cookieOptions: { | |
| password: "mypassword", | |
| isSecure: false | |
| } | |
| }, | |
| travelogue: { |
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
| INPUT="$1" | |
| XML=$(basename "$1" .adoc).xml | |
| asciidoctor -b docbook -d article "$1" | |
| fopub "$XML" | |
| rm "$XML" |
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'); | |
| var express = require('express'); | |
| var app = express(); | |
| app.get('/', function (req, res) { | |
| res.attachment(); | |
| fs.createReadStream('test.pdf').pipe(res); | |
| }); | |
| app.listen(8080); |
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 csv = require('csv'); | |
| var async = require('async'); | |
| var fs = require('fs'); | |
| var MongoClient = require('mongodb').MongoClient; | |
| MongoClient.connect('mongodb://localhost:27017/csvdb', function(err, db) { | |
| if (err) throw err; | |
| var collection = db.collection('myCSVs'); | |
| var queue = async.queue(collection.insert.bind(collection), 5); |
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
| ~/tmp ❯❯❯ node index.js | |
| null | |
| [ {}, {}, {} ] |
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
| dd if=/dev/zero of=input.txt bs=512k count=50 |
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
| #!/usr/bin/nodejs | |
| var levelup = require('levelup'); | |
| var http = require('http'); | |
| var util = require('util'); | |
| var Transform = require('stream').Transform || require('readable-stream').Transform; | |
| var server = http.createServer(onRequest); | |
| // Save something in db |
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
| $ node -v | |
| v0.10.16 | |
| $ node index.js | |
| /root/tmp/node_modules/async/lib/async.js:710 | |
| process: function () { | |
| ^ | |
| RangeError: Maximum call stack size exceeded |