Skip to content

Instantly share code, notes, and snippets.

View sheminanto's full-sized avatar
✍️
Learning

Shemin Anto sheminanto

✍️
Learning
  • Software Craftsperson at Incubyte
View GitHub Profile
@astery
astery / gist:6137727
Last active April 12, 2023 15:20
Eager loading and custom select.
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.2.6'
require 'active_record'
require 'minitest/autorun'
require 'logger'
$logger = Logger.new(STDOUT)
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
@sepastian
sepastian / multi_cartesian_product.rb
Last active July 26, 2024 19:46
Build the cartesian product of multiple arrays in Ruby.
# Given an array of arrays s = [ [1,2,3], [4,5,6], ... ]
# compute the Cartesian product among the elements of s.
require 'pp'
s = [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
pp s[1..-1].inject(s[0]){ |m,v| m = m.product(v).map(&:flatten) }
[[1, 3, 6],
[1, 3, 7],
[1, 3, 8],
@ldez
ldez / gmail-github-filters.md
Last active April 16, 2025 20:12
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@brianjbayer
brianjbayer / gist-unlocking-the-secrets-of-rails-secrets-and-credentials.md
Last active April 8, 2025 10:05
A comprehensive examination of Rails Secrets, Credentials, and Secret Key Base

Unlocking the Secrets of Rails Secrets and Credentials

Interurban Tunnel at Blackhand Gorge- Brian J Bayer


If you are like many (most?) of us, you have encountered Rails Credentials/Secrets and secret_key_base and may have been left a bit (or more) confused.

This post is an attempt to remove some of that confusion by