Skip to content

Instantly share code, notes, and snippets.

View colorful-tones's full-sized avatar
💓
Don’t believe the hype!

Damon Cook colorful-tones

💓
Don’t believe the hype!
View GitHub Profile
@colorful-tones
colorful-tones / foobar.css
Created October 31, 2018 18:24
CSS variables: valid vs invalid values
:root {
--my-var: 🎃;
}
.foo {
color: var(--my-var);
}
@colorful-tones
colorful-tones / foo.css
Created October 31, 2018 18:22
CSS variables with fallback value
.foo {
color: var(--my-var, red); /* Red if --my-var is not defined */
}
@colorful-tones
colorful-tones / variables.css
Last active November 1, 2018 13:14
CSS color variables
:root {
/* Set initial saturation and lightness values */
--sat: 50%;
--light: 50%;
/* Set amount of light & saturation to change for darker & lighter color variants */
--shader: 15%;
/* Calculate saturation values for lighter & darker color variations */
--satDarker: calc(var(--sat) + var(--shader));
@colorful-tones
colorful-tones / buttons.css
Last active October 31, 2018 18:18
CSS buttons
.button {
--button-bg: var(--button-bg-base);
background-color: var(--button-bg);
color: var(--button-c-base);
// other button default styling stuff...
&:hover {
--button-bg: var(--button-bg-base-hover);
}
}
@colorful-tones
colorful-tones / buttons.css
Created October 31, 2018 17:54
[Managing CSS color variables] A method for writing, organizing and scaling CSS color variables #CSS
.button {
--button-bg: var(--button-bg-base);
background-color: var(--button-bg);
color: var(--button-c-base);
// other button default styling stuff...
&:hover {
--button-bg: var(--button-bg-base-hover);
}
@colorful-tones
colorful-tones / for-in-loop-1.js
Last active September 24, 2018 20:53
[Fun with `for` loops] #JavaScript
// https://courses.wesbos.com/account/access/5b6921eb99ce1f5578c26a50/view/174357559
const cuts = [ 'Chuck', 'Brisket', 'Shank', 'Short Rib' ];
for ( const index in cuts ) {
console.log( cuts[index] );
}
@colorful-tones
colorful-tones / leftpad.js
Last active September 24, 2018 20:40
[Left pad] simple left page function from Wes Bos's ES6 course #JavaScript #utility
// https://courses.wesbos.com/account/access/5b6921eb99ce1f5578c26a50/view/174357553
function left_pad( str, length = 20 ) {
return `-> ${' '.repeat( length - str.length )}${str};
}
console.log( left_pad( 'All' );
console.log( left_pad( 'these' );
console.log( left_pad( 'strings' );
console.log( left_pad( 'should' );
console.log( left_pad( 'be' );
/*
* Root-level Variables
* Usage: color: var( --c-primary );
*/
:root {
--c-blue-quinary: #174893;
--c-white: #ffffff;
--font-secondary: 'Source Sans Pro', sans-serif;
@colorful-tones
colorful-tones / style.css
Created September 21, 2018 15:04
[Stylelint test #1] Testing possibly 10up Stylelint rules
:root {
/* Colors. */
--color-white: #fff;
--color-dark: #111;
--color-light: #e9e9e8;
--color-brand: #5a6fff;
--color-black-rgb: 0, 0, 0;
--spacing-unit: 0.5rem;
--spacing-unit-2: 1rem;
@colorful-tones
colorful-tones / aliases
Last active October 12, 2018 15:34
docker
#########################################
# Docker #
#########################################
alias dc="docker-compose"
# Interact with WP-CLI in Docker container
alias dockwp="docker-compose exec --user www-data phpfpm wp"
# SSH in to Docker container
alias dockroot="docker-compose exec --user root phpfpm bash"
alias dockbash='docker-compose exec --user www-data phpfpm bash'