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 | |
use Magento\Framework\Model\ResourceModel\IteratorFactory; | |
class HugeTableIterator | |
{ | |
/** @var IteratorFactory */ | |
private $iteratorFactory; | |
/** UnbufferedQueryConnectionFactory */ |
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 | |
use Magento\Framework\App\ObjectManager; | |
use Magento\Framework\App\ResourceConnection; | |
use Magento\Framework\DB\Adapter\AdapterInterface; | |
class UnbufferedQueryConnectionFactory | |
{ | |
/** @var ResourceConnection */ | |
private $resourceConnection; |
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 | |
$pdo = new PDO("mysql:host=localhost;dbname=foo", 'user', 'pass'); | |
$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); | |
$result = $pdo->query(/* SELECT ... */); | |
// $result is now unbuffered, and not loaded into memory until you ask for it |
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 | |
use Magento\Framework\App\ResourceConnection; | |
use Magento\Framework\Model\ResourceModel\IteratorFactory; | |
class HugeTableIterator | |
{ | |
/** @var ResourceConnection */ | |
private $resourceConnection; | |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
// saveJSON: XML to JSON conversion/transformation | |
// The saveJSON method is implemented as a method of the example DOMDocumentExtended class, which | |
// extends DOMDocument. It will transform the currently loaded DOM into JSON using XSLT. Since | |
// there isn't a reliable automatic way of detecting if certain siblings nodes should be | |
// represented as arrays or not, a "forceArray" parameter can be passed to the saveJSON method. | |
// It should be noted that the forceArray functionality doesn't recognize namespaces. This is | |
// an easy enough fix, I just didn't need it at the time of writing (look for local-name() and |
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
$button = $('get button selector'); | |
$button.on(function() { | |
runFilters(addClassNoFilters); | |
}); | |
function runFilters(callback) { | |
// do filters |
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 | |
function getAlternativeRoom() | |
{ | |
$rooms = array(); | |
$bookings = $this->getMeetingRoomBooking(); | |
$locationId = $bookings[0]->getMeetingRoom() | |
->getMeetingRoomLocationId(); | |
$query = Doctrine_Core::getTable('MeetingRoom') | |
->createQuery('r') |