These set of scripts are for Magento 2. For Magento 1, see this Gist.
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 | |
| /** | |
| * Add SRI attributes to external JS resources | |
| */ | |
| function add_sri_attribute($tag, $handle, $src = null) | |
| { | |
| $known_hashes = array( | |
| 'https://code.jquery.com/jquery-1.12.4.min.js' => 'sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=', | |
| ); |
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 | |
| function d($arg) { | |
| if (is_object($arg)) { | |
| echo PHP_EOL . 'CLASS: ' . get_class($arg) . PHP_EOL; | |
| if ($arg instanceof \Magento\Framework\DB\Select) { | |
| var_dump($arg->__toString()); | |
| } | |
| if (method_exists($arg, 'getSelect')) { | |
| var_dump($arg->getSelect()->__toString()); |
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
| #!/bin/bash | |
| if [ ! -f ./app/etc/config.php ]; then | |
| echo "-- ERROR" | |
| echo "-- This doesn't look like a Magento 2 install. Please make sure" | |
| echo "-- that you are running this from the Magento main doc root dir" | |
| exit | |
| fi | |
| echo -ne '\n' |
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
| #!/bin/bash | |
| LOCKFILE=deploy.lock | |
| if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then | |
| echo "-- ERROR" | |
| echo "-- Deployment is already running" | |
| exit | |
| fi |
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 | |
| namespace App\Providers; | |
| use Illuminate\Support\ServiceProvider; | |
| class ConfigServiceProvider extends ServiceProvider | |
| { | |
| /** | |
| * Overwrite any vendor / package configuration. |
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
| for (var i = 1; i <= 100; i++) { | |
| if (i % 15 === 0) { | |
| console.log('FizzBuzz'); | |
| } else if (i % 3 === 0) { | |
| console.log('Fizz'); | |
| } else if (i % 5 === 0) { | |
| console.log('Buzz'); | |
| } else { | |
| console.log(i); | |
| } |
Includes:
- Configuration
- BrowserSync
- Environments (e.g.,:
--environment=production) - Image optimization (gif, jpg, png, and svg)
- Sass compilation with external libraries
- Bower installed Sass libraries example(s)
- CSS processing with Pleeease
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
| /** | |
| * Disable and enable event on scroll begin and scroll end. | |
| * @see http://www.thecssninja.com/javascript/pointer-events-60fps | |
| */ | |
| (function(r, t) { | |
| window.addEventListener('scroll', function() { | |
| // User scrolling so stop the timeout | |
| clearTimeout(t); | |
| // Pointer events has not already been disabled. | |
| if (!r.style.pointerEvents) { |