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
app.get( | |
'/dashboard/sso', | |
middleware.checkForUserObject, | |
// @ts-expect-error - TS7006 - Parameter 'req' implicitly has an 'any' type. | TS7006 - Parameter 'res' implicitly has an 'any' type. | TS7006 - Parameter 'next' implicitly has an 'any' type. | |
// eslint-disable-next-line unused-imports/no-unused-vars | |
function dashboardGetSso(req, res, next) { | |
const payload = { | |
iat: Math.ceil(new Date().getTime() / 1000), | |
jti: uuid.v4(), | |
first_name: req.user.firstName, |
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
Talk.ready.then(function() { | |
const me = new Talk.User({ | |
id: member.id, | |
name: member.customFields["free-user"], | |
email: member.auth.email, | |
photoUrl: member.profileImage, | |
welcomeMessage: null, | |
role: "brand", | |
}); |
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
<script src="https://cdn.jsdelivr.net/npm/p5@1.6.0/lib/p5.js"></script> | |
<script> | |
const dotSize = 3 | |
const spacing = dotSize * 8 | |
const areaOfEffect = 64 | |
let dots = [] | |
function setup() { | |
let cnv = createCanvas(windowWidth, windowHeight); |
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
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns"></script> | |
<script> | |
// chart-1 | |
const ctx = document.getElementById("chart-1").getContext("2d"); | |
const sunriseDates = document.querySelectorAll("[sunrise-date]"); | |
const sunriseValues = document.querySelectorAll("[sunrise-value]"); | |
const fvsDates = document.querySelectorAll("[fvs-date]"); | |
const fvsValues = document.querySelectorAll("[fvs-value]"); | |
const lgtDates = document.querySelectorAll("[lgt-date]"); |
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
// This endpoint lives on my cloudflare worker | |
// It is called each time the user launches the DE. | |
// Note that we already have the user's access token from initial app install. | |
// The access token is stored in KV SITEID_SITE_INFO. | |
app.post('/resolve', async (c) => { | |
// Get the siteId and idToken from the request body | |
const body = await c.req.json(); | |
const { siteId, idToken } = body; | |
// Check KV for access token and credits |
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 currentDomain = window.location.hostname; | |
let scriptElement = document.createElement('script'); | |
scriptElement.type = 'text/javascript'; | |
if (currentDomain === 'staging.webflow.io') { | |
// staging | |
scriptElement.src = 'http://127.0.0.1/index.js'; | |
} else if (currentDomain === 'www.example.com') { | |
// production |
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
let circle = Bodies.circle(i, 10, 30, { | |
friction: 0.3, | |
frictionAir: 0.00001, | |
restitution: 0.8, | |
render: { | |
sprite: { | |
texture: "your-image-link-here.jpg", | |
}, | |
}, | |
plugin: { |
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 isValidTimeFormat(timeStr) { | |
const twelveHourFormat = /^(\d{1,2}:\d{2} [AP]M)$/i; | |
const twentyFourHourFormat = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/; | |
if (twelveHourFormat.test(timeStr)) { | |
return { valid: true, is24HourFormat: false }; | |
} else if (twentyFourHourFormat.test(timeStr)) { | |
return { valid: true, is24HourFormat: true }; | |
} else { | |
return { valid: false, is24HourFormat: false }; |
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 initialize() { | |
var markers = []; | |
var input = /** @type {HTMLInputElement} */ | |
(document.getElementById('Address')); | |
var options = { | |
componentRestrictions: { | |
country: 'gb' | |
} | |
} | |
var autocomplete = new google.maps.places.Autocomplete(input,options); |
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
// Define your attribute names here. | |
const ATTR_NAME = "wb-data"; | |
const ATTR_ITEM_VALUE = "tab-item"; | |
const ATTR_CONTENT_VALUE = "tab-content"; | |
gsap.registerPlugin(ScrollTrigger); | |
function init() { | |
const tabItems = document.querySelectorAll( | |
`[${ATTR_NAME}="${ATTR_ITEM_VALUE}"]` |
NewerOlder