Skip to content

Instantly share code, notes, and snippets.

View marcelolx's full-sized avatar
:shipit:
from home

Marcelo Lauxen marcelolx

:shipit:
from home
View GitHub Profile
@marcelolx
marcelolx / tools.md
Last active April 6, 2023 11:30
Things I am building
require "bundler/inline"
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.
gem 'rails', github: "marcelolx/rails", branch: "issue-25718"
gem 'sqlite3'
end
require 'active_record'
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
gem "sqlite3"
end
@marcelolx
marcelolx / rspec_hash_matcher.rb
Created July 16, 2021 20:43
RSpec Hash Matcher
require "rspec/expectations"
# This matcher merges the provided hash into the actual hash and compares if the merged hash stays the same after the merge
#
# The difference between other aproaches is that here we don't override a nested hash, this means that the actual value being like the hash below
# { abc: "def", nested: { erf: "tre", tuc: "abc" } }
# when compared with this hash below
# { abc: "def", nested: { erf: "tre" } }
# will not replace override the nested hash from `nested: { erf: "tre", tuc: "abc" }` to `nested: { erf: "tre" }`
# and yes, will just merge the keys of the provided hash with the actual hash
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails"
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails"

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@marcelolx
marcelolx / labels.css
Created August 13, 2020 21:08 — forked from gavinblair/labels.css
Adds : after labels and * after required labels
/* Adds : after labels */
form label:after{
content:":";
}
/* Adds * after required labels */
form label.required:after{
content:"*";
}
@marcelolx
marcelolx / remove_sql_from_errors.rb
Created July 6, 2020 14:42 — forked from timraasveld/remove_sql_from_errors.rb
Remove SQL queries from exceptions on Rails production / staging
# config/initializers/hide_sql_from_errors.rb
# Monkey patch ActiveRecord to not show executed statements in production errors.
# Without this patch, error reporting services such as AppSignal would receive
# sensitive data used in failed queries.
# Use `class_eval` on AbstractAdapter instead of first defining a module and
# then including it, because otherwise our patch would sometimes be overridden
# by Rails' class autoloading
ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
#!/bin/bash
if [ "$1" = "l" ]; then
$ANDROID_HOME/emulator/emulator.exe -list-avds
elif [ "$1" = "r" ]; then
$ANDROID_HOME/emulator/emulator.exe -avd $2
else
echo "Para listar os AVDs |-> ./andemu.sh l"
echo "Para executar um AVD |-> ./andemu.sh r nomeAVD"
fi