Skip to content

Instantly share code, notes, and snippets.

Trung Lê joneslee85

Block or report user

Report or block joneslee85

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
joneslee85 /
Last active Jul 3, 2019
How to bundler to bundle install mysql2 gem

So if you have ever run into failing to install mysql2 gem with bundler, here is a quick way to resolve it:

  1. Install MySQL with dev headers
  2. Configure bundler option: bundle config build.mysql2 --with-mysql-dir=<path_to_mysql_folder>
  3. bundle install

If you run into issue like this (which is likely if your MySQL does not get installed into /usr/local/mysql on macOS)

/Users/tle/.asdf/installs/ruby/2.3.5/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2/lib/mysql2.rb:33:in `require':LoadError: dlopen(/Users/tle/.asdf/installs/ruby/2.3.5/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
joneslee85 /
Last active Feb 22, 2019
Where does AWS CodeDeploy agent store its scripts?


joneslee85 / gist:64ff44f7618e1c4ed1d57d470638c5e6
Created Aug 16, 2018
Link to download puppet learning VM
View gist:64ff44f7618e1c4ed1d57d470638c5e6
Original page:
Version: 6.5 (Quest Guide v2.3.0)
File Size: 3.2 GB
MD5: be3df9bc000b98b9aec6002f071968da
### Minimum requirements
* Internet-enabled Windows, OS X, or Linux computer with 10GB free space and a VT-x/AMD-V enabled processor.
* 4GB memory (8GB is recommended)
joneslee85 /
Last active Jun 19, 2018
How to transfer money to Legame with TransferWise?
  • Name: カブシキガイシャ レガーメ
  • Bank: 1695
  • Branch: 004
  • No: 0680377
joneslee85 / foreman_regex.rb
Last active Apr 5, 2018
A simple regex to match foreman log output
View foreman_regex.rb
message = %Q{3:54:04 worker.1 | main_message_is_here}
FOREMAN_REGEX = /^(?<TIME>([0-1]?[0-9]|[2][0-3]):([0-5][0-9])(:[0-5][0-9]))\s(?<PROGRAM>\S*)\s+\|(?<MESSAGE>.*)$/
match = FOREMAN_REGEX.match(message)
match["TIME"] #=> "3:54:04"
match["PROGRAM"] #=> "worker.1"
match["MESSAGE"] #=> "main_message_is_here"
joneslee85 /
Created Nov 12, 2017
Ruby Regex to match unicorn log output


I, [2017-11-11T00:00:09.560827 #54806]  INFO -- : greedy message is here

Filter in Regex:

View gist:6486587d9c70f748d4e8a209ae2dc57a
Q: What is LTS status of NodeJS 4.x?
A: End of Life
B: Active
C: Maintenance <--
Q: What are the official supported languages for Android development?
A: Ruby
B: Cobol
C: Kotlin <--
D: Erlang
joneslee85 /
Last active May 12, 2017
Rails way to let router to handle all exception

What people tend to do is to handle exception in controller with rescue_from, well it is totally fine. However there is also a different way by delegating the handling to router.

Configure the app to handle exception with Router

# config/application.rb

config.exceptions_app = self.routes
View gist:2a94deb92b13a10acc4c16e969fc60ff
Mentor list
@kimhieu - L - Android/Backend
@kiennt - M - Elixir/Backend
@codeaholicguy - L - JS
joneslee85 / 00_pending_migrations.rb
Last active Nov 8, 2016
An initialiser to prevent app to bootstrap app on dev env if pending migrations - cover Rails 3 or newer
View 00_pending_migrations.rb
## Place in config/initializers/00_pending_migrations.rb
# Raise an error and abort the run there are any pending migrations:
if Rails.env.development?
# Rails 4 way ;)
if Rails.version >= '4'
# Rails 3 way - TODO: remove when we up to Rails 4
migrator =
You can’t perform that action at this time.