2crows
3blackcrows
3inside
3linestrike
3outside
3starsinsouth
# Channel | |
class CommentsChannel < ApplicationCable::Channel | |
def self.broadcast_comment(comment) | |
broadcast_to comment.message, comment: CommentsController.render( | |
partial: 'comments/comment', locals: { comment: comment } | |
) | |
end | |
def follow(data) | |
stop_all_streams |
require 'tempfile' | |
# The DSL class. The render method simply takes a block, then executes the block in the scope of the DSL class. You can see | |
# a use of it in the next file. | |
module Keyd | |
class DSL | |
def self.render(&block) | |
d = new | |
d.instance_exec(&block) |
-- based on https://www.crunchydata.com/blog/understanding-postgres-iops | |
SELECT | |
interval '1 millisecond' * total_exec_time AS "Total Exec. Time", | |
to_char ( | |
(total_exec_time / sum(total_exec_time) OVER ()) * 100, | |
'FM90D0' | |
) || '%' AS "Proportional Exec. Time", | |
to_char (calls, 'FM999G999G999G990') AS "Calls", | |
interval '1 millisecond' * (blk_read_time + blk_write_time) AS "Time Spent on IO", |
At the time of writing this article, PostgreSQL 17 is nearly out. On September 5th, the first release candidate was published. The final release is expected on September 26th, but we can already explain why we’ve been eagerly awaiting this release since 1 year.
At Lifen, we’ve loved Rails from the beginning. We have several Rails applications, each with different scopes and teams, all using PostgreSQL as the main database. Some of these applications handle a significant amount of traffic, and their databases need to be properly monitored. This is done by the infrastructure team and the developers themselves using PgAnalyze, Grafana and sometimes AWS console with "Performance Insight".
More than a year ago, we started monitoring the 95th and 99th percentile response times (p95, p99) on an endpoint that was experiencing timeouts. These p99 times were important because they involved a client with significantly mo
-- Carefull setup script is slow | |
-- SETUP SCRIPT :: START -- | |
DROP TABLE IF EXISTS docs; | |
CREATE TABLE docs ( | |
id SERIAL PRIMARY KEY, | |
type varchar(40) DEFAULT 'pdf' NOT NULL, | |
status varchar(40) NOT NULL, | |
sender_reference varchar(40) NOT NULL, | |
sent_at TIMESTAMPTZ, |
[ | |
{ | |
"context": "Editor", | |
"bindings": { | |
"alt-up": "editor::SelectLargerSyntaxNode", | |
"alt-down": "editor::SelectSmallerSyntaxNode", | |
"ctrl-cmd-up": "editor::MoveLineUp", | |
"ctrl-cmd-down": "editor::MoveLineDown" | |
} | |
} |
class FuzzyIndex | |
def initialize | |
@index = Hash.new { |h, k| h[k] = Set.new } | |
end | |
def []=(key, value) | |
trigrams(key).each { @index[it] << [key, value] } | |
end | |
def [](query) |
- Web Wormhole https://webwormhole.io/ https://github.com/saljam/webwormhole
- ToffeeShare https://toffeeshare.com/
- FilePizza https://file.pizza/
ShareDrop sharedrop.io https://github.com/szimek/sharedrop(SOLD, not recommended, use one of the forks)A clone SnapDrop snapdrop.net https://github.com/RobinLinus/snapdrop(SOLD, not recommended, use one of the forks)- A fork PairDrop https://pairdrop.net/ https://github.com/schlagmichdoch/pairdrop
- Instant.io https://instant.io/
- FileTC https://file.tc/
- You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use
rails new
first to generate all of the boilerplate files necessary. - Create an app in the current directory with
rails new .
- Use Tailwind CSS for styling. Use
--css tailwind
as an option on therails new
call to do this automatically. - Use Ruby 3.2+ and Rails 8.0+ practices.
- Use the default Minitest approach for testing, do not use RSpec.
- Default to using SQLite in development.
rails new
will do this automatically but take care if you write any custom SQL that it is SQLite compatible. - An app can be built with a devcontainer such as
rails new myapp --devcontainer
but only do this if requested directly. - Rails apps have a lot of directories to consider, such as app, config, db, etc.
- Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
- Guard against incapable browsers accessing controllers with `allo