Semantic search

Results for “HTTP APIs and Rails”

Search took 157ms

Chunked transfer encoding in Rails (streaming)

Published

Anyone who has written a little PHP knows what the flush() family of functions do. The ideal usage scenario for using chunked transfer[0] is when we have something costly to render e.g. the first three most recent articles on a blog. Why, one might ask? Why stream It is rather simple: in a normal Rails render, the server …

Improve Rails performance by adding a few gems

Published

After working with Rails for some time, you start nitpicking about how to improve it. This is the first in a series of articles on how to improve (even marginally) Rails's performance. Archive note (2014): This is Rails 4.1-era advice. Do not copy these dependencies, native extensions, or global monkey patches into a …

Building a small blog cms in rails

Published

Editor’s note (2026): This is a 2010 architectural sketch, not a current Rails security tutorial. RBAC is not inherently required for a single-author blog, production is not a substitute for automated or staging security tests, and authorization should fail closed under a current threat model. Current guidance Securing …

Shedding some light into UUID version 4 in Ruby and Rails

Published

Ruby's standard library and Rails's PostgreSQL adapter use by default version 4 UUIDs. This could be changed in Rails migrations via: Archive note (2015; updated context 2024): These excerpts describe Rails 4.2-era behavior, not current defaults. RFC 4122 was obsoleted by RFC 9562 in May 2024; UUIDv4 has 122 random bits …

Keep your Rails logs free of unwanted noise

Published

I like to use Rollbar 's default plan for small apps or prototypes that are works in progress. Getting production exceptions in my inbox can be quite useful but most of them are actually 404s - sure there are a multitude of ways for filtering out the noise (Fail2Ban , hand-written iptables rules , etc.) Historical note: …

Interesting links - Is logging a "code smell" ?

Published

I was reading this article , and it raises quite an unexpected question - "Can we consider logging as a code smell"? Clearly - the answer is more nuanced than that and whilst I do enjoy the event bus approach from the article - that seems like overkill for most applications. It's interesting that Aspect Oriented …

On Ruby modules and concerns

Published

Modules are useful for highly specialized code that can be injected into other classes for fun and profit or for creating namespaces. An interesting approach is to use modules as an alternative to classical inheritance (without the usual trade-offs) : the core idea is to share an abstracted role that can be included in a …

The perils of writing request specs using concurrent-ruby under the JVM

Published

This article describes a 2017 JRuby, concurrent-ruby, and RSpec setup. Current APIs, integrations, and behavior may differ, so the workaround below should be read as historical rather than current guidance. When I write an API, though I'm not a hard core TDD practitioner, I do like writing specs - especially request specs …

Ruby 2.2.0 Preview 1 quick Rails benchmarks

Published

Great news everyone! Ruby 2.2 preview 1 has been released ! I'm really curious about the Incremental GC and Symbol GC so let's run some quick Rails benchmarks on a normal Rails API app. Archive note (2014): Ruby 2.2.0-preview1 was prerelease software and must not be used now. Ruby 2.2 reached end of life on 31 March 2018; …

Installing a rails mysql stack on my laptop was a bit tricky

Published

Historical instructions (2010)—do not follow on a current machine. Ruby 1.8/1.9 and Rails 2.3/3 are unsupported and lack current security fixes. Manually copying DLLs into runtime directories is unsafe and brittle. The commands below are retained only as a record of the old environment; use supported Ruby/Rails versions …

Making Rails asset pipeline faster

Published

This article reflects the 2016-era Rails asset pipeline—Ruby Sass, libsass, Compass, therubyracer, and Node.js 6—and is not current Rails asset guidance. We all know that for a rather large Rails app with a substantial front end, the asset pre-compilation and more importantly - development mode changes are far from …

Is Rubinius 2.2.3 production ready ?

Published

Ruby 2.1 was released this Christmas, great news everyone! It sports a better GC (RGenGC — generational GC), hierarchical method caching, some small syntax changes and non-experimental refinements. All in all one can expect 5% to 15% performance increase which is quite awesome. Archive note (2014): Rubinius 2.2.3, JRuby …

Ruby meets LISP: Unveiling alien tech at Friendly.rb's lightning talk

Published

Originally published after the 2023 Friendly.rb conference in Romania, this is an archival account of that talk. At the Friendly.rb conference in Romania, I explored an experimental blend of Ruby and the Lisp family, implemented here through Clojure. This journey was more about embracing the spirit of experimentation …

Semantic search in Rails using sqlite-vec, Kamal and Docker

Published

I’ve been reading a lot about search lately: kNN, BM25, RRF and related ideas, both within Elasticsearch and in isolation. With the advent of LLMs, especially open-weight models, plus modern hardware, it feels like a good time to approach some of this in a pragmatic way. On the blog I'm already using a form of BM25 via …

On Ruby 2.0 memory usage, Unicorn and Heroku

Published

On UNIX-like operating systems (e.g. Linux) there's the concept of process forking via the fork() system call. When one calls fork from a parent-process it will spawn a new child-process - that is a copy of its parent, then both processes return from fork. The child-process has an exact copy of the parent's memory in a …

Next page