Skip to content

Instantly share code, notes, and snippets.

View jlengstorf's full-sized avatar
💭
partyin

Jason Lengstorf jlengstorf

💭
partyin
View GitHub Profile
@jlengstorf
jlengstorf / youtube.astro
Created March 4, 2024 02:26
working Astro code for using Paul Irish's lite-youtube-embed in a component
---
import 'lite-youtube-embed/src/lite-yt-embed.css';
export interface Props {
videoid: string;
title?: string;
}
const { videoid, title } = Astro.props;
---
@jlengstorf
jlengstorf / claim-swag.sh
Created October 27, 2021 17:42
If you registered for Jamstack Conf 2021, you can run this command to claim swag
curl --location --request POST 'https://deploy-preview-1--jamstackconf2021-swag.netlify.app/api/claim-swag' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "YOUREMAIL@example.com"
}'
@jlengstorf
jlengstorf / machine.js
Created February 25, 2021 18:04
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jlengstorf
jlengstorf / serverless-function-send-sms.js
Created February 19, 2021 03:34
An example of a serverless function that sends an SMS message using Twilio (deployable to Netlify Functions).
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
exports.handler = async () => {
const response = await client.messages.create({
// RIP Mitch Hedberg
body: 'Is a hippopotamus a hippopotamus... or a really cool opotamus?',
from: '+15552888588',
to: '+15558675309',
@jlengstorf
jlengstorf / machine.js
Last active January 3, 2021 20:07
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jlengstorf
jlengstorf / machine.js
Last active June 13, 2020 21:50
Generated by XState Viz: https://xstate.js.org/viz
const formatCommand = msg => {
const { name, duration, message, audio, image } = msg.handler;
return {
command: name,
message,
audio,
image,
duration: duration * 1000, // convert seconds to milliseconds
const effectsMachine = Machine({
id: 'effects',
initial: 'idle',
context: {
transitionSpeed: 600,
duration: 4000,
},
states: {
idle: {
on: {
@jlengstorf
jlengstorf / machine.js
Created March 20, 2020 18:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
const checkAuth = () => false;
const getTwitchAuth = async () => ({id: 123, displayName: 'jlengstorf'});
const getNetlifyAuth = async () => 'auth';
const getCurrentConfig = () => 'config';
const getNetlifySites = () => ['site'];
const machine = Machine({
id: 'dashboard',
initial: 'checkingAuth',
context: {
@jlengstorf
jlengstorf / machine.js
Last active January 18, 2020 23:47
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions