Skip to content

Instantly share code, notes, and snippets.

View dimanyc's full-sized avatar

Dimitry Nazarov dimanyc

View GitHub Profile
@delameko
delameko / upgrade-postgres-9.5-to-9.6.md
Last active October 24, 2024 08:55 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
@eebs
eebs / sql_statement_profiling.rb
Created December 17, 2019 21:29
spec/support/sql_statement_profiling.rb
RSpec.configure do |config|
example_sql_counts = Hash.new(0)
config.around(:example) do |procsy|
sql_count = 0
callback = ->(*args) { sql_count +=1 }
ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
procsy.call
end
@thestrabusiness
thestrabusiness / backend_usage.rb
Created March 4, 2023 15:04
React + ActionCable Example
class GameChannel < ApplicationCable::Channel
def subscribed
game = Game.find(params[:id])
stream_for game
end
end
## When the game state changes
GameChannel.broadcast_to(game, GameSerializer.render(game))