Skip to content

Instantly share code, notes, and snippets.

View rafaelcgo's full-sized avatar

Rafael Oliveira rafaelcgo

View GitHub Profile
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active April 2, 2024 10:04
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@isseu
isseu / Bitbucket Pipeline Rails.yml
Created December 13, 2016 17:11
To run rails with bitbucket pipeline CI
# This is a sample build configuration for Ruby.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: ruby:2.2.4
clone:
depth: 3
@ostinelli
ostinelli / logentries_manual_setup.md
Last active August 11, 2022 21:37
How to use a single Logentries account on Heroku.

If you have multiple applications on Heroku and would like to use a single Logentries account for all of them, this is how you do it. Basically, do not use add-ons, and send all drains to your account.

  • In your Logentries account, click on Add Log
  • Select Manual
  • In the form that appears, input the following:
    • Log Name: access.log
    • Select Set: new set named myapp-{environment}, for instance myapp-staging (at least, this is how I like to name my entries)
    • Select the Plain TCP, UDP - logs are sent via syslog option
  • Click on Create Log Token
@erikhenrique
erikhenrique / bin-cc.md
Last active February 5, 2024 16:06
Bin de cartões de crédito para validação

Validação para cartão de crédito.

Bin e padrões para validação de cartão de crédito.

Bandeira Começa com Máximo de número Máximo de número cvc
Visa 4 13,16 3
Mastercard 5 16 3
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active April 23, 2024 02:53
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@lardawge
lardawge / sunspot_kaminari_support.rb
Created June 24, 2011 16:58
Override to allow sunspot to return an array that can be used by Kaminari
module Sunspot
module Search
class AbstractSearch
private
def maybe_will_paginate(collection)
collection.instance_eval <<-RUBY, __FILE__, __LINE__ + 1
def current_page
#{@query.page}
@juggy
juggy / call_template.rb
Created May 17, 2011 19:25
Render a complete page in rails 3 without controller
# create the template
template = PageOfflineTemplate.new
template.quote = quote
template.pages = quote.build_pages
# Here I render a template with layout to a string then a PDF
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml")
@fallwith
fallwith / http_headers_dump.rb
Created January 28, 2011 20:41
Rails controller code to dump raw HTTP headers from a request
logger.warn "*** BEGIN RAW REQUEST HEADERS ***"
self.request.env.each do |header|
logger.warn "HEADER KEY: #{header[0]}"
logger.warn "HEADER VAL: #{header[1]}"
end
logger.warn "*** END RAW REQUEST HEADERS ***"