Skip to content

Instantly share code, notes, and snippets.

View michaelwhyte's full-sized avatar

Michael Whyte michaelwhyte

View GitHub Profile
@michaelwhyte
michaelwhyte / isnumeric.js
Last active January 30, 2018 21:08
A function to determine if a value is a number even if the value is a string number
// Code from this stackoverflow question
// https://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number
function isNumeric(num){
return !isNaN(num)
}
@michaelwhyte
michaelwhyte / box-sizing-reset.css
Created February 6, 2018 17:55
Box Sizing Reset
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
@michaelwhyte
michaelwhyte / keyboard-accessible-dropdown.js
Created February 8, 2018 19:03
Make dropdown navigation bar keyboard accessible
const $nav = $('nav');
// The following JS modified from
// JS found at this per: http://codepen.io/laviperchik/pen/dlcBt
$.fn.accessibleDropDown = function () {
var el = $(this);
/* Make dropdown menus keyboard accessible */
@michaelwhyte
michaelwhyte / full-bleed-in-fixed-width.css
Created February 14, 2018 04:17
Full bleed element inside a fix-width parent
/* This code from this CSS-Tricks article:
https://css-tricks.com/full-width-containers-limited-width-parents/
*/
.full-width {
width: 100vw;
position: relative;
left: 50%;
right: 50%;
@michaelwhyte
michaelwhyte / vs-code-settings.js
Created February 14, 2018 05:00
Visual Studio Code TWD - Settings
{
"emmet.triggerExpansionOnTab": true,
"path-autocomplete.extensionOnImport": true,
"editor.fontSize": 36
}
@michaelwhyte
michaelwhyte / system-font.css
Created February 16, 2018 21:43
System Font Stack for the Web
/*
This code modified from:
https://css-tricks.com/shipping-system-fonts-github-com/
*/
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
@michaelwhyte
michaelwhyte / vs-code-editor-settings.json
Last active May 18, 2018 23:10
Visual Studio Code Settings
{
"emmet.triggerExpansionOnTab": true,
"path-autocomplete.extensionOnImport":true,
"editor.fontSize": 36,
"workbench.colorTheme": "Default Light+",
"terminal.integrated.fontSize": 24,
"git.ignoreMissingGitWarning": true,
"workbench.editor.enablePreview": false,
"editor.formatOnSave": true,
"html.format.enable": true,
@michaelwhyte
michaelwhyte / php-vs-code-bug-fix.json
Created March 6, 2018 00:10
Visual Studio Code - PHP Bug Fix - PHP files cause an error in Visual Studio Code - Add these lines to your settings file to fix that
{
"php.suggest.basic": false,
"php.validate.enable": false
}
@michaelwhyte
michaelwhyte / vs-code-twd-bcit-php-bug-fix.json
Created March 6, 2018 19:24
VS Code - TWD BCIT computers PHP file bug fix
{
"php.validate.executablePath": "C:/MAMP/bin/php/php7.1.5/php.exe"
}
@michaelwhyte
michaelwhyte / get-siblings.js
Created April 6, 2018 17:35
Get sibling elements with an optional filter selector
// Get Sibling Elements with Filter
// The getSiblings() and getChildren() code has been customized by @michaelwhyte
// from code found on this Stackoverflow question:
// https://stackoverflow.com/questions/842336/is-there-a-way-to-select-sibling-nodes
//
// The code from the stackoverflow question is based on
// jQuery's siblings() code
function getSiblings(n, filter) {
return getChildren(n.parentNode.firstChild, n, filter);
}