type Customer {
id: ID!
email: String!
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Authenticator, View, Image, Text, Heading, useTheme, useAuthenticator } from '@aws-amplify/ui-react' | |
import { BrowserRouter } from "react-router-dom" | |
import { Routes, Route } from "react-router-dom" | |
import AppRoutes from "./AppRoutes" | |
import MarketingPage from './routes/MarketingPage' | |
import logoSvg from './logo.svg' | |
function App() { | |
const { route, user, signOut } = useAuthenticator(context => [context.route, context.user, context.isPending]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Comment": "A Hello World example of the Amazon States Language using Pass states", | |
"StartAt": "Create pending order", | |
"States": { | |
"Create pending order": { | |
"Type": "Pass", | |
"Next": "Select Payment Method" | |
}, | |
"Select Payment Method": { | |
"Type": "Choice", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sign(name, fontSize = 96) { | |
// assumes the id of the canvas element is 'canvas' | |
const canvas = document.getElementById('canvas') | |
const ctx = canvas.getContext('2d'); | |
ctx.font = `italic ${fontSize}px Snell Roundhand`; | |
const signatureWidth = ctx.measureText(name).width; | |
const x = canvas.width/2 - signatureWidth/2; | |
const y = canvas.height/2 + fontSize/2; | |
ctx.fillStyle = ctx.strokeStyle; | |
ctx.fillText(name, x, y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/ | |
(function(){ | |
function getCookie(cname) { | |
var name = cname + "="; | |
var decodedCookie = decodeURIComponent(document.cookie); | |
var ca = decodedCookie.split(';'); | |
for(var i = 0; i <ca.length; i++) { | |
var c = ca[i]; | |
while (c.charAt(0) == ' ') { | |
c = c.substring(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/ | |
let YOUR_DOMAIN = "YOUR_DOMAIN.TLD" // ex: scrapingbee.com | |
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MIT No Attribution | |
# | |
# Copyright 2022 Ben Kehoe | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
# software and associated documentation files (the "Software"), to deal in the Software | |
# without restriction, including without limitation the rights to use, copy, modify, | |
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so. | |
# |
npm install -g @aws-amplify/cli
npm init private
amplify init
? Enter a name for the project tenant
? Enter a name for the environment develop
? Choose your default editor: Visual Studio Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
branchname=${1:-$(git rev-parse --abbrev-ref HEAD)} | |
if ! [ -x "$(command -v jq)" ]; then | |
echo 'Error: "jq" is not installed.' >&2 | |
exit 1 | |
fi | |
if [ ! $SECRET_GH_TOKEN ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from "react" | |
import { confirm } from "../modals" | |
const hrefBlank = element => { | |
const href = element.getAttribute("href") | |
return !href || href === "#" | |
} | |
function useBeforeLeave({ | |
message = "", |
NewerOlder