Skip to content

Instantly share code, notes, and snippets.

Jamon Holmgren jamonholmgren

Block or report user

Report or block jamonholmgren

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jamonholmgren
jamonholmgren / shorteners.zsh
Last active Feb 20, 2020
Lets you shorten URLs from your terminal -- assuming you have a Netlify shortener installed per https://github.com/kentcdodds/netlify-shortener
View shorteners.zsh
# URL shortener scripts by Jamon Holmgren, 2020-02-19
# License: MIT
#
# Setup:
# 1. Follow Kent C. Dodds' video to create a new URL shortener with Netlify: https://www.youtube.com/watch?v=HL6paXyx6hM
# 2. Clone it to your local machine (I put it in ~/Code/shortener)
# 3. Modify this file to point to the right file
# 4. Add `source ~/path/to/this/shortner.zsh` to your .zshrc (note this was only tested with zsh)
#
# Usage:
@jamonholmgren
jamonholmgren / raw-data-npm-vs-yarn.txt
Created Jan 31, 2020
Yarn 1 vs Yarn 2 vs NPM article
View raw-data-npm-vs-yarn.txt
Things that are important to us in a JS package manager
Yarn - NPM - Description
✔ ✔ 1. Predictability -- will install the same packages every time
✔ ✔ 2. Reliability -- it's not flaky / fail randomly
✔ ✔ 3. Caching -- local installs wherever possible (less network traffic/bandwidth)
✔ X 4. Speed -- needs to be fast
✔ ✔ 5. Cost of change -- needs to be manageable, both in terms of technical and also training-wise
✔ ✔ 6. Feature: outdated
✔ ✔ 7. Feature: interactive-upgrade
✔ ✔ 8. Broad support -- works with React Native, Node CLIs, web, etc
@jamonholmgren
jamonholmgren / webview-detect-fullscreen.jsx
Last active Feb 14, 2020
Example of detecting when a YouTube video goes full screen or ends full screen in React Native WebView.
View webview-detect-fullscreen.jsx
const App = () => {
return (
<>
<WebView
injectedJavaScript={`
(function() {
setTimeout(() => {
const video = document.getElementsByClassName("html5-main-video")[0]
video.addEventListener('webkitbeginfullscreen', (event) => {
window.ReactNativeWebView.postMessage("Full Screen");
@jamonholmgren
jamonholmgren / react-native-yoga-issue.md
Created Sep 27, 2019
Issue building React Native ios -- yoga
View react-native-yoga-issue.md

I was running into a React Native build issue where I was getting this (only captured part of the error message, unfortunately):

Target Support Files/yoga/yoga.xcconfig: unable to open file (in target "yoga" in project "Pods") (in target 'yoga' from project 'Pods')

To fix:

rm -rf ios/build
@jamonholmgren
jamonholmgren / app.js
Created Sep 25, 2019
Fast Refresh Issue
View app.js
// Run `yarn add -D reactotron-react-native` first.
import React from 'react';
import {View, Text} from 'react-native';
import Reactotron from 'reactotron-react-native';
Reactotron.onCustomCommand({
command: 'someCommand',
handler: () => null,
});
View react-portal-error.txt
Exception 'Given `rootTag` (3) does not correspond to a valid root shadow view instance.' was thrown while invoking createView on target UIManager with params (
15,
RCTRawText,
3,
{
text = hello;
}
)
callstack: (
0 CoreFoundation 0x000000011086b8db __exceptionPreprocess + 331
@jamonholmgren
jamonholmgren / node-gyp-error.md
Created Dec 20, 2018
fsevents / Node gyp error
View node-gyp-error.md

Problem: I ran into a problem where running yarn would result in a weird fsevents error with a large backtrace.

Solution: Delete your yarn.lock file and yarn again.

yarn install v1.12.3
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
@jamonholmgren
jamonholmgren / .zshrc
Created Aug 2, 2016
zsh function script to toggle Do Not Disturb mode on a Mac from terminal/command line
View .zshrc
# zsh function script to toggle DND on a Mac
function dnd () {
osascript -e "
tell application \"System Events\" to tell process \"SystemUIServer\"
key down option
click menu bar item 1 of menu bar 2
key up option
end tell
"
}
View content-example.eex
<h2>Wearables</h2>
<p>
Wearable technology is in its infancy, but we are well ahead of the
curve. We can help you write the future, whether you are looking to the
wrist with Android Wear or Apple Watch, or even farther to Virtual
Reality and beyond.
</p>
View async_matrix.ex
defmodule AsyncMatrix do
@moduledoc """
Builds a matrix with mutable values using Agent processes.
iex> list = [["x", "x", "o"], ["o", "x", "o"], ["x", "o", "x"]]
[["x", "x", "o"], ["o", "x", "o"], ["x", "o", "x"]]
iex> matrix = AsyncMatrix.from_list(list)
%{0 => %{0 => #PID<0.143.0>, 1 => #PID<0.144.0>, 2 => #PID<0.145.0>},
1 => %{0 => #PID<0.146.0>, 1 => #PID<0.147.0>, 2 => #PID<0.148.0>},
You can’t perform that action at this time.