Skip to content

Instantly share code, notes, and snippets.

@lonfee88
lonfee88 / test_glob.js
Last active August 29, 2015 14:27
node path.sep
var glob = require('glob');
var path = require('path');
var sep = process.platform != 'win32' ? '\\' : '/';
console.log(sep);
var patterns = ['**/*.js', '**\\*.js'];
patterns.map(function(pattern){
var tmp = pattern.split(sep).join(path.sep);
console.log(pattern);
console.log(tmp);
@lonfee88
lonfee88 / dom2html.js
Created April 15, 2016 09:47
dom2html
function nodeToString ( node ) {
var tmpNode = document.createElement( "div" );
tmpNode.appendChild( node.cloneNode( true ) );
var str = tmpNode.innerHTML;
tmpNode = node = null; // prevent memory leaks in IE
return str;
}
//http://stackoverflow.com/questions/4239587/create-string-from-htmldivelement