Skip to content

Instantly share code, notes, and snippets.

View existentialmutt's full-sized avatar

Rafe Rosen existentialmutt

View GitHub Profile
@KonnorRogers
KonnorRogers / view_component_helper.rb
Last active May 10, 2021 12:09
For nested components
View view_component_helper.rb
module ViewComponentHelper
def component(name, context: nil, **args, &block)
cache_keys = Array(args.delete(:cache))
cache_if cache_keys.present?, cache_keys do
return render_component_in(context, name, **args, &block) if context
return render component_class_for(name).new(args), &block
end
end
@julianrubisch
julianrubisch / turbo_frame_history_controller.js
Last active May 8, 2021 02:39
Tabbed navigation with turbo
View turbo_frame_history_controller.js
import { navigator } from "@hotwired/turbo";
import { Controller } from "stimulus";
import { useMutation } from "stimulus-use";
export default class extends Controller {
connect() {
useMutation(this, { attributes: true, childList: true, subtree: true });
}
mutate(entries) {
@hopsoft
hopsoft / Dockerfile
Last active May 17, 2023 19:58
Dockerize your Rails app
View Dockerfile
FROM ruby:3.0-alpine
RUN apk add --no-cache --update \
ack \
bash \
build-base \
curl \
git \
htop \
less \
@staltz
staltz / introrx.md
Last active February 22, 2024 17:42
The introduction to Reactive Programming you've been missing
View introrx.md