Skip to content

Instantly share code, notes, and snippets.

View devinrhode2's full-sized avatar
😀

Devin Rhode devinrhode2

😀
View GitHub Profile
@devinrhode2
devinrhode2 / install.rb
Last active December 22, 2023 06:11 — forked from aubguillemette/install.rb
Homebrew without sudo-Aub's fork with a few minor changes from kenchan's fork
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
# chmod +x install.rb
# ./install.rb
YOUR_HOME = ENV['HOME']
HOMEBREW_PREFIX = "#{YOUR_HOME}/usr/local"
system "mkdir -p #{HOMEBREW_PREFIX}"
HOMEBREW_CACHE = "#{YOUR_HOME}/Library/Caches/Homebrew"
HOMEBREW_REPO = 'https://github.com/Homebrew/brew'
@devinrhode2
devinrhode2 / .prettierrc.js
Last active December 8, 2023 20:32
Prettier config settings to reduce merge conflicts
// Prettier config to reduce merge conflicts: https://gist.github.com/devinrhode2/08c84e175c61b282b76f4766a94e4a01
/** @type {import('prettier').RequiredOptions} */
module.exports = {
singleQuote: true,
semi: false,
// avoid even more merge conflicts: https://prettier.io/blog/2020/03/21/2.0.0.html#change-default-value-for-trailingcomma-to-es5-6963httpsgithubcomprettierprettierpull6963-by-fiskerhttpsgithubcomfisker
trailingComma: 'all',
printWidth: 40,
@devinrhode2
devinrhode2 / TraceKitSupplement.js
Last active October 23, 2023 12:49
Stuff I've added to my error reporting/handling stuff in addition to TraceKit.js, ideally in a few months I don't write any of this code
function exceptionalException(message) {
'use strict';
if (exceptionalException.emailErrors !== false) {
exceptionalException.emailErrors = confirm('We had an error reporting an error! Please email us so we can fix it?');
}
}
//test
//exceptionalException('try 1!');
//exceptionalException('try 2!');
@devinrhode2
devinrhode2 / serverFnFetch.ts
Created August 22, 2023 16:22
used to monkey patch a `fetch` call inside some javascript framework.
// https://stackoverflow.com/questions/43004657/modify-the-url-of-a-new-request-object-in-es6
// used to monkey patch a `fetch` call inside some javascript framework.
const serverFnFetch: typeof fetch = function (input, init) {
const isRequest = input instanceof Request;
const currentUrlObj = new URL(
isRequest ? input.url : input,
location.href,
);
const currentUrlWithoutOrigin = currentUrlObj
@devinrhode2
devinrhode2 / withFooBarPropInjected.tsx
Created July 10, 2023 04:08
withFooBarPropInjected.tsx with generics etc
import React from 'react';
import { useCheckoutSessionId } from '../useCheckoutSessionId';
type ComponentThatRequiresCheckoutSessionId<TProps> = (
yourBaseProps: TProps,
) => JSX.Element | null;
/** Patches return type */
type RemoveProp<
type asdf = HTMLElement;
const validateElement = <
// eslint-disable-next-line @typescript-eslint/ban-types
TInstanceType extends Element,
>(
node: Element | null,
{
nodeNickname,
tagName,
@devinrhode2
devinrhode2 / levels.md
Last active April 15, 2023 12:57
typescript tsconfig compilerOptions settings ranked by value
@devinrhode2
devinrhode2 / README.md
Last active April 10, 2023 12:20 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@devinrhode2
devinrhode2 / .gitconfig
Last active March 17, 2023 15:35
git add-archive <sha>
[alias]
add-archive = "!runit() { REFS_BRANCH=`git branch -a --contains $1 | xargs` && \
NEW_REF=`echo refs/archive/$(date '+%Y-%m-%d')/$(git config user.name)/$REFS_BRANCH/$(date '+%s')` && \
git update-ref $NEW_REF $1 && \
echo consider deleting $REFS_BRANCH && \
echo attempting to backup archives && \
git push origin refs/archive/*:refs/archive/* && \
echo Here is your remote commit ref url && \
echo https://github.com/org/repo/commit/$1; }; runit"
@devinrhode2
devinrhode2 / clean-scrollbar.css
Created May 2, 2012 03:42
Like, basically PERFECT scrollbars
/**
* Like, basically PERFECT scrollbars
*/
/*
It's pure CSS.
Since a quick google search will confirm people going crazy about Mac OS Lion scrollbars...
this has no fade-out effect.
In Mac OS Lion, the lowest common denominator is always showing scrollbars by a setting.