Skip to content

Instantly share code, notes, and snippets.

View steppefox's full-sized avatar
🦥

Eldar Amantay steppefox

🦥
View GitHub Profile
@steppefox
steppefox / js_in_array.js
Created June 13, 2013 06:47
javascript in_array snippet like php function; needle (ru: игла) - what we want to find; haystack (ru: стог) - where;
function in_array(needle, haystack, strict) {
//original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
var found = false, key, strict = !!strict;
for (key in haystack) {
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
found = true;
break;
}
}
@steppefox
steppefox / elasticsearch.monit
Created June 11, 2013 05:32
Snippet for monit configuration file. Its check process named "elasticsearch" and start it, if elasticsearch is down.
check process elasticsearch with pidfile /var/run/elasticsearch.pid
start program = "/etc/init.d/elasticsearch start"
stop program = "/etc/init.d/elasticsearch stop"
if 5 restarts within 5 cycles then timeout