Skip to content

Instantly share code, notes, and snippets.


Drew Bredvick dbredvick

View GitHub Profile
dbredvick / main.yml
Created May 13, 2022 21:36
github action
View main.yml
name: End-to-end tests
on: [deployment_status]
runs-on: ubuntu-20.04
fail-fast: false
containers: [1, 2, 3]
dbredvick / example.js
Created January 3, 2022 17:54
Next.js Image caching / correct headers
View example.js
// --- ✅ better caching
import imageSrc from '../public/images/image.png'
import Image from 'next/image'
return <Image src={imageSrc}/>
// --- ❌ worse caching
import Image from 'next/image'
dbredvick / vercel.json
Last active September 9, 2021 18:39
create-react-app caching on Vercel
View vercel.json
"headers": [
"source": "/static/:slug*",
"headers": [
"key": "Cache-Control",
"value": "max-age=31536000"
View index.js
const stanzaOne = `First they came for the socialists, and I did not speak out—
Because I was not a socialist.`
const stanzaTwo = `Then they came for the trade unionists, and I did not speak out—
Because I was not a trade unionist.`
const stanzaThree = `Then they came for the Jews, and I did not speak out—
Because I was not a Jew.`
const stanzaFour = `Then they came for me—and there was no one left to speak for me.`
dbredvick / package.json
Created January 12, 2020 01:38
typescript nextjs twilio example package.json
View package.json
"name": "resolution-reminder",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
"dependencies": {
dbredvick / text.ts
Created January 12, 2020 00:22
NextJS Twilio Typescript example
View text.ts
import { NextApiResponse, NextApiRequest } from "next";
const twillio = require('twilio');
const authToken = process.env.TWILIO_AUTH_TOKEN;
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const myCellPhoneNumber = process.env.MY_NUMBER;
const superSecretAPIKey = 'ABCD1234';
export default async (req: NextApiRequest, res: NextApiResponse) => {
const client = twillio(accountSid, authToken);
const auth = req.headers.authorization;
dbredvick / moment-holidays.js
Last active February 10, 2017 20:10 — forked from jrhames/moment-holidays.js
Holidays plugin for Moment.JS
View moment-holidays.js
//## Moment.JS Holiday Plugin
// Call .holiday() from any moment object. If date is a US Federal Holiday, name of the holiday will be returned.
// Otherwise, return nothing.
// Example:
// `moment('12/25/2013').holiday()` will return "Christmas Day"