Skip to content

Instantly share code, notes, and snippets.

View rajgurung's full-sized avatar
:octocat:

Raj Gurung rajgurung

:octocat:
  • Indeed Flex
  • London, UK
View GitHub Profile
@rajgurung
rajgurung / kill_sidekiq_job.rb
Created November 19, 2021 17:05 — forked from Chocksy/kill_sidekiq_job.rb
Kill sidekiq jobs by process id for busy jobs and by jid for other sets.
# FOR BUSY JOBS
# take the process_id from the /busy page in sidekiq and kill the longest running one.
workers = Sidekiq::Workers.new
workers.each do |process_id, thread_id, work|
process = Sidekiq::Process.new('identity' => process_id)
process.stop! if process_id == 'integration.3:4:71d1d7f4ef5a'
end
# FOR SCHEDULED JOBS
# you need to know the jid to make this happen
@rajgurung
rajgurung / facebook.rb
Created July 16, 2020 06:32 — forked from a14m/facebook.rb
Gist for manually OAuth2 facebook for Rails APIs
# lib/omniauth/facebook.rb
require 'httparty'
module Omniauth
class Facebook
include HTTParty
# The base uri for facebook graph API
base_uri 'https://graph.facebook.com/v2.3'
@rajgurung
rajgurung / Ruby_Rails_Naming_Conventions.md
Created September 19, 2018 13:00 — forked from alexpchin/Ruby_Rails_Naming_Conventions.md
Ruby & Rails Naming Conventions

Alex's Rails Cheat Sheet

I think the most confusing thing that I have found about Ruby on Rails so far has been the transition from (trying to) write code myself to the use of the fabled "Rails Magic". So, to help my own understanding of a few core Ruby on Rails concepts, I have decided to write something on what I think is a CRITICAL topic... the idea of Convention over Configuration and why (in my mind) it is the most important thing that helps Rails become magic!

(This may be a topic that we cover in more detail in class but as I said, I'm writing this for my own understanding... I hope it helps someone else understand things too... Perhaps you can give me a hand when I'm crying next week!)

##Convention over configuration ###What does this "actually" mean...

# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs