Skip to content

Instantly share code, notes, and snippets.

View agamm's full-sized avatar
🍪
Cookie: cookies=∞;\r\n

Agam More agamm

🍪
Cookie: cookies=∞;\r\n
View GitHub Profile
import fs from "fs";
import fse from "fs-extra";
import path from "path";
import { promisify } from "util";
import { exec } from "child_process";
const execAsync = promisify(exec);
function chunkArray(array, chunkSize) {
const chunks = [];
@agamm
agamm / showAllResolved.md
Last active February 26, 2024 08:56
Show all resolved comments in a Github Pull Request

Run this in the console:

document.querySelectorAll('span.Details-content--closed').forEach((e)=>{e.click()})

From the creator of: unzip.dev 🚀

@agamm
agamm / fixUrls.js
Created February 1, 2024 07:53
Ghost Editor Link Fixer and ?ref= adder
/*
This script helps fix links that have a prefix whitespace (sometimes when copying from google).
Also it allows to add a ?ref=yoursite to all links in the newsletter issue.
Worked with the latest ghost version up to now (Feb 2024)
*/
const GhostAdminAPI = require("@tryghost/admin-api");
const path = require("path");
@agamm
agamm / domains.json
Created September 23, 2023 11:15
Match urls to Alexa 1M top websites
["yourdomain.com", "your2nddomain.com"...]
@agamm
agamm / settings.py
Created December 1, 2022 18:03
Django settings for postgres from URI
import urllib
# ...
DB_URL = config('DATABASE_URL') # Get from your config
db_props = urllib.parse.urlparse(DB_URL)
db_name = db_props.path
db_user = db_props.username
db_password = db_props.password
db_host = db_props.hostname
db_port = db_props.port
@agamm
agamm / testing.helper.ts
Last active October 22, 2022 22:02
Table tests with Jest (including exceptions)
// If you ever so fancy, you might want to check: unzip.dev
export const tableTest = (
test: jest.It,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
cases: any[][],
testFn: CallableFunction
) => {
test.each(cases)(`${testFn.name}(%s) should be %s`, async (input, output) => {
const asyncFn = testFn.constructor.name == 'AsyncFunction';
@agamm
agamm / gist:7a839180075b77220729
Last active October 13, 2022 22:26
Simple time logging class in PHP.
<?php
//Exec time class
/*
Example:
Time::start('functionToTest');
functionToTest();
Time::p();
Time::t();
*/
class Time{
@agamm
agamm / convert.py
Last active October 13, 2022 22:25
Python money/currency format and convert string to integer.
from re import sub, search
from decimal import Decimal
# Not production ready
def convert(m):
r = 1.0
if "£" in m:
r = 1.28 # Make sure to check this (conversion rate between pounds and usd)
z = 0
@agamm
agamm / mbox-extract-attachments3.py
Last active October 13, 2022 22:24 — forked from kellerza/mbox-extract-attachments3.py
mbox-extract-attachments3.py with fix to support iso-8859-8-i encoding.
#!/usr/bin/env python3
# pylint: disable=invalid-name
"""mbox-extract-attachments3 - Extract attachments from mbox files.
Good companion for Google Takeout https://takeout.google.com/settings/takeout
Modified by http://github.com/kellerza from
https://github.com/PabloCastellano/pablog-scripts/
- Python3 & linter errors
- New Filenames
@agamm
agamm / color-range-slider.markdown
Last active October 13, 2022 22:21
Color range slider with animated emoji.

Color range slider

As the slider handle is dragged, it's background color matches that of the gradient track below.

Uses jQueryUI slider.

A Pen by Agam on CodePen.

License.