Skip to content

Instantly share code, notes, and snippets.

View RobinDaugherty's full-sized avatar

Robin Daugherty RobinDaugherty

View GitHub Profile
@RobinDaugherty
RobinDaugherty / app_admin_resourcename.rb
Created November 15, 2018 18:04
PaperTrail ActiveAdmin history pane
ActiveAdmin.register DeviceState do
# ...
action_item :history, only: :show do
link_to 'History', [:history, :admin, resource]
end
member_action :history do
render "layouts/history"
end
# ...
end
ruby_apps:
- name: releasemaker_production
ruby_version: 'ruby_2.4.3'
app_has_background_processes: false
deployment_keys: |
ssh-rsa etc
environment:
RAILS_ENV:
RAILS_MAX_THREADS:
DATABASE_URL:
module Split
module Persistence
##
# Used for testing so we can use controllers that use Split without needing Redis.
# I can't believe I have to write this, it should be part of the split gem.
# But this doesn't work anyway, because Split keeps going to Redis anyway.
class MemoryAdapter
def initialize(context, key = nil)
@data = {}
end
@RobinDaugherty
RobinDaugherty / CoreDataController.swift
Last active July 15, 2018 23:50 — forked from kharrison/CoreDataController.swift
Swift wrapper for NSPersistentContainer - Easy Core Data Setup with iOS 10 and PromiseKit
//
// CoreDataController.swift
//
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright
@RobinDaugherty
RobinDaugherty / home-bin-prettify
Last active May 1, 2018 17:58 — forked from macielsmith/home-bin-prettify
prettify json files in git project before comparing
#!/bin/zsh
# Staged files
{ git diff --name-only --diff-filter=d --relative &
# Staged files
git diff --cached --name-only --relative &
# Unstaged new files
git ls-files --others --exclude-standard } |
# Remove duplicates
sort -u |
@RobinDaugherty
RobinDaugherty / Gemfile
Created January 19, 2018 19:48
Guardfile example
group :development do
gem 'guard', require: false
gem 'guard-rspec', require: false
gem 'guard-migrate', require: false
gem 'guard-rubocop', require: false
gem 'guard-bundler', require: false
gem 'guard-pow', require: false
end
@RobinDaugherty
RobinDaugherty / bundler.txt
Created August 25, 2017 16:14
Ruby segfaults with simplecov (macOS)
better_errors/lib/better_errors/raised_exception.rb:40: [BUG] Segmentation fault at 0x00000000000001
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
@RobinDaugherty
RobinDaugherty / circle.yml
Created August 7, 2017 18:05
CircleCI 2.0 conversion for Rails app with staging and production deployed to Flynn cluster
dependencies:
post:
- gem install circleci_deployment_notifier
deployment:
staging:
branch: master
owner: omniboard
commands:
- git fetch --unshallow || true
- echo $CIRCLE_SHA1 > REVISION
@RobinDaugherty
RobinDaugherty / monthly.rb
Created July 31, 2017 15:54
Time-series value generator
(1..12).map { |m| [Time.new(2016, m, 1).to_i * 1000, 100 * m] }
(1..12).map { |m| [Time.new(2016, m, 1).to_i * 1000, 1200 / m] }
(1..12).map { |m| [Time.new(2016, m, 1).to_i * 1000, (m / 2) * 100] }
@RobinDaugherty
RobinDaugherty / apply_this.sh
Last active December 7, 2018 12:45
Fix Pow's nack so that better_errors works on ruby 2.1+
curl -L https://gist.githubusercontent.com/RobinDaugherty/2731f20d303e6506d451384df2189210/raw/b52e6231170b3dce39633db29634dc892751910f/pow_better_errors_fix.patch |
patch ~/Library/Application\ Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb