This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dotenv from 'dotenv' | |
import Eleventy from '@11ty/eleventy' | |
import express from 'express' | |
import morgan from 'morgan' | |
import memoize from 'lodash/memoize.js' | |
import path from 'path' | |
import fs from 'fs' | |
const ENV = process.env.NODE_ENV || 'development' | |
const PORT = process.env.PORT || 3001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from 'node-fetch' | |
import dotenv from 'dotenv' | |
import Twitter from 'twitter' | |
import { decode } from 'html-entities' | |
dotenv.config() | |
// URL of notes JSON feed | |
const NOTES_URL = 'https://mxb.dev/notes.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Promise.all: if one promise rejects, all fail. | |
const [dogs, cats, possums] = await Promise.all([ | |
getDogs(), | |
getCats(), | |
getPossums() | |
]) | |
// Promise.allSettled: if one rejects, | |
// the others will still go through! | |
const allRequests = await Promise.allSettled([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ~ curl -H "Accept-Encoding: gzip,deflate,br" -I -X GET https://mxb.dev | |
HTTP/2 200 | |
cache-control: public, max-age=0, must-revalidate | |
content-type: text/html; charset=UTF-8 | |
date: Thu, 20 Aug 2020 12:00:12 GMT | |
etag: "631b652bdb73e4d0c9b90d79a626dac9-ssl-df" | |
referrer-policy: no-referrer-when-downgrade | |
strict-transport-security: max-age=31536000 | |
x-content-type-options: nosniff | |
x-frame-options: DENY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ToolTip */ | |
[aria-label].has-tooltip { | |
position: relative; | |
} | |
[aria-label].has-tooltip::after { | |
display: block; | |
content: attr(aria-label); | |
width: auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
OLD_MSG=$(git log --format=%B -n1) | |
git commit --amend -m "$OLD_MSG, #$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const allowsTracking = () => { | |
const dnt = | |
window.doNotTrack || | |
navigator.doNotTrack || | |
navigator.msDoNotTrack | |
if (dnt === 1 || dnt === '1' || dnt === 'yes') { | |
return false | |
} | |
if ('msTrackingProtectionEnabled' in window.external) { | |
return !window.external.msTrackingProtectionEnabled() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Custom Selection Color */ | |
::selection { | |
background: #d81e05; | |
color: #ffffff; | |
} | |
::-moz-selection { | |
background: #d81e05; | |
color: #ffffff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const allButtons = document.querySelectorAll('button'); | |
const init = btn => { | |
btn.classList.add('is-initialized'); | |
btn.addEventListener('click', () => console.log(btn, 'clicked')); | |
return btn; | |
} | |
Array.from(allButtons, init); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li class="card"> | |
<a href="/foo" class="card__link"> | |
<p class="card__title">The Card Title</p> | |
<img class="card__image" src="/some/image.jpg" alt=""> | |
<small class="card__meta">Some category</small> | |
<p class="card_summary">Lorem ipsum, dolor sit amet!</p> | |
</a> | |
</li> |
NewerOlder