Skip to content

Instantly share code, notes, and snippets.

View rlue's full-sized avatar

Ryan Lue rlue

View GitHub Profile
@rlue
rlue / cj.rb
Created December 7, 2020 09:47
Cangjie IME lookup script
#!/usr/bin/env ruby
# frozen_string_literal: true
module CangjieMap
IM_TABLE_RAW = DATA.readlines.freeze
module Radicals
ROM_TO_CJ_MAP = IM_TABLE_RAW[12..37].map(&:split).to_h.freeze
CJ_TO_ROM_MAP = ROM_TO_CJ_MAP.to_a.map(&:reverse).to_h.freeze
@rlue
rlue / assign_unit_benchmark.rb
Last active July 19, 2018 03:04
Benchmark for modifications to Associations::Assign — calculating changes BEFORE assign_attributes (worst-case scenario)
require 'benchmark'
ASSOCIATIONS = {
'2' => (1..10).to_a,
'4' => (1..10).to_a,
'6' => (1..10).to_a,
'8' => (1..10).to_a,
'10' => (1..10).to_a,
'12' => (1..10).to_a,
'14' => (1..10).to_a,
@rlue
rlue / 1238_sample_mail
Created June 6, 2018 05:43
A raw mail file for reproducing Issue #1238 in mikel/mail
From 8b11391258c-c-720@example.com Wed Nov 2 12:35:34 2016
Return-Path: <8b11391258c-c-720@example.com>
X-Original-To: info@example.ch
Delivered-To: example-swiss-sales@arber.example.com
Received: from h2.example.com (h2.example.com [85.194.241.179])
by arber.example.com (Postfix) with ESMTP id 84A4760187
for <info@example.ch>; Wed, 2 Nov 2016 12:35:34 +0100 (CET)
MIME-Version: 1.0
From: Paula <databases.en@example.com>
To: info@example.ch
@rlue
rlue / kaminari_issue_931.rb
Last active November 27, 2017 10:19
Kaminari Issue #931: #page.size borks for certain AR relations (e.g., ordered by association attributes)
# IMPORTANT: This bug report is specific to postgresql. Create the test DB with
#
# $ createdb kaminari
#
# before running this test case.
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"

Keybase proof

I hereby claim:

  • I am rlue on github.
  • I am ryanlue (https://keybase.io/ryanlue) on keybase.
  • I have a public key ASCSBlloCRfd54KXvQSrRPyWNfLRNce0t4fjwxd-ZpNdlwo

To claim this, I am signing this object: