Skip to content

Instantly share code, notes, and snippets.

View ekafyi's full-sized avatar

Eka ekafyi

View GitHub Profile
@ekafyi
ekafyi / gtwm-example-portfolio-site.md
Last active June 12, 2020 19:18
How I made the example portfolio site for Gatsby Theme Web Monetization

How I made the example portfolio site with Gatsby Theme Web Monetization

In this site, I combine gatsby-theme-web-monetization with the excellent Emilia Theme by LekoArts using its starter site. Then I continue with the steps below.

  1. Install the theme.
yarn add gatsby-theme-web-monetization
# or npm install --save gatsby-theme-web-monetization

How I made the basic (blog) example site with Gatsby Theme Web Monetization

In this site, I combine gatsby-theme-web-monetization with Gatsby’s official blog and note themes. I use the official Gatsby starter, plugins, and component shadowing from this tutorial. Then I continue with the steps below.

  1. Install the theme.
yarn add gatsby-theme-web-monetization
# or npm install --save gatsby-theme-web-monetization
@ekafyi
ekafyi / machine.js
Last active July 21, 2020 17:10
Generated by XState Viz: https://xstate.js.org/viz
const handWashMachine1 = Machine({
id: 'handwash',
initial: 'unwashed',
states: {
unwashed: {
on: {
START_WASH: 'washing'
}
},
washing: {
@ekafyi
ekafyi / machine.js
Created July 21, 2020 17:22
Generated by XState Viz: https://xstate.js.org/viz
const handWashMachine2 = Machine({
id: 'handwash',
initial: 'unwashed',
states: {
unwashed: {
on: {
START_WASH: 'washing'
}
},
washing: {
@ekafyi
ekafyi / machine.js
Last active July 21, 2020 18:27
Generated by XState Viz: https://xstate.js.org/viz
const handWashMachine2b = Machine({
id: 'handwash',
initial: 'unwashed',
states: {
unwashed: {
on: {
START_WASH: 'washing'
}
},
@ekafyi
ekafyi / machine.js
Created July 21, 2020 18:40
Generated by XState Viz: https://xstate.js.org/viz
const tapStates = {
initial: 'tapOff',
states: {
tapOff: {
on: {
TURN_ON: 'tapOn'
}
},
tapOn: {
on: {
@ekafyi
ekafyi / machine.js
Created July 21, 2020 18:56
Generated by XState Viz: https://xstate.js.org/viz
const tapStates = {
initial: 'tapOff',
states: {
tapOff: {
on: {
TAP_ON: 'tapOn'
}
},
tapOn: {
on: {
@ekafyi
ekafyi / netlify-functions-spotify-api.js
Last active July 31, 2020 06:19
my attempt to adapt glitch.com/~spotify-web-api-node into Netlify functions
// truncated version of my attempt to adapt https://glitch.com/~spotify-web-api-node into Netlify functions
const SpotifyWebApi = require("spotify-web-api-node");
const TEST_ARTIST_ID = "1lYT0A0LV5DUfxr6doRP3d";
let accessToken;
const spotifyApi = new SpotifyWebApi({
clientId: process.env.SPOTIFY_CLIENT_ID,
@ekafyi
ekafyi / machine.js
Last active June 24, 2021 17:43
Generated by XState Viz: https://xstate.js.org/viz
const fooMachine = Machine({
id: 'foo',
initial: 'loading',
// Local context for entire machine
context: {
retries: 0,
activeFilter: {},
},
@ekafyi
ekafyi / machine.js
Last active June 25, 2021 18:03
Generated by XState Viz: https://xstate.js.org/viz
const fetchLocations = async () => {
// fake response
return new Promise(resolve => setTimeout(() => resolve(["foo", "bar", "baz"]), 1000));
// return fetch(`/api/notion/locations`).then((response) => response.json());
}
const updateLocations = (_c, evt) => {
const { query } = evt;
console.log(query); // { AGES: "18_TO_49" }