Skip to content

Instantly share code, notes, and snippets.

View jmscarnatto's full-sized avatar
🎯
Focusing

Jose Scarnatto jmscarnatto

🎯
Focusing
View GitHub Profile
@jmscarnatto
jmscarnatto / rails_8_plus.md
Last active January 25, 2025 15:10
Rails Dockerfile - the definitive guide for production with precompile and migrations

Rails 'VERSION >=8.x' - SQLite ONLY

Dockerfile

ARG RUBY_VERSION=3.3.6

FROM ruby:$RUBY_VERSION

ENV RAILS_ENV=production \
    BUNDLE_PATH=/bundle \
    BUNDLE_WITHOUT="development test" \
@jmscarnatto
jmscarnatto / Linux_setup.md
Last active November 3, 2024 19:41
Basic linux setup for programming

Summary

  1. Install basic tools
  2. Oh-My-Sh / Powerlevel10k / Autosuggestions / ....
  3. Install Docker
  4. Install RVM
  5. Install NVM
  6. Vscdode Settings
  7. Vscode extensions

1 - Basic tools

@jmscarnatto
jmscarnatto / vscode_mac_keybinding.md
Last active December 6, 2023 11:08
MacOs shortcuts keybinding
// Place your key bindings in this file to override the defaults
[
    {
        "key": "cmd+down",
        "command": "workbench.action.terminal.focusNext",
        "when": "terminalFocus"
    },
    {
        "key": "cmd+up",
@jmscarnatto
jmscarnatto / api_properties_client.rb
Last active November 11, 2023 23:48
api_properties_client
# frozen_string_literal: true
require 'uri'
require 'net/http'
require 'json'
require 'webmock/rspec'
class Properties
API_URL = 'https://api.stagingeb.com/v1/properties'
API_KEY = 'l7u502p8v46ba3ppgvj5y2aad50lb9'
@jmscarnatto
jmscarnatto / Rails_patterns_tips.md
Last active October 17, 2023 11:21
Rails patterns design tips and tricks
@jmscarnatto
jmscarnatto / ruby_snippets.md
Last active February 1, 2024 17:44
ruby_snippets.md

Debug

puts caller(0,10); binding.pry

monitor certain field on model

class YourModel < ActiveRecord::Base
  def myfield=(*args)
@jmscarnatto
jmscarnatto / gtk.css
Last active October 16, 2024 12:07
script for quick installation of zsh on Ubuntu
# For Gnome terminal
# add or edit ~/.config/gtk-3.0/gtk.css
VteTerminal,
TerminalScreen,
vte-terminal {
padding: 10px 10px 30px 10px;
-VteTerminal-inner-border: 10px 10px 30px 10px;
}
@jmscarnatto
jmscarnatto / vscode_ruby_snippets.json
Created December 14, 2022 15:00
vscode ruby snippets
# ~/Library/Application Support/Code/User/snippets/ruby.json
{
// Place your snippets for ruby here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
@jmscarnatto
jmscarnatto / rails_react.md
Last active September 29, 2022 13:59
Docker + Rails + React + Tailwind
  1. Create the project structure
docker run -it --rm -v ${PWD}:/usr/src/app -w /usr/src/app ruby:3.1.2 bash -c 'gem install rails && rails new trader-bot -T -d mysql -c tailwind'
  1. /<project_name>/Dockerfile

wget https://github.com/jmscarnatto/dockerfile-rails7/raw/main/Dockerfile

@jmscarnatto
jmscarnatto / .zshrc
Last active September 25, 2024 14:02
.zshrc
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH