This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rynaro/daily-codex | |
Rynaro/mini-rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |