Skip to content

Instantly share code, notes, and snippets.


Serhat M. Dündar msdundar

View GitHub Profile
fernandoaleman /
Last active Nov 18, 2020
Install mysql2 on MacOS Mojave

For MacOS Catalina, visit Install mysql2 on MacOS Catalina


Installing mysql2 gem errors on MacOS Mojave.


Make sure openssl is installed on Mac via Homebrew.

osulyanov / config.yml
Last active Jul 31, 2020
Circle CI workflows config to test and deploy Ruby on Rails application with PostgreSQL database. Test with Rspec, precompile assets then deploy with Capistrano.
View config.yml
# Ruby CircleCI 2.0 configuration file
# Check for more details
defaults: &defaults
working_directory: ~/repo
- image: circleci/ruby:2.4.1-node-browsers
juno / system_test_driven_by_headless_chrome.rb
Created Nov 13, 2017
Rails 5.1 System Test driven by headless chrome.
View system_test_driven_by_headless_chrome.rb
using: :chrome,
screen_size: [1400, 900],
options: {
desired_capabilities: {
chromeOptions: {
args: %w[headless disable-gpu],
prefs: {
'' => 'Accept-Language',
k1r8r0wn /
Last active Sep 9, 2020
Russian i18n locale for `Devise` gem
# Русский перевод для
# Другие переводы на
confirmed: "Ваша учётная запись успешно подтверждена."
send_instructions: "В течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи."
send_paranoid_instructions: "Если ваш адрес email есть в нашей базе данных, то в течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи."
icyleaf / ar_migrate.rb
Last active Nov 13, 2020
ActiveRecord type of integer (tinyint, smallint, mediumint, int, bigint)
View ar_migrate.rb
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb
# Maps logical Rails types to MySQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
return super unless type.to_s == 'integer'
case limit
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
when nil, 4, 11; 'int(11)' # compatibility with MySQL default
kyletcarlson / rspec_model_testing_template.rb
Last active Nov 17, 2020
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems:
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
View gist:206253
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
You can’t perform that action at this time.