Folder structure
|-/input #Still images
|-/frames #Converted and resized frames
|-/output
|- video.mp4
(function($) { | |
$.fn.extend({ | |
coverElement: function(options) { | |
var settings = $.extend(true, { | |
container: 'html' //Default is fit the viewport | |
}, options); | |
var $elements = this, | |
$container = this.first().closest(settings.container); |
Folder structure
|-/input #Still images
|-/frames #Converted and resized frames
|-/output
|- video.mp4
body { | |
width: 360px; | |
} | |
.box { | |
width: 100%; | |
} | |
.box header { | |
background: #ddd; |
Koa is based on generators which are a new feature in ES6. The syntax for a generator is function* fnName() {}
where fnName
is optional, just as with normal functions. What generators allow one to do is effectively to suspend execution and hand over the execution flow to the calling function, which can then inject data into the generator. This is exploited to make async calls seem sync. Example:
function *() {
var data = yield db.find(); //yield suspends execution and hands over the control flow
data.map(someMapper);
}
As you can see we can pretend the async function db.find
is sync, because the caller takes care of executing the function for us and can inject the response into the variable data. That's the high level overview of generators. How they actually work is another story but nothing you need to worry about at first. ES6 (also known as Harmony) features are not enabled by default so when running node, use the harmony flag: node --harmony index.js
#Copy 2.1GB | |
DATASIZE=$(echo '2^31' | bc) | |
dd if=/dev/zero bs=$DATASIZE count=1 | nc [HOST] 2222 |
var KMeans = require('kmeans-js'); | |
var getPixels = require('canvas-pixels'); | |
var document = require('global/document'); | |
var img = require('img'); | |
var canvas = document.createElement('canvas'), | |
context = canvas.getContext('2d'); | |
img('https://www.npmjs.org/static/img/npm.png', function(err, el) { | |
canvas.width = el.width; |
root = true | |
# Unix-style newlines with a newline ending every file | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
trim_trailing_whitespace = true | |
charset = utf-8 | |
indent_style = space | |
indent_size = 2 |
var stream = require('stream'); | |
var messageStream = require('./message-stream'); | |
var jsonify = new stream.Transform({ | |
writableObjectMode: true, | |
transform: function(chunk, enc, cb) { | |
this.push(JSON.stringify(chunk, null, 2) + '\n'); | |
cb(); | |
} | |
}); |
{ | |
"name": "minimal-protected-server", | |
"version": "0.0.0", | |
"description": "Minimal password protected server", | |
"main": "server.js", | |
"dependencies": { | |
"basic": "0.0.3", | |
"st": "^0.5.3" | |
} | |
} |
var stream = require('stream'); | |
var outer = 0, inner = 0; | |
var collectorStream = stream.Readable({ | |
highWaterMark: 1, | |
objectMode: true, | |
read: function() { | |
var self = this; | |
var id1 = outer++; |