Skip to content

Instantly share code, notes, and snippets.

View andyford's full-sized avatar

Andy Ford andyford

View GitHub Profile
// a js/node sleep/delay because I always forget how
// credit: https://stackoverflow.com/a/49139664/17252
await new Promise(resolve => setTimeout(resolve, 2000));
@andyford
andyford / clear-console.js
Created May 19, 2017 21:32
Clear the dev console on cmd+k
document.addEventListener('keydown', function(e) {
if (e.keyCode == 75 && (e.ctrlKey || e.metaKey)) {
console.clear();
}
});
@andyford
andyford / breakpoint-rainbow-box.scss
Last active February 21, 2018 23:25
Breakpoint rainbows for Bootstrap (v4-alpha5) for glaringly obvious breakpoint debugging/development
// puts a little box in the bottom right instead of changing the body bg color
body:after {
content: 'xlg';
position: fixed;
z-index: 99999;
bottom: 0;
right: 0;
padding: 2px 5px;
border: 1px solid;
@andyford
andyford / table-with-border-radius.scss
Last active July 12, 2016 11:13
Because I always forget how to do it...
$table-rounded-border-color-outer: #ccc;
$table-rounded-border-color-inner: #ddd;
$table-rounded-border-radius: 5px;
.table-rounded {
border-collapse: separate;
border: 1px solid $table-rounded-border-color-outer;
border-width: 1px 0 0 1px;
border-radius: $table-rounded-border-radius;
input[type="password"] {
font-family: Verdana, Impact, serif;
font-weight: bolder;
letter-spacing: 0.1em;
// reset for placeholders (if using them)
// assumes '$font-sans' is the default font for your inputs
&::-webkit-input-placeholder {
font-family: $font-sans;
<h1>abcd efg hijk lmnop qrs tuv wxyz</h1>
<h1>1234567890 ?! $#@%&*() - = + :;""''.,/</h1>
<h1>ABCD EFG HIJK LMNOP QRS TUV WXYZ</h1>
<h2>abcd efg hijk lmnop qrs tuv wxyz</h2>
<h2>1234567890 ?! $#@%&*() - = + :;""''.,/</h2>
<h2>ABCD EFG HIJK LMNOP QRS TUV WXYZ</h2>
<h3>abcd efg hijk lmnop qrs tuv wxyz</h3>
@andyford
andyford / color-map-categories.scss
Last active May 25, 2016 13:08
Category classes with corresponding colors using Sass map
$category-colors: (
alpha: red,
bravo: darkorange,
charlie: gold,
delta: yellowgreen,
echo: green,
foxtrot: skyblue,
golf: blue,
hotel: purple,
india: violet,
@andyford
andyford / sass-columns.scss
Last active May 25, 2016 12:44
Basic sass column widths for any multiple of columns
$max-columns: 8;
@for $i from 2 through $max-columns {
@for $j from 1 through ($i - 1) {
.col-#{$j}-#{$i} {
width: decimal-floor((($j / $i) * 100%), 3);
}
}
}
@andyford
andyford / basic-grid.scss
Created January 25, 2016 11:29
super basic Sass grid
$total-cols: 12;
.col-group {
position: relative;
// @include clearfix; // bourbon
// @include pie-clearfix; // compass
}
.col {
@andyford
andyford / NavMainCtrl.js
Created August 15, 2014 21:43
Current/Active nav in AngularJS
/*
* NavMainCtrl
* inspired by: http://stackoverflow.com/a/18894679/17252
*/
.controller('NavMainCtrl', ['$scope', '$location', function ($scope, $location) {
$scope.isCurrentPath = function (paths) {
// if we get a string instead of an array, turn into array with single string element
if (_.isString(paths)) { paths = [paths]; }
var i, len = paths.length;