This file contains hidden or 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 | |
$suffixes = array(''); | |
// ... | |
foreach ($suffixes as $suffix) { | |
foreach ($dirs as $dir) { | |
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (defined('PHP_WINDOWS_VERSION_BUILD') || is_executable($file))) { | |
return $file; | |
} | |
} |
This file contains hidden or 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 | |
// https://stackoverflow.com/questions/18562684/how-to-get-database-field-type-in-laravel/18563159#18563159 | |
/* @var $schema \Doctrine\DBAL\Schema\AbstractSchemaManager */ | |
$schema = DB::getDoctrineSchemaManager(); | |
$columns = $schema->listTableColumns('cities'); | |
dd($columns); | |
/* |
This file contains hidden or 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 | |
/** | |
* Wrapper for JSON decode that implements error detection with helpful error | |
* messages. | |
* | |
* @param string $json JSON data to parse | |
* @param bool $assoc When true, returned objects will be converted into | |
* associative arrays. | |
* @param int $depth User specified recursion depth. |
This file contains hidden or 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
^[a-zA-Z][\w:.-]*$ |
This file contains hidden or 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
{ | |
"name": "spakkionu/validate", | |
"description": "Validation Test", | |
"require": { | |
"illuminate/validation": "~4.2.9" | |
}, | |
"license": "MIT", | |
"authors": [ | |
{ | |
"name": "Jonathan Bernardi", |
This file contains hidden or 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
ini_set('error_reporting', E_ERROR); | |
register_shutdown_function("fatal_handler"); | |
function fatal_handler() { | |
$error = error_get_last(); | |
echo("<pre>"); | |
print_r($error); | |
} |
This file contains hidden or 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
#! /usr/bin/env lnav -i | |
{ | |
"magento_log" : { | |
"title" : "Magento Log Format", | |
"description" : "Log format used in Magento 1.", | |
"url" : "https://gist.github.com/chrisvanderpoel/e19dcab8ce69bc9806a3", | |
"regex" : { | |
"basic" : { | |
"pattern" : "^(?<timestamp>[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}\\T[0-9]{2}\\:[0-9]{2}\\:[0-9]{2}\\+[0-9]{2}\\:[0-9]{2})\\s(?<level>\\w+)\\s(?<component>\\(\\w+\\))\\:\\s(?<body>.*)$" | |
} |
This file contains hidden or 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 | |
// Check if an Mview index is up-to-date | |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read'); | |
$sub = $connection->select()->from(['cl' => $table], ['version_id'])->order('version_id DESC')->limit(1); | |
$select = $connection->select() | |
->from(['m' => 'enterprise_mview_metadata'], ['version_id', 'latest_id' => $sub, 'status']) | |
->where('changelog_name = ?', $table) | |
->limit(1); | |
$status = $connection->fetchRow($select); |
This file contains hidden or 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 | |
// Notice this is NOT SAVING the setting... | |
Mage::app()->getStore()->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, '0'); | |
// Build your collection here... |
This file contains hidden or 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 | |
// http://magento.stackexchange.com/questions/43917/fastest-way-to-update-an-attribute-in-all-products | |
$product->setData('something', true); | |
$product->getResource()->saveAttribute($product, 'something'); | |
// OR | |
\Mage_Catalog_Model_Resource_Product_Action::updateAttributes |