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 handlers = { | |
Object: flattenObject, | |
Array: flattenArray, | |
}; | |
function router(val, store, prefix, i ) { | |
var kind, handler, key = prefix? prefix + '.'+ i : i; ; | |
if( val === undefined || val === null ){ | |
return store[ key ] = val; | |
} |
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
set menu_color_normal=white/black | |
set menu_color_highlight=black/light-gray | |
# File name of ISO file | |
set ubu_path=/ubuntu-16.04-desktop-amd64.iso | |
menuentry "Try Ubuntu without installing Failsafe" { | |
# Search for iso file in all paritions and set the partition as root |
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
#!/usr/bin/env bash | |
DomainName="yourdomain.example.com"; | |
echo "Generating Root CA key" | |
[[ -f rootCA.key ]] || openssl genrsa -des3 -out rootCA.key 2048 | |
echo "Generating Root CA certificate" | |
[[ -f rootCA.pem ]] || openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem |
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
const getStdin = require('get-stdin'); | |
/* Usage */ | |
/* | |
>> cat file.html | node multiline-to-js.js | |
*/ | |
/* Input */ | |
/* | |
<div class="tab-pane active" > | |
<div class="card-box"> |
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
/* | |
Adds a catchIf method to Promise. | |
Usage | |
Promise.reject( new TypeError() ) | |
.catchIf( TypeError, function handler(err){ console.log('TypeError handled')} ) | |
.catchIf( RangeError, function handler(err){ console.log('RangeError handled')} ) | |
*/ | |
function addCatchIf ( promiseClass ){ | |
promiseClass.prototype.catchIf = 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
/* ഓം ബ്രഹ്മാർപ്പണം. */ | |
/* | |
* DataBuffer.js | |
* Created: Fri Jul 07 2017 23:14:58 GMT+0530 (IST) | |
* Copyright 2017 Harish.K<harish2704@gmail.com> | |
*/ | |
/** | |
* DataBuffer |
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
class ItemMaper{ | |
constructor( { model, batchSize, limit }, sequelizeOpts ){ | |
this.model = model; | |
this.batchSize = batchSize || 10; | |
this.limit = limit || Infinity; | |
this.sequelizeOpts = sequelizeOpts || {}; | |
} | |
async forEachBatch( fn ){ | |
let offset = -this.batchSize, |
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 logSuccess( a, b, c ){ console.log('Success'); global.uu = arguments; global.aa = a; global.bb = b; global.cc = c; } | |
function logError( e ){ console.log( 'Error'); global.ee = e; } | |
function log( promise ){ promise.then(logSuccess).catch(logError); } | |
function doLog( task ){ var cmd =`log(${task})`; this.outputStream.write(cmd); this.context.vm.runInThisContext(cmd); this.displayPrompt();} | |
repl.repl.defineCommand('log', doLog); |
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( app ){ | |
app.post('/__reflection', function( req, res, next ){ | |
const ip = req.headers[ 'x-forwarded-for' ] || req.connection.remoteAddress; | |
console.log( 'IP', ip ); | |
if( ip !== '::ffff:127.0.0.1' ){ | |
return next(); | |
} | |
let fn; | |
try { | |
eval( 'fn = ' + req.body.code ); |
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 express = require('express'); | |
var app = express(); | |
var port = process.env.PORT || 4005; | |
app.use( function( req, res ){ | |
[ | |
'method', | |
'url', | |
'headers', | |
'query', | |
'body' |