Skip to content

Instantly share code, notes, and snippets.

💭
Cleaning up GitHub ... Teams, Organizations, Repos, all of it!

Macario James macariojames

💭
Cleaning up GitHub ... Teams, Organizations, Repos, all of it!
Block or report user

Report or block macariojames

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@macariojames
macariojames / position-offset-userway.css
Last active Jul 10, 2019
Offset position of Userway.org widget
View position-offset-userway.css
// So I needed to change the position of the floating widget on mobile for my site since
// I have a fixed footer navbar. After not seeing any controsl in the .js script, figured i'd just override it
// via CSS. Here you go.
// (Yes, using '!important' is crappy, but it was necessary to get this done.) ~mj
@media screen and (max-width: 768px) {
body .userway.userway_p3 {
bottom: 65px!important;
}
}
@macariojames
macariojames / print-necessary-template-directory.php
Created May 9, 2019
WordPress: function to display template directory based on needs, such as CSS, images, js files, etc.
View print-necessary-template-directory.php
// echo relevant directory ~mj
function print_dir($type) {
if($type === '')
$dir = get_template_directory_uri();
else if ($type === 'js')
$dir = get_template_directory_uri() . '/public/js/';
else if ($type === 'css')
$dir = get_template_directory_uri() . '/public/css/';
else if ($type === 'images')
@macariojames
macariojames / select-option-disable.js
Last active Apr 17, 2019
Disabling Form Select Option based on value (Gravity Form)
View select-option-disable.js
// This was specifically for Gravity Form i wanted to disable options based on a null value.
// In the dropdown I had, some values were used as headers so people would know the type of
// item they were selecting -- in this case the dropdown was for liquor/wine selection
// Before to put the "true" part after disabled rather than leaving it blank
// or it won't work in any browser but Chrome (Mac).
// gForm disable select options with null or '|0' value
$('.gform_body select option[value="null|0"]').attr("disabled","true");
@macariojames
macariojames / header.php
Created Apr 5, 2019
WordPress redirect non-logged in user to a page/site
View header.php
// put this in header.php
if (!is_user_logged_in()) {
wp_redirect( 'https://www.yourdomain.com');
exit;
} ?>
View local-horizontal-slim-10_7.css
#mc_embed_signup form{text-align:center;padding:10px 0}.mc-field-group{display:inline-block}#mc_embed_signup input.email{font-family:"Open Sans","Helvetica Neue",Arial,Helvetica,Verdana,sans-serif;font-size:15px;border:1px solid #ABB0B2;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;color:#343434;background-color:#fff;box-sizing:border-box;height:32px;padding:0 .4em;display:inline-block;margin:0;width:350px;vertical-align:top}#mc_embed_signup label{display:block;font-size:16px;padding-bottom:10px;font-weight:700}#mc_embed_signup .clear{display:inline-block}#mc_embed_signup .button{font-size:13px;border:none;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;letter-spacing:.03em;color:#fff;background-color:#aaa;box-sizing:border-box;height:32px;line-height:32px;padding:0 18px;display:inline-block;margin:0;transition:all .23s ease-in-out 0s}#mc_embed_signup .button:hover{background-color:#777;cursor:pointer}#mc_embed_signup div#mce-responses{float:left;top:-1.4em;padding:0 .5
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||(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 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>
<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 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/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 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) 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 Oct 29, 2018
WordPress/PHP: display active functions
View display-active-functions.php
echo "<pre>"; print_r( get_defined_functions() );
You can’t perform that action at this time.