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
| read -p "Purge all untracked Git files? " -n 1 && [[ $REPLY =~ ^[Yy]$ ]] && git stash save -u && git stash drop "stash@{0}" |
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
| # when investigationg an existing project that uses makefiles it is very useful to lookup all its commands/targets | |
| # this bash alias does exactly that when run in makefile containing directory | |
| # the script taken from here https://unix.stackexchange.com/questions/230047/how-to-list-all-targets-in-make | |
| # and fixed a bit to use it in the alias | |
| alias mkshowall="make -npq : 2> /dev/null | awk -v RS= -F: '\$1 ~ /^[^#%.]+$/ { print \$1 }'" |
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
| // When debugging Laravel application | |
| // just add this code somewhere in AppServiceProvider::boot() | |
| // and it will log all SQL-queries in file "query.log" | |
| $file = storage_path('query.log'); | |
| if (file_exists($file)) {unlink($file);} | |
| \Illuminate\Support\Facades\DB::listen(function($query) use ($file) { | |
| \Illuminate\Support\Facades\File::append( | |
| $file, | |
| $query->sql . ' [' . json_encode($query->bindings) . ']' . PHP_EOL |
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
| /** | |
| * When testing Laravel PHP code, sometimes it is necessary to mock object through alias, | |
| * for example to override object static methods. | |
| * | |
| * It can be done like this: | |
| * $this->mockSomeObject = $this->mock('alias:SomeObjectClassName'); | |
| * . | |
| * Hovewer mocking a class in a such way persists even after Mockery::close() and could affects remainder tests. | |
| * To overcome this, just add these two annotations in each class where class is mocked by alias | |
| * |
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
| import os | |
| import re | |
| import requests | |
| import zipfile | |
| XML_INFO_URL = 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE_' | |
| DRIVER_PATH = 'https://chromedriver.storage.googleapis.com' | |
| ZIPPED_DRIVER_FILE_NAME = 'chromedriver_linux64.zip' | |
| UNZIPPED_DRIVER_FILE_NAME = 'chromedriver' |
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 | |
| /** | |
| * gets real image urls in Facebook CDN from "fake" url that comes from Facebook API news feeds | |
| * take in account that those real urls have embedded timestamp that makes them valid only temporarily | |
| * @param type $imageFakeUrl - "fake" url from Facebook API output | |
| * @return array with image info in multiple resolutions including theirs urls | |
| * @throws UnexpectedValueException | |
| * | |
| * detailed description: being queried for content, Facebook API returns fake images urls | |
| * that points to HTML page with this image and text description |
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
| /* | |
| * WP REST API version 2.0-beta7 | |
| * API base url ishttp://www.example.com/wp-json | |
| * | |
| * Reference | |
| * https://developer.wordpress.org/rest-api/reference/media/ | |
| * | |
| * Description | |
| * an example of loading image to WordPress API using Guzzle | |
| * inspired by s-hiroshi's gist at https://gist.github.com/s-hiroshi/3477e07454d809b9d38f |
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
| <html> | |
| <head> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.4/vue.js"></script> | |
| </head> | |
| <body> | |
| <div id='vue-app'> | |
| <tabs> | |
| <tab name="First tab"> | |
| This is the content of the first tab | |
| </tab> |