Skip to content

Instantly share code, notes, and snippets.

View Rynaro's full-sized avatar
⚗️
Doing alchemy!

Henrique A. Lavezzo Rynaro

⚗️
Doing alchemy!
View GitHub Profile
@Rynaro
Rynaro / component_mailer.rb
Created September 13, 2021 20:09
View component from Rails Mailers
# frozen_string_literal: true
class ComponentMailer < ApplicationMailer
def notify(me)
mail to: 'henrique@mail.com', subject: 'Component', body: ApplicationController.render(MyComponent.new(me: me))
end
end
@Rynaro
Rynaro / quicksort.rb
Last active August 29, 2015 13:57
Simple QuickSort in Ruby
def quick ary
(x = ary.pop)? quick( ary.select do |i| i < x end) + [x] + quick( ary.select do |i| i > x end ) : []
end
print quick [23, 56, 87, 1, 5, 67, 345, 76, 5, 8, 7, 234]