Skip to content

Instantly share code, notes, and snippets.

@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

I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer.
I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc).
# Install rvm (no sudo!)
# ------------------------------------------------------
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
source ~/.rvm/scripts/rvm
rvm install ree-1.8.7-2010.02
@duduribeiro
duduribeiro / Makefile
Created September 16, 2019 02:30
Makefile
default: all
.PHONY: default all fetch_dump
date := `date '+%Y-%m-%d'`
TARGET_IMAGE ?= my_app
all: check_vars fetch_dump generate_image push_to_registry clean finished
check_vars: