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
<button id="elem" onclick="alert('Click!');">Autoclick</button> | |
<script> | |
let event = new Event("click"); | |
elem.dispatchEvent(event); | |
</script> | |
<h1 id="elem">Hello from the script!</h1> | |
<script> |
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 RestocksService from '../../../services/supreme/RestocksService'; | |
import StorageService from '../../../services/StorageService'; | |
import ChromeService from '../../../services/ChromeService'; | |
export default class RestockMonitor { | |
constructor(intervalMs) { | |
this.intervalMs = intervalMs; | |
this.onNewProductsCallbacks = []; | |
this.onProductsRestockCallbacks = []; | |
} |
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 setWithExpiry(key, value, ttl) { | |
const now = new Date() | |
// `item` is an object which contains the original value | |
// as well as the time when it's supposed to expire | |
const item = { | |
value: value, | |
expiry: now.getTime() + ttl, | |
} | |
localStorage.setItem(key, JSON.stringify(item)) |
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 getWithExpiry(key) { | |
const itemStr = localStorage.getItem(key) | |
// if the item doesn't exist, return null | |
if (!itemStr) { | |
return null | |
} | |
const item = JSON.parse(itemStr) | |
const now = new Date() | |
// compare the expiry time of the item with the current time | |
if (now.getTime() > item.expiry) { |
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 means that 1rem equals the font size | |
of the html element (which for most browsers has a default value of 16px). |
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 () { | |
var ROOT_URL = "https://canopy.co"; | |
var PRICE_SELECTORS = [ | |
".priceLarge", | |
".a-color-price.a-size-large", | |
".a-color-price.a-size-medium", | |
"#priceblock_ourprice" | |
]; | |
var IMAGE_SELECTORS = [ |
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 ave(arr) { | |
if (arr && arr.length) { | |
//easy way to get array total is using reduce; c is current | |
const total = arr.reduce((a, c) => { | |
return a + c; | |
}); | |
return total / arr.length; | |
} | |
throw new Error('wrong arr'); | |
}; |
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
pick 019325e 0.1.0 | |
pick a4b689d Fetch all dependencies | |
squash 714a49d Matches keywords to Docker repos | |
pick d2d1ca3 parseDependencies returns an object of dependencies. | |
squash e3b6cd9 Clean up packageParser | |
squash 57acd67 Initial commit | |
squash 3f3e05e Rough out how we'll make Dockerfiles | |
squash 9e10b94 Can check for, make Docker files | |
squash a27b0ee Write docker files | |
pick a0980b8 Build Dockerfiles |
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
// Based on http://stackoverflow.com/a/10520017/1307721 and http://stackoverflow.com/a/16022728/1307721 | |
Podium = {}; | |
Podium.keydown = function(k) { | |
var oEvent = document.createEvent('KeyboardEvent'); | |
// Chromium Hack | |
Object.defineProperty(oEvent, 'keyCode', { | |
get : function() { |
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://medium.com/@bryanjenningz/how-to-record-and-play-audio-in-javascript-faa1b2b3e49b --> | |
<!-- https://docs.aws.amazon.com/en_us/sdk-for-javascript/v2/developer-guide/s3-example-photo-album.html --> | |
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.585.0.min.js"></script> | |
<script> | |
function uploadAWS(blob) { | |
var vaultBucketName = "[YOUR-BUCKET-NAME]"; | |
var bucketRegion = "[YOUR-AWS-REGION]"; | |
var IdentityPoolId = "[YOUR-IDENTITY-POOL-ID]"; |