Skip to content

Instantly share code, notes, and snippets.


M. Serhat Dundar msdundar

Block or report user

Report or block msdundar

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
fernandoaleman /
Created Oct 2, 2018
Install mysql2 on MacOS Mojave


Installing mysql2 gem errors on MacOS Mojave.


Make sure openssl is installed on Mac via Homebrew.

brew install openssl
osulyanov / config.yml
Last active Nov 7, 2019
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',
icyleaf / ar_migrate.rb
Last active Feb 12, 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 Feb 20, 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.