Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.
brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
public static function acf_validate_vocher_code_unique($valid, $value, $field, $input_name) { | |
// Bail early if value is already invalid. | |
if ($valid !== true) { | |
return $valid; | |
} | |
$result = self::validate_voucher_unqiue($value); | |
if( !empty($result) ){ | |
return $result; |
add_filter('acf/validate_value/name=voucher', 'acf_validate_vocher_code_unique', 10, 4); | |
function acf_validate_vocher_code_unique($valid, $value, $field, $input_name) { | |
// Bail early if value is already invalid. | |
if ($valid !== true) { | |
return $valid; | |
} | |
$result = validate_voucher_unqiue($value); |
/* | |
* Add our Custom Fields to simple products | |
*/ | |
function mytheme_woo_add_custom_fields() { | |
global $woocommerce, $post; | |
echo '<div class="options_group">'; | |
// Text Field |
#!/bin/bash | |
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462 | |
find . -type f -iname "*.png" -exec optipng -nb -nc {} \; | |
find . -type f -iname "*.png" -exec advpng -z4 {} \; | |
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \; | |
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \; |
add_filter( 'woocommerce_product_add_to_cart_text', 'superbotics_add_to_cart_text', 20, 2); | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'superbotics_add_to_cart_text', 20, 2); | |
function superbotics_add_to_cart_text( $text, $_product ) { | |
if ( ! $_product->is_in_stock() ) { | |
$text = __('<Custom Text>', 'superbotics-customizations'); | |
} | |
return $text; | |
} |
var tableToExcel = (function() { | |
var uri = 'data:application/vnd.ms-excel;base64,' | |
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' | |
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } | |
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } | |
return function(tableID, name) { | |
table = document.getElementById(tableID); | |
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}; | |
var link = document.createElement("a"); | |
link.download |
function copyToClipboard(textToCopy) { | |
var textArea; | |
function isOS() { | |
//can use a better detection logic here | |
return navigator.userAgent.match(/ipad|iphone/i); | |
} | |
function createTextArea(text) { | |
textArea = document.createElement('textArea'); |
apt update | |
apt upgrade | |
apt install apache2 | |
a2enmod headers rewrite | |
systemctl restart apache2 | |
sudo ufw allow in "Apache" | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update |
<IfModule mod_rewrite.c> | |
# Block suspicious user agents and requests | |
RewriteCond %{HTTP_USER_AGENT} (libwww-perl|wget|python|nikto|curl|scan|java|winhttp|clshttp|loader) [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} (;|<|>|'|"|\)|\(|%0A|%0D|%22|%27|%28|%3C|%3E|%00).*(libwww-perl|wget|python|nikto|curl|scan|java|winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR] | |
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR] | |
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR] | |
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC,OR] | |
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR] |