Skip to content

Instantly share code, notes, and snippets.


David Wells DavidWells

View GitHub Profile
DavidWells / reset.css
Last active Sep 17, 2021 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips:
View reset.css
v2.0-modified | 20110126
License: none (public domain)
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
View open-color-postcss-variables.js
// via
const palette = {
dark: [

Aligning images

left alignment

This is the code you need to align images to the left:

<img align="left" width="100" height="100" src="">
DavidWells / package.json
Created Sep 12, 2021
Symlink a directory for package.json scripts
View package.json
"if-not-ci": "pnpm ts support/scripts/run-if-not-ci.ts",
DavidWells / aws-lambda-redirect.js
Created Jun 28, 2018
How to do a 301 redirect from an AWS lambda function
View aws-lambda-redirect.js
exports.handler = (event, context, callback) => {
const response = {
statusCode: 301,
headers: {
Location: '',
return callback(null, response);
DavidWells / javascript-highlight-text.js
Created Sep 10, 2021
Highlight Search match in JS
View javascript-highlight-text.js
function highlightMatch(string, regexp) {
return escapeString(string).replace(regexp, (match) => `<mark>${match}</mark>`)
// Used to match HTML entities and HTML characters.
const unescapedHtml = /[&<>"']/g
const hasUnescapedHtml = RegExp(unescapedHtml.source)
const htmlEscapes = {
'&': '&amp;',
DavidWells / netlify.toml
Last active Aug 25, 2021
All Netlify.toml & yml values
View netlify.toml
ID = "Your_Site_ID"
# Settings in the [build] context are global and are applied to all contexts unless otherwise overridden by more specific contexts.
# This is the directory to change to before starting a build.
base = "project/"
# NOTE: This is where we will look for package.json/.nvmrc/etc, not root.
# This is the directory that you are publishing from (relative to root of your repo)
View no-try-catch-async-await.js
/* Helper buddy for removing async/await try/catch litter 🗑 */
function O_o(promise) {
return promise.then(data => {
if (data instanceof Error) return [data]
return [null, data]
}).catch(err => [err])
/* Look ma, no try/catch */
async function usageExample(params) {
DavidWells / add-wordpress-settings-page.php
Created Jan 28, 2013
WordPress :: Add Settings Page with All Fields
View add-wordpress-settings-page.php
Plugin Name: Homepage Settings for BigBang
Plugin URI:
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI:
// Specify Hooks/Filters
View serverless.full.yml
# serverless.yml
name: myService
awsKmsKeyArn: arn:aws:kms:us-east-1:XXXXXX:key/some-hash # Optional KMS key arn which will be used for encryption for all functions
frameworkVersion: ">=1.0.0 <2.0.0"
name: aws