Skip to content

Instantly share code, notes, and snippets.

@royce002
royce002 / disable-mod-pagespeed-htaccess
Created May 5, 2017 18:32
How to disable Mod PageSpeed in .htaccess
ModPagespeed off
@royce002
royce002 / CloseIframeVideo.js
Created July 6, 2017 00:51
Closes an iframe video on modal close
var $frame = $('iframe#yourIframeId');
// saves the current iframe source
var vidsrc = $frame.attr('src');
// sets the source to nothing, stopping the video
$frame.attr('src','');
// sets it back to the correct link so that it reloads immediately on the next window open
$frame.attr('src', vidsrc);
@royce002
royce002 / gist:1894c65e44335d4bb3d069572178ad0b
Created July 31, 2017 17:00
MySql Script to Move To Inno
SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;')
FROM INFORMATION_SCHEMA.TABLES
WHERE ENGINE='MyISAM'
AND table_schema = 'mydatabase';
@royce002
royce002 / js
Created August 21, 2017 18:46
JS Phone Number Formatter
/*** PHONE NUMBER FORMATTER ***/
function phoneFormat(input) {
// Strip all characters except digits
input = input.replace(/\D/g, '');
// Trim input to ten characters, to preserve phone format
input = input.substring(0, 10);
// Format string based on length
var size = input.length;
if (size == 0) {
input = input;
@royce002
royce002 / defineConstantForSecurity.php
Created October 26, 2017 19:02
Define a constant between pages for security
<?php
if(!defined('MyConstant')) {
die('Direct access not permitted');
}
?>
<?php
define('MyConstant', TRUE);
?>
@royce002
royce002 / shopifyOrderDelete.js
Created November 2, 2017 15:07
Delete an Order from the Shopify Backend. (Good for test order blowout)
$('button[name="button"].btn-destroy')[0].click();
setTimeout(function() {
console.log("fire");
$('.btn-destroy-no-hover')[0].click();
}, 600);
img[alt=""],
img:not([alt]){
border:5px solid #c00;
}
@royce002
royce002 / wp_enqueue_scripts.php
Created December 1, 2017 18:43
Enqueue Scripts and styles with timestamp versioning for functions.php in WordPress
/**
* Enqueue Styles & Scripts w/ a hook
*/
function enqueue_styles_scripts_versioning() {
wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/style.css'), false);
wp_enqueue_script( 'main-styles', get_template_directory_uri() . '/js/example.js', array(), filemtime(get_template_directory() . '/js/example.js'), true );
}
add_action( 'wp_enqueue_scripts', 'enqueue_styles_scripts_versioning' );
@royce002
royce002 / .gitignore
Created February 13, 2018 17:40 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@royce002
royce002 / Print Directory With Out Details
Created March 1, 2018 03:44
Windows command to print directory contents showing filenames only
cmd /r dir /b > filename.txt