Skip to content

Instantly share code, notes, and snippets.

View ThisIsMissEm's full-sized avatar

Emelia Smith ThisIsMissEm

View GitHub Profile
@ThisIsMissEm
ThisIsMissEm / express-handlebars-globals.js
Created March 5, 2024 16:17
If you've ever needed a `global` value in an express.js application using handlebars.js, then you can do this nasty hack. This allows you to write handlebars templates with variables like `{{@exphbs.data.X}}` where `X` is a property on `res.locals.globals`.
import expressHandlebars from "express-handlebars";
// setup handlebars for view templates:
const hbs = expressHandlebars.create({
extname: ".hbs",
helpers: { /* ... handlebars helpers */ },
});
// The express handlebars package in theory allows setting values in the
// handlebars `data` side-channel, however, the the way to set this value is via
@ThisIsMissEm
ThisIsMissEm / .gitconfig
Created January 19, 2024 20:01
My git configuration
[core]
logallrefupdates=true
autocrlf = false
quotepath = false
excludesfile = ~/.config/git/ignore
[fetch]
prune = true
[push]
default = current
[pull]
@ThisIsMissEm
ThisIsMissEm / export-tsm-urls.js
Created September 8, 2023 18:19
This is a little script that I used to migrate my tabs from Chrome to Firefox, by using Tab Session Manager. Unfortunately though, the export file from Chrome failed silently to import to Firefox, so I needed to process the file: this produces output of the tab URLs and the title of each tab in a window, separated out by the windows that you had…
import { readFile } from 'node:fs/promises'
async function main(args) {
const file = args[2];
const contents = await readFile(args[2], { encoding: "utf8" })
const session = JSON.parse(contents)[0];
let count = 0;
for (const windowId in session.windows) {
const window = session.windows[windowId];
@ThisIsMissEm
ThisIsMissEm / gist:57e5a773a3758b7520b633e5700e288e
Created February 24, 2023 21:07
Namecheap doesn't provide a CSV of all their current prices, and when you download your domains list as CSV, they don't give you the price that domain will renew at. They do have a pricing table at https://www.namecheap.com/domains/#pricing which running the following snippet will produce a string of CSV data that is the current pricing informat…
const rows = document.querySelectorAll("#pricing tbody > tr");
let csv = "TLD,Register Price,Special Price,Renew Price,Special Renew Price\n";
for(let row of rows) {
let tld = row.querySelector(".gb-tld-name").innerText;
let newPrice = "",newPriceSpecial = "",renewPrice = "",renewPriceSpecial = "";
let $NewPrice = row.querySelector("td:nth-child(2) > span:not(.gb-price--sale)");
let $RenewPrice = row.querySelector("td:nth-child(3) > span:not(.gb-price--sale)");
if ($NewPrice) {
newPrice = $NewPrice.innerText.substr(1);
@ThisIsMissEm
ThisIsMissEm / router.tsx
Last active December 4, 2020 14:14
How to use loadable component properly with react-router using full dynamic imports and correct typescript types.
import loadable, { LoadableComponent } from '@loadable/component';
import { RouteComponentProps } from 'react-router-dom';
import { StaticContext } from 'react-router';
import { LocationState } from 'history';
// Autogenerated Types for the Capabilities and their Screens:
import { Capabilities, Screens } from './routeTypes';
export * from 'react-router-dom';
export function createScreen<
@ThisIsMissEm
ThisIsMissEm / bootstrap.ts
Created September 27, 2020 22:51
entrypoint.js is the entrypoint for the CLI and lives in bin/ and is tied to a scripts entry. bootstrap.js figures out the conditions under which we are executing, and extracts the argv variables from the command run in the terminal, so you can pass them to your cli.js file.
import path from 'path';
const debug = require('debug')('cli:bootstrap');
debug({
npm_lifecycle_script: process.env.npm_lifecycle_script,
npm_config_argv: process.env.npm_config_argv,
npm_config_username: process.env.npm_config_username,
});
@ThisIsMissEm
ThisIsMissEm / t5571-pre-push-hook.sh.diff
Created August 19, 2020 22:16
Patch with test for git pre-push hook when remote is already up to date; No stdin lines are generated
diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh
index ac53d63869..edb619726e 100755
--- a/t/t5571-pre-push-hook.sh
+++ b/t/t5571-pre-push-hook.sh
@@ -19,14 +19,31 @@ test_expect_success 'setup' '
test_commit one &&
git push parent1 HEAD:foreign
'
+
+COMMIT1="$(git rev-parse HEAD)"

Yes, this is absolutely a spam email. Worse than that, you've failed to at all in anyway make this a personal outreach to a candidate.

Honestly, I've lost track of how many times I've declined Amazon already. You treat staff who are essential to your business like crap, have huge and unjustified pay disparities between your lowest paid and highest paid staff, invade peoples privacy & sell that data to police, have shitty management practices that undervalue minorities, and a crappy interviewing process.

Ask yourself: given all that, why would I ever want to work at Amazon?

You're like the Boomer of tech companies.

@ThisIsMissEm
ThisIsMissEm / Post-checkout-hook.js
Last active October 2, 2020 16:57
The only post-checkout git hook I'll agree with
#! /usr/bin/env node
/**
* This file does not use typescript as it's run before you've necessarily run `yarn install`
* As such, we can only use built-in modules here.
*/
function main() {
let [
// Arguments from the githook: https://git-scm.com/docs/githooks#_post_checkout
#! /usr/bin/env node
/**
* This file does not use typescript as it's run before you've necessarily run `yarn install`
* As such, we can only use built-in modules here.
*/
function main() {
let [
// Arguments from the githook: https://git-scm.com/docs/githooks#_post_checkout