TL;DR: If you want to see me perform a spoken word poem about JavaScript in front of 1000 people (and on video), please ⭐ star this gist. If you're on mobile, you'll need to request desktop site.
var dbs = db.getMongo().getDBNames() | |
for(var i in dbs){ | |
db = db.getMongo().getDB( dbs[i] ); | |
if (db.getName() !== 'admin' && db.getName() !== 'local') | |
{ | |
print( "dropping db " + db.getName() ); | |
db.dropDatabase(); | |
} | |
} |
var getReadableFileSizeString = function(fileSizeInBytes) { | |
var i = -1; | |
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; | |
do { | |
fileSizeInBytes = fileSizeInBytes / 1024; | |
i++; | |
} while (fileSizeInBytes > 1024); | |
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]; | |
}; |
Lsyncd is a tool used to keep a source directory in sync with other local or remote directories. It is a solution suited keeping directories in sync by batch processing changes over to the synced directories.
So the generic use case is to keep a source directory in sync with one or more local and remote directories.
#!/bin/bash | |
#проверка сайтов по списку | |
echo "<<<---------------- www-check ------------------->>>" | |
SERVERFILE='/tmp/list/all.list' | |
/usr/local/ispmgr/sbin/mgrctl -m ispmgr wwwdomain | cut -d\ -f1 | cut -d\= -f2 >$SERVERFILE | |
ADMIN="[email protected]" | |
status_file="/tmp/list/www_status.txt" |
#!/bin/bash -x | |
export nginx_version=1.9.9 | |
# get latest rtmp mod | |
mkdir /usr/local/src | |
cd /usr/local/src | |
git clone git://github.com/arut/nginx-rtmp-module.git | |
# get nginx | |
wget http://nginx.org/download/nginx-${nginx_version}.tar.gz |
myAwesomeApp | |
|-client | |
| |-lib #Only Client libraries | |
| |-js | |
| |-templates | |
|-collections #Define, Publish & Subscribe collections | |
|-lib #Isomorphic (Client + Server) libraries | |
|-public (or static) #files & folders avaliable via http | |
| |-css | |
| |-other |
/*jshint strict:false */ | |
/* | |
* @function | |
* @namespace String.prototype | |
* @name clone | |
* | |
* @description Clone (a.k.a. create singleton) of String object | |
* This method allows to resolve issue with variable's referencing | |
* See performance here: http://jsperf.com/clone-create-singleton-for-string-object |
I have following object:
var cities={10:'Tashkent', 14:'Karakalpakiya', 16:'Andijan'};
I want sort it by city names, so after sort it should be:
var cities={16:'Andijan', 14:'Karakalpakiya', 10:'Tashkent'};
But I can't sort object properties, instead can convert object into array, then sort items.