Skip to content

Instantly share code, notes, and snippets.

View iagopiimenta's full-sized avatar
🏠
Working from home

Iago Pimenta iagopiimenta

🏠
Working from home
View GitHub Profile
@vicenterusso
vicenterusso / docker-compose.yml
Last active November 12, 2023 13:33
Docker Compose with fix Fedora 35/36/37 MySQL container - Leak Memory - High Usage - Error code 137
version: '3'
services:
mysqldb:
image: mysql:5.7.22
container_name: mysql_container_name
restart: always
ulimits:
nproc: 65535
nofile:
soft: 20000

Mysql2::Error: Specified key was too long; max key length is 767 bytes

You might get this error with InnoDB tables on MariaDB < 10.2.2, MySQL < 5.7. Although, this error might be also triggered on newer versions if you switch to COMPACT row format.

In the abovementioned releases the default InnoDB row format is COMPACT. With this format the maximum index prefix length is [767 bytes][max-index-prefix]. The default character set is [latin1][def-charset], but if you use

@tkrotoff
tkrotoff / FrontendFrameworksPopularity.md
Last active May 2, 2024 03:18
Front-end frameworks popularity (React, Vue, Angular and Svelte)
@andyyou
andyyou / rails_webpacker_bootstrap_expose_jquery.md
Last active August 9, 2022 07:38
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collects all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
# config/initializers/activestorage.rb
Rails.application.config.to_prepare do
# Provides the class-level DSL for declaring that an Active Record model has attached blobs.
ActiveStorage::Attached::Macros.module_eval do
def has_one_attached(name, dependent: :purge_later, acl: :private)
class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}
@active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self, dependent: #{dependent == :purge_later ? ":purge_later" : "false"}, acl: "#{acl}")
end
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add bootstrap@4.0.0-beta jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 3, 2024 11:43
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@jgillman
jgillman / restore.sh
Last active March 8, 2024 17:51
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@mfazekas
mfazekas / rr42_create_obj_with_serialized_perf.rb
Created December 14, 2014 23:27
rr42_create_obj_with_serialized_perf
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.1.8'
#gem 'rails', '4.2.0.rc3'
gem 'sqlite3'
gem 'pg'
gem 'byebug'
GEMFILE