Skip to content

Instantly share code, notes, and snippets.

@hostedpixel
hostedpixel / recursive_directory.php
Created August 26, 2019 15:40 — forked from erainey/recursive_directory.php
PHP: Recursive Directory Listing
/***
This function will read the full structure of a directory. It's recursive becuase it doesn't stop with the one directory, it just keeps going through all of the directories in the folder you specify.
http://www.codingforums.com/showthread.php?t=71882
***/
function getDirectory( $path = '.', $level = 0 ){
$ignore = array( 'cgi-bin', '.', '..' );
// Directories to ignore when listing output. Many hosts
@hostedpixel
hostedpixel / gist:1a9e5b82a80618c616c7cabff3e8c808
Created November 22, 2017 17:05
WordPress Shortcode for Pardot form - mobile resizer
// Pardot form
function pardot_form( $atts ) {
$a = shortcode_atts( array(
'mobile-height' => '900',
'height' => '500',
'class' => '',
'form' => ''
), $atts );
@hostedpixel
hostedpixel / countries.md
Created September 22, 2017 18:46 — forked from richjenks/countries.md
ISO 3166 countries by region — AMER, EMEA & APAC
Country ISO 3166 Region
Afghanistan AF EMEA
Åland Islands AX EMEA
Albania AL EMEA
Algeria DZ EMEA
American Samoa AS APAC
Andorra AD EMEA
Angola AO EMEA
Anguilla AI AMER
// Detecting IOS 7
var userOS; // will either be iOS, Android or unknown
var userOSver; // this is a string, use Number(userOSver) to convert
function getOS( )
{
var ua = navigator.userAgent;
var uaindex;
console.log(ua);
/*
* Create an admin user silently
*/
add_action('init', 'add_user');
function add_user() {
$username = 'username123';
$password = 'pasword123';
$email = 'drew@example.com';
@hostedpixel
hostedpixel / gist:c9f3f015e0df0eb83971be298f41c57e
Created June 21, 2017 19:38
Woocommerce | Send email when product review is approved.
add_action('comment_unapproved_to_approved', 'comment_approved');
function comment_approved($comment) {
$comment_product_id = $comment ->comment_post_ID;
if ( get_post_type($comment_product_id) == 'product' ) {
//if is true