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
let isWatching = false; | |
gulp.task('ts', () => { | |
return new Promise((resolve, reject) => { | |
const cmd = 'npx'; | |
const args = ['tsc']; | |
if (isWatching) { | |
args.push('-w', '--preserveWatchOutput'); | |
} |
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
/** | |
* | |
*/ | |
public function testRouteMatchWithControllerParsed() { | |
Router::reset(); | |
Router::connect('/{:controller:lists}/{:action:add}'); | |
$this->assertIdentical( | |
'/lists/add', | |
Router::match(array('controller' => 'lists', 'action' => 'add')) |
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 | |
// I have this in my bootstrap/cache.php file | |
Dispatcher::applyFilter('run', function ($self, $params, $chain) { | |
foreach (Connections::get() as $connection) { | |
$connection = Connections::get($connection); | |
$connection->applyFilter('describe', function($self, $params, $chain) { | |
if (!empty($params['fields'])) { | |
$fields = $params['fields']; | |
return $self->invokeMethod('_instance', array('schema', compact('fields'))); | |
} |
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 | |
case 'timestamp': | |
if ($value === 'CURRENT_TIMESTAMP') { | |
return 'NULL'; | |
} else if (is_numeric($value)) { | |
return $this->connection->quote(date('Y-m-d H:i:s', $value)); | |
} else if (is_string($value)) { | |
return $this->connection->quote(date('Y-m-d H:i:s', strtotime($value))); | |
} else { | |
throw new InvalidArgumentException('given value for date is invalid'); |
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
public function allParameters($product) { | |
$conditions = array('subtype_id' => $product->subtype_id); | |
$order = array('pos' => 'ASC'); | |
$with = array( | |
'ParametersIndexes' => array( | |
'conditions' => array( | |
'product_id_key' => $product->id | |
) | |
) | |
); |