Skip to content

Instantly share code, notes, and snippets.

View sj26's full-sized avatar
🤹‍♂️

Samuel Cochran sj26

🤹‍♂️
View GitHub Profile
@sj26
sj26 / Gemfile
Last active September 23, 2021 05:47
Example mailcatcher setup with foreman
source "https://rubygems.org"
gem "foreman"
gem "rack"
gem "sinatra"
gem "mail"
@sj26
sj26 / rspec
Last active July 19, 2021 22:49
#!/bin/bash
set -euo pipefail
echo -e "--- :database: Preparing databases"
bin/rake db:test:prepare db:job_log_chunks:reset
echo -e "+++ :rspec: Running \033[33mspecs\033[0m :cow::bell:"
@sj26
sj26 / basecamp-pull-to-refresh.user.js
Last active June 10, 2021 01:58
I use the heystack page as the root of my basecamp tab, and often want to read notifications then go back to the heystack with a trackpad swipe, but then the heystack contents is outdated because turblinks restores the previous contents. So this lets me stay on the trackpad and do a pull-to-refresh to update the notifications. Ideally it would r…
// ==UserScript==
// @name basecamp-pull-to-refresh
// @description Pull to refresh the Basecamp 3 Heystack page.
// @author Samuel Cochran <sj26@sj26.com>
// @license MIT
// @version 1
// @match https://3.basecamp.com/*/my/readings
// @run-at document-end
// @homepage https://gist.github.com/sj26/0c04accaaf2ec83b2deb79425f8046ca
// ==/UserScript==
@sj26
sj26 / active_record_timescale_extensions.rb
Last active June 4, 2021 00:16
Timescale extensions for ActiveRecord
# Put this in config/initializers/
module ActiveRecord::Tasks::TimescaleExtensions
def structure_load(filename, extra_flags)
# If this structure is using timescaledb then we need to take some extra steps
# https://docs.timescale.com/timescaledb/latest/how-to-guides/backup-and-restore/pg-dump-and-restore#entire-database
if system "grep", "-Eq", "CREATE EXTENSION( IF NOT EXISTS)? timescaledb", filename
puts "Enabling timescale extension"
connection.enable_extension("timescaledb")
@sj26
sj26 / .gitignore
Last active November 12, 2020 01:30 — forked from guilherme-teodoro/style.css
Basecamp 3 - Dark mode
*.css
!*.user.css
/node_modules
@sj26
sj26 / basecamp-show-tweet-cards.user.js
Last active September 8, 2020 01:05
Show cards in embedded tweets in campfires etc so you can see the images etc that are being shared
// ==UserScript==
// @name basecamp-show-tweet-cards
// @description Show cards in embedded tweets so you can see the images etc that your friends are sharing
// @author Samuel Cochran <sj26@sj26.com>
// @license MIT
// @version 1
// @match https://bc3-production-assets-cdn.basecamp-static.com/*/embeds/*/chat
// @run-at document-end
// @homepage https://gist.github.com/sj26/d550954a0387b717907af9a335f6ce15
// @updateURL https://gist.github.com/sj26/d550954a0387b717907af9a335f6ce15/raw/56b1e3e3c8c43444fc78e0f34fb3d409f18e79fe/basecamp-show-tweet-cards.user.js
@sj26
sj26 / basecamp-more-hotkeys.user.js
Last active September 1, 2020 06:06
Some more hotkeys for Basecamp keyboard warriors
// ==UserScript==
// @name basecamp-more-hotkeys
// @description Some more hotkeys for Basecamp keyboard warriors
// @author Samuel Cochran <sj26@sj26.com>
// @license MIT
// @version 1.2
// @match https://3.basecamp.com/*
// @homepage https://gist.github.com/sj26/06856f09522171e995577fe7c2e6efea
// @updateURL https://gist.github.com/sj26/06856f09522171e995577fe7c2e6efea/raw/a4013f6171d2ce42522fb142c3b7968ce5f033e6/basecamp-more-hotkeys.user.js
// ==/UserScript==
# syntax = docker/dockerfile:experimental
FROM ruby:2.6.5 AS base
ADD https://www.postgresql.org/media/keys/ACCC4CF8.asc /etc/apt/trusted.gpg.d/pgdg.asc
ADD https://deb.nodesource.com/gpgkey/nodesource.gpg.key /etc/apt/trusted.gpg.d/nodesource.asc
ADD https://dl.yarnpkg.com/debian/pubkey.gpg /etc/apt/trusted.gpg.d/yarn.asc
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
@sj26
sj26 / buildkite-release-stable.yml
Last active August 21, 2020 06:55
Buildkite pipeline sometimes-unblock
steps:
- command: echo release stable
@sj26
sj26 / README.md
Created March 12, 2012 10:27
RSpec ExampleGroup extensions for CarrierWave

RSpec ExampleGroup extensions for CarrierWave

Infers as much as possible about uploader—the model class, what it's mounted as, etc—, sets up an uploader for specs, handles dis/enabling processing for only uploader specs, and makes it easy to describe behaviour of versions.

Drop it in spec/support/carrierwave.rb or something similar.

TODO: Microgem coming, can't get it all loading in the right order.