Skip to content

Instantly share code, notes, and snippets.

View vojtaholik's full-sized avatar
:octocat:
🍀

Vojta Holik vojtaholik

:octocat:
🍀
View GitHub Profile
@vojtaholik
vojtaholik / machine.js
Last active October 8, 2020 13:30
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@vojtaholik
vojtaholik / machine.js
Created October 20, 2020 08:05
Generated by XState Viz: https://xstate.js.org/viz
const quizMachine = Machine({
id: 'question',
initial: 'idle',
context: {
questions: [{title: "question 1", title: "question 2", id: 'question-1'}],
currentQuestionId: 'question-1',
answers: []
},
states: {
idle: {
@vojtaholik
vojtaholik / playlist.json
Created December 21, 2020 13:15
nested playlists using new resource types
{
"type": "playlist",
"title": "Create an eCommerce Store with Next.js and Stripe Checkout",
"description": "**Accept payments & sell products powered by Stripe and the best of the JAMStack**\n\nThere are as many ways to build an e-commerce store on the internet as there are products to sell. One thing is for certain, e-commerce is here to stay and as professional developers we need to understand how to build fully custom stores for our clients using the best modern tools available.\n\n- React: flexible and customizable while following modern best practices\n- Next.js: lightening fast with guide rails to help your project perform as consumers expect\n- Stripe Checkout: lets you offload reams of complicated business logic to a trusted third party that maintains regulatory compliance, global payments, and a standard UX.\n\nYour store will have well managed local component state using React Hooks and you'll also have clear and cohesive shared (global) state with React Context.\n\nFinally you'll deploy your

Form component with first name and email address fields to subscribe to a form, tag, or sequence in ConvertKit.

Requirements

  1. API endpoint under /api/convertkit/subscribe which can be imported from @skillrecordings/convertkit/dist/api/subscribe
  2. Environment variables:
NEXT_PUBLIC_CONVERTKIT_SIGNUP_FORM=convertkit_form_id
NEXT_PUBLIC_CONVERTKIT_TOKEN=convertkit_public_token
NEXT_PUBLIC_CONVERTKIT_SUBSCRIBER_KEY=ck_subscriber_id
// Menu: Search egghead.io
// Description: Browse egghead.io's lesson library
// Shortcut: cmd option e
// Author: egghead.io
// Twitter: @eggheadio
/** @type {import("@johnlindquist/kit")} */
let algoliasearch = await npm("algoliasearch");
let app = await env("EGGHEAD_PUBLIC_ALGOLIA_APP");
// Menu: egghead.io
// Description: Browse egghead.io's lesson library
// Shortcut: option e
// Author: egghead.io
// Twitter: @eggheadio
/** @type {import("@johnlindquist/kit")} */
let algoliasearch = await npm("algoliasearch");
let app = await env("EGGHEAD_PUBLIC_ALGOLIA_APP");
// Menu: New Project
// Description: Creates new project from template
/** @type {import("@johnlindquist/kit")} */
const PROJECTS_DIR = `~/Documents/dev/projects`;
const DEFAULT_TEMPLATE_DIR = `${PROJECTS_DIR}/template`;
let projectName = await arg("Project name");
let projectTemplate = await arg("Project template", [
// Menu: Book Search
// Description: Use Open Library API to search for books
// Author: John Lindquist
// Twitter: @johnlindquist
let query = await arg('Search for a book title:')
//This API can be a little slow. Wait a couple seconds
let response = await get(`http://openlibrary.org/search.json?q=${query}`)
/* eslint-disable no-nested-ternary */
import React from 'react';
import { motion } from 'framer-motion';
import { useAtom } from 'jotai';
import {
appConfigAtom,
getAssetAtom,
isReadyAtom,
splashBodyAtom,
splashHeaderAtom,
// Menu: Compress Images
// Description: Compress images using imagemin
// Author: Vojta Holik
// Twitter: @vjthlk
/** @type {import("@johnlindquist/kit")} */
let imagemin = await npm("imagemin");
let imageminJpegtran = await npm("imagemin-jpegtran");
let imageminJpegRecompress = await npm("imagemin-jpeg-recompress");