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
| // Controller method... | |
| public function download() | |
| { | |
| return response()->streamDownload(function () { | |
| $token = config('services.cloudflare.api_token'); | |
| $accountId = config('services.cloudflare.account_id'); | |
| $cloudflareApi = 'https://api.cloudflare.com/client/v4'; | |
| echo Http::withToken($token) | |
| ->post($cloudflareApi.'/accounts/'.$accountId.'/browser-rendering/pdf', [ |
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 | |
| /** | |
| * Shortcode Extended | |
| * | |
| * @package ShortcodeExtended | |
| * @author Chris Sparshott | |
| * @copyright 2022 Chris Sparshott | |
| * @license GPL-2.0-or-later | |
| * |
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 | |
| // The field accepts a value with this structure | |
| $value = [ | |
| 'address' => '123 Example St, Townsville XYZ 1234, Country', | |
| 'lat' => - 38.1486228, | |
| 'lng' => 144.360414, | |
| 'zoom' => 14, | |
| 'place_id' => 'Ei0xMjMgTW9vcmFib29sIFN0LCBHZWVsb25nIFZJQyAzMjIwLCBBdXN0cmFsaWEiMBIuChQKEgmX0JaIHBTUahFyH_LC9sYD8hB7KhQKEglDz-DYDxTUahECZY8QisCjzg', | |
| 'street_number' => 123, |
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 modify_woo_ticket_headers( $headers, $id ) { | |
| remove_filter( 'woocommerce_email_headers', 'modify_woo_ticket_headers' ); | |
| $organizer_email = tribe_get_organizer_email( $id, false ); | |
| // add organizer email if it's a valid email address | |
| if ( is_email( $organizer_email ) ) { | |
| $headers[] = sprintf( 'Cc: %s', $organizer_email ); | |
| } |
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
| // From https://blog.dalanmiller.com/2018/12/02/easily-removing-all-your-files-from-flickr/ | |
| document.querySelectorAll('.photo-data-list, .account-data-list') | |
| .forEach( item => | |
| item.querySelectorAll('a') | |
| .forEach((e) => { | |
| console.log(e.href) | |
| } | |
| )) |
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 | |
| /** | |
| * Filter for GravityForms to group select field choices by a special "optgroup" choice. | |
| * | |
| * Simply add a new choice with a value of 'optgroup' to the dropdown to start a group of options. | |
| * All following choices will be grouped under it using its label for the group. | |
| * Any number of groups can be created, as each optgroup choice will start a new group. | |
| * Supports field placeholder & ungrouped options, but must be before the first group. | |
| * | |
| * This snippet can be added to your theme's functions.php, or a custom plugin. |
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
| # from https://codeburst.io/how-i-hacked-my-terminal-so-a-happy-whale-would-spout-software-quotes-at-me-6791e6c74fc6 | |
| % | |
| Simple things should be simple, complex things should be possible. | |
| The Wiki Way: Quick Collaboration on the Web, Bo Leuf, Ward | |
| Cunningham | |
| % | |
| Simplicity is the soul of efficiency. | |
| Austin Freeman | |
| % |
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 | |
| /** | |
| * Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended | |
| * to the end of the array. | |
| * | |
| * @param array $array | |
| * @param string $key | |
| * @param array $new | |
| * |
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 array_size($arr) { | |
| $byte = 0; | |
| foreach ($arr as $key => $val) { | |
| $byte += is_array($val) ? array_size($val) : mb_strlen($val); | |
| } | |
| $kb = number_format($byte / 1024, 4); | |
| $mb = number_format($byte / 1048576, 4); | |
| $gb = number_format($byte / 1073741824, 4); | |
| $result = array('Bytes: ' => $byte, 'Kilobytes: ' => $kb, 'Megabytes: ' => $mb, 'Gigabytes: ' => $gb); |
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
| /* Given table 'zipcodes' with columns: | |
| zipcode, latitude, longitude. | |
| Find zipcodes within radius from given zipcode. | |
| EXAMPLE: | |
| Coordinates for zip 91326 and radius 25 mi: | |
| */ | |
| SET @location_lat = 34.2766, | |
| @location_lon = -118.544; | |
| SELECT zipcode, ( 3959 * acos( cos( radians(@location_lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(@location_lon) ) + sin( radians(@location_lat) ) * sin( radians( latitude ) ) ) ) AS distance |
NewerOlder