This file contains hidden or 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 removeLastComma(strng){ | |
var n=strng.lastIndexOf(","); | |
var a=strng.substring(0,n) | |
return a; | |
} | |
function addAnd(strng){ | |
var sp = strng.split(','); | |
sp.pop(); | |
// log('splitting', sp) |
This file contains hidden or 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/bash | |
# this file assumes you have setup the config files on 3 different servers (6 config files) | |
# my sample a_master.conf: on server A | |
#------------------------------ | |
# protected-mode no | |
# daemonize yes | |
# port 6379 | |
# pidfile /var/run/redis_6379.pid | |
# logfile "redis6379.log" | |
# masterauth somemasterpass |
This file contains hidden or 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
// can't remember where I got this but I did not write it: | |
// if app requires db.js | |
// place it in a required file, like db.js and the variable '__line__' will be available in app as well | |
// begin Object for __line__ | |
Object.defineProperty(global, '__stack__', { | |
get: function(){ | |
var orig = Error.prepareStackTrace; | |
Error.prepareStackTrace = function(_, stack){ return stack; }; | |
var err = new Error; |
This file contains hidden or 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 like(haystack, needle) { | |
let n = -1; | |
if (typeof haystack !== 'object') { | |
let str = new String(haystack); | |
if (str !== "undefined") { | |
/// haystack = 'x'; | |
/// needle = ['a','b','c','x']; | |
if (!Array.isArray(needle)) { | |
needle = [needle]; |