Skip to content

Instantly share code, notes, and snippets.

View mikenikles's full-sized avatar

Mike mikenikles

View GitHub Profile
@mikenikles
mikenikles / alert-branch-name.js
Last active November 26, 2023 15:21
Bookmarklets, use https://make-bookmarklets.com/ to add to your browser
const get_issue_branch = () => {
const number = document.querySelector("h1.gh-header-title span").textContent;
const title = document.querySelector("h1.gh-header-title .js-issue-title").textContent;
return `${number.substring(1)}-${title.toLowerCase().replaceAll(" ", "-").replaceAll(/[^-a-z]/g, "")}`;
};
const get_pull_request_branch = () => document.querySelector(".commit-ref.head-ref a span").textContent;
const copyBranchName = () => {
if (window.location.host !== "github.com") return;
@mikenikles
mikenikles / github-labels-export.js
Last active January 24, 2024 20:39
Scripts to export GitHub issue labels from one repository and import them to another repository.
/**
* The array of issues is copied to your clipboard. Paste it somewhere before you copy the `github-labels-import.js` file content.
*
* Run this script on the https://github.com/OWNER/REPO/labels page.
*/
const convertRgbaToHex = (rgba) => {
// Match the values in the parentheses
const match = rgba.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)/);
if (!match) return;
* **Takeaways**
* Share test utilities
* Use a lint rule when people don't follow best practices
* Not sure this is worth the effort for us
* It's easy to start writing tests, it's hard to continuously maintain tests and consistently keep coverage high
* How do you test a module?
* In isolation
* With integrations
* Mock integrations
* Test app but mock external dependencies
@mikenikles
mikenikles / config.yml
Last active November 23, 2021 16:52
A (mostly) automated release process
version: 2
# Re-usable blocks to reduce boilerplate
# in job definitions.
references:
container_config: &container_config
docker:
- image: my-company/circleci:gcloud # We use a custom Alpine Linux base image with the bare minimum
working_directory: /tmp/workspace
restore_repo: &restore_repo