This file contains 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
function paypalFees($sub_total, $round_fee) { | |
// Set Fee Rate Variables | |
$fee_percent = '3.4'; // Paypal's percentage rate per transaction (3.4% in UK) | |
$fee_cash = '0.20'; // Paypal's set cash amount per transaction (£0.20 in UK) | |
// Calculate Fees | |
$paypal_fee = ((($sub_total / 100) * $fee_percent) + $fee_cash); | |
if ($round_fee == true) { |
This file contains 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 highlight($astring, $aword) { | |
if (!is_array ($aword) || !is_string ($astring) || empty ($aword) ) { | |
return false; | |
} | |
$aword = implode ('|', $aword); | |
return preg_replace ('@\b('.$aword.')\b@si', '<strong style="background-color:red">$1</strong>', $astring); | |
} |
This file contains 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 | |
if ( ! class_exists('WP_List_Table')) { | |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php'); | |
} | |
class Events_List_Table extends WP_List_Table | |
{ | |
function __construct() | |
{ | |
global $status, $page; |
This file contains 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
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; | |
[formatter setDateFormat:@"MM-dd-yyy"]; | |
// To use a specific start date | |
// NSDate *startDate = [formatter dateFromString:@"02-16-2013"]; | |
// Start with todays date | |
NSDate *startDate = [NSDate date]; | |
// End date |
This file contains 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
// https://www.php.net/manual/en/transliterator.transliterate.php | |
function slugify($string, $separator = '-') | |
{ | |
$slug = trim(strip_tags($string)); | |
$slug = transliterator_transliterate('NFD; [:Nonspacing Mark:] Remove; NFC; Any-Latin; Latin-ASCII; Lower();', $slug); | |
$slug = preg_replace("/[^a-zA-Z0-9\\/_|+ -]/", '', $slug); | |
$slug = preg_replace("/[\\/_|+ -]+/", $separator, $slug); | |
$slug = trim($slug, $separator); | |
return $slug; | |
} |
This file contains 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
# Method 1 | |
certbot certonly --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory --manual-public-ip-logging-ok -d '*.<ypurdomain>' -d '<ypurdomain>' | |
# Method 2 | |
certbot -d example.com --manual --preferred-challenges dns certonly |
This file contains 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
const admin = require("admin"); | |
function getFirebaseUser(req, res, next) { | |
console.log("Check if request is authorized with Firebase ID token"); | |
if ( | |
!req.headers.authorization || | |
!req.headers.authorization.startsWith("Bearer ") | |
) { | |
console.error( | |
"No Firebase ID token was passed as a Bearer token in the Authorization header.", |
This file contains 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
############################################ | |
## 503 Maintenance mode | |
RewriteCond %{REQUEST_URI} !^/maintenance/ | |
RewriteCond %{REMOTE_HOST} !^YOUR\.IP\.ADDRESS\.HERE$ | |
RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1$ | |
RewriteRule .* index.php [R=503,L] | |
ErrorDocument 503 /maintenance/maintenance.html |
This file contains 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
# Keyboard | |
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms) | |
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms) |
This file contains 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
@ECHO OFF | |
ECHO Creating SSL Cert... | |
set NGINX_HOME=C:\nginx114 | |
set OPENSSL_HOME="C:\Program Files\OpenSSL-Win64\bin" | |
set PATH=%PHP_HOME%;%PATH% | |
openssl req -x509 -nodes -days 36500 -newkey rsa:4096 -keyout %NGINX_HOME%/ssl/%1.key -out %NGINX_HOME%/ssl/%1.crt | |
ECHO SSL Cert Created... | |
ECHO %NGINX_HOME%/conf/%1.key | |
ECHO %NGINX_HOME%/conf/%1.crt |
NewerOlder