Skip to content

Instantly share code, notes, and snippets.

View rafaelgaspar's full-sized avatar

Rafael Gaspar rafaelgaspar

View GitHub Profile
# Original find_for_authentication from Devise authenticatable.rb
def find_for_authentication(conditions)
find(:first, :conditions => conditions)
end
# Overwrite find_for_authentication and put it in your User model
def self.find_for_authentication(conditions={})
unless conditions[:email] =~ /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i # email regex
Usuario
_______________________________________
Id | Nome | CPF | Rua | Cidade | Estado
O Correto seria:
Usuario
_____________________________
Id | Nome | CPF | Endereco_Id
on getiTunesCurrentSong()
tell application "iTunes"
try
if not (exists current track) then return ""
return (get name of current track) & " - " & (get artist of current track)
end try
end tell
end getiTunesCurrentSong
using terms from application "Messages"
1 192.168.1.1 (192.168.1.1) 0.764 ms 0.411 ms 0.376 ms
2 177.16.68.1.static.host.gvt.net.br (177.16.68.1) 5.268 ms 4.394 ms 4.376 ms
3 gvt-po-2-88.rd02.cta.gvt.net.br (200.139.125.36) 4.211 ms
177.99.179.static.host.gvt.net.br (177.99.179.132) 5.538 ms
gvt-po-7-88.rd03.cta.gvt.net.br (200.139.125.33) 174.682 ms
4 gvt-te-0-1-0-0-rc01.cta.gvt.net.br (189.59.247.65) 6.202 ms
gvt-te-0-5-0-5.rc01.cta.gvt.net.br (189.59.251.201) 6.425 ms
gvt-te-0-5-0-9.rc01.cta.gvt.net.br (187.115.213.41) 7.529 ms
5 gvt-te-0-5-0-3.rc03.cta.gvt.net.br (187.115.212.182) 4.881 ms 7.753 ms
gvt-te-0-0-0-9.rc04.cta.gvt.net.br (187.115.212.193) 5.851 ms
traceroute to 216.246.109.210 (216.246.109.210), 64 hops max, 52 byte packets
1 192.168.1.1 (192.168.1.1) 0.743 ms 0.482 ms 0.413 ms
2 177.16.68.1.static.host.gvt.net.br (177.16.68.1) 4.510 ms 4.370 ms 4.427 ms
3 gvt-po-9-90.rd03.cta.gvt.net.br (177.99.179.130) 4.838 ms
gvt-po-3-90.rd02.cta.gvt.net.br (177.99.179.129) 4.750 ms 4.640 ms
4 gvt-te-0-1-0-0-rc01.cta.gvt.net.br (189.59.247.65) 4.641 ms
gvt-te-0-5-0-12.rc02.cta.gvt.net.br (189.59.251.225) 4.947 ms
gvt-te-0-5-0-9.rc01.cta.gvt.net.br (187.115.213.41) 7.934 ms
5 gvt-te-0-5-0-3.rc03.cta.gvt.net.br (187.115.212.182) 6.248 ms 7.909 ms
gvt-te-0-0-0-9.rc04.cta.gvt.net.br (187.115.212.193) 6.734 ms
@rafaelgaspar
rafaelgaspar / mockserver.rb
Created May 20, 2015 18:44
A simple sinatra app that answers to everything and opens up a debugger.
#!/usr/bin/env ruby
%w{sinatra byebug}.each { |g| require g }
%w{get post put patch delete}.each { |m| send(m, '*') { debugger } }

Keybase proof

I hereby claim:

  • I am rafaelgaspar on github.
  • I am rafaelgaspar (https://keybase.io/rafaelgaspar) on keybase.
  • I have a public key whose fingerprint is 9EB4 8149 C716 C5BC CFF3 B0A0 0996 2583 7BCA 90A9

To claim this, I am signing this object:

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@rafaelgaspar
rafaelgaspar / RESQUE_REMOVE_DUPLICATES.md
Last active March 22, 2024 21:18
Remove duplicate jobs from a Resque queue.

remove_duplicates.rb

Remove duplicate Resque jobs that have already been queued for processing.

Execute

To run this against a Rails installtion in production use the following command: bundle exec rails runner -e production /path/to/script/remove_duplicates.rb. See rails runner for more information.

Notes

@rafaelgaspar
rafaelgaspar / 0_reuse_code.js
Created December 19, 2016 12:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console