Skip to content

Instantly share code, notes, and snippets.

View ceritium's full-sized avatar
🏠
Working from home

Jose Galisteo ceritium

🏠
Working from home
View GitHub Profile
@ceritium
ceritium / solid_queue_lock_in_transaction.rb
Created October 4, 2026 18:02
Solid Queue: a concurrency-limited job enqueued inside a transaction holds its semaphore lock until the transaction ends (single-file reproduction)
# frozen_string_literal: true
# A Solid Queue job with concurrency controls, enqueued inside a transaction on
# Solid Queue's own connection, holds its semaphore's row lock until that
# transaction ends.
#
# This happens when Solid Queue shares the app's database connection (no
# `connects_to`) and enqueueing isn't deferred until commit
# (`enqueue_after_transaction_commit` disabled). Enqueueing a due job acquires
# its semaphore right away, with a `SELECT ... FOR UPDATE` on the key's row or
@ceritium
ceritium / solid_queue_dispatcher_deadlock.rb
Created October 4, 2026 17:54
Solid Queue: two dispatchers deadlocking on concurrency semaphores (single-file reproduction)
# frozen_string_literal: true
# Two Solid Queue dispatchers deadlocking on concurrency semaphores.
#
# dispatch_next_batch dispatches its whole batch in one transaction and, for
# jobs with concurrency controls, acquires each job's semaphore in the order the
# jobs come in. Two dispatchers whose batches share keys can acquire them in
# opposite order and deadlock.
#
# Needs a PostgreSQL server. The script creates (and drops) its own database.
@ceritium
ceritium / diagram.md
Last active January 26, 2023 10:08
How it works
                                             ┌────────────────────────────┐
                                             │                            │
                                             │                            │
                                             │                            │
                                             │                            │
                   ......................>   │           Worker           │
                   .                         │                            │
                   .                         │                            │
                   .                         │                            │
@ceritium
ceritium / Capybara.md
Created October 5, 2022 07:42 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@ceritium
ceritium / ajax_widget.rb
Created June 30, 2021 21:11 — forked from rmahnovetsky/ajax_widget.rb
Apotomo ajax widget example
module Apotomo
class AjaxWidget < Apotomo::Widget
responds_to_event :ajax_display
def display
render :view => :display
end
def ajax_display
@ceritium
ceritium / stimulus.md
Created November 7, 2020 22:53 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet
@ceritium
ceritium / poem2.txt
Last active May 11, 2019 21:19
1914, and Other Poems by Rupert Brooke
I. PEACE
Now, God be thanked Who has matched us with His hour,
And caught our youth, and wakened us from sleeping,
With hand made sure, clear eye, and sharpened power,
To turn, as swimmers into cleanness leaping,
Glad from a world grown old and cold and weary,
Leave the sick hearts that honour could not move,
And half-men, and their dirty songs and dreary,
@ceritium
ceritium / gist:d5d3d60393229d1f032810261b2352ab
Created May 11, 2019 21:12
Paradise Lost by John Milton
Of Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
With loss of _Eden_, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav’nly Muse, that on the secret top
Of _Oreb_, or of _Sinai_, didst inspire
That Shepherd, who first taught the chosen Seed,
In the Beginning how the Heav’ns and Earth
Rose out of _Chaos_: Or if _Sion_ Hill
@ceritium
ceritium / gist:f79be8fea3828cdcb71917700baadade
Created May 10, 2019 16:59
The U.S. Environmental Protection Agency's
The U.S. Environmental Protection Agency's (EPA) greenhouse gas emissions monitoring program has found that Americans are in for a "dangerous" climate change — with a "huge" increase in air pollution and a "very bad" one.
The 287-page report, released Friday, reveals that the rise in emissions from the burning of fossil fuels, especially coal, has increased a "dangerous" level of air pollution, leaving many Americans "in a state of air pollution that is increasing at a rate not seen in their lifetime."
The report is the latest in a series of reports by the agency.
The EPA has been trying to figure out how to stop the increase in air pollution from burning of fossil fuels; that's a big commitment.
In the report, the agency found a "significant increase" in the total number of air pollutants in the U.S. from 2010 to 2015, an increase of 11.4 percent, or about the same as the total of all the air pollutants from the past decade.
@ceritium
ceritium / gist:d4fec4c324501bde092910630e72a682
Created May 10, 2019 16:38
Jared Kushner and Ivanka Trump are among
Jared Kushner and Ivanka Trump are among the about 100 people at the White House who are expected to be in attendance at a Trump-branded event at the New York Stock Exchange on July 27, the day after the U.S. election.
The event will take place at the White House Office of Management and Budget.
The event is meant to be a "show of strength" for a president who has struggled for days to get his first term running, and has drawn criticism for its racial and gender identity.
Kushner, the president's son-in-law and senior adviser, had been a vocal critic of Trump throughout the campaign, and a part of his campaign during the campaign, when he vehemently denied allegations he had sexually harassed a woman at a campaign event in a Washington hotel room.
The first ever Jewish, world-famous, and successful American president was born into a Jewish family in Brooklyn. His mother was a Holocaust survivor, and he grew up in a small community of Jewish immigrants in the Midwest.