Skip to content

Instantly share code, notes, and snippets.

Automating everything with

Ahmad Awais ⚡️ ahmadawais

Automating everything with
View GitHub Profile
breadthe /
Created Sep 2, 2022
Stable Diffusion prompt script
echo -n "Enter a prompt: "
read prompt
echo -n "Steps (default 10): "
read steps
if [[ -z "$steps" ]]; then

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
acidjazz / tw-skeleton.css
Last active Feb 1, 2021
tailwind skeleton css
View tw-skeleton.css
.skeleton {
--text-opacity: 0;
background-image: linear-gradient(100deg, #edf2f7 0%, #f4f7fa 20%, #edf2f7 40%);
background-position: 50%;
background-size: 200%;
animation: skeleton 1.25s infinite linear;
.skeleton-teal {
background-image: linear-gradient(100deg, #b4c5f8 0%, #cad8f9 20%, #b4c5f8 40%);
View attribution.js
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(;
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
mayneyao / notion2blog.js
Last active Sep 20, 2022 > Personal Blog | custom domain + disqus comment
View notion2blog.js
const MY_DOMAIN = ""
const START_PAGE = ""
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
const corsHeaders = {
"Access-Control-Allow-Origin": "*",

👀📎 It looks like you're preparing to MC a conference...

🚨 GIANT DISCLAIMER: This stuff is far from authoritative. But it's what I think works for me, and what I enjoy in an MC when I'm attending a conference.

Biggest tip - enjoy yourself.

calebporzio / pure_html_css_modal.css
Last active Feb 28, 2022
The CSS for the pure HTML/CSS modal I tweeted about.
View pure_html_css_modal.css
details summary {
cursor: pointer;
outline: none !important;
display: inline-block;
padding: 8px 12px;
padding-top: 10px;
border-radius: 4px;
overflow: hidden;
background: #F09825;
color: white;
sarthology / regexCheatsheet.js
Created Jan 10, 2019
A regex cheatsheet 👩🏻‍💻 (by Catherine)
View regexCheatsheet.js
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
View minimal-analytics-snippet.js
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {