Skip to content

Instantly share code, notes, and snippets.

View aleonjob's full-sized avatar
🤓
happy coding

Andres Leon aleonjob

🤓
happy coding
View GitHub Profile
@Chocksy
Chocksy / kill_sidekiq_job.rb
Last active July 2, 2024 19:45
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
long_process_id = 'integration.3:4:71111aaa111' # Eg: 'integration.3:4:71d1d7f4ef5a'
workers.each do |process_id, thread_id, work|
process = Sidekiq::Process.new('identity' => process_id)
process.stop! if process_id == long_process_id
end
# FOR SCHEDULED JOBS
@tetiana12345678
tetiana12345678 / chatter.md
Last active November 8, 2017 15:42
Building a chat app with Elixir and Phoenix

Create new umbrella application

$ mix new chatter --umbrella
$ cd chatter

Create new Phoenix Project

$ cd apps
@johncip
johncip / rails_eager_load.md
Last active December 23, 2023 15:35
Active Record eager loading strategies

N+1 query problem

  • ORMs make it easy to a query per loop iteration, which we want to avoid

eager_load

  • single query (left outer join)
  • can reference the other table's columns in where

preload

  • a few queries (one per table)
  • typically faster
@subfuzion
subfuzion / curl.md
Last active July 3, 2024 11:43
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.