Skip to content

Instantly share code, notes, and snippets.

View GPrimola's full-sized avatar
👨‍💻
Working from Milano

Giorgio Primola GPrimola

👨‍💻
Working from Milano
View GitHub Profile
@GPrimola
GPrimola / rails-controller-testing-integration.rb
Created May 10, 2018 19:08
Monkey patch adapter to stop warning messages of deprecated style when using rails-controller-testing gem
module Rails::Controller::Testing::Integration
%w(
get post patch put head delete xml_http_request
xhr get_via_redirect post_via_redirect
).each do |method|
define_method(method) do |*args|
if old_fashion?(args)
action = args.first
params = args[1]
@GPrimola
GPrimola / ruby_class_references.sh
Created June 19, 2018 20:53
Class usage in a Ruby project
find app lib -iname '*.rb' | xargs grep -h '^[[:space:]]*class\|module\b' | sed 's/^[[:space:]]*//' | cut -d ' ' -f 2 | while read class; do echo `grep -rl "\b$class\b" app lib --include="*.rb" | wc -l` $class; done | sort -n | uniq
// Colocar linha por linha no console do navegador (preferência Google Chrome)
// Tutorial Google Chrome JS Console: https://developers.google.com/web/tools/chrome-devtools/console/?hl=pt-br
// iCarros
$('h3.direita.preco_anuncio').map((i, v) => v.innerHTML).map((i,v) => v.match(/\d{2}\.\d{3}/gi)).map((i,v) => v.replace('.', '')).map((i,v) => parseInt(v))
// WebMotors
$('.advert .price-novo').map((i, v) => v.innerHTML).map((i,v) => v.match(/\d{2}\.\d{3}/gi)).map((i,v) => v.replace('.', '')).map((i,v) => parseInt(v))
// A única coisa chata é que tem que rodar página por página, pois a aplicação é malfeita e o link de paginação
@GPrimola
GPrimola / install-erlang.sh
Last active July 4, 2024 15:59
Install Erlang
# First of All
# CHECK>>>> https://github.com/asdf-vm/asdf-erlang?tab=readme-ov-file#before-asdf-install
# From https://twitter.com/MackeyTech/status/1521236821933395968
# Other sources:
## https://www.erlang.org/doc/installation_guide/install#Advanced-configuration-and-build-of-ErlangOTP_Configuring
## https://www.erlang.org/doc/man/erl.html
## https://www.erlang.org/doc/man/kernel_app.html
@GPrimola
GPrimola / settings.json
Created May 6, 2022 13:22
Visual Studio User Setting
{
"window.openFilesInNewWindow": "on",
"window.openFoldersInNewWindow": "on",
"extensions.confirmedUriHandlerExtensionIds": [],
"pgsql.connections": [
{
"host": "localhost",
"dbname": "finops",
"user": "postgres",
"password": "",
@GPrimola
GPrimola / .zshrc.history
Last active September 28, 2025 17:41
zsh history tweaks
# HISTORY
HISTFILE=~/.zsh_history # location of the history file
HISTFILESIZE=1000000000 # history limit of the file on disk (lines)
HISTSIZE=1000000000 # current session's history limit
SAVEHIST=500000 # zsh saves this many lines from the in-memory history list to the history file upon shell exit
HISTTIMEFORMAT="[%F %T]"
setopt EXTENDED_HISTORY # records the time when each command was executed along with the command itself
setopt SHARE_HISTORY # allows multiple Zsh sessions to share the same command history
setopt INC_APPEND_HISTORY # history file is updated immediately after a command is entered
@GPrimola
GPrimola / settings.json
Last active September 28, 2025 17:38
VSCode Config for Atom Elixir Syntax Highlighting
// Refer to https://github.com/GPrimola/vscode-elixir-ls/blob/function-capture-anonymous/syntaxes/elixir.json
{
"workbench.colorTheme": "Atomize",
"workbench.colorCustomizations": {},
"workbench.tree.indent": 16,
"window.openFilesInNewWindow": "on",
"editor.semanticHighlighting.enabled": false,
"editor.bracketPairColorization.enabled": false,
"editor.fontSize": 14,
"editor.fontFamily": "MesloLGS NF, Consolas, DejaVu Sans Mono, monospace",
@GPrimola
GPrimola / install_asdf.sh
Created June 19, 2024 20:39 — forked from ricardopadua/install_asdf.sh
Installing Elixir and Erlang With ASDF ( Fedora )
#!/bin/bash
## Ricardo Pádua
## install asdf in fedora
## install curl and git
dnf install curl git
## install asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0
@GPrimola
GPrimola / erlang-ubuntu.sh
Last active June 8, 2025 18:41
Install Erlang on Ubuntu 20.04
# Install Mise
sudo apt install curl
curl https://mise.run | sh
echo "eval \"\$(/home/giorgio/.local/bin/mise activate bash)\"" >> ~/.bashrc
#
# Strong Requirements
#
# [ ] git (to install with mise/asdf)
sudo apt install git