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
# app/channels/hello_channel.rb | |
class HelloChannel < ActionCable::Channel::Base | |
def say_hello(data) | |
times_to_say_hello = data.fetch("times_to_say_hello") | |
hello = "Hello, #{current_profile.name}!" | |
times_to_say_hello.times do | |
ActionCable.server.broadcast(current_profile.id, hello) | |
end | |
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
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
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
# I'm using this script for a 64-bit Linux Environment running Puma with Ruby 2.3 version. | |
# I have tested that the Sidekiq server stops and restarts by handling the USR1 and TERM signals while deploying an app, rebooting an instance and while restarting the app server. | |
# Below are the steps to include this script in the EB instance and start sidekiq server on deployment. | |
## Include this file inside the .ebextensions folder in the application directory. | |
## Set up the sidekiq.yml(sidekiq concurrency, queues and other settings) file inside the config folder in the application directory. | |
## Make sure sidekiq pid file path and sidekiq log file path SHOULD NOT be specified in the above sidekiq.yml file.(only when using this script on EB instance) | |
## Set the RAILS_ENV variable in the EB configuration. | |
## Deploy the application to the EB instance. | |
## ssh into the instance and search if sidekiq is running. ( ps aux | grep sidekiq ) | |
## Once this script is added to the EB instance, add the .ebextensions/sideki |
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
stats = Sidekiq::Stats.new | |
stats.queues | |
stats.enqueued | |
stats.processed | |
stats.failed |
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
//....add this in app/assets/javascript/active_admin.js | |
$(function(){ | |
// CONFIGURE PANELS COLLAPSER | |
$(".panel[data-panel]").each(function(){ | |
var $this = $(this); | |
var $a = $("<a href='javascript:void(null)'>").on("click",function(event){ | |
$(this).closest(".panel").find(".panel_contents").each(function(){ | |
$(this).slideToggle(); | |
}); | |
$(this).closest("h3").each(function(){ |