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
extend Controllers | |
plugin :flow | |
plugin :container | |
route do |r| | |
r.on("users") do | |
r.is do | |
r.get to: 'users#index' | |
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
where( | |
" availability_days = 'Todos os dias' OR -- Passa todos os dias | |
availability_days = 'Fim de semana' AND tsrange( -- Passa fim de semana apenas se a data de retirada - sexta as 18 horas, data de retirada - proxima segunda as 10 da manha, incluso em (pickup, return) | |
(:pickup_date::timestamp::date - cast(extract(dow from :pickup_date::timestamp::date) as int) + 5 + interval '18 hour'), | |
(:pickup_date::timestamp::date - cast(extract(dow from :pickup_date::timestamp::date) as int) + 8 + interval '10 hour')) | |
@> tsrange(:pickup_date::timestamp,:return_date::timestamp) OR | |
availability_days = 'Durante a semana' AND tsrange( -- Passa durante a semana apenas se a data de retirada - segunda 0 da manhã, data de retirada - sabado 0 da manha, incluso em (pickup, return) | |
(:pickup_date::timestamp::date - cast(extract(dow from :pickup_date::timestamp::date) as int) + 1 + interval '0 hour'), | |
(:pickup_date::timestamp::date - cast(extract(dow from :pickup_date::timestamp::date) as int) + 6 + inte |
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 get_binding | |
a = 1 | |
@c = 3 | |
@d = 4 | |
e5 = 5 | |
a8 = 8 | |
binding | |
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
require 'warden/github' | |
class SidekiqGithubChecker | |
def self.registered(app) | |
app.helpers do | |
def warden; env['warden'] end | |
def github_organization_authenticate!(name) | |
unless warden.user.organization_member?(name) | |
halt [401, {}, ["You don't have access to organization #{name}"]] | |
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
one_through_one :accepted_car_request_transition, | |
class: CarRequestTransition, | |
join_table: :car_requests, | |
right_key: :id, | |
right_primary_key: :car_request_id, | |
left_key: :car_request_group_id, | |
left_primary_key: :id, | |
conditions: { | |
accepted_car_request_transition__most_recent: true, | |
accepted_car_request_transition__to_state: 'accepted' |
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
Método: PATCH | |
Url: http://smartwalletstaging.mundipagg.com/Account/84f3a00f-390b-4195-ab0f-a3fe47daf482 | |
Header: SmartWalletKey=cba88b40-c2c2-4ca1-b882-0b7dd2f0185b | |
Corpo: | |
{ | |
"AccountReference": 552, | |
"Addresses": [{ | |
"AddressNumber": "123", | |
"Country": "Brasil", | |
"City": "São Paulo", |
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
class Roda | |
module RodaPlugins | |
module BasicAuth | |
OPTS = {}.freeze | |
DEFAULTS = { | |
realm: "Restricted Area", | |
unauthorized_headers: proc do |opts| | |
{'Content-Type' => 'text/plain', | |
'Content-Length' => '0', |
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
auth = Rack::Auth::Basic::Request.new(env) | |
unless auth.provided? | |
# env['warden'].custom_failure! # If you're using warden avoid intercepting 401 | |
r.halt [401, {'Content-Type' => 'text/plain', 'Content-Length' => '0', 'WWW-Authenticate' => 'Basic realm="Restricted Area"'}, []] | |
end | |
unless auth.basic? | |
r.halt [400, {'Content-Type' => 'text/plain', 'Content-Length' => '0'}, []] | |
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
DB[:compute_nodes]. | |
select_group(:compute_nodes__host). | |
join(:aggregate_hosts, host: :host). | |
where(aggregate_hosts__deleted_at: nil, compute_nodes__deleted_at: nil). | |
select_append{sum(:running_vms).as(:running_vms_sum)}. | |
select_append{sum(:vcpus_used).as(:vcpus_used_sum)}. | |
select_append{sum(:memory_mb_used).as(:memory_mb_used_sum)} |
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
Sou algo mais do que este punhado de terra | |
que, em sangue e nervos, se envaidece e se apega | |
e que ao pó, uma vez mais, há de retornar, disperso; | |
sou um abismo que o nada do universo quebra, | |
sou o espaço que seduz a matéria que me integra; | |
sou a luz de minha lâmpada na noite mais negra | |
e a mais negra noite quenaod minha lâmpada se apaga; | |
sou a fronteira dos outros, imprecisa e vaga. | |
Sou o esgar vencido dos velhos séculos | |
e o gesto prepotente dos séculas que ainda estão distantes: |