Skip to content

Instantly share code, notes, and snippets.

@tony-rowan
tony-rowan / icon_component.rb
Last active May 10, 2026 21:04
A fully encapsulated component to handle inlining SVGs
# frozen_string_literal: true
class IconComponent < ViewComponent::Base
class IconNotFoundError < StandardError; end
attr_reader :icon, :size, :options
# Chnage default size class based on your project
def initialize(icon, size: "size-6", **options)
@icon = icon
@tony-rowan
tony-rowan / Gemfile
Created April 19, 2026 20:39
Opinionated default Gemfile for Rails monolith projects
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails"
gem "bcrypt"
gem "bootsnap", require: false
gem "importmap-rails"
gem "solid_cable"
gem "solid_cache"
@tony-rowan
tony-rowan / CLAUDE.md
Last active April 19, 2026 20:36
Base generic CLAUDE.md file for Standard rails monolith projects

CLAUDE.md

Project

  • Rails {{VERSION}} · Ruby {{VERSION}} · PostgreSQL {{VERSION}}
  • Tailwind CSS v4 · Turbo · Stimulus
  • ViewComponent · Lookbook
@tony-rowan
tony-rowan / captions.vtt
Created October 1, 2024 16:12
Sample captions file
WEBVTT
00:00:00.000 --> 00:00:02.000
This is a video testing the captions
00:00:02.000 --> 00:00:04.000
feature. Do the captions work?
00:00:05.000 --> 00:00:06.000
yep.
module Example
def self.run
HTTP.get('http://www.example.com/?a=b&c=4&d[]=1&d[]=2&d[]=3')
end
end
RSpec.describe Example do
describe '::run' do
it 'should match an explicit query hash' do
stub_request(:get, 'www.example.com')
@tony-rowan
tony-rowan / commit-msg.context
Last active May 5, 2020 11:04
Git commit hook to remind you to add some context
#!/bin/bash
COMMIT_MSG_FILE=$1
# Exit immidiately if there is already some context for the commit
PATTERN="^\[.+\]"
COMMIT_MSG_SUMMARY=`head -n 1 $COMMIT_MSG_FILE`
if [[ $COMMIT_MSG_SUMMARY =~ $PATTERN ]]; then
exit 0
fi
flickr = FlickRaw::Flickr.new
photos = flickr.interestingness.getList(per_page: ARGV[0])
photos.each do |photo|
photo_url = flickr.photos.getSizes(photo_id: photo.id)[-1].source
photo_format = photo_url.split('.').last
photo_file = "~/Photos/Wallpapers/flickr/#{photo.title}#{photo_format}"
@tony-rowan
tony-rowan / setup.sh
Created December 4, 2016 16:06
Set up a new mac for development
#!/bin/bash
# Install brew (will install xcode tools)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Brewed Ruby
brew install ruby
# Install Brewed Git
brew install git
@tony-rowan
tony-rowan / flat_ui_colors_swift
Last active May 30, 2017 09:48
The colors at www.flatuicolors.com as a UIColor extension.
extension UIColor {
class var flat_turquoise: UIColor {
return UIColor(colorLiteralRed: 26 / 255.0, green: 188 / 255.0, blue: 156 / 255.0, alpha: 1.0)
}
class var flat_greenSea: UIColor {
return UIColor(colorLiteralRed: 22 / 255.0, green: 160 / 255.0, blue: 133 / 255.0, alpha: 1.0)
}
@tony-rowan
tony-rowan / makepods
Last active January 5, 2016 20:33
Shell script to create a new blank template pod file
#!/bin/bash
E_INPROPER_USAGE=300
DEF_NAME="MyApp"
DEF_VERSION="8.4"
DEF_INCLUDE_TESTS=true
makepodfile() {
echo "Creating Podfile"