Skip to content

Instantly share code, notes, and snippets.

View markedmondson's full-sized avatar

Mark Edmondson markedmondson

View GitHub Profile
@hopsoft
hopsoft / README.md
Last active August 8, 2022 20:13
Heroku Review Apps managed by GitHub Actions

Heroku Review Apps managed by GitHub Actions

This gist aims to provide a simple solution for managing Heroku Review Apps with GitHub Actions due to the security incident that continues to disrupt Heroku's GitHub integration.

.github
├── workflows
│   ├── heroku_review_app_create.yml
│   └── heroku_review_app_destroy.yml
@kaspermeyer
kaspermeyer / jquery_event_delegator.coffee
Created December 13, 2018 14:06
Dispatch jQuery events as regular DOM events
# ~ Dispatch jQuery events as regular DOM events ~
#
# Delegated events are given a new name in the format `jquery:<original event name>`.
# If you delegate `ajax:send` you will be able to listen for `jquery:ajax:send`
# on native event listeners such as Stimulus actions and `EventTarget.addEventListener`.
#
# Notes:
# * The first parameter must be called "event".
# * The parameters can be accessed as members on the `event.detail` object.
#
@pcreux
pcreux / rtt
Last active March 30, 2021 22:27
Run tests for all changed app, lib and test files
#!/usr/bin/env ruby
# Run unit test for all added or changed app, lib and test files.
# Ex:
# * `rtt` will run tests for all files changed since the last commit
# * `rtt master` will run tests for all files different from master
if ARGV[0]
files = `git diff --name-only $(git merge-base HEAD #{ARGV[0]})..$(git rev-parse --abbrev-ref HEAD)`.split("\n")
else
files = `git status -s`.split("\n").map { |f| f.split(' ').last }
@joshco
joshco / Guardfile.rb
Last active May 10, 2019 18:44
Vagrant Guest Guard HTTP Solution
require 'sinatra'
require 'json'
# Use of guard-yield based on wisdom from https://github.com/e2
# use of HTTP crime by @joshco
class SinatraGuard < Sinatra::Base
set :bind, '0.0.0.0'
set :port, 4000
@tylerhunt
tylerhunt / rendering_helper.rb
Created March 20, 2015 15:48
Override Rails' #render helper to fix an issue with rendering partials based on an object within a namespace.
module RenderingHelper
# Override Rails' #render helper to fix an issue with it not honoring objects
# with #to_partial_path definitions that return absolute paths, which is
# problematic when rendering partials within a namespaced controller.
def render(options={}, locals={}, &block)
return super unless options.respond_to?(:to_partial_path)
object = options
path = object.to_partial_path