Skip to content

Instantly share code, notes, and snippets.

@stevehanson
stevehanson / App.css
Created February 5, 2020 17:48
React Pokedex
.pokemons {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
grid-column-gap: 1em;
grid-row-gap: 1em;
max-width: 700px;
margin: 0 auto;
}
.poke {
@stevehanson
stevehanson / ajax.js
Created October 28, 2020 17:55
wait_for_ajax
// wrapper around axios for ajax functionality
// sets globals when fetching content to help with Rspec wait_for_ajax
// adapted from: https://gist.github.com/sheharyarn/7f43ef98c5363a34652e60259370d2cb
import axios from 'axios'
export const request = (options) => {
const onSuccess = (response) => {
popAjax()
window.current_ajax_request = null // for rspec wait_for_ajax
@stevehanson
stevehanson / setup
Created November 4, 2022 16:14
React Native bin/setup
#!/bin/bash
#
# Script to be run on new project setup. Run with `bin/setup`. Does the following:
#
# * Installs ENV and key files from 1Password (does not overwrite existing)
# * Runs bundle install, yarn install
# * Sets project environment to 'staging'
downloadFile() {
if [ -e $1 ]
@stevehanson
stevehanson / compress-video.sh
Last active September 24, 2025 18:42
Compress Video (Automator script)
# in automator, "Get Selected Finder Items" -> receive "Current movie files", then "Run shell script" with below script
# If is already an mp4, adds "compressed" on the end (so doesn't overwrite) and compresses a bit more heavily
# otherwise converts video like .mov to .mp4
# the `>/dev/null 2>&1 &` bit moves conversion to the background so it doesn't freeze Finder
for f in "$@"
do
if [[ "$f" == *.mp4 ]]; then
/opt/homebrew/bin/ffmpeg -i "$f" -c:v libx264 -crf 25 "${f%.mp4}.compressed.mp4" >/dev/null 2>&1 &
else
/opt/homebrew/bin/ffmpeg -i "$f" -c:v libx264 -crf 24 "${f%.*}.mp4" >/dev/null 2>&1 &