This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clean_sidekiq_and_invalidate_batches | |
Sidekiq::BatchSet.new.each { |batch| Sidekiq::Batch.new(batch.bid).invalidate_all } | |
Sidekiq::Queue.all.each(&:clear) | |
end | |
def clean_sidekiq_and_delete_batches | |
Sidekiq::BatchSet.new.each { |batch| Sidekiq::Batch::Status.new(batch.bid).delete } | |
Sidekiq::Queue.all.each(&:clear) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'singleton' | |
class DebugLog < Logger | |
include Singleton | |
def initialize(log_file = 'debug') | |
super(Rails.root.join("log/#{log_file}.log")) | |
self.formatter = formatter() | |
self | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WARNING: This docker-compose.yml is only for testing purpose. | |
# Parameters: | |
# - name: CONFLUENT_PLATFORM_VERSION | |
# default: 3.0.0 | |
# reference: https://hub.docker.com/u/confluentinc/ | |
# Ports: | |
# - description: Major ports are exposed to host computer | |
# - zookeeper: 2181 | |
# kafka1: 9091 | |
# kafka2: 9092 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnpublishMovies | |
def call | |
movies_to_unpublish = Movies.where_not( | |
unpublish_at: nil, | |
) | |
series_to_unpublish = Series.where_not( | |
unpublish_at: nil, | |
) | |
shows_to_unpublish = Shows.where_not( | |
unpublish_at: nil, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnpublishMovies | |
def call | |
movies_to_unpublish = Movies.where_not( | |
unpublish_at: nil, | |
) | |
series_to_unpublish = Series.where_not( | |
unpublish_at: nil, | |
) | |
shows_to_unpublish = Shows.where_not( | |
unpublish_at: nil, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_bizarre_time(year, month, day, hour, minute, second) | |
Time.parse("#{year}-#{month}-#{day} #{hour}:#{minute}:#{second}") | |
end | |
parse_bizarre_time(*["2020", "10", "06", "10", "20", "30"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnpublishMovies | |
def call | |
to_unpublish_list = [ | |
{ | |
field: :unpublish_at, | |
klasses: [Movies, Series, Shows], | |
}, | |
{ | |
field: :date_to_unpublish_podcast, | |
klasses: [Podcast], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnpublishMovies | |
def call | |
movies_to_unpublish = Movies.where_not( | |
unpublish_at: nil, | |
) | |
series_to_unpublish = Series.where_not( | |
unpublish_at: nil, | |
) | |
shows_to_unpublish = Shows.where_not( | |
unpublish_at: nil, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Random = require("random-js").Random; | |
function deckProbabilityTest(cycles = 1) { | |
let random = new Random(); | |
let results = [] | |
let originalDeck = [1,2,3,4,5,6] | |
let totalCards = originalDeck.length | |
let desiredCardAtEnd = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adicionando jQuery | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// ... give time for script to load, then type (or see below for non wait option) | |
jQuery.noConflict(); | |
// Função Recursiva que faz o Scrap | |
function scrap_comments(nodeset = [], query_hash, variables) { | |
result = [] |
NewerOlder