This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Very handly (not just) for Rails : | |
* | |
* 1. setup RoR input method naming convention : | |
* | |
* $.fn.changeFormMethod.inputName = '_method'; | |
* | |
* 2. Any time You need to change Your forms method : | |
* (e.g. re-using forms new forms for edit-ation) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RouteRecognizer | |
attr_reader :paths | |
# To use this inside your app, call: | |
# `RouteRecognizer.new.initial_path_segments` | |
# This returns an array, e.g.: ['assets','blog','team','faq','users'] | |
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)} | |
def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su postgres | |
psql | |
update pg_database set datistemplate=false where datname='template1'; | |
drop database Template1; | |
create database template1 with owner=postgres encoding='UTF-8' | |
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0; | |
update pg_database set datistemplate=true where datname='template1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ruby | |
# config/initializers/mysql_utf8mb4_fix.rb | |
require 'active_record/connection_adapters/abstract_mysql_adapter' | |
module ActiveRecord | |
module EmojiConnectionAdapters | |
refine AbstractMysqlAdapter do | |
NATIVE_DATABASE_TYPES[:string] = { name: "varchar", limit: 191 } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |