Skip to content

Instantly share code, notes, and snippets.

View ThomasGHenry's full-sized avatar

Thomas G Henry ThomasGHenry

View GitHub Profile
@kettanaito
kettanaito / README.md
Last active May 6, 2024 14:58
Chromium on Vercel (serveless)

Chromium on Vercel (serverless)

This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.

Getting started

Step 1: Install dependencies

Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.

@vhoyer
vhoyer / README.md
Last active June 30, 2021 17:23
Overly complex script to run coverage only on changed files from one branch to another (defaults to the master).

Run branch coverage

Overly complex script to run coverage only on changed files from one branch to another (defaults to the master). This makes you only run tests that are different on the current branch compared to another branch, and this only runs coverage for the files that changed also. Bear in mind that this is also overly specific to the project I was working on and it's subfolders and file structure. That said, even if it does not work for you first try (which will probably not), it should serve as a good kick start.

So, you have installed Android Studio, and is setting it up for react native, buuuut you're new to fish and it seems like it doesn't have a .bashrc or .zshrc equivalent.

worry not, just run the following, in order:

Set the ANDROID_HOME variable, here the U will make it persist through restarts, and the x will make it be exported:

set -Ux ANDROID_HOME $HOME/Android/Sdk
@oofnikj
oofnikj / answerfile
Last active May 7, 2024 05:55
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@jonnyjava
jonnyjava / working_effectively_with_legacy_code.md
Created November 4, 2019 21:51
Working effectively with legacy code summary

WORKING EFFECTIVELY WITH LEGACY CODE

To me, legacy code is simply code without tests. I’ve gotten some grief for this definition. What do tests have to do with whether code is bad? To me, the answer is straightforward, and it is a point that I elaborate throughout the book: Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.

Chapter 1 Changing Software

Four Reasons to Change Software: For simplicity’s sake, let’s look at four primary reasons to change software.

Task Estimation

Each task requires an estimated point value based on time, complexity, and unknowns. Ensuring tickets are broken down into sensible, actionable chunks can reduce unknowns and allow the team to point a ticket based on the task’s time and complexity. A good scale to use for point values is the fibonacci sequence (1, 2, 3, 5, 8, 13) because it reflects that uncertainty on how to execute a task increases with task size.

A team should point each ticket as if any member were to take it on. This increases team flexibility and improves the quality of task estimation. Team members should therefore estimate each task as a group, and converge on a point value on which every member agrees. One method is planning poker, in which each team member reveals their individual point estimation of a task at the same time before the team collectively decides on the appropriate point value.

In practice, estimating point value based on ti

@the-vampiire
the-vampiire / extract-cookies.js
Last active November 1, 2023 23:46
express supertest / superagent utility for accessing response cookies as objects
const shapeFlags = flags =>
flags.reduce((shapedFlags, flag) => {
const [flagName, rawValue] = flag.split("=");
// edge case where a cookie has a single flag and "; " split results in trailing ";"
const value = rawValue ? rawValue.replace(";", "") : true;
return { ...shapedFlags, [flagName]: value };
}, {});
const extractCookies = headers => {
const cookies = headers["set-cookie"]; // Cookie[]
@sergeyvlakh
sergeyvlakh / injector.js
Created March 19, 2019 10:17
Dynamic prop injector
function injectDataAttribute(reactElement) {
if (React.isValidElement(reactElement)) {
try {
reactElement.type.attrs = { "data-test-id": reactElement.type.displayName};
} catch(e) {}
}
}
const Injector = prefix => App => {
@igorvolnyi
igorvolnyi / README.md
Last active February 23, 2021 22:18
DRY solution for Sequelize.js models vs migrations problem
@edPratt
edPratt / mac-osx-node-npm.md
Last active December 19, 2019 21:56
Fixing npm On Mac OS X; When npm install -g does not work

Nuke Everything node/npm related

(If you have setup another prefix)
rm -rf .npm-global

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall node --ignore-dependencies node
rm -rf /usr/local/lib/node_modules