Skip to content

Instantly share code, notes, and snippets.

Making things. All the things. Ahh!

Macario James macariojames

Making things. All the things. Ahh!
View GitHub Profile
View local-mc-validate.js
!function(e,t){"use strict";function n(e){var t=e.length,n=K.type(e);return!K.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)))}function r(e,n,r,i){if(K.acceptData(e)){var a,o,s=K.expando,u="string"==typeof n,l=e.nodeType,c=l?K.cache:e,d=l?e[s]:e[s]&&s;if(d&&c[d]&&(i||c[d].data)||!u||r!==t)return d||(l?e[s]=d=$.pop()||K.guid++:d=s),c[d]||(c[d]={},l||(c[d].toJSON=K.noop)),("object"==typeof n||"function"==typeof n)&&(i?c[d]=K.extend(c[d],n):c[d].data=K.extend(c[d].data,n)),a=c[d],i||(||({}),,r!==t&&(a[K.camelCase(n)]=r),u?(o=a[n],null==o&&(o=a[K.camelCase(n)])):o=a,o}}function i(e,t,n){if(K.acceptData(e)){var r,i,a,s=e.nodeType,u=s?K.cache:e,l=s?e[K.expando]:K.expando;if(u[l]){if(t&&(r=n?u[l]:u[l].data)){K.isArray(t)?t=t.concat(,K.camelCase)):t in r?t=[t]:t=(t=K.camelCase(t))in r?[t]:t.split(" ");for(i=0,a=t.length;a>i;i++)delete r[t[i]];if(!(n?o:K.isEmptyObject)(r))return}(n||(delete u[l].data,o(u[l])))&&(s?K.cleanData([
macariojames / apache2.conf
Created Jan 27, 2019
For gzip compression - Add to Apache conf file
View apache2.conf
<Directory /var/www/html/>
<IfModule mod_mime.c>
AddType application/x-javascript .js
AddType text/css .css
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/plain text/xml application/javascript
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
macariojames / .htaccess
Created Jan 26, 2019
Enable Gzip Compression - Apache - Add this to the .htaccess file
View .htaccess
# Enable Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
macariojames / .htaccess
Last active Jan 26, 2019
Leverage Browser Caching - Apache - Add this to .htaccess file
View .htaccess
# Thank you to this gist for some edits (check history! lol)
# Leverage Browser Caching
# Fonts
# Add correct content-type for fonts
AddType application/ .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
macariojames / display-active-functions.php
Last active Oct 29, 2018
WordPress/PHP: display active functions
View display-active-functions.php
echo "<pre>"; print_r( get_defined_functions() );
macariojames / mobile-map-clicker-jquery.js
Last active Oct 29, 2018
Link opens Google Maps, iOS Maps on mobile device; normal browser link otherwise (jQuery)
View mobile-map-clicker-jquery.js
// Checks if on mobile device
// Changes link to go to Google Maps
// Which should open automatically in Apple or Google Maps on Android/iOS device ~mj
function mobileMapClicker() {
// Checks userAgent if mobile device
if (/Mobi/.test(navigator.userAgent)) {
console.log('Mobile Device Detected!');
/* if we're on iOS, open in Apple Maps */
macariojames / functions.php
Last active Dec 3, 2020
Change wp-login.php page title // Remove "WordPress" from login page
View functions.php
// Put this in your functions.php file
// Changes wp-login.php page title
// Here I'm removing the default "WordPress" at the end of it ~mj
function custom_login_title( $login_title ) {
return str_replace(array( ' &lsaquo;', ' &#8212; WordPress'), array( ' &lsaquo;', ''),$login_title );
add_filter( 'login_title', 'custom_login_title' );
macariojames / instagram-feed.js
Created Aug 31, 2018
Sorta vanilla javascript instagram feed
View instagram-feed.js
// thank you
// for the basis of this feed grab
var getInstagramFeed = function () {
var request = new XMLHttpRequest();
var token = 'ACCESS_TOKEN';
var count = 3;'GET', ''+token+'&count='+count, true);
request.onload = function(container) {
macariojames / functions.php
Last active Aug 1, 2019
Wordpress: register and enqueue of scripts, use wp_localize_script to get current theme images
View functions.php
// for the JS file that needs theme images
// append rest of directory
// could add multiple variables if wanted inside array
// ~mj
'main', // $handle
'siteurl' => print_dir('images') // instead of custom function print_dir(), you can put the path of your images directory
macariojames / wp_-sql-query.sql
Created Aug 27, 2018
SQL to change default WordPress tables (wp_ to wp_customname_)
View wp_-sql-query.sql
RENAME table `wp_commentmeta` TO `wp_localapi_commentmeta`;
RENAME table `wp_comments` TO `wp_localapi_comments`;
RENAME table `wp_links` TO `wp_localapi_links`;
RENAME table `wp_options` TO `wp_localapi_options`;
RENAME table `wp_postmeta` TO `wp_localapi_postmeta`;
RENAME table `wp_posts` TO `wp_localapi_posts`;
RENAME table `wp_terms` TO `wp_localapi_terms`;
RENAME table `wp_termmeta` TO `wp_localapi_termmeta`;
RENAME table `wp_term_relationships` TO `wp_localapi_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp_localapi_term_taxonomy`;
You can’t perform that action at this time.