Skip to content

Instantly share code, notes, and snippets.

View existentialmutt's full-sized avatar

Rafe Rosen existentialmutt

View GitHub Profile

Keybase proof

I hereby claim:

  • I am existentialmutt on github.
  • I am existentialmutt (https://keybase.io/existentialmutt) on keybase.
  • I have a public key whose fingerprint is 644B 7A07 984F 1E10 DEA9 7DB2 5C41 B88A F0B3 3FF3

To claim this, I am signing this object:

@existentialmutt
existentialmutt / user.behaviors
Created October 4, 2014 04:30
Light Table User Behaviors
;; User behaviors
;; -----------------------------
;; Behaviors are stored as a set of diffs that are merged together
;; to create the final set of functionality that makes up Light Table. You can
;; modify these diffs to either add or subtract functionality.
;;
;; Behaviors are added to tags, objects with those tags then automatically gain
;; whatever logic the behavior imparts. To see a list of user-level behaviors,
;; start typing a word related to the functionality you want in between the square
;; brackets (e.g. "theme").
@existentialmutt
existentialmutt / rails.cap
Last active December 6, 2016 18:16 — forked from joost/deploy.rb
Capistrano 3 rails console tasks and log tailing tasks
# Place in lib/capistrano/tasks/rails.cap and require it in your Capfile
# See: https://gist.github.com/existentialmutt/c904d6e55cd09dda81ea9751d2e66e6d
# Adapted to work with RVM installed to /usr/local
namespace :rails do
desc "tail rails logs"
task :tail_logs do
on roles(:app) do
execute "tail -f #{shared_path}/log/#{fetch(:rails_env)}.log"
end
end
@existentialmutt
existentialmutt / db_fixtures_export.rake
Last active March 25, 2023 21:10 — forked from kuboon/db_fixtures_export.rake
Generate fixtures from db. Readable by rake db:fixtures:load
# lib/tasks/db_fixtures_export.rake
namespace 'db:fixtures' do
desc "generate fixtures from the current database"
task :export => :environment do
Rails.application.eager_load!
models = defined?(ApplicationRecord) ? ApplicationRecord.descendants : ActiveRecord::Base.descendants
models.each do |model|
puts "exporting: #{model}"
@existentialmutt
existentialmutt / index.haml
Last active June 10, 2020 20:53
SortableList. Harness for applying SortableJS to resources generically.
-# app/views/thingies/index.haml
%table
%thead
%tr
%th
%th Thingy Name
%tbody#thingyList{data: {sortable_list_url: reorder_thingies_path} }
- @thingies.order(:position).each do |thingy|
%tr{data: {sortable_item_id: thingy.id, sortable_item: true}}
%td
@existentialmutt
existentialmutt / confirm-navigation-controller.js
Last active June 10, 2020 21:07
Confirm Navigation: Rails partial for confirming navigation with a custom modal. Built with Bootstrap and StimulusJS
// app/javascript/controllers/confirm-navigation-controller.js
import { Controller } from "stimulus";
import Rails from "rails-ujs";
export default class extends Controller {
static targets = ["confirmationModal"];
connect() {
}
@existentialmutt
existentialmutt / polyfills.js
Last active October 27, 2020 13:35
Polyfills for StimulusReflex in IE11
/*
This is the polyfill list from an application that has StimulusReflex / CableReady working in IE 11.
It is almost certainly overkill because some of our non-SR/CR features need polyfills too.
What's definitely needed is `@stimulus/polyfills`, `custom-event-polyfill`, `nodelist-foreach-polyfill`,
`@webcomponents/template`, and at least some of the object and array polyfills.
We also only use a few basic features of SR/CR so fancier stuff like Notifications may require additional polyfills.
*/
@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:
class SynchronousJob < ApplicationJob
def self.perform_later
raise "This job is not designed to be run asynchronously. Please use #perform_now"
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
});
}