Skip to content

Instantly share code, notes, and snippets.

View breim's full-sized avatar
:shipit:

Henrique Breim breim

:shipit:
  • Barcelona, Spain
View GitHub Profile
@breim
breim / erro.rb
Created July 10, 2014 16:13
Erro no sidekiq
deploy@VilaDeFabiano:~/viladefabiano$ bundle exec sidekiq
2014-07-10T16:12:28Z 2270 TID-45f4w INFO: Booting Sidekiq 2.17.7 with redis options {}
2014-07-10T16:12:28Z 2270 TID-45f4w INFO: Running in ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
2014-07-10T16:12:28Z 2270 TID-45f4w INFO: See LICENSE and the LGPL-3.0 for licensing details.
2014-07-10T16:12:28Z 2270 TID-45f4w INFO: Starting processing, hit Ctrl-C to stop
2014-07-10T16:12:28Z 2270 TID-ld0ss Sidekiq::Extensions::DelayedMailer JID-5642f1b11420d41d6a72ae42 INFO: start
2014-07-10T16:12:59Z 2270 TID-ld0ss Sidekiq::Extensions::DelayedMailer JID-5642f1b11420d41d6a72ae42 INFO: fail: 30.35 sec
2014-07-10T16:12:59Z 2270 TID-ld0ss WARN: {"retry"=>true, "queue"=>"default", "class"=>"Sidekiq::Extensions::DelayedMailer", "args"=>["---\n- !ruby/class 'UnsubscribeMailer'\n- :unsubscribe_confirmation\n- - !ruby/object:Subscriber\n attributes:\n id: 1\n email: henrique@breim.com.br\n verification: b8d7429816da0d522de0f707bea1fc47\n
@breim
breim / controller.rb
Created July 11, 2014 16:21
Carregar JS dentro do controller
# Controller
def nome_da_action
format.html {redirect_to :back, notice: "Enviado!"}
format.js
end
# Dentro da view do controle, o arivo nome_da_action.js.erb
package br.com.empresa.projeto;
public class Main {
public static void main(String[] args) {
for (int i = 1; i<=3000000; i++){
System.out.println(i);
}
}
}
@breim
breim / gist:db5ce9732c3a4cc20cf6
Created July 16, 2014 21:56
Correção raspberry
I had those issues as well.
I edited the /etc/network/interfaces file and added a line to the wlanx section:
wireless-power off
@breim
breim / deploy.rb
Last active August 29, 2015 14:06
Deploy with NGINX and Phushion Passenger
# Adicione o usuário
adduser deploy
# de poder ao usuário criado como se fosse root
visudo
deploy ALL=(ALL:ALL) ALL
# Configure o ssh
@breim
breim / nginx
Created September 6, 2014 23:51
Nginx config
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@breim
breim / gist:1ec4981dc7a854011629
Created October 18, 2014 19:39
Nginx 1.4.6 Default configuration
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
@breim
breim / mega.rb
Created November 21, 2014 02:22
Megasena
count = Array.new(60) {| i | i +1} # Array de objetos
resultado_mega = [1,21,22,27,32,45]
i = 0
data_de_inicio = Time.now
valor_do_jogo = 2
array_gerado = []
while array_gerado != resultado_mega do
array_gerado = count.sample(6).sort!
@breim
breim / nopassword_devise.rb
Created December 1, 2014 11:59
Não preicsa digitar senha novamente no devise para alterar cadastro
# Esque esqueminha, ele não precisa digitar a senha atual para alterar o cadastro.
def update_with_password(params={})
if params[:password].blank?
params.delete(:password)
params.delete(:password_confirmation) if params[:password_confirmation].blank?
end
update_attributes(params)
end
source 'https://rubygems.org'
# Custom Gems
gem 'websocket-rails'
gem 'devise'
gem 'kaminari'
gem 'bootstrap-kaminari-views' # adiciona o thema do bootstrap 3 nas page views
gem 'friendly_id', '~> 5.0.0'
gem 'devise-async'