Skip to content

Instantly share code, notes, and snippets.

View duduribeiro's full-sized avatar

Cadu Ribeiro duduribeiro

View GitHub Profile
@duduribeiro
duduribeiro / application.html.erb
Created November 14, 2024 15:15
nested layout
<!DOCTYPE html>
<html lang="<%= I18n.locale %>" class="h-full">
<head>
<title><%= content_for(:title) || "AppName" %></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= yield :head %>
@duduribeiro
duduribeiro / .gitattributes
Created August 3, 2024 03:02 — forked from bobmaerten/.gitattributes
Automatically resolve Git merge conflicts in Rails schema.rb by picking the most recent date in the conflict (works with Rails 6 and recent versions of Git). The following files should be in your home ~ directory.
db/schema.rb merge=railsschema
@duduribeiro
duduribeiro / LICENSE
Created April 26, 2023 16:06 — forked from alexevanczuk/LICENSE
Code for conditional builds
MIT License
Copyright (c) 2022 Gusto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@duduribeiro
duduribeiro / poodir-notes.md
Created September 9, 2021 02:28 — forked from speric/poodir-notes.md
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
@duduribeiro
duduribeiro / .devcontainer.json
Created June 21, 2021 14:24 — forked from solnic/.devcontainer.json
VS Code configs
{
"name": "app",
"dockerComposeFile": "docker-compose.yml",
"service": "dev",
"workspaceFolder": "/usr/local/src/app",
"extensions": [
"eamodio.gitlens",
"sleistner.vscode-fileutils",
"rebornix.Ruby",
"castwide.solargraph",
@duduribeiro
duduribeiro / ramdisk.sh
Created June 9, 2021 00:12 — forked from rxin/ramdisk.sh
ramdisk create/delete on Mac OS X.
#!/bin/bash
# From http://tech.serbinn.net/2010/shell-script-to-create-ramdisk-on-mac-os-x/
#
ARGS=2
E_BADARGS=99
if [ $# -ne $ARGS ] # correct number of arguments to the script;
then
{"Key Mappings":{"0xf700-0x260000":{"Text":"[1;6A","Action":10},"0x37-0x40000":{"Text":"0x1f","Action":11},"0x32-0x40000":{"Text":"0x00","Action":11},"0xf709-0x20000":{"Text":"[17;2~","Action":10},"0xf70c-0x20000":{"Text":"[20;2~","Action":10},"0xf729-0x20000":{"Text":"[1;2H","Action":10},"0xf72b-0x40000":{"Text":"[1;5F","Action":10},"0xf705-0x20000":{"Text":"[1;2Q","Action":10},"0xf703-0x260000":{"Text":"[1;6C","Action":10},"0xf700-0x220000":{"Text":"[1;2A","Action":10},"0xf701-0x280000":{"Text":"0x1b 0x1b 0x5b 0x42","Action":11},"0x38-0x40000":{"Text":"0x7f","Action":11},"0x33-0x40000":{"Text":"0x1b","Action":11},"0x7f-0x100000-0x33":{"Label":"","Action":11,"Text":"0x15"},"0xf703-0x220000":{"Text":"[1;2C","Action":10},"0x7f-0x80000-0x33":{"Label":"","Action":11,"Text":"0x1B 0x08"},"0xf701-0x240000":{"Text":"[1;5B","Action":10},"0xf70d-0x20000":{"Text":"[21;2~","Action":10},"0xf702-0x280000-0x7b":{"Label":"","Action":38,"Text":"\\033b"},"0xf702-0x260000":{"Text":"[1;6D","Action":10},"0xf729-0x40000":{"Text":
@duduribeiro
duduribeiro / longest_classes.sh
Created May 12, 2021 14:18
find longest classes
#/bin/bash
# using fd
# fd --glob "**/*.rb" | xargs wc -l | sort -rn | head
find . -name "*.rb" | xargs wc -l | sort -rn | head
@duduribeiro
duduribeiro / doom.txt
Created September 24, 2020 01:01 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias