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
| Convert code from using array syntax to object property syntax. | |
| Find: | |
| \$(\w+)\['([^']+)'\] | |
| Replace: | |
| \$$1->$2 | |
| Modified from https://edmondscommerce.github.io/php/phpstorm-regex-convert-array-to-object-syntax.html |
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
| Patch Drupal core with https://www.drupal.org/files/issues/ignore_front_end_vendor-2329453-111.patch | |
| drush vset features_rebuild_on_flush FALSE | |
| drush vset entity_rebuild_on_flush FALSE | |
| More details: | |
| http://a-fro.com/speed-up-cache-clearing-on-drupal7 | |
| https://www.drupal.org/node/2329453 |
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
| git tag -a 0.1 -m "Initial public release" master | |
| git push --tags |
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
| # Go to the vagrant machine directory | |
| $ cd /path/to/vagrant_machine | |
| # Find out and make note of the IP address of the vagrant machine, you should find it in Vagrantfile | |
| # Destroy the vagrant machine | |
| $ vagrant destroy | |
| # Remove the IP from ssh known hosts | |
| $ ssh-keygen -R <IP ADDRESS> |
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
| Complete line: | |
| cmd + shit + return | |
| Surround with: | |
| cmd + alt + T | |
| Synchronize: | |
| cmd + alt + Y | |
| Move current line up/down: |
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 | |
| $image_url = '/path/to/image.jpg'; | |
| getimagesize($image_url, $image_info); | |
| if (!isset($image_info['APP13'])) { | |
| die('No IPTC data found.'); | |
| } |
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 hasParent(DOMElement $element, array $parents) { | |
| $parent = $element->parentNode; | |
| while ($parent = $parent->parentNode) { | |
| if (in_array($parent->tagName, $parents)) { | |
| return TRUE; | |
| } | |
| } | |
| return FALSE; | |
| } |
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 | |
| $base_url = 'http://www.reverendfun.com'; | |
| $archive = new DOMDocument(); | |
| $archive->loadHTML(file_get_contents('http://www.reverendfun.com/artchives/')); | |
| $i = 0; | |
| $image_urls = []; | |
| $time = time(); | |
| foreach ($archive->getElementsByTagName('a') as $archive_a) { |
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 | |
| $specimen = rand(1, 30); | |
| $width = rand(640, 1600); | |
| $height = rand(360, 1600); | |
| $placeholders = array( | |
| "http://place.manatee.lc/$specimen/$width/$height.jpg", | |
| "http://placecorgi.com/$width/$height", | |
| "http://placekitten.com/$width/$height", | |
| ); | |
| shuffle($placeholders); |