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
# Composer Windows | |
Se der erro ao instalar pacotes (PHP unable to load php_curl.dll extension), adicionar php no path do Windows: | |
The right way to do it is to add the PHP path to the Windows Path variable. In Control Panel -> System click on Advanced System Settings and use the button Environment Variables. Under System Variables you will find the Path variable. Edit it and append ;C:\PHP to it - or whatever the path to your PHP folder is. Then fully stop Apache and start it again (a simple restart might not be enough). | |
# Composer Phalcon | |
Para usar composer no Phalcon carregue autoload em config/loader.php: |
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
1. In your AWS Management Console, go to the EC2 Tab. | |
2. Check the instance you want to change (from micro to large, for example) | |
3. Put the instance in a 'Stopped' state. | |
4. Click the 'Instance Actions' menu, and choose 'Change Instance Type' | |
5. Choose the level you want the instance to run at (small, medium, large) | |
6. Click 'Yes, Change'. | |
7. Restart the instance in question. | |
Note: JUST MAKE SURE YOU HAVE YOUR ELASTIC IP SET UP AND ALLOCATED TO THE INSTANCE. INSTANCE'S IP WILL CHANGE RANDOMLY WHEN YOU RESTART YOUR INSTANCE. |
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
## Nova instância do zero com Phalcon | |
Com servidor pronto (PHP instalado e rodando), uma típica configuração irá precisar de: | |
1. Adicionar extensão phalconphp | |
2. Adicionar extensão mongodb | |
3. |
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
db.getCollection("schools").find({ | |
geometry: | |
{ $near: | |
{ | |
$geometry: { type: "Point", coordinates: [ -3.729858, 40.227383 ] }, | |
$minDistance: 1000, | |
$maxDistance: 5000000 | |
} | |
} | |
}) |
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
// https://stackoverflow.com/questions/20348093/mongodb-aggregation-how-to-get-total-records-count | |
// Pre 3.4 | |
$result = $collection->aggregate(array( | |
array('$match' => $document), | |
array('$group' => array('_id' => '$book_id', 'date' => array('$max' => '$book_viewed'), 'views' => array('$sum' => 1))), | |
array('$sort' => $sort), | |
// get total, AND preserve the results | |
array('$group' => array('_id' => null, 'total' => array( '$sum' => 1 ), 'results' => array( '$push' => '$$ROOT' ) ), |
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
// Requires official MongoShell 3.6+ | |
use webapp; | |
db.getCollection("schools").aggregate( | |
[ | |
{ | |
"$match" : { | |
"status" : "active", | |
"country" : "Reino Unido", | |
"city" : "Londres" | |
} |
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 | |
$filter = ['_id' => ['$in' => $idsObjArray]]; | |
cursor = $myCollection->find($filter, [])->toArray(); |
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
ccApp.checkRecaptcha = function($form) { | |
res = $form.find('.g-recaptcha-response').val(); | |
if (res == "" || res == undefined || res.length == 0) | |
return false; | |
else | |
return true; | |
} | |
$(document).on('submit', '.ajax-form', function(event) { | |
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
$user = $collection->findOneAndUpdate(['_id' => $post['_id']], ['$set' => $post], ['returnDocument' => \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER]); |
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
insertArr = [ | |
[ | |
'_id' => new \MongoDB\BSON\ObjectId(), | |
'name' => 'teste | |
] | |
]; | |
$collection = $this->mongo->webapp->hosting; | |
$collection->updateOne( | |
['_id' =>new \MongoDB\BSON\ObjectId($hostingId), 'rooms._id' => new \MongoDB\BSON\ObjectId($roomId)], |