Skip to content

Instantly share code, notes, and snippets.

View jakebellacera's full-sized avatar

Jake Bellacera jakebellacera

View GitHub Profile
@jakebellacera
jakebellacera / convertSvgPathsToCsv.js
Created February 16, 2023 22:47
Converts folders of SVGs into a CSV of paths to be used in an icon library.
import fs from "node:fs/promises";
const camelize = (s) => s.replace(/-./g, (x) => x[1].toUpperCase());
const getPathsFromSvg = async (path) => {
const svg = await fs.readFile(path, { encoding: "utf-8" });
const paths = svg.match(/d="(.*?)"/);
if (!paths) {
throw new Error(`No paths in file ${path}`);
@jakebellacera
jakebellacera / userscript-github-pull-request-autofocus.js
Last active November 3, 2021 16:50
Quickly review files in Github pull requests by pressing spacebar on your keyboard with this userscript.
// ==UserScript==
// @name Github Pull Request Autofocus
// @description Helps you quickly review files in Github pull requests.
// @author Jake Bellacera
// @match https://github.com/*/pull/*/files
// ==/UserScript==
// HOW TO USE
// ==========
// 1. Open a Github pull request.
@jakebellacera
jakebellacera / export-vscode-search-to-csv.js
Last active October 21, 2024 21:06
Export VSCode search results to CSV
// How to use:
// 1. In VS Code, perform a search.
// 2. Click "Open in editor" to open the search results in a `.code-search` file
// 3. Save the file
// 4. In terminal, run `node export-vscode-search-to-csv.js path/to/results.code-search path/to/exported.csv`
const fs = require("fs");
const path = require("path");
const readline = require("readline");
@jakebellacera
jakebellacera / disable-yoast-seo-automatic-og-image-lookup.php
Last active October 20, 2020 19:27
Force Yoast SEO to show the default open graph image in case a feature image isn't set.
<?php
/**
* Plugin Name: Disable Yoast SEO Automatic Open Graph Images
* Plugin URI: https://gist.github.com/jakebellacera/c2aab8f786a0617b27dd4914c70463d4
* Description: Shows the default open graph image in case a feature image isn't set, rather than showing a random image on the page.
* Version: 0.0.0
* Author: Jake Bellacera
* Author URI: https://www.jakebellacera.com/
*/
@jakebellacera
jakebellacera / DiffView.js
Created November 20, 2019 17:41
A component for visualizing diffs on objects
import React from "react";
const groupDiffs = (from, to, parseValue, parseKey) => {
return mergeKeys(from, to).reduce((groups, key) => {
const group = groupFn(key, from[key], to[key]);
const name = parseKey ? parseKey(key) : key;
const from = parseValue ? parseValue(key, from) : from;
const to = parseValue ? parseValue(key, to) : to;

Keybase proof

I hereby claim:

  • I am jakebellacera on github.
  • I am jakebellacera (https://keybase.io/jakebellacera) on keybase.
  • I have a public key ASC4p2BMaTpJb1AMSJvdMhW60Cu5d_gmkrqk5kRDdrG1rwo

To claim this, I am signing this object:

// Events are tracked using the Split.track() method
//
// The format is as follows:
// split.track(CUSTOMER_ID, TRAFFIC_TYPE, EVENT_TYPE, VALUE)
// Example #1: Track page load time
split.track(USER_ID, "user", "page_load_time", 5.5346);
// Example #2: Track API response time
split.track(USER_ID, "user", "api_response_time", 1.7459);
@jakebellacera
jakebellacera / 0-slack-standup.txt
Last active November 8, 2018 22:50
A preview of how a standup message should be formatted within Slack
Yesterday:
> * Redesigned dashboards
> * Drafted blog post
> * Speced out homepage redesign plan
Today:
> * Peer review blog post copy with @lenore
> * Review homepage redesign plan with design team
SplitClient split = SplitFactoryBuilder.build("YOUR_API_KEY").client();
String treatment = split.getTreatment("USER_ID", "my-feature");
if (treatment.equals("on")) {
// insert on code here
} else if (treatment.equals("off")) {
// insert off code here
} else {
// insert control code here
@jakebellacera
jakebellacera / hubspot-adwords-gclid-tracking.js
Last active December 21, 2022 00:56
Simple HubSpot gclid tracking code integration
// The script below will ensure that gclid parameters are associated with
// contacts in HubSpot.
//
// A few things are required before this script will work:
//
// * You will need to have the HubSpot tracking code installed on the page. A
// few modifications will be required if you don't have the tracking code
// installed. Additionally, you will lose out on the built-in cross-domain
// features that the hubspot tracking code uses to store cookies.
// * You will need to have this script installed on every page.