Skip to content

Instantly share code, notes, and snippets.

View philhawksworth's full-sized avatar
💭
Working remotely from home on St Albans

Phil Hawksworth philhawksworth

💭
Working remotely from home on St Albans
View GitHub Profile
@philhawksworth
philhawksworth / short-url.sh
Last active September 14, 2023 14:28
Raycast script to shorten a URL with https://findthat.at
#!/bin/zsh
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Short URL
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🔗
# @raycast.argument1 { "type": "text", "placeholder": "URL" }
@philhawksworth
philhawksworth / schedule-site-refresh-function.js
Created March 2, 2023 14:05
A daily scheduled function to rebuild a Netlify site with a build hook.
// npm install @netlify/functions
// to get access to scheduling function invocations
// using cron notiation or some handy aliases
const { schedule } = require("@netlify/functions");
const handler = async function(event, context) {
// Trigger a site rebuild and deploy
fetch("https://api.netlify.com/build_hooks/HOOK-ID-FROM-ADMIN", {
@philhawksworth
philhawksworth / dpr-example-fetch-and-render-on-demand.js
Created May 4, 2021 10:02
Example of an implementation using Netlify' On Demand Builder functions for DPR
require('dotenv').config();
const { builder } = require("@netlify/functions");
// Use the same page template our SSG uses dureing the build
const pageTemplate = require('../../src/site/_includes/layouts/idea.11ty.js');
const {
DATABASE_URL,
SUPABASE_SERVICE_API_KEY
@philhawksworth
philhawksworth / inventory.json
Last active May 18, 2020 00:04
Inventory data for API and UI demo
{
"prod-cat-outfit-pirate" : { "stock": 0 },
"prod-cat-outfit-bunny" : { "stock": 500 },
"prod-cat-outfit-lion" : { "stock": 7 },
"prod-cat-book" : { "stock": 1000 }
}
@philhawksworth
philhawksworth / camera-kit.md
Last active August 22, 2020 15:40
Camera and light setup

Camera

I bought the Sony a5100 which is an older modle but very popular for this purpose. Seems less available on amazon.com at the moment than the updated model which is very similar and probably better:

Sony a6000

HDMI link

@philhawksworth
philhawksworth / freecodecamp_intro_to_jamstack.md
Last active June 26, 2021 20:37
freeCodeCamp - Introduction to JAMstack

freeCodeCamp Introduction to JAMstack

Here's a list of links to resources to accompany the "Introduction to JAMstack" video on freeCodeCamp, by Phil Hawksworth

Watch the video

JAMstack video

@philhawksworth
philhawksworth / conference-mc-tips.md
Last active February 13, 2023 21:52
Conference MC-ing tips

👀📎 It looks like you're preparing to MC a conference...

🚨 GIANT DISCLAIMER: This stuff is far from authoritative. But it's what I think works for me, and what I enjoy in an MC when I'm attending a conference.


Biggest tip - enjoy yourself.

@philhawksworth
philhawksworth / jamstack-q-and-a-frontend-united.md
Last active May 23, 2019 12:50
Q&A from the JAMstack talk at Frontend United

Thanks for all of your questions during my talk at Frontend United: JAMstack: Silly name. Serious business.

1. Jeremy asks:

@philhawksworth
philhawksworth / netlify.toml
Created January 4, 2018 17:21
Example netlify configuration file
# Our global, build settings
[build]
base = "site" # run the buold from this directory
publish = "public" # the output diretory to push to the CDN after the build
command = "gulp build" # the command to build our site
# Specific branch context: Deploys from this branch
# will take these settings and override their
# current ones.
@philhawksworth
philhawksworth / _redirects
Last active December 27, 2021 21:49
Simple example of Netlify _redirects file
# Redirect with a 301
/home / 301
# Redirect with a 302
/my-redirect / 302
# Rewrite a path
/pass-through /index.html 200