Skip to content

Instantly share code, notes, and snippets.

View sheminanto's full-sized avatar
✍️
Learning

Shemin Anto sheminanto

✍️
Learning
  • Software Engineer
View GitHub Profile
@ldez
ldez / gmail-github-filters.md
Last active July 16, 2024 09:41
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
@sepastian
sepastian / multi_cartesian_product.rb
Last active January 11, 2023 09:26
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],
@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:')