Skip to content

Instantly share code, notes, and snippets.

View smapira's full-sized avatar

smapira smapira

View GitHub Profile
namespace :db do
task 'migrate_custom' do
ActiveRecord::ConnectionAdapters::TableDefinition.prepend(
CoreExtensions::ActiveRecord::ConnectionAdapters::TableDefinition
)
Rake::Task['db:migrate'].invoke
end
end
module CoreExtensions
@smapira
smapira / application.rb
Created September 23, 2021 07:54
Configuration generator into config/application.rb
config.generators do |g|
g.assets false
g.helper false
g.scaffold_controller false
g.erb false
g.resource_route false
g.test_framework :rspec,
fixtures: true,
controller_specs: true,
helper_specs: false,
@smapira
smapira / .pryrc
Last active September 20, 2021 10:38
# curl https://gist.githubusercontent.com/smapira/80b890029fbe08ddeacd4ada6f338a83/raw --output .pryrc
begin
require 'hirb'
rescue LoadError
# Missing goodies, bummer
end
if defined? Hirb
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling
@smapira
smapira / .dockerignore
Created August 24, 2020 13:23
.dockerignore for new rails project
!log/.keep
!public/assets/.keep
!tmp/.keep
.bundle
.byebug_history
.circleci
.env
.env.*
.git/*
.github
@smapira
smapira / Makefile into Rails
Last active January 16, 2022 07:03
Makefile for new rails project
# curl https://gist.githubusercontent.com/smapira/cc6a50f82cea034b07f02088c06b65dd/raw --output Makefile
## ==============================
## database organizations
## ==============================
drop-db:
bundle exec rails db:environment:set RAILS_ENV=development && bundle exec rake db:drop
create-db:
@smapira
smapira / config.yml
Last active July 28, 2020 10:11
circle ci config for new rails project
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.6.2-node-browsers
@smapira
smapira / remove-all-gems.sh
Last active July 26, 2020 18:36
remove all gems.sh
#!/usr/bin/env bash
# Execute script from URL
# curl -s https://gist.githubusercontent.com/smapira/f0a46b802fc2ad823b68423e2ed74ef5/raw | sh
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
@smapira
smapira / .gitignore
Last active July 26, 2020 18:30
.gitignore for new rails project
# Created by .ignore support plugin (hsz.mobi)
### macOS template
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
@smapira
smapira / Gemfile
Last active September 30, 2021 18:27
Gemfile for new rails project
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'aasm' # Ruby state machines
gem 'active_model_serializers' # implementation and Rails hooks
gem 'ahoy_email' # First-party email analytics
gem 'ahoy_matey' # First-party analytics
gem 'blind_index' # Securely search encrypted database fields
@smapira
smapira / .rubocop.yml
Last active July 28, 2020 18:24
rubocop.yml for new rails project
AllCops:
Exclude:
- 'vendor/**/*'
- 'db/seeds.rb'
- 'db/seeds/**/*'
- 'db/schema.rb'
- 'db/migrate/**/*'
- 'node_modules/**/*'
- 'config/initializers/**/*'
- 'bin/**/*'