Skip to content

Instantly share code, notes, and snippets.

View kcdragon's full-sized avatar
🏠
Working from home

Mike Dalton kcdragon

🏠
Working from home
View GitHub Profile
@bkeepers
bkeepers / README.md
Last active October 24, 2022 20:02
Fail Rails system tests if there are any JavaScript errors

We're on the cusp of 2022 and most software is now written in JavaScript, but it is still virtually impossible to fail integration tests on a JavaScript error and get a useful stack trace from the browser.

This gist includes my description of the problem and sample code from my attempts to solve it.

What I want:

  • Integration test should fail (preferabbly immediately) on any uncaught JavaScript error (window.onerror, unhandledrejection, etc)
  • The stack trace should use source maps and be close to what browsers show in DevTools

The tools I'm currently using:

name: ml4t
channels:
- conda-forge
- defaults
dependencies:
- python=3.6
- cycler=0.10.0
- kiwisolver=1.1.0
- matplotlib=3.0.3
- numpy=1.16.3
@quiver
quiver / iam-policy.json
Last active April 23, 2024 07:02
How to connect to Amazon RDS PostgreSQL with IAM credentials
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:region:account-id:dbuser:dbi-resource-id/database-user-name"
@marcotc
marcotc / sidekiq_retry_time.csv
Created February 14, 2017 18:16
Sidekiq retry exponential backoff formula times
Retry count Retry Time Total Cumulative Time Total Cumulative Days
0 0:00:00 0:00:00 0.0
1 0:00:16 0:00:16 0.0
2 0:00:31 0:00:47 0.0
3 0:01:36 0:02:23 0.0
4 0:04:31 0:06:54 0.0
5 0:10:40 0:17:34 0.0
6 0:21:51 0:39:25 0.0
7 0:40:16 1:19:41 0.1
8 1:08:31 2:28:12 0.1
@gongo
gongo / json-reformat.el
Last active June 11, 2020 00:48
見づらい JSON 文字列を雰囲気見やすくする elisp です http://gongo.hatenablog.com/entry/2012/02/10/222051
;;; json-reformat --- Reformat tool for JSON
;; Author: Wataru MIYAGUNI <gonngo@gmail.com>
;; Keywords: json
;; Copyright (c) 2012 Wataru MIYAGUNI
;;
;; MIT License
;;
;; Permission is hereby granted, free of charge, to any person obtaining
@benfyvie
benfyvie / object_diagnostics.rb
Created December 22, 2011 17:30 — forked from eric/object_diagnostics.rb
Tools for debugging memory bloat using Ruby's built in ObjectSpace
module ObjectDiagnostics
extend self
#This is handy when you want to determine what types of objects are contributing to memory bloat
#returns the change in object counts since the last time this method was called
def change_in_object_counts
#this will start all counts at 0 for the initial run
@previous_counts ||= Hash.new(0)
@therobot
therobot / gist:102770
Created April 27, 2009 22:06
Rolls back database to migration level of the previously deployed release
before "deploy:rollback:revision", "deploy:rollback_database"
desc "Rolls back database to migration level of the previously deployed release"
task :rollback_database, :roles => :db, :only => { :primary => true } do
if releases.length < 2
abort "could not rollback the code because there is no prior release"
else
rake = fetch(:rake, "rake")
rails_env = fetch(:rails_env, "production")
migrate_env = fetch(:migrate_env, "")