public function actionMigrate()
{
// Keep current application
$oldApp = \Yii::$app;
// Load Console Application config
$config = require \Yii::getAlias('@app'). '/config/console.php';
new \yii\console\Application($config);
$result = \Yii::$app->runAction('migrate', ['migrationPath' => '@app/migrations/', 'interactive' => false]);
// Revert application
$ php some-bench.php | |
strtotime: 0.15609812736511 | |
datetime: 0.31521701812744 | |
datetime without instanciation: 0.11794400215149 | |
custom: 0.70522284507751 |
Monokai color to Sherwin-Williams mapping
(monokai-blue-light "#89BDFF") -> SW 6961 BLUE BEYOND
(monokai-gray "#595959") -> SW 7048 URBANE BRONZE
(monokai-gray-darker "#383830") -> SW 6258 TRICORN BLACK
(monokai-gray-darkest "#141411") -> SW 6990 CAVIAR
(monokai-gray-lightest "#595959") -> SW 7048 URBANE BRONZE
(monokai-gray-light "#E6E6E6") -> SW 6539 SOOTHING WHITE
(monokai-green "#A6E22A") -> SW 6920 CENTER STAGE
(monokai-green-light "#A6E22E") -> [SW 6920 CENTER STAGE]
<?php | |
/* | |
This function saved my life. | |
found on: http://www.sitepoint.com/forums//showthread.php?t=438748 | |
by: crvandyke | |
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?! | |
*/ | |
$array = json_decode(json_encode($object), true); |
Like PHP's htmlentities()/htmlspecialchars() functions, JavaScript is easy to implement it.
/**
It's easy to configurate a Laravel server site with directory protection:
Laravel Web Server Configuration
Laravel smartly detects the current base url so that you don't need to set the base url for subdirectoy:
The exchange of new line & br HTML tag could refer to PHP - nl2br() function, which uses to inserts HTML line breaks before all newlines in a string.
These JavaScript functions consider whether to use insert or replace to handle the swap.
Copied from the official Docker-for-mac documentation (thanks Brett for the updated doc pointer):
Docker Desktop for Mac comes with scripts to enable completion for the docker, docker-machine, and docker-compose commands. The completion scripts may be found inside Docker.app, in the Contents/Resources/etc/
directory and can be installed both in Bash and Zsh.
Bash has built-in support for completion To activate completion for Docker commands, these files need to be copied or symlinked to your bash_completion.d/
directory. For example, if you installed bash via Homebrew:
location ~ /\.git { | |
deny all; | |
} | |
# or, all . directories/files in general (including .htaccess, etc) | |
location ~ /\. { | |
deny all; | |
} |
openssl genrsa -out self-ssl.key
openssl req -new -key self-ssl.key -out self-ssl.csr -config csr.conf
openssl x509 -req -days 365 -in self-ssl.csr -signkey self-ssl.key -out self-ssl.crt -extensions req_ext -extfile csr.conf
Sign from Root CA:
openssl x509 -req -days 365 -extensions req_ext -extfile csr.conf -CA RootCA.crt -CAkey RootCA.key -in self-ssl.csr -out self-ssl.crt