See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
/* -------------------------------------------------------------------------- */ | |
// All Bootstrap 5 Sass Mixins [ Cheat sheet ] | |
// Updated to Bootstrap v5.1.x | |
// @author https://anschaef.de | |
// @see https://github.com/twbs/bootstrap/tree/main/scss/mixins | |
// @see https://github.com/twbs/bootstrap/blob/main/scss/_variables.scss | |
/* -------------------------------------------------------------------------- */ | |
// Options | |
// @see https://getbootstrap.com/docs/5.1/customize/options/ |
// Class Inheritance Example | |
// NOT RECOMMENDED. Use object composition, instead. | |
// https://gist.github.com/ericelliott/b668ce0ad1ab540df915 | |
// http://codepen.io/ericelliott/pen/pgdPOb?editors=001 | |
class GuitarAmp { | |
constructor ({ cabinet = 'spruce', distortion = '1', volume = '0' } = {}) { | |
Object.assign(this, { | |
cabinet, distortion, volume |
const wait = time => new Promise((resolve) => setTimeout(resolve, time)); | |
wait(3000).then(() => console.log('Hello!')); // 'Hello!' |
const wait = ( | |
time, | |
cancel = Promise.reject() | |
) => new Promise((resolve, reject) => { | |
const timer = setTimeout(resolve, time); | |
const noop = () => {}; | |
cancel.then(() => { | |
clearTimeout(timer); | |
reject(new Error('Cancelled')); |
const wait = time => new Promise( | |
res => setTimeout(() => res(), time) | |
); | |
wait(200) | |
// onFulfilled() can return a new promise, `x` | |
.then(() => new Promise(res => res('foo'))) | |
// the next promise will assume the state of `x` | |
.then(a => a) | |
// Above we returned the unwrapped value of `x` |
// HOF Wraps the native Promise API | |
// to add take a shouldCancel promise and add | |
// an onCancel() callback. | |
const speculation = ( | |
fn, | |
cancel = Promise.reject() // Don't cancel by default | |
) => new Promise((resolve, reject) => { | |
const noop = () => {}; | |
const onCancel = ( |
import speculation from 'speculation'; | |
const wait = ( | |
time, | |
cancel = Promise.reject() // By default, don't cancel | |
) => speculation((resolve, reject, onCancel) => { | |
const timer = setTimeout(resolve, time); | |
// Use onCancel to clean up any lingering resources | |
// and then call reject(). You can pass a custom reason. |
const filter = (fn, arr) => arr.reduce((newArr, item) => { | |
return fn(item) ? newArr.concat([item]) : newArr; | |
}, []); |
<?php | |
//* Do NOT include the opening php tag | |
//* Load Lato and Merriweather Google fonts | |
add_action( 'wp_enqueue_scripts', 'bg_load_google_fonts' ); | |
function bg_load_google_fonts() { | |
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:300,700|Merriweather:300,700', array(), CHILD_THEME_VERSION ); | |
} |