- Current implementation is known as streams2.
- Introduced in node v0.10.
- "suck" streams instead of "spew" streams.
- Instead of
data
events spewing, callread()
to pull data from source. - When there isn't any data to consume, then
read()
will return undefined. - Adding a
data
event listener will switch the Readable stream into "old mode", where data is emitted as soon as it is available rather than waiting for you to callread()
to consume it. This requires you to handle backpressure problems manually. - The
pipe
method helps write less code and handles back-pressure. - If you add an
end
listener and don't everread()
orpipe()
, it'll never emitend
.
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
"use strict"; | |
var crypto = require("crypto"); | |
var EncryptionHelper = (function () { | |
function getKeyAndIV(key, callback) { | |
crypto.pseudoRandomBytes(16, function (err, ivBuffer) { | |
var keyBuffer = (key instanceof Buffer) ? key : new Buffer(key) ; |
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
{ | |
"name": "bbg", | |
"version": "0.0.0", | |
"dependencies": { | |
"angular-animate": "~1.3.4", | |
"angular-cookies": "~1.3.4", | |
"angular-touch": "~1.3.4", | |
"angular-sanitize": "~1.3.4", | |
"jquery": "~2.1.1", | |
"angular-ui-router": "~0.2.13", |
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
{ | |
"generator-gulp-angular": { | |
"version": "0.11.0", | |
"props": { | |
"angularVersion": "~1.3.4", | |
"angularModules": [ | |
{ | |
"key": "animate", | |
"module": "ngAnimate" | |
}, |
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
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
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
$scope.specialist.photoUrl = false; | |
//Workaround for issue described here: https://issues.apache.org/jira/browse/CB-7131 | |
var imgLoadErr = function () { | |
$scope.specialist.photoUrl = false; | |
}; | |
var img = new Image(); | |
img.onerror = imgLoadErr; | |
img.onabort = imgLoadErr; | |
img.onload = function () { |
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
<script> | |
/*jslint unparam: true */ | |
/*global window, $ */ | |
$(function () { | |
'use strict'; | |
// Change this to the location of your server-side upload handler: | |
function removeErrorLabels() { | |
$('label.error-message').remove(); | |
} |
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
// requirements | |
var PHPUnserialize = require('php-unserialize'); // npm install php-unserialize | |
var MCrypt = require('mcrypt').MCrypt; // npm install mcrypt | |
// helper function | |
function ord( string ) { // Return ASCII value of character | |
// | |
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) |
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 | |
/* | |
* Locale checker | |
*/ | |
\App::setLocale('ru'); | |
$languages = array('ru', 'en', 'ua', 'by', 'kz', 'md'); | |
$locale = Request::segment(1); |
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 | |
return array ( | |
'host' => '127.0.0.1', | |
'port' => 9312, | |
'indexes' => array ( | |
'discash_offers' => array ( 'table' => 'offers', 'column' => 'id' ), | |
'discash_products' => array ( 'table' => 'products', 'column' => 'id' ), | |
) | |
); |
NewerOlder