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 / example.cr
Created June 21, 2023 21:33
Uma explicação sobre checagem e conversão de tipos em tempo de execução no crystal.
require "json"
puts "Checando tipos no Crystal"
# Checando tipos em tempo de execução
json_text = JSON.parse("[1, 2, 3]")
# Você pode usar o `.class` para checar o tipo de uma variável
puts "Usando .class"
@aristotelesbr
aristotelesbr / yardoc_cheatsheet.md
Created November 16, 2022 15:23 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet
@aristotelesbr
aristotelesbr / yardoc_cheatsheet.md
Created November 16, 2022 15:23 — forked from phansch/yardoc_cheatsheet.md
Improved YARD cheatsheet
@aristotelesbr
aristotelesbr / ruby_google_analytics_server_to_server.md
Created September 7, 2022 20:14 — forked from joost/ruby_google_analytics_server_to_server.md
Google Analytics API (server-to-server) using Ruby
@aristotelesbr
aristotelesbr / estimate.rb
Created September 2, 2022 20:16 — forked from micahroberson/estimate.rb
Generate and save a pdf to S3 with wicked_pdf and paperclip
# Main reference was lascarides' post at http://stackoverflow.com/questions/14743447/getting-pdf-from-wickedpdf-for-attachment-via-carrierwave
# estimate.rb
# ...
has_attached_file :pdf,
storage: :s3,
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
bucket: ENV['AWS_BUCKET']
@aristotelesbr
aristotelesbr / 00_destructuring.md
Created January 14, 2022 21:38 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@aristotelesbr
aristotelesbr / example.rb
Created March 23, 2021 23:20
Usando a composição ao seu favor com dry-monads
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'pry'
gem 'dry-monads'
end
require 'dry/monads'
@aristotelesbr
aristotelesbr / .gitignore
Created November 14, 2020 20:55 — forked from serradura/.gitignore
u-thenable - A backport/polyfill of `yield self` and` then` methods for old Ruby versions. (https://rubygems.org/gems/u-thenable)
.tool-versions
@aristotelesbr
aristotelesbr / create_recipe.ex
Created June 6, 2020 15:48
Como renderizar dados associados
defmodule RecipeBox.CreateRecipe do
@moduledoc """
Create a new Recipe
"""
import Ecto.Changeset
alias RecipeBox.{Recipe, Repo}
def run(params) do
%Recipe{}
# frozen_string_literal: true
class Customer
attr_reader :name, :document, :email, :address
def initialize(first_name, last_name, document, email, address)
@name = ValueObjects::Name.new(first_name, last_name)
@document = document
@email = email
@address = address