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
#!/bin/bash | |
cd /tmp | |
rm -rf backup | |
mkdir backup | |
cd backup | |
MONGO_HOST="127.0.0.1" | |
MONGO_PORT="27017" | |
MONGODUMP_PATH="/usr/bin/mongodump" |
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
// Command: | |
// Change database for your db name and collection for your collection name | |
// Remove limit(1). Is there in order to avoid accidents ;) | |
mongo database --eval \"db.collection.find().limit(1).forEach(function(doc){ var nd = new Date(doc.created_at); nd.setDate(nd.getDate() + 1); doc.created_at = new ISODate(nd.toISOString()); db.collection.save(doc)});" | |
/* The function in a more readable fashion :) | |
function(doc) { | |
var nd = new Date(doc.created_at); | |
nd.setDate(nd.getDate() + 1); |
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
.body { | |
background-image: url(http://placehold.it/1600x900); | |
background-position: center center; | |
background-repeat: no-repeat; | |
background-attachment: fixed; | |
background-size: cover; | |
background-color: #ffffff; | |
background-size: cover; | |
} |
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
# Setting up the repo | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list | |
# Updating and installing | |
sudo apt-get update | |
# WARNING: check out the -y here... | |
sudo apt-get install -y mongodb-org | |
# For a specific version, use this command |
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 () { | |
return { | |
_state : { | |
views : 'views' | |
}, | |
set : function(key, val) { this._state[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
# Creating a patch: | |
cd /path/of/the/root/of/the/project | |
git diff --no-prefix > /path/to/patch_file | |
#Applying a patch | |
cd /path/of/the/root/of/the/project | |
patch -p0 < /path/to/patch_file |
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 query = {}; | |
var search = { | |
field: 'name', | |
value: 'Your value' | |
}; | |
query[search.field] = { | |
$regex: new Regexp(search.value), | |
$options: "i" |