Skip to content

Instantly share code, notes, and snippets.

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

Rob Lacey braindeaf

🏠
Working from home
View GitHub Profile
module Haml::Filters::CodeConcern
extend ActiveSupport::Concern
def render(text)
<<~CODE
<div class="sa-code-snippet-wrapper">
<div class="sa-code-snippet">
<div class="code-title">HAML Snippet</div>
<button class="copy-code-button">Copy</button>
<pre class="chroma"><code>#{Haml::Helpers.preserve text}</code></pre>
</div>
@braindeaf
braindeaf / method_trace.rb
Created September 10, 2025 20:34
Using MethodTrace to identify where Memoizing might be helpful.
#
# With reference to
# Just a run-down of TracePoint
#
# https://medium.com/@baweaver/exploring-tracepoint-in-ruby-part-one-example-code-2cf9b1a1b956
# Rotoscope tracks method invocations but not arguments
#
# https://github.com/Shopify/rotoscope
#
# Rack::MethodTrace - allows us to see which methods are called more than once and which are memoized