A Pen by Andrew Pagan on CodePen.
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
/* | |
* 1. Go to https://global.americanexpress.com/offers/eligible | |
* 2. Open up console | |
* 3. Paste this script in and click "Enter" | |
*/ | |
(() => { | |
const nodes = Array.from(document.querySelectorAll(".offer-cta")).filter((n) => n.innerText === "Add to Card") | |
const nodeCount = nodes.length; | |
const SECONDS = 1000; |
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
/* | |
Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. | |
In other words, return true if one of s1's permutations is the substring of s2. | |
*/ | |
const checkInclusion = (s1, s2) => { | |
if (s1.length > s2.length) return false; | |
const s1Dict = {}; |
A Pen by Andrew Pagan on CodePen.
A Pen by Andrew Pagan on CodePen.
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 React, { useEffect, useState } from "react"; | |
import { useRouter } from "next/router"; | |
import { MDXProvider } from "@mdx-js/react"; | |
const components = { | |
h1: (props: string) => <h1 style={{ color: "tomato" }} {...props} />, | |
}; | |
const Placeholder: React.FC = () => { | |
return <>Loading</>; |
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
var stringShift = function(s, shift) { | |
var move = 0, | |
s= s.split(''); | |
for (var i = 0; i < shift.length; i ++) { | |
if (shift[i][0] === 0) { | |
move -= shift[i][1]; | |
} else if (shift[i][0] === 1) { | |
move += shift[i][1]; | |
} |