Skip to content

Instantly share code, notes, and snippets.

View macariojames's full-sized avatar
💭
Making things. All the things. Ahh!

Macario James macariojames

💭
Making things. All the things. Ahh!
View GitHub Profile
@macariojames
macariojames / local-mc-validate.js
Created January 28, 2019 16:04
Minified 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||(a.data||(a.data={}),a=a.data),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.map(t,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
macariojames / apache2.conf
Created January 27, 2019 20:16
For gzip compression - Add to Apache conf file
<Directory /var/www/html/>
<IfModule mod_mime.c>
AddType application/x-javascript .js
AddType text/css .css
</IfModule>
<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
macariojames / .htaccess
Created January 26, 2019 15:51
Enable Gzip Compression - Apache - Add this to the .htaccess file
# Enable Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
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
macariojames / .htaccess
Last active January 26, 2019 16:06
Leverage Browser Caching - Apache - Add this to .htaccess file
# Thank you to this gist for some edits (check history! lol) https://gist.github.com/Zodiac1978/3145830
# Leverage Browser Caching
# Fonts
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .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
macariojames / display-active-functions.php
Last active October 29, 2018 19:50
WordPress/PHP: display active functions
echo "<pre>"; print_r( get_defined_functions() );
@macariojames
macariojames / mobile-map-clicker-jquery.js
Last active October 29, 2018 18:40
Link opens Google Maps, iOS Maps on mobile device; normal browser link otherwise (jQuery)
// 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() {
console.log(navigator.userAgent);
// 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
macariojames / functions.php
Last active August 4, 2021 13:30
Change wp-login.php page title // Remove "WordPress" from login page
<?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
macariojames / instagram-feed.js
Created August 31, 2018 20:47
Sorta vanilla javascript instagram feed
// thank you https://ariasthompson.com/2018/02/08/adding-instagram-feed-website-without-plugin/
// for the basis of this feed grab
var getInstagramFeed = function () {
var request = new XMLHttpRequest();
var token = 'ACCESS_TOKEN';
var count = 3;
request.open('GET', 'https://api.instagram.com/v1/users/self/media/recent/?access_token='+token+'&count='+count, true);
request.onload = function(container) {
@macariojames
macariojames / functions.php
Last active August 1, 2019 19:07
Wordpress: register and enqueue of scripts, use wp_localize_script to get current theme images
// for the JS file that needs theme images
// append rest of directory
// could add multiple variables if wanted inside array
// ~mj
wp_localize_script(
'main', // $handle
'WPURLS',
array(
'siteurl' => print_dir('images') // instead of custom function print_dir(), you can put the path of your images directory
@macariojames
macariojames / wp_-sql-query.sql
Created August 27, 2018 18:17
SQL to change default WordPress tables (wp_ to wp_customname_)
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`;