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
$m = new MongoClient(); // connect to local mongodb | |
$db = $m->products; //select 'mongo database' named products | |
$clothing_col = $db->clothing; //create a collection from the 'table' clothing | |
//create the aggregation | |
//create the Match on clothing-category = shoes or brand = nike AND size 37 | |
$ops = array( | |
array( | |
'$match' => array('$or' => array(array("category" => 'shoes'), | |
array("brand" => 'nike')), |
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
$m = new MongoClient(); // connect to local mongodb | |
$db = $m->products; //select 'mongo database' named products | |
$clothing_col = $db->clothing; //create a collection from the 'table' clothing | |
$brands = array('nike', 'puma'); | |
//create the aggregation | |
//create the Match on clothing-category = shoes or brand = array | |
$ops = array( | |
array( | |
'$match' => array('$and' => array( |
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
$m = new MongoClient(); // connect to local mongodb | |
$db = $m->products; //select 'mongo database' named products | |
$clothing_col = $db->clothing; //create a collection from the 'table' clothing | |
$brands = array('nike', 'puma'); | |
//create the aggregation | |
//create the Match on pricing bigger or equals 75 | |
$ops = array( | |
array( | |
'$match' => array('price' => array('$gte' => '75')) |
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
$today = strtotime(date('Y-m-d 00:00:00')); | |
$yesterday = strtotime(date('Y-m-d 00:00:00', (time() - 24 * SECONDS_PER_HOUR))); | |
$m = new MongoClient(); // connect to local mongodb | |
$db = $m->orders; //select 'mongo database' named orders | |
$items_col = $db->items; //create a collection from the 'table' ordered items | |
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
<?php | |
/** | |
* Zend Framework | |
* | |
* LICENSE | |
* | |
* This source file is subject to the new BSD license that is bundled | |
* with this package in the file LICENSE.txt. | |
* It is also available through the world-wide-web at this URL: | |
* http://framework.zend.com/license/new-bsd |
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
<?php | |
/** | |
* Created by PhpStorm. | |
* User: theovandersluijs | |
* Date: 14/01/15 | |
* Time: 21:18 | |
*/ | |
error_reporting(E_ALL); | |
ini_set('display_errors', 1); | |
require_once '../Zend/blogger.php'; //don't forget you need this file also! |
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 | |
#Force file syncronization and lock writes | |
mongo admin --eval "printjson(db.fsyncLock())" | |
MONGODUMP_PATH="/usr/bin/mongodump" #this should be the path to mongodump | |
MONGO_HOST="localhost" #different when not on same server | |
MONGO_PORT="27017" #could be different | |
MONGO_DATABASE="[dbname]" #name of your db | |
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 | |
#add right params at [PARAM] | |
export LC_ALL=C | |
BAK="/opt/backup" | |
TIMESTAMP=`date +%F-%H%M` | |
S3_BUCKET_NAME=[BUCKET_NAME] | |
S3_BUCKET_PATH=[BUCKET_PATH] |
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 showPostsOtherSite($atts) { | |
//this information is found in the config.php of your other wordpress blog | |
$db_username = 'XXXXXXXXXX'; | |
$db_password = 'XXXXXXXXXX'; | |
$db_database = 'XXXXXXXXXX'; | |
$db_host = 'localhost'; //leave localhost or type IP from different server! | |
$db_prefix = 'XX_'; //something like wp_ (don't forget the _ sign) | |
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
<!-- | |
Add this to your _config.yml | |
months: | |
- Januari | |
- Februari | |
- Maart | |
- April | |
- Mei | |
- Juni | |
- July |