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
// Stopwatch class | |
class Stopwatch { | |
constructor(displayCallback) { | |
this.startTime = null; | |
this.elapsedTime = 0; | |
this.timerInterval = null; | |
this.displayCallback = displayCallback; // Function to update the display | |
} | |
// Starts or resumes the stopwatch from 0 |
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
<!-- wp:group {"className":"stopwatch","layout":{"type":"constrained","contentSize":"400px"}} --> | |
<div class="wp-block-group stopwatch"><!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"}},"border":{"radius":"15px"}},"backgroundColor":"accent-5","layout":{"type":"constrained","contentSize":"400px"}} --> | |
<div class="wp-block-group has-accent-5-background-color has-background" style="border-radius:15px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)"><!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"center"}} --> | |
<div class="wp-block-group"><!-- wp:outermost/icon-block {"iconName":"wordpress-swatch"} --> | |
<div class="wp-block-outermost-icon-block"><div class="icon-container" style="width:48px"><svg xmlns="http://www.w3.org/2000/svg" v |
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
const productsToAdd = [ | |
{ 'add-to-cart': 68, 'quantity': 2 }, | |
{ 'add-to-cart': 69, 'quantity': 3 }, | |
{ 'add-to-cart': 70, 'quantity': 4 } | |
]; | |
for (const product of productsToAdd) { | |
try { | |
const response = await fetch(window.location.pathname, { | |
method: 'POST', |
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
{ | |
resolve: `gatsby-source-wordpress-experimental`, | |
options: { | |
url: | |
process.env.WPGRAPHQL_URL || | |
`https://dev-gatsby-source-wordpress-v4.pantheonsite.io/graphql`, | |
verbose: true, | |
schema: { | |
queryDepth: 5, | |
typePrefix: `Wp`, |
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
<template> | |
<div class="container"> | |
<h1>{{ msg }}</h1> | |
<div class="calculator"> | |
<div class="display"> | |
{{ display }} | |
</div> | |
<div class="buttons"> | |
<div class="one"> | |
<button class="delete" @click="del()">DEL</button> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JS Promises</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body style="padding: 20px;"> | |
I want | |
<input type="text" name="count" id="count"> |
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
/* | |
Adjust RGB - Choose exactly what colour you want! | |
This sketch is a follow up to my last one 'AdjustBrightness' | |
The code receives the analog sensor value of the potentiometer from analog pin 0, | |
maps it from a range of 0 - 511 and uses this value choose what colour to light up. | |
created 26 Dec 2015 | |
by Muhammad Muhsin |
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
/* | |
Adjust Brightness - Works just like the light dimmer at you home! | |
A little sketch I came up with after going through a couple of examples. | |
This code receives the analog sensor value of the potentiometer from analog pin 0 | |
and uses this value to set the brightness of the output of pin 9. | |
Based on the following example projects: | |
Read Analog Voltage - https://www.arduino.cc/en/Tutorial/ReadAnalogVoltage | |
Fade - https://www.arduino.cc/en/Tutorial/Fade |