Skip to content

Instantly share code, notes, and snippets.

View PaulJuliusMartinez's full-sized avatar

Paul Julius Martinez PaulJuliusMartinez

View GitHub Profile
@PaulJuliusMartinez
PaulJuliusMartinez / model-eager-loading.rb
Created June 25, 2019 21:57
Support nested eager loading on Sequel models that have already been loaded into memory.
module Sequel
module Plugins
# This plugin adds support for eager loading associations _after_ a record, or
# multiple records, have been fetched from the database. It is useful for ensuring
# nested associations are efficiently loaded when it is difficult to modify the
# dataset used to initially fetch the data.
#
# Example usage:
#
# artist = Artist.first
@PaulJuliusMartinez
PaulJuliusMartinez / record-screen-timelapse.rb
Created April 8, 2022 16:58
Simple macOS script for taking screenshots every X seconds on multiple displays
#! /usr/bin/env ruby
require 'time'
def usage
puts "USAGE: ./record-timelapse every 10 displays 1,2"
end
if ARGV[0] != "every" || ARGV[2] != "displays"
usage