Skip to content

Instantly share code, notes, and snippets.

View timm-oh's full-sized avatar
🐰

Tim McCarthy timm-oh

🐰
View GitHub Profile
@timm-oh
timm-oh / build.js
Created April 12, 2022 15:41
esbuild config file with live reloading for rails
#!/usr/bin/env node
import esbuild from "esbuild"
import chokidar from "chokidar"
import http from "http"
const watchDirectories = [
"./app/assets/builds/*",
"./app/views/**/*.erb",
]
@timm-oh
timm-oh / Dockerfile
Last active November 3, 2022 14:15
Docker / esbuild combination
ARG RUBY_VERSION=3.1.2
FROM ruby:$RUBY_VERSION-bullseye as builder
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 \
LANG=C.UTF-8 \
BUNDLE_RETRY=3 \
BUNDLE_PATH=/gems
ARG RAILS_ENV=production
ENV RAILS_ENV $RAILS_ENV
# This is needed during the build process because when precompiling assets, the
@timm-oh
timm-oh / create_review_app.rb
Last active May 5, 2022 12:25
Heroku 'Review app' setup
require 'json'
pipeline = "PIPELINE_UUID"
pipeline_owner = "enterprise_team_name or email_address"
name = "heroku_app_name"
# CREATE APP
`heroku apps:create #{name} --team=#{pipeline_owner} --region=eu` # using eu region, otherwise it defaults to us
info_output = `heroku apps:info #{name} --json`
app_info = JSON.parse(info_output)
@timm-oh
timm-oh / .iex.exs
Last active March 4, 2025 21:05
Elixir phoenix docker setup
:logger.debug("""
> `docker attach $(docker compose ps web -q)` to attach IEx.pry()
> Ctrl + P + Q to detach from the container terminal
""")
@timm-oh
timm-oh / .zshrc
Last active May 9, 2025 13:13
Creates git branching name according to a specific format
# All other config
# Usage
# $ git:(main) new-task "Setup dockerfile for development"
# $ git:(tim.mccarthy/setup-dockerfile-for-development)
alias gcom="checkout-main"
function checkout-main() {
main_branch=$(main-branch)
defmodule Helpers do
def copy(term) do
text =
if is_binary(term) do
term
else
inspect(term, limit: :infinity, pretty: true)
end
port = Port.open({:spawn, "pbcopy"}, [])