Skip to content

Instantly share code, notes, and snippets.

<?php
// Initilise cURL
$ch = curl_init();
// Set the cURL Options
$optArray = array(
CURLOPT_URL => 'https://example.com/api/getInfo/',
CURLOPT_RETURNTRANSFER => true
);
@keithgreer
keithgreer / telephone-country-codes.php
Last active December 23, 2021 09:59
Mapping international dialing codes to ISO 3166-1 alpha-2 country codes - https://keithgreer.dev/global-payments-sca-3d-secure-2
/*
* Usage: $calling_codes['GB'] will return "44", the UK's dialing code.
*/
$calling_codes = [
'BD' => '880',
'BE' => '32',
'BF' => '226',
'BG' => '359',
'BA' => '387',
@keithgreer
keithgreer / numeric-country-code.php
Last active December 23, 2021 09:59
This code maps ISO 3166-1 alpha-2 country codes to their ISO 3166-1 numeric three-digit equivalents https://keithgreer.dev/global-payments-sca-3d-secure-2
/*
* Usage: $countries['GB'] will return "826", the UK's ISO 3166-1 numeric three-digit code.
*/
$countries = [
'AF' => '004',
'AX' => '248',
'AL' => '008',
'DZ' => '012',
'AS' => '016',
{%- unless template == 'index' or template == 'cart' or template == 'list-collections' or template == '404' -%}
{%- assign t = template | split: '.' | first -%}
<nav class="breadcrumbs" role="navigation" aria-label="breadcrumbs">
<ol class="breadcrumbs__list">
<li class="breadcrumbs__item">
<a class="breadcrumbs__link" href="/">Home</a>
</li>
{%- case t -%}
{%- when 'page' -%}
<?php # https://keithgreer.uk/wordpress-code-completely-disable-comments-using-functions-php
/* PURPOSE
* Disable comments on ALL post types
* remove/hide any existing comments
* from displaying and hide forms.
*/
/* INSTALL
* Add into your active theme's functions.php file.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
## START EXPIRES CACHING ##
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"