Skip to content

Instantly share code, notes, and snippets.


Michoel Samuels AnalyzePlatypus

View GitHub Profile

Tailwind Icon Height sizes

These CSS classes will size any square SVG to match the default TailwindCSS font sizes. Great for mixing icons with text on buttons and headings.

The icon sizes were manually picked, so they match my taste. Your mileage may vary! I've also added sizes that are larger than Tailwind's max font size for really big icons in hero sections and the like


View Using (and debugging) Pre-signed S3

Using (and debugging) Pre-signed S3 URLS

Architecture - A Brief Overview

A Pre-signed URL is used to allow untrusted users to temporary access to private S3 resources. (Example: upload an image to a private S3 bucket).

The URL is a string consists of:

  1. AWS URL of the object to be accessed, and
  2. A signed base64 string describing the HTTP request:
AnalyzePlatypus /
Last active May 12, 2021
Deploy a Node.js Lambda function using the AWS CLI

.env file


# Read the .env file
View Referral Fees

Amazon's referral fees, in JSON format.

Does not contain "Categories Requiring Approval"

Last updated April 19, 2021


Compression Test

A quick script for testing how well a JSON file compresses

// Imports

const fs = require('fs');
const { promisify } = require('util');
const { deflate } = require('zlib');
View Root Categories

These are the 35 root categories on

Retrieved via Keepa API on April 12, 2021.

API call:<REDACTED>&domain=1&category=0&parents=1
AnalyzePlatypus / swBuildEnvVarFile.js
Created Jul 26, 2020
Build an Env Var file for your service workers
View swBuildEnvVarFile.js
By default, service workers cannot access our Vue environment variables.
To allow this, this script collects the variables we want at build time
and places them in a JS file that the service worker can access.
To prevent the leak of sensitive credentials (the SW file is public),
only whitelisted environment variables are built into this file.
Deploy this file alongside your service worker, and import th efile in your service worker (`importScripts('swenv.js');` in Workbox)
View AWS Lambda - Upload `node_modules` without `devDependencies`.md

AWS Lambda - Upload node_modules without devDependencies

By default, ZIPing the project directory will included all of your devDependencies. slowing your upload speed to a crawl as you upload an enormous bundle containing 80% useless code (unless you're testing in production™ )

You only need your production dependencies when deploying, but need you devDependencies for development. But you have to deploy from the same directory, and it must be named node_modules. How can slim down the ol' deploy bundle?

Here's a horrible but effective hack that accomplishes this:

  1. We'll create an additional directory called node_modules__prod for storing production dependencies.
  2. When we deploy we swap the names of the dev and production node_modules directories 😱, so the deploy tool stupidly uploads what it thinks is our full node_modules but actually is our production-only modules directory.
  3. When deploy is done (or fails) we swap the directory names again, restoring us back to developme

Obtaining Gmail OAuth tokens

To access your Gmail account from the API, you will need to obtain the following values from Google's OAuth system:

clientId clientSecret refreshToken

Part 1: Client secrets

  1. Open

AWS Lambda SAM cli: Using local env vars

To use local env vars, you must follow the following steps:

  1. Declare all env vars in your template.yml, like so:
 Type: AWS::Serverless::Function