One-liner for finding non-ASCII characters
# Linux
$ grep --color='auto' -P -n "[\x80-\xFF]" file.js
# Mac OS X after 'brew install pcre'
$ pcregrep --color='auto' -n "[\x80-\xFF]" file.js
<?php | |
add_action('admin_init', 'add_meta_boxes', 1); | |
function add_meta_boxes() { | |
add_meta_box( 'repeatable-fields', 'Audio Playlist', 'repeatable_meta_box_display', 'post', 'normal', 'high'); | |
} | |
function repeatable_meta_box_display() { | |
global $post; |
FROM alpine:3.3 | |
MAINTAINER Tom Maiaroto <tom@outdoorsy.co> | |
# Install packages | |
RUN apk --update --repository http://dl-3.alpinelinux.org/alpine/edge/main add \ | |
freetype-dev \ | |
libjpeg-turbo-dev \ | |
libpng-dev \ | |
libwebp-dev \ | |
php7 \ |
One-liner for finding non-ASCII characters
# Linux
$ grep --color='auto' -P -n "[\x80-\xFF]" file.js
# Mac OS X after 'brew install pcre'
$ pcregrep --color='auto' -n "[\x80-\xFF]" file.js
@echo off | |
wsl exit | |
powershell -Command "Set-NetAdapterLso -Name 'vEthernet (WSL)' -IPv4Enabled $False -IPv6Enabled $False" |
<?php | |
/** | |
* gets the current post type in the WordPress Admin | |
*/ | |
function get_current_post_type() { | |
global $post, $typenow, $current_screen; | |
//we have a post so we can just get the post type from that | |
if ( $post && $post->post_type ) { | |
return $post->post_type; |
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter | |
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' ); | |
function add_my_custom_product_data_tab( $product_data_tabs ) { | |
$product_data_tabs['my-custom-tab'] = array( | |
'label' => __( 'My Custom Tab', 'my_text_domain' ), | |
'target' => 'my_custom_product_data', | |
); | |
return $product_data_tabs; | |
} |
<?php | |
$args = array( | |
// Normal query goes here // | |
'no_found_rows' => true, // counts posts, remove if pagination required | |
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...) | |
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required | |
); |
#!/bin/bash | |
brew search librabbitmq | |
brew install rabbitmq-c | |
pecl install amqp | |
# set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.10.0 | |
# if it fails follow the following (reference: https://github.com/pdezwart/php-amqp/issues/355#issuecomment-563203121): |
var mkdir = function(dir) { | |
// making directory without exception if exists | |
try { | |
fs.mkdirSync(dir, 0755); | |
} catch(e) { | |
if(e.code != "EEXIST") { | |
throw e; | |
} | |
} | |
}; |