Skip to content

Instantly share code, notes, and snippets.

@LucasPadovan
LucasPadovan / gist:4652260
Created January 28, 2013 01:59
Acts_as_votable error.
Jan 27 17:44:51 cursoscetem app/web.1: Completed 500 Internal Server Error in 226ms
Jan 27 17:45:17 cursoscetem app/web.1: Started GET "/boards/4/conversations/80" for 190.179.138.202 at 2013-01-28 01:45:17 +0000
Jan 27 17:45:17 cursoscetem app/web.1: ActionView::Template::Error (undefined method `voted_for?' for #<User:0x00000002c48590>):
Jan 27 17:45:17 cursoscetem app/web.1: 16: = sanitizar_bbcode(comment.body)
Jan 27 17:45:17 cursoscetem app/web.1: 17: %hr
Jan 27 17:45:17 cursoscetem app/web.1: 18: .well.well-dark.pull-right
Jan 27 17:45:17 cursoscetem app/web.1: 19: - unless @current_user.voted_for?(comment)
Jan 27 17:45:17 cursoscetem app/web.1: 20: = link_to '+', votar_encuesta_path(comentario_id: comment), remote: true, class: 'badge badge-success'
Jan 27 17:45:17 cursoscetem app/web.1: 21:
Jan 27 17:45:17 cursoscetem app/web.1: 22: = link_to '-', votar_encuesta_path(comentario_id: comment, negativo: true), remote: true, class: 'badge badge-warning'
@LucasPadovan
LucasPadovan / srbuj error
Created October 5, 2013 05:18
Srbuj I18n error
##es.application.yml
...
correctly_created: 'Tipo de intervención agregado correctamente.'
...
##inter_types_controller.rb
js_notify( message: t('view.intervention_types.correctly_created'), type: 'alert-success js-notify-18px-text', time: 2500 )
##html generado
### Chrome Ubuntu - Sin problemas
@LucasPadovan
LucasPadovan / firehouse_unit_test
Created October 27, 2013 03:58
Test unitarios firehouse
Este es el log de los test unitarios COMENTANDO la validación del truck_number de los endowments.
Fallan 3 creo, intervention, endowment y endowment_line. Ni idea para que es el Version.count que aparece en los test unitarios autogenerados.
/home/lockon/.rbenv/versions/1.9.3-p327/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Itest /home/lockon/Programas/RubyMine-5.4/rb/testing/runner/tunit_or_minitest_in_folder_runner.rb
Testing started at 00:54 ...
Work directory: /home/lockon/workspace/firehouse
Loading files....
=========================================
1. /home/lockon/workspace/firehouse/test/unit/intervention_test.rb:1
2. /home/lockon/workspace/firehouse/test/unit/endowment_test.rb:1
@LucasPadovan
LucasPadovan / Log_firehouse_con_truck_presence
Created October 27, 2013 04:04
Log test unitarios sin comentar lina de validacion de truck_presence de endowment
/home/lockon/.rbenv/versions/1.9.3-p327/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Itest /home/lockon/Programas/RubyMine-5.4/rb/testing/runner/tunit_or_minitest_in_folder_runner.rb
Testing started at 01:01 ...
Work directory: /home/lockon/workspace/firehouse
Loading files....
=========================================
1. /home/lockon/workspace/firehouse/test/unit/intervention_test.rb:1
2. /home/lockon/workspace/firehouse/test/unit/endowment_test.rb:1
3. /home/lockon/workspace/firehouse/test/unit/firefighter_test.rb:1
4. /home/lockon/workspace/firehouse/test/unit/mobile_intervention_test.rb:1
5. /home/lockon/workspace/firehouse/test/unit/user_test.rb:1
Zendesk_api gem version 1.1.1
###########################################################################################################################
Using ruby 1.9.2 -p125 with /api/v2 part.
[1] pry(main)> class CustomerService
[1] pry(main)* require 'zendesk_api'
[1] pry(main)*
[1] pry(main)* class << self
@LucasPadovan
LucasPadovan / Clean pay reports
Created January 13, 2014 14:33
Clean payment reports and coupon payments
payment_reports = PaymentReport.where(medium: 'PagoFacil')
payments = Payment.where(payment_report_id: payment_reports.map(&:id))
payments.update_all(payment_report_id: nil)
payment_reports.destroy_all
@LucasPadovan
LucasPadovan / delete_sidekiq_works.rb
Created August 19, 2014 15:20
Call this multiple times to delete the stack of the worker
q = Sidekiq::Queue.new('worker_name')
q.each do |j|
j.delete
end
@LucasPadovan
LucasPadovan / autostart_ssh_agent
Created April 21, 2015 00:58
Autostart code for ssh agent in windwos
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
agent_is_running() {
@LucasPadovan
LucasPadovan / LRShift.js
Created September 4, 2018 14:51
Shift an array left and right
let items = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'];
function shift({array, direction, amount}) {
let arr = array.slice(0);
let times = amount > arr.length ? amount % arr.length : amount;
let result = arr;
let modifier = direction === 'left' ? arr.length - times : times;
result = arr.concat(arr.splice(0, modifier));
@LucasPadovan
LucasPadovan / adjustToCenter.js
Created September 5, 2018 15:51
adjust array to center
console.clear();
const uno = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
let activeIndex = 1;
const visibleElements = 5;
const centerElement = parseInt(visibleElements / 2, 0);
const dos = uno.map((item, index) => {
let adjustedIndex = index + 2 + activeIndex;
let level = 3;