- using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml- using inventory:
127.0.0.1 ansible_connection=local| ############################################################################### | |
| # Helpful Docker commands and code snippets | |
| ############################################################################### | |
| ### CONTAINERS ### | |
| docker stop $(docker ps -a -q) #stop ALL containers | |
| docker rm -f $(docker ps -a -q) # remove ALL containers | |
| docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
| # exec into container |
| const handlers = Symbol('handlers'); | |
| // adapts a handler class to a common interface | |
| // (technically this one isn't required - the handler class already implements the same interface) | |
| class ClassDispatchable { | |
| constructor(theClass) { | |
| this.theClass = theClass; | |
| } | |
| handle(command) { | |
| return (new this.theClass).handle(command); |
| <?php | |
| require_once 'abstract.php'; | |
| class Mage_Shell_CheckImages extends Mage_Shell_Abstract | |
| { | |
| const CATALOG_PRODUCT = '/catalog/product'; | |
| const CACHE = '/cache/'; | |
| protected function _glob_recursive($pattern, $flags = 0) |
| # You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
| # This is how I upload my new Sol Trader builds (http://soltrader.net) | |
| # Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
| S3KEY="my aws key" | |
| S3SECRET="my aws secret" # pass these in | |
| function putS3 | |
| { | |
| path=$1 |
| #!/bin/bash | |
| # Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462 | |
| find . -type f -iname "*.png" -exec optipng -nb -nc {} \; | |
| find . -type f -iname "*.png" -exec advpng -z4 {} \; | |
| find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \; | |
| find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \; |
| Elastic Load Balancer, CloudFront and Let's Encrypt |
| 1) install npm packages | |
| 2) update brunch-config.js | |
| 3) remove Bootstrap from web/static/css/app.css | |
| 4) rename web/static/css/app.css to web/static/css/app.scss | |
| 5) update web/static/css/app.scss |
| <?php | |
| /** | |
| * Magento | |
| * | |
| * NOTICE OF LICENSE | |
| * | |
| * This source file is subject to the Open Software License (OSL 3.0) | |
| * that is bundled with this package in the file LICENSE.txt. | |
| * It is also available through the world-wide-web at this URL: | |
| * http://opensource.org/licenses/osl-3.0.php |
ansible-playbook --connection=local 127.0.0.1 playbook.yml127.0.0.1 ansible_connection=local| <template name="magento2:__" value="<?php echo __('$SELECTION$'); ?>" description="Translation" toReformat="false" toShortenFQNames="true"> | |
| <context> | |
| <option name="HTML" value="true" /> | |
| <option name="PHP" value="true" /> | |
| </context> | |
| </template> | |
| <template name="magento2:collection" value="class Collection extends AbstractCollection { /** * Initialize resource model * * @return void */ protected function _construct() { $this->_init($model$::class, $resourceModel$::class); } }" toReformat="true" toShortenFQNames="true"> | |
| <variable name="model" expression="" defaultValue="" alwaysStopAt="true" /> | |
| <variable name="resourceModel" expression="" defaultValue="" alwaysStopAt="true" /> | |
| <context> |