Skip to content

Instantly share code, notes, and snippets.

View philsav's full-sized avatar

Philip S philsav

View GitHub Profile
@philsav
philsav / util.js
Created May 28, 2021 09:55 — forked from gitdagray/util.js
Javascript Utility Functions
// Youtube tutorial here: https://youtu.be/LDgPTw6tePk
// These functions are designed to be exported, but you could create a class instead. See tutorial video.
// #1 proper case
export const properCase = (string) => {
return `${string[0].toUpperCase()}${string.slice(1).toLowerCase()}`;
};
@philsav
philsav / functions.php
Created September 11, 2020 13:48 — forked from alexander-young/functions.php
Defer Javascript in WordPress
function defer_parsing_of_js($url)
{
if (is_admin()) return $url; //don't break WP Admin
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
add_filter('script_loader_tag', 'defer_parsing_of_js', 10);
@philsav
philsav / gist:927472f6bd25ebb8378840bed971c5a4
Last active April 3, 2020 08:46 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached .
git commit -m 'Remove the now ignored directory node_modules'
git push origin master