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
function gRetain(options) { | |
var stream = new Stream.Writable({objectMode:true}) | |
, fileMap = {} | |
, timeout | |
, size = 0 | |
; | |
options.limit = options.limit || 0; | |
options.delay = options.delay || 300; |
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 STYLE_ATTRIBUTE = 'TEXT-STYLE-NAME'; | |
var styleMatches = function (item, styleName) { | |
if (!item || item.attributes === undefined || item.attributes[STYLE_ATTRIBUTE] === undefined) { | |
return false; | |
} | |
return item.attributes[STYLE_ATTRIBUTE].match(styleName); |
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
module.exports = function xbbcode2html(str, options) { | |
var all = options.all || false; | |
var cleanup = options.cleanup || false; | |
var secure = options.secure || false; | |
var tags = [ | |
'span', 'kbd', 'var', 'del', 'ins', 'div', 'strong', 'em', 'dfn', 'cite', | |
'q', 'blockquote', 'p', 'br', 'a', 'ol', 'ul', 'li', 'abbr', 'acronym', | |
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'pre', 'address', 'img', 'tr', | |
'th', 'td', 'table', 'caption', 'thead', 'tfoot', 'tbody', 'dl', 'dd', 'dt', | |
'map', 'area', 'code', 'samp', 'sub', 'sup' |
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 Mixin = require('Mixin'); | |
var Mixin1 = require('Mixin1'); | |
var Mixin2 = require('Mixin2'); | |
var Mixin3 = require('Mixin3'); | |
function MyCtor() { | |
} | |
Mixin.set(myCtor, Mixin1, Mixin2, Mixin3); |
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 clone = require('gulp-clone'); | |
gulp.task("default", function() { | |
var normal = gulp.src( destination + '*.png' ); | |
var retina = normal.pipe(clone()); | |
normal.pipe(makeSprites()) | |
.pipe(gulp.dest( imagesBase + '1x/' )); |
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 YError = require('yerror'); | |
var _localDateCopy = global.Date; | |
var DateMock = { | |
_mocking: false, | |
_pendingQueue: [], | |
_assignedQueue: [], | |
_pendingIndex: 0, | |
start: function(theTimeQueue, options) { |
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
Number.prototype.toAmount = function() { | |
var parts=(this+'').split('.'); | |
parts[0]=(parts[0]?parts[0]:'0'); | |
parts[1]=(parts[1]?parts[1].substring(0,2):'00'); | |
parts[1]+=(parts[1].length==1?'0':''); | |
return parts[0]+'.'+parts[1]; | |
} | |
var price=12.112; | |
console.log(price.toAmount()); // Outputs 12.11 |
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 | |
# Init | |
cd / | |
if [ "$1" != "Y" ]; then | |
echo "$0 1:sure(Y/N)" | |
else | |
while read orgid database | |
do |
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
// Chaining API for URIBuilder | |
var uri=new URLBuilder().parse('bad_url_format').addQueryParam('param','value').setPort('443').toString(); | |
// How to handle the bad url parse error ? | |
// Don't want to throw exception | |
// Can't return null |
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
// Chainable API for URIBuilder | |
var uri = new URLBuilder(logErrorHandler) | |
.parse('bad_url_format') | |
.addQueryParam('param','value') | |
.setPort('443') | |
.toString(); | |
function logErrorHandler(err, url_object){ | |
if('parse_error'===err.type) |
OlderNewer