<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Today I Learned</title>
    <description>TIL is an open-source project by Hashrocket that exists to catalogue the sharing and accumulation of knowledge as it happens day-to-day.
    </description>
    <link>http://til.hashrocket.com/</link>
    <atom:link href="http://til.hashrocket.com/rss" rel="self" type="application/rss+xml" />
    
      <item>
        <title>
          <![CDATA[Use the Global Command in Vim - #vim]]>
        </title>
        <link>http://til.hashrocket.com/posts/wy0eeoiooz-use-the-global-command-in-vim</link>
        <description>
          <![CDATA[<p>
Today I learned about the <code class="inline">global</code> command in (n)vim, which allows you to run a command on multiple lines matching a pattern.</p>
<p>
Let's say I want to remove all lines in a file matching <code class="inline">pattern1</code>. In command mode, I can do this with:</p>
<pre><code>:g/pattern1/d_</code></pre>
<p>
(The vim <code class="inline">:help</code> file recommends using <code class="inline">d_</code> to avoid clobbering registers, which will make it faster)</p>
<p>
Any ex command is a valid command, and you can also execute normal mode commands with <code class="inline">norm</code></p>
<pre><code>:g/pattern1/norm {command}</code></pre>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Mon, 06 Apr 2026 16:42:34 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/wy0eeoiooz-use-the-global-command-in-vim</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Retry On Raised Exceptions in Ruby - #ruby]]>
        </title>
        <link>http://til.hashrocket.com/posts/ytfcqajbg2-retry-on-raised-exceptions-in-ruby</link>
        <description>
          <![CDATA[<p>
You can use the <code class="inline">retry</code> keyword to re-attempt code execution after an error is raised. A very primitive example would be -</p>
<pre><code class="ruby language-ruby">  def do_something
     Service.call # might raise an error
  rescue
    retry
  end</code></pre>
<p>
<code class="inline">retry</code> will call the code above the rescue again. The caveat, here, is that the above code will trigger an infinite loop, so you must handle this explicitly. </p>]]>
        </description>
        <dc:creator>andrewvogel</dc:creator>
        <pubDate>Wed, 25 Feb 2026 23:31:04 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/ytfcqajbg2-retry-on-raised-exceptions-in-ruby</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Git Bisect For Bug Tracking - #git]]>
        </title>
        <link>http://til.hashrocket.com/posts/e3tv5pxqea-git-bisect-for-bug-tracking</link>
        <description>
          <![CDATA[<p>
The <code class="inline">bisect</code> command can be used to traverse your commit history to find where an unwaned behavior was introduced. If your current commit is broken, and you have a previous working commit, but there's lots of commits in between, <code class="inline">bisect</code> will help you navigate those commits in between to locate which commit added the unwanted behavior.</p>
<p>
check out <a href="https://git-scm.com/docs/git-bisect">these docs</a></p>]]>
        </description>
        <dc:creator>jackrosa</dc:creator>
        <pubDate>Mon, 23 Feb 2026 18:39:05 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/e3tv5pxqea-git-bisect-for-bug-tracking</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Sorting Map Keys with `inspect/2` in Elixir - #elixir]]>
        </title>
        <link>http://til.hashrocket.com/posts/rwsot1nqn7-sorting-map-keys-with-inspect2-in-elixir</link>
        <description>
          <![CDATA[<p>
Elixir maps don't guarantee key ordering, so inspecting a map can produce an unexpected output:</p>
<pre><code class="elixir language-elixir">iex(1)&gt; %{c: 3, a: 2, b: 1, f: %{c: 3, a: 2, b: 1}} |&gt; inspect()
"%{c: 3, f: %{c: 3, b: 1, a: 2}, b: 1, a: 2}"</code></pre>
<p>
Today I learned we can pass <code class="inline">sort_maps: true</code> via <code class="inline">custom_options</code> to <code class="inline">inspect/2</code> to get alphabetically sorted keys and this applies to <strong>nested maps</strong> too:</p>
<pre><code class="elixir language-elixir">iex(2)&gt; %{c: 3, a: 2, b: 1, f: %{c: 3, a: 2, b: 1}} |&gt; inspect(custom_options: [sort_maps: true])
"%{a: 2, b: 1, c: 3, f: %{a: 2, b: 1, c: 3}}"</code></pre>
<p>
This is particularly useful when writing tests or diffing output where consistent key ordering matters.</p>]]>
        </description>
        <dc:creator>viniciusnegrisolo</dc:creator>
        <pubDate>Thu, 19 Feb 2026 14:20:15 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/rwsot1nqn7-sorting-map-keys-with-inspect2-in-elixir</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Enum ordering in Postgres - #sql]]>
        </title>
        <link>http://til.hashrocket.com/posts/tpvvhmnoez-enum-ordering-in-postgres</link>
        <description>
          <![CDATA[<p>
Rather than adhering to alphabetical order, when using <code class="inline">order by</code> with an enum column, the sorting adheres to the order in which the values were listed when the enum was created.</p>
<pre><code class="sql language-sql">create type application_status as enum (
  'submitted',
  'under_review',
  'accepted',
  'rejected'
);

create table applications (
  applicant_name text,
  status application_status
);

insert into applications values
  ('George Washington', 'accepted'),
  ('John Adams', 'under_review'),
  ('Thomas Jefferson', 'under_review'),
  ('Aaron Burr', 'rejected'),
  ('Thomas Pinckney', 'submitted');
  
select * from applications order by status;

-- applicant_name    | status
-- ------------------+-------------
-- Thomas Pinckney   | submitted
-- John Adams        | under_review
-- Thomas Jefferson  | under_review
-- George Washington | accepted
-- Aaron Burr        | rejected</code></pre>]]>
        </description>
        <dc:creator>marylee</dc:creator>
        <pubDate>Tue, 17 Feb 2026 21:16:30 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/tpvvhmnoez-enum-ordering-in-postgres</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Check Subclass Relationships in Ruby - #ruby]]>
        </title>
        <link>http://til.hashrocket.com/posts/tu0egszz43-check-subclass-relationships-in-ruby</link>
        <description>
          <![CDATA[<p>
Today I learned the <code class="inline">&lt;</code> operator can be used to compare classes and their relationships in their ancestry.</p>
<p>
Let's say I have the following class setup:</p>
<pre><code class="ruby language-ruby">class A end

class B &lt; A
end

class C end</code></pre>
<p>
Then I can use <code class="inline">&lt;</code> to determine if <code class="inline">A</code> is a subclass or ancestor of <code class="inline">B</code>, and also see that <code class="inline">B</code> is not related to <code class="inline">C</code>:</p>
<pre><code class="ruby language-ruby">pry(main)&gt; B &lt; A
# =&gt; true

pry(main)&gt; A &lt; B
# =&gt; false

pry(main)&gt; B &lt; C
# =&gt; nil # no relation</code></pre>
<p>
There's also <code class="inline">&gt;</code> which checks the inverse:</p>
<pre><code class="ruby language-ruby">pry(main)&gt; B &gt; A
# =&gt; false

pry(main)&gt; A &gt; B
# =&gt; true

pry(main)&gt; B &gt; C
# =&gt; nil # still no relation</code></pre>
<p>
<a href="https://docs.ruby-lang.org/en/master/Module.html#method-i-3C">Docs</a></p>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Tue, 17 Feb 2026 18:29:05 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/tu0egszz43-check-subclass-relationships-in-ruby</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Visualize a Git Branch's History - #git]]>
        </title>
        <link>http://til.hashrocket.com/posts/pfjzwvr00o-visualize-a-git-branchs-history</link>
        <description>
          <![CDATA[<p>
Here are some handy args for the <code class="inline">git log</code> command to show a nicely visualized commit history</p>
<pre><code>git log --oneline --graph --decorate --all</code></pre>]]>
        </description>
        <dc:creator>jackrosa</dc:creator>
        <pubDate>Mon, 16 Feb 2026 19:11:30 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/pfjzwvr00o-visualize-a-git-branchs-history</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Grepping in Ruby - #ruby]]>
        </title>
        <link>http://til.hashrocket.com/posts/issajeaua5-grepping-in-ruby</link>
        <description>
          <![CDATA[<p>
I was looking at a rather large model in Ruby and wanted to search through its methods to see what might be available. I found out there's an <a href="https://ruby-doc.org/core-2.7.2/Enumerable.html#method-i-grep">Enumerable#grep</a> method that lets you search like you would in the terminal.</p>
<p>
Here's a simple example:</p>
<pre><code class="ruby language-ruby">["apple", "banana", "apricot"].grep(/^ap/)
# =&gt; ["apple", "apricot"]</code></pre>
<p>
Here's some more useful examples:</p>
<pre><code class="ruby language-ruby">[1, "two", :three].grep(String)
# =&gt; ["two"]

[3, 7, 12].grep(1..10)
# =&gt; [3, 7]</code></pre>
<p>
Here's a real world example I used it for:</p>
<pre><code class="ruby language-ruby">Post.methods.grep(/deleted/)
=&gt; [:without_deleted, :with_deleted, :deleted, :only_deleted]</code></pre>]]>
        </description>
        <dc:creator>craighafer</dc:creator>
        <pubDate>Thu, 12 Feb 2026 19:40:24 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/issajeaua5-grepping-in-ruby</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Push to Multiple Remotes Simultaneously - #git]]>
        </title>
        <link>http://til.hashrocket.com/posts/qkfqt9q7il-push-to-multiple-remotes-simultaneously</link>
        <description>
          <![CDATA[<p>
I've started mirroring some of my git repos to multiple remotes, making use of git's decentralized nature. I quickly realized this can become tedious. If I have my <code class="inline">origin</code> remote set to urlA, and <code class="inline">backup</code> remote set to urlB, then I have to push to each remote each time.</p>
<pre><code class="shell language-shell">$ git push origin main
$ git push backup main</code></pre>
<p>
I don't know about you, but I <strong>will</strong> forget to push to backup at <em>least</em> 50% of the time. </p>
<p>
Turns out you can use <code class="inline">git remote set-url</code> to add multiple repo urls to a remote (for push only, not fetch). So you can add urlA and urlB to <code class="inline">origin</code>, so any push to origin will push to both remotes.</p>
<pre><code class="shell language-shell">$ git remote set-url --add --push origin urlA
$ git remote set-url --add --push origin urlB

$ git remote -v 
origin  urlA (fetch)
origin  urlA (push)
origin  urlB (push)
</code></pre>
<p>
You can't do this for fetch - think about the conflicts pulling from branches on 2 different remotes that have diverged 😱</p>
<p>
<a href="https://git-scm.com/docs/git-remote">git-remote Docs</a></p>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Tue, 10 Feb 2026 21:17:23 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/qkfqt9q7il-push-to-multiple-remotes-simultaneously</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Case insensitive string comparison with casecmp? - #ruby]]>
        </title>
        <link>http://til.hashrocket.com/posts/h04yjjvheu-case-insensitive-string-comparison-with-casecmp</link>
        <description>
          <![CDATA[<p>
I found out today that Ruby has a <a href="https://ruby-doc.org/3.4.1/String.html#method-i-casecmp-3F">casecmp?</a> in the String class that compares strings case insensitively:</p>
<pre><code class="ruby language-ruby">"Hello".casecmp?("hello") #=&gt; true
"JAX".casecmp?("jAx")     #=&gt; true
"foo".casecmp?("bar")     #=&gt; false</code></pre>
<p>
This is preferable to <code class="inline">string_1.downcase == string_2.downcase</code> since it avoids allocating new string objects.</p>]]>
        </description>
        <dc:creator>viniciusnegrisolo</dc:creator>
        <pubDate>Fri, 23 Jan 2026 21:34:43 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/h04yjjvheu-case-insensitive-string-comparison-with-casecmp</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Limit Rows Returned in Oracle SQL - #sql]]>
        </title>
        <link>http://til.hashrocket.com/posts/2e7a5urirx-limit-rows-returned-in-oracle-sql</link>
        <description>
          <![CDATA[<p>
Postgres has a lovely <code class="inline">LIMIT</code> clause that allows you to limit the number of returned rows.</p>
<pre><code class="sql language-sql">SELECT *
FROM blogs
LIMIT 10;</code></pre>
<p>
Oracle SQL does not have a <code class="inline">LIMIT</code> clause (one of the many reasons why FOSS is better 😉) Instead, it has <code class="inline">FETCH</code> which will do the same thing, albeit more verbosely.</p>
<pre><code class="sql language-sql">SELECT *
FROM blogs
FETCH FIRST 10 ROWS ONLY;</code></pre>
<p>
<code class="inline">FETCH</code> is available in Oracle 12c and above. On older Oracle versions, you can use the <code class="inline">ROWNUM</code> pseudo column. Keep in mind it's 1-based indexing.</p>
<pre><code class="sql language-sql">SELECT *
FROM blogs
where ROWNUM &lt;= 10</code></pre>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Fri, 23 Jan 2026 15:53:17 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/2e7a5urirx-limit-rows-returned-in-oracle-sql</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Get Whodunnit Instance from PaperTrailGlobalId - #rails]]>
        </title>
        <link>http://til.hashrocket.com/posts/zyaljswzpx-get-whodunnit-instance-from-papertrailglobalid</link>
        <description>
          <![CDATA[<p>
I ran into an issue trying to get an instance of the <code class="inline">User</code> who made a change captured by <a href="https://github.com/paper-trail-gem/paper_trail">paper_trail</a> with the <a href="https://github.com/ankit1910/paper_trail-globalid">paper_trail-globalid</a> gem.</p>
<p>
With regular <code class="inline">paper_trail</code>, calling <code class="inline">whodunnit</code> will give you the id or name of the user who... dunnit.</p>
<pre><code class="ruby language-ruby">post.versions.last.whodunnit
# =&gt; "Tony Yunker"</code></pre>
<p>
With the <a href="https://github.com/ankit1910/paper_trail-globalid">paper_trail-globalid</a> gem, whodunnit is saved as, well, a global id.</p>
<pre><code class="ruby language-ruby">post.versions.last.whodunnit
# =&gt; "gid://app/User/12345"</code></pre>
<p>
This isn't super helpful on it's own, but <code class="inline">actor</code> will resolve the global id and return an instance of the model it references.</p>
<pre><code class="ruby language-ruby">post.versions.last.whodunnit
# =&gt; &lt;User:0x000000015d618010...&gt;</code></pre>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Thu, 22 Jan 2026 17:29:14 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/zyaljswzpx-get-whodunnit-instance-from-papertrailglobalid</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Convert an enumerable to a hash - #ruby]]>
        </title>
        <link>http://til.hashrocket.com/posts/1wxgqtduey-convert-an-enumerable-to-a-hash</link>
        <description>
          <![CDATA[<p>
In Ruby if you want to easily convert your enumerable object into a hash, use <code class="inline">index_by</code>.</p>
<p>
This uses the block result as the key and the element as the value.</p>
<p>
Here is an example:</p>
<pre><code class="ruby language-ruby"># In this example, `posts` is an array of Post objects
posts.index_by(&amp;:slug)
=&gt; { "slug-1" =&gt; &lt;Post ...&gt;, "slug-2" =&gt; &lt;Post ...&gt;, ...}</code></pre>]]>
        </description>
        <dc:creator>craighafer</dc:creator>
        <pubDate>Mon, 22 Dec 2025 15:46:58 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/1wxgqtduey-convert-an-enumerable-to-a-hash</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Delete/Drop a key-value pair from an object - #javascript]]>
        </title>
        <link>http://til.hashrocket.com/posts/5bfihjncmc-deletedrop-a-key-value-pair-from-an-object</link>
        <description>
          <![CDATA[<p>
In Javascript, if you want to <code class="inline">drop</code> or <code class="inline">delete</code> a key-value pair from an object you just pass the <code class="inline">object.key</code> to the <code class="inline">delete</code> keyword, like this:</p>
<pre><code class="javascript language-javascript">// Assume we have an object like this
let object = {
  toyota: ['camry'], 
  honda:  ['accord', 'civic']
}

// It would display something like this
object
=&gt; {toyota: ['camry'], honda: ['accord', 'civic'] }

// We can drop/delete the object value like this
delete object.toyota
=&gt; true

// It would now display something like this
object
=&gt; {honda: ['accord', 'civic']}</code></pre>]]>
        </description>
        <dc:creator>craighafer</dc:creator>
        <pubDate>Thu, 18 Dec 2025 17:21:42 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/5bfihjncmc-deletedrop-a-key-value-pair-from-an-object</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Get OS Details in Linux With os-release - #devops]]>
        </title>
        <link>http://til.hashrocket.com/posts/2qnduofrsd-get-os-details-in-linux-with-os-release</link>
        <description>
          <![CDATA[<p>
You can find a bunch of details about your OS in <code class="inline">/etc/os-release</code>. You probably know most of these details if you're running it on your main machine, but it can come in handy if you're on a VM or in a container.</p>
<pre><code class="bash language-bash">% cat /etc/os-release
NAME="Fedora Linux"
VERSION="43 (Sway)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=43
VERSION_CODENAME=""
PRETTY_NAME="Fedora Linux 43 (Sway)"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=43
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=43
SUPPORT_END=2026-12-02</code></pre>
<p>
The <code class="inline">ID_LIKE</code> field can be particularly useful if the distro is a derivative of another distro. For example, if the OS is Oracle Linux, the <code class="inline">ID-LIKE</code> value will be <code class="inline">fedora</code>, from which it's derived. Very useful for troubleshooting.</p>
<pre><code>NAME="Oracle Linux Server"
ID="ol"
ID_LIKE="fedora"
VERSION_ID="8.9"</code></pre>
<p>
More info about <code class="inline">os-release</code> can be found <a href="https://www.freedesktop.org/software/systemd/man/latest/os-release.html">here</a></p>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Wed, 17 Dec 2025 22:47:09 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/2qnduofrsd-get-os-details-in-linux-with-os-release</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Typed Arrays in GDScript - #computer-science]]>
        </title>
        <link>http://til.hashrocket.com/posts/p65okjuffx-typed-arrays-in-gdscript</link>
        <description>
          <![CDATA[<p>
You can define an array of a strict type in Godot like this:</p>
<pre><code class="python language-python">var names: Array[string] = ["Hash", "Rocket"]

# Or if you had a custom class:
var powerups: Array[Pickup] = []</code></pre>]]>
        </description>
        <dc:creator>jackrosa</dc:creator>
        <pubDate>Sat, 13 Dec 2025 18:13:54 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/p65okjuffx-typed-arrays-in-gdscript</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Get Array's Min and Max with minmax - #ruby]]>
        </title>
        <link>http://til.hashrocket.com/posts/uodz90rbg0-get-arrays-min-and-max-with-minmax</link>
        <description>
          <![CDATA[<p>
In ruby, you can get the minimum value in an array with <code class="inline">#min</code> and the maximum value with <code class="inline">#max</code>. </p>
<p>
But sometimes you need both the min and max, and it feels a waste to make two separate calls. Turns out you can get both in one with <code class="inline">#minmax</code> - which will return a two element array with the min and max values.</p>
<pre><code class="ruby language-ruby">pry(main)&gt; [1, 2, 3].minmax
# =&gt; [1, 3]</code></pre>
<p>
You can also pass it a block for custom ordering criteria.</p>
<p>
<a href="https://ruby-doc.org/3.4.1/Enumerable.html#method-i-minmax">Docs</a></p>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Wed, 03 Dec 2025 19:37:24 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/uodz90rbg0-get-arrays-min-and-max-with-minmax</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Get multiple random array elements in ruby - #ruby]]>
        </title>
        <link>http://til.hashrocket.com/posts/zv3hwp8n5x-get-multiple-random-array-elements-in-ruby</link>
        <description>
          <![CDATA[<p>
You can pass an integer argument to <code class="inline">.sample</code> to get multiple random elements from an array in ruby</p>
<pre><code class="ruby language-ruby">["this", "is", "a", "til", "post"].sample(2)
# =&gt; ["this", "post"]</code></pre>]]>
        </description>
        <dc:creator>jackrosa</dc:creator>
        <pubDate>Sat, 22 Nov 2025 18:59:49 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/zv3hwp8n5x-get-multiple-random-array-elements-in-ruby</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Lint Your Factories with FactoryBot.lint - #testing]]>
        </title>
        <link>http://til.hashrocket.com/posts/9tkz9zvhwy-lint-your-factories-with-factorybotlint</link>
        <description>
          <![CDATA[<p>
Today I learned you can lint your Factories with <code class="inline">FactoryBot.lint</code>. This will run through all your factories, and list any that failed to create. You can also include traits in the listing with <code class="inline">FactoryBot.lint traits: true</code>. Useful for ensuring your factories remain valid.</p>
<p>
<a href="https://github.com/thoughtbot/factory_bot/blob/main/GETTING_STARTED.md#linting-factories">Docs</a></p>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Fri, 21 Nov 2025 18:30:54 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/9tkz9zvhwy-lint-your-factories-with-factorybotlint</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Run Explain (and Anaylze) in Rails Console - #rails]]>
        </title>
        <link>http://til.hashrocket.com/posts/mriqy32ylo-run-explain-and-anaylze-in-rails-console</link>
        <description>
          <![CDATA[<p>
If you're troubleshooting some slow SQL queries, chances are you've used <code class="inline">EXPLAIN</code> or even <code class="inline">EXPLAIN ANALYZE</code>. But TIL, that you can actually run these in the Rails console on your Rails models (Active Model Relations). It looks something like this -</p>
<pre><code class="ruby language-ruby">&gt; User.active.explain</code></pre>
<p>
Or if you're on a more recent version of Rails, you can also pass arguments to <code class="inline">.explain</code>, such as <code class="inline">:analyze</code> -</p>
<pre><code class="ruby language-ruby">&gt; User.active.explain(:analyze)</code></pre>
<p>
You can also call it on other methods like <code class="inline">pluck</code>, etc. - </p>
<pre><code class="ruby language-ruby">&gt; User.active.explain.pluck</code></pre>
<p>
Be warned that calling <code class="inline">.explain</code> will execute the query.</p>
<p>
<a href="https://devdocs.io/rails~7.2/activerecord/relation#method-i-explain">https://devdocs.io/rails~7.2/activerecord/relation#method-i-explain</a></p>
<p>
<a href="https://guides.rubyonrails.org/active_record_querying.html#running-explain">https://guides.rubyonrails.org/active_record_querying.html#running-explain</a></p>]]>
        </description>
        <dc:creator>andrewvogel</dc:creator>
        <pubDate>Thu, 20 Nov 2025 09:09:04 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/mriqy32ylo-run-explain-and-anaylze-in-rails-console</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Generate Rails Model With Unique Attribute - #rails]]>
        </title>
        <link>http://til.hashrocket.com/posts/j7kkg2gbr1-generate-rails-model-with-unique-attribute</link>
        <description>
          <![CDATA[<p>
When generating a rails column, you can specify an attribute to have a unique constraint like this:</p>
<pre><code class="bash language-bash">rails g model Song title:string:uniq</code></pre>
<p>
In your migration, this will look like:</p>
<pre><code class="ruby language-ruby">add_index :songs, :title, unique: true</code></pre>]]>
        </description>
        <dc:creator>jackrosa</dc:creator>
        <pubDate>Tue, 11 Nov 2025 21:48:05 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/j7kkg2gbr1-generate-rails-model-with-unique-attribute</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[TOON: Token-Efficient Data Format for LLMs - #computer-science]]>
        </title>
        <link>http://til.hashrocket.com/posts/vmhfguylba-toon-token-efficient-data-format-for-llms</link>
        <description>
          <![CDATA[<p>
Today I discovered <a href="https://github.com/toon-format/spec">TOON (Token-Oriented Object Notation)</a>, a serialization format designed specifically for LLMs that achieves <strong>30-60% token reduction</strong> compared to JSON.</p>
<h2>
Why It's Better</h2>
<p>
Unlike JSON, TOON eliminates redundant syntax (braces, brackets, most quotes). Unlike CSV, it supports <strong>nested fields</strong>. It also provides better accuracy through explicit lengths and fields before hand, this seems to make LLM better to understand the data that's comming.</p>
<h2>
Example</h2>
<p>
<strong>JSON</strong>:</p>
<pre><code class="json language-json">{
  "users": [
    { "id": 1, "name": "Alice", "role": "admin" },
    { "id": 2, "name": "Bob", "role": "user" }
  ]
}</code></pre>
<p>
<strong>TOON</strong>:</p>
<pre><code>users[2]{id,name,role}:
  1,Alice,admin
  2,Bob,user</code></pre>
<p>
Keys are declared once, then data flows as comma-separated rows with YAML-style indentation for nesting.</p>]]>
        </description>
        <dc:creator>viniciusnegrisolo</dc:creator>
        <pubDate>Tue, 11 Nov 2025 21:31:36 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/vmhfguylba-toon-token-efficient-data-format-for-llms</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Filter RSpec Tests by Type - #rails]]>
        </title>
        <link>http://til.hashrocket.com/posts/wjdikz1xcc-filter-rspec-tests-by-type</link>
        <description>
          <![CDATA[<p>
Sometimes I just want to run <code class="inline">model</code> rspec tests, or run everything except for those slow <code class="inline">feature</code> tests in my rails app. Today I learned you can do that with the <code class="inline">--tag</code> option.</p>
<p>
To only run <code class="inline">model</code> specs:</p>
<pre><code>$ bundle exec rspec --tag type:model</code></pre>
<p>
To exclude <code class="inline">feature</code> specs (using the <code class="inline">~</code>):</p>
<pre><code>$ bundle exec rspec --tag ~type:feature</code></pre>
<p>
What's convenient is <code class="inline">rspec-rails</code> will infer the <code class="inline">type</code> of the spec based on it's location in the <code class="inline">spec/</code> directory, so even if you don't explicitly tag your tests with <code class="inline">type: :model</code> these filters will still work.</p>
<p>
<a href="https://rspec.info/features/3-13/rspec-core/command-line/tag/">rspec --tag option docs</a></p>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Tue, 11 Nov 2025 18:42:14 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/wjdikz1xcc-filter-rspec-tests-by-type</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[Delete Lines with Patterns and Ex Commands - #vim]]>
        </title>
        <link>http://til.hashrocket.com/posts/wwyk7usrgq-delete-lines-with-patterns-and-ex-commands</link>
        <description>
          <![CDATA[<p>
Today I learned some cool ways to delete lines of text in (n)vim. <a href="https://til.hashrocket.com/posts/11b908779e-delete-lines-that-match-a-pattern">Josh TIL'ed</a> that you can execute an Ex command on a buffer with the <code class="inline">:g</code> command. So if you want to delete any lines that match <em>pattern</em>, you can run </p>
<pre><code>:g/pattern/d</code></pre>
<p>
Which is pretty neat! But you can also flip it - to delete any lines that <strong>don't</strong> match the pattern, you can use <code class="inline">:v</code> or <code class="inline">:g!</code></p>
<pre><code>:v/pattern/d</code></pre>
<pre><code>:g!/pattern/d</code></pre>
<p>
You can also restrict to a range of lines - if you want to only delete lines matching <em>pattern</em> between lines 40 and 50, you can do so with:</p>
<pre><code>:40,50 g/pattern/d</code></pre>]]>
        </description>
        <dc:creator>tonyyunker</dc:creator>
        <pubDate>Fri, 07 Nov 2025 17:54:20 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/wwyk7usrgq-delete-lines-with-patterns-and-ex-commands</guid>
      </item>
    
      <item>
        <title>
          <![CDATA[React Activity component - #react]]>
        </title>
        <link>http://til.hashrocket.com/posts/xlette7yrw-react-activity-component</link>
        <description>
          <![CDATA[<p>
Today I learned about React 19.2’s new <code class="inline">&lt;Activity&gt;</code> component.</p>
<pre><code class="tsx language-tsx">&lt;Activity mode={isShowingSidebar ? "visible" : "hidden"}&gt;
  &lt;Sidebar /&gt;
&lt;/Activity&gt;</code></pre>
<p>
When <code class="inline">mode="hidden"</code>, React unmounts all <code class="inline">useEffect</code>, it keeps state cached and yet the DOM stays rendered via <code class="inline">display: none</code>.</p>
<p>
Switching back to <code class="inline">mode="visible"</code> restores the view instantly with its previous state and fire all <code class="inline">useEffect</code> again.</p>
<p>
This is perfect for tabs, modals, and any UI you want ready-to-go.</p>
<p>
reference: <a href="https://react.dev/reference/react/Activity">React Activity docs</a></p>]]>
        </description>
        <dc:creator>viniciusnegrisolo</dc:creator>
        <pubDate>Fri, 07 Nov 2025 15:38:00 GMT</pubDate>
        <guid isPermaLink="true">http://til.hashrocket.com/posts/xlette7yrw-react-activity-component</guid>
      </item>
    
  </channel>
</rss>
