I hereby claim:
- I am carlosagp on github.
- I am carlosagp (https://keybase.io/carlosagp) on keybase.
- I have a public key ASAVARPsP0aB8htzJaGMvFZu3_ipg8AWFNVgIjifL6C-1Qo
To claim this, I am signing this object:
| # frozen_string_literal: true | |
| # In {rails_app}/config/initializers/terminal_utils.rb | |
| Rails.configuration.to_prepare do | |
| require "terminal/utils" | |
| module Rails::ConsoleMethods | |
| include Terminal::Utils | |
| end | |
| end |
| def get_last_job_and_perform(queue) | |
| raw_job = Resque.redis.lrange("queue:#{queue}", 0, -1).last | |
| job = Resque.decode(raw_job) | |
| klass = Resque::Job.constantize(decoded_job['class']) | |
| klass.perform(*decoded_job['args']) | |
| end |
| def delete_mailer_jobs(number=10) | |
| queue_name = 'mailer' | |
| jobs = Resque.redis.lrange('queue:mailer', 0, number) | |
| deleted_count = 0 | |
| jobs.each do |job| | |
| decoded_job = Resque.decode(job) | |
| if decoded_job['class'] == 'MailerQueue' && decoded_job['args'].include?('error_notification') | |
| Resque::Job.destroy(queue_name, decoded_job['class'], *decoded_job['args']) | |
| deleted_count += 1 |
I hereby claim:
To claim this, I am signing this object:
| javascript: | |
| ( | |
| function() { | |
| var e, i; | |
| e = document.getElementById('pull_request_title'); | |
| if (e) { | |
| var m = e.value.match(/\/(\d+)\/(.*)/) || []; | |
| i = m[1] || 'N/A'; | |
| e.value = (m[2] || 'Description'); | |
| }; |
| require 'test/unit' | |
| require 'solution' | |
| class RotationTest < Test::Unit::TestCase | |
| def test_square_rotation | |
| square = [ | |
| [0, 1, 0, 0], | |
| [0, 1, 1, 0], | |
| [0, 0, 1, 0], | |
| [0, 0, 0, 0] |
| #!/usr/bin/ruby | |
| choices = {1 => 'Rock', 2 => 'Paper', 3 => 'Scissors'} | |
| puts "These are your choices" | |
| puts "1) Rock" | |
| puts "2) Paper" | |
| puts "3) Scissors" | |
| print "Please enter the number of your choice: " | |
| player_choice = gets | |
| player_choice = player_choice.to_i |
| # Rock paper scissors | |
| choices = %w[rock paper scissors] # this is the as: ['rock', 'paper', 'scissors'] | |
| results = { | |
| :player => 0, | |
| :computer => 0, | |
| :ties => 0 | |
| } | |
| player_results = 0 |
| # Reversing a String | |
| puts 'Give me your string' | |
| string_captured = gets().chomp # Get the input and remove the new line characted | |
| # Go through each char from beginning to end in the captured string and then | |
| # concatenate them by putting the last characted accessed at the beginning | |
| # of the new string. | |
| new_string_v1 = '' | |
| string_captured.chars.each{|c| new_string_v1 = c + new_string_v1 } |