Skip to content

Instantly share code, notes, and snippets.

Avatar

Vinny Osiro osiro

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am osiro on github.
  • I am vinnyosiro (https://keybase.io/vinnyosiro) on keybase.
  • I have a public key ASB-4pzMykyH_ae9LW4ze1cwuseAW4T1Ovr_7hdzo4cnRgo

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am osiro on github.
  • I am osiro (https://keybase.io/osiro) on keybase.
  • I have a public key ASAxm79Wqj97ULS3IJ9fu6v_0beZr_CQGIRwYUkebFRT_wo

To claim this, I am signing this object:

View build_number.rb
# /lib/custom_middleware/build_number.rb
module CustomMiddleware
class BuildNumber
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
headers['X-Build-Number'] = Rails.configuration.build_number
View trackings_controller.rb
class TrackingsController < ApplicationController
def create
@tracking = Tracking.create(tracking_params)
render json: { success: true }
end
private
def tracking_params
params.require(:tracking).permit(:ip, :url)
View volunteer_create_shift_user_spec.rb
require 'rails_helper'
feature 'Volunteer can view profile of event', js: true do
sign_in_as(:volunteer)
scenario 'Volunteer participate to events' do
event = FactoryGirl.create(:event).decorate
visit(volunteer_event_path(event))
View edit.html.haml
- if policy(@entry).amend?
= f.input :amendment_notes, hint: "Write an explanation of amendments here. This will be emailed to the timesheet's owner and submitter."
= f.input :parking_allowance, as: :boolean, wrapper: :checkbox, input_html: { checked: @entry.parking_allowance_claim.present? }
= link_to_back(user_timesheet_path(user, @entry.timesheet))
= f.button :submit, "Update"
View categorias.yml
categories:
- title:
pt-BR: Serviços
en: Services
sub_categories:
- title:
pt-BR: Transporte
en: Transfer
- title:
pt-BR: Alimentícios
View sd_spec.rb
describe ".published"
subject { Post.published(published_at) }
let(:published_at) { Time.now }
let(:published_post) { FactoryGirl.create :post, published_at: published_at }
let(:unpublished_post) { FactoryGirl.create :post, published_at: 1.day.from_now }
View query_performance.txt
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan using index_items_on_owner_id on items (cost=0.14..200000003297.04 rows=9 width=46)
Index Cond: (owner_id = 2)
Filter: ((((reports_count < 3) OR (owner_id = 2)) AND (NOT (SubPlan 1))) OR (alternatives: SubPlan 2 or hashed SubPlan 3) OR (alternatives: SubPlan 4 or hashed SubPlan 5))
SubPlan 1
-> Result (cost=0.29..21.56 rows=50 width=0)
One-Time Filter: ((items.id = items.id) AND (items.owner_id <> 2))
-> Nested Loop (cost=0.29..21.56 rows=50 width=0)
-> Index Only Scan using index_reported_items_on_reported_by_id_and_item_id on reported_items (cost=0.14..8.16 rows=1 width=0)
View ep2.py
# inclusão da biblioteca útil para o sorteio de números
import random
def main():
# semente para gerar os números aleatórios
semente = int(input("Semente: "))
# inicialize o gerador de números aleatórios
random.seed(semente)