Skip to content

Instantly share code, notes, and snippets.

View aristotelesbr's full-sized avatar
🏠
Working from home

Aristóteles Coutinho aristotelesbr

🏠
Working from home
View GitHub Profile
@aristotelesbr
aristotelesbr / yardoc_cheatsheet.md
Created November 16, 2022 15:23 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet
@serradura
serradura / .gitignore
Last active November 14, 2020 20:55
u-thenable - A backport/polyfill of `yield self` and` then` methods for old Ruby versions. (https://rubygems.org/gems/u-thenable)
.tool-versions
@dbourguignon
dbourguignon / proc_composition-2.rb
Last active July 9, 2021 01:16
Proc composition in ruby 2.6
require "bigdecimal"
# List of our individual pricing rules
TAX = ->(val) { val + val*0.05 }
FEE = ->(val) { val + 1 }
PREMIUM = ->(val) { val + 10 }
DISCOUNT = ->(val) { val * 0.90 }
ROUND_TO_CENT = ->(val) { val.round(2) }
# One presenter
PRESENT = ->(val) { val.to_f }
@zealot128
zealot128 / README.md
Last active April 6, 2023 12:14
ActiveStorage migration guide and caveats from Carrierwave (similar starting point for Paperclip)

Migrate Carrierwave to ActiveStorage

Migrate, e.g. organisation.logo (Carrierwave "LogoUploader") to organisation.logo2 (ActiveStorage)

require 'migrate_attachment'
migrate_attachment!(
  klass: Organisation, 
  attachment_attribute: :logo, 
  carrierwave_uploader: LogoUploader, 
Proprietary Broadcom drivers are packaged and available in the rpmfusion repo.
Verify that your card is a Broadcom using: `lspci -vnn -d 14e4:`
**Sample output:**
02:00.0 Network controller [0280]: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter [14e4:43a0] (rev 03)
## Install
Install the [rpmfusion](http://rpmfusion.org/) repo, note only "nonfree" is required, as the Broadcom Driver is proprietry: http://rpmfusion.org/
@bdubaut
bdubaut / Dockerfile Elixir
Last active July 17, 2020 02:44
Elixir/Phoenix docker-compose setup
FROM elixir:1.5.3-alpine
WORKDIR /app
ADD . /app
# Install hex & rebar
RUN mix local.hex --force && \
mix local.rebar --force && \
mix hex.info
@troyharvey
troyharvey / deployment.yml
Last active February 27, 2024 04:47
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@vadimstroganov
vadimstroganov / dry-transaction.rb
Last active May 16, 2021 02:00
Rails example for dry-transaction and dry-validation
# app/controllers/users_controller.rb
class UsersController < ApplicationController
def create
Operations::User::Create.new.call(params[:user]) do |m|
m.success do |user_response|
render json: user_response
end
m.failure do |responce|
render json: responce, status: :not_acceptable
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active April 4, 2024 10:38
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@rmosolgo
rmosolgo / Gemfile
Last active March 27, 2023 08:38
GraphQL Ruby Subscriptions
source 'https://rubygems.org'
gem "graphql", github: "rmosolgo/graphql-ruby", branch: "subscriptions"
gem "sinatra"
gem "thin"