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
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
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@kyletcarlson
kyletcarlson / rspec_model_testing_template.rb
Last active Nov 15, 2019
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:
@icyleaf
icyleaf / ar_migrate.rb
Last active Nov 19, 2019
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
@juno
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
driven_by(
:selenium,
using: :chrome,
screen_size: [1400, 900],
options: {
desired_capabilities: {
chromeOptions: {
args: %w[headless disable-gpu],
prefs: {
'modifyheaders.headers.name' => 'Accept-Language',
@osulyanov
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 https://circleci.com/docs/2.0/language-ruby/ for more details
#
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/ruby:2.4.1-node-browsers
environment:
@fernandoaleman
fernandoaleman / mysql2-mojave.md
Created Oct 2, 2018
Install mysql2 on MacOS Mojave
View mysql2-mojave.md

Problem

Installing mysql2 gem errors on MacOS Mojave.

Solution

Make sure openssl is installed on Mac via Homebrew.

brew install openssl
You can’t perform that action at this time.