Skip to content

Instantly share code, notes, and snippets.

View existentialmutt's full-sized avatar

Rafe Rosen existentialmutt

View GitHub Profile
@existentialmutt
existentialmutt / irbr.rb
Last active November 25, 2022 00:51
irbr - record irb history to the file of your choice
#!/usr/bin/env ruby
# irbr (short for "IRB Recorder")
#
# Starts an IRB session and appends your history to the specified file
# or "scratch.rb" by default
#
# USAGE irbr.rb output.rb
require "irb"
@existentialmutt
existentialmutt / application.js
Last active August 3, 2022 15:58
Include JS from ruby gem with esbuild
import "my-gem"
@existentialmutt
existentialmutt / update_standard_todo.rb
Created September 10, 2021 16:34
remove files from standard_todo.yml as they are committed
#!/usr/bin/env ruby
require 'pathname'
require "tempfile"
require "fileutils"
base = ENV.fetch("STANDARD_UPDATE_BASE") { "$HEAD" }
files = `git diff #{base} --name-only --staged`.split("\n")
app_root = Pathname.new File.expand_path('../../', __FILE__)
import { Controller } from "stimulus";
export default class extends Controller {
connect() {
this.element[this.identifier + "-controller"] = this;
}
confirm() {
return new Promise((resolve, reject) => {
this.confirmationResolve = resolve;
@existentialmutt
existentialmutt / modal_component.html.erb
Last active March 31, 2023 19:22
Modal ViewComponent
<div class="modal fade" id="<%= dom_id %>" role="dialog" tabindex="-1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<% if header %>
<div class="modal-header">
<%= header %>
<%- if header_close_btn %>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<i class="fa fa-times-circle"></i>
</button>
@existentialmutt
existentialmutt / README.md
Last active July 4, 2021 00:35 — forked from leastbad/README.md
mrujs w/ cable-car plugin

"dependencies": { "cable_ready": "TBD", "mrujs": "TBD" }

@existentialmutt
existentialmutt / application_controller.rb
Created June 18, 2021 17:48
use Rails::CurrentAttributes with current_user
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
before_action :set_current_user
private def set_current_user
Current.user = current_user
end
end
import { Controller } from "stimulus";
import SlimSelect from "slim-select";
export default class extends Controller {
connect() {
this.slimSelect = new SlimSelect({
select: this.element,
addToBody: true
});
}
class SynchronousJob < ApplicationJob
def self.perform_later
raise "This job is not designed to be run asynchronously. Please use #perform_now"
end
end
@existentialmutt
existentialmutt / Ruby.sublime-syntax
Last active February 19, 2022 21:49
Enhancing Sublime Ruby syntax highlighting with ERB and HAML embedded in heredocs
%YAML 1.2
---
name: Ruby (Custom)
# TODO: unresolved issues
#
# text:
# "p << end
# print me!
# end"
# symptoms: