absorb.md

Tobi Lütke

Chronological feed of everything captured from Tobi Lütke.

The Positional Game: Engineering High-Growth Systems via First Principles

High-performance company building requires a shift from quantitative 'tactical' optimization to 'positional' strategic thinking and first-principles derivation. By treating the business as a series of nested functions that must be re-run when foundational booleans change, leaders can avoid the local maxima of path-dependent legacy solutions. True competitive alpha is found in the unquantifiable—fun, delight, and the reduction of psychological friction (courage barriers) for the end user.

Snowman Fokus: A Customizable Browser Blocker for Enhanced Productivity

Snowman Fokus is a Greasemonkey-compatible script designed to block distracting websites, promoting focused work. It offers a unique feature to display random quotes from Readwise if an API key is provided, transforming blocked screens into a source of valuable content. The tool emphasizes user customizability, serving as a base for personalized "ADHD hacking" solutions.

Tobi Lütke on Contentment, Constraints, and Craft in Business

Tobi Lütke, CEO of Shopify, discusses his philosophies on work, leadership, and personal fulfillment. He emphasizes the pursuit of "contentment" over "happiness" and highlights the critical role of constraints in fostering creativity and effective team collaboration. Lütke also advocates for a "truth-seeking" approach to decision-making, in contrast to prioritizing perceived "rightness" within social contexts.

Durable SQLite for Rails Production with Litestream via Docker

This Gist demonstrates a Dockerfile setup for deploying a Rails application to production using SQLite3 for data persistence, made durable with Litestream. The configuration outlines pulling Litestream, setting environment variables for database path and S3 replication, installing Ruby dependencies, precompiling assets, and linking the database. The `CMD` orchestrates Litestream to restore the database if it doesn't exist, run migrations, and then replicate changes while running the Rails server.

Kindle Highlights to Obsidian Markdown Converter

This Ruby script automates the extraction of Kindle highlights and notes from Amazon's Kindle Cloud Reader and converts them into individual Markdown files. These files are formatted for compatibility with knowledge management tools like Obsidian.md, including metadata such as title, author, ASIN, and location links for each highlight.

Tobi Lütke: The Entrepreneurial Mindset and Shopify's Growth

Tobi Lütke, CEO of Shopify, discusses his unique approach to business, emphasizing continuous learning, challenging assumptions, and solving fundamental problems. He highlights the importance of fostering an entrepreneurial spirit and a growth mindset within his company, even in the face of significant challenges. Lütke advocates for stripping away inefficiencies and focusing on core value creation, drawing from his personal experiences and the evolution of Shopify.

Tobi Lütke Verifies GitHub Ownership via Keybase PGP Signature

Tobi Lütke claims identity linkage between GitHub username 'tobi' and Keybase profile 'tobi' using a PGP-signed proof object. The proof includes key fingerprint 7D83 588B B379 6236 C5E1 E2FB 05AC 86DA DD36 CAA2, a JSON body specifying the web service binding, and an embedded PGP signature verifiable on keybase.io. Ownership is demonstrated by publishing the signed gist on GitHub, enabling public auditability via Keybase CLI tools.

Ruby Keyword Arguments Are 9x Slower Than Positional Arguments, Hash Arguments 4x Slower

Benchmark by Shopify CTO Tobi Lütke compares Ruby method calls with positional arguments, keyword arguments, and hash arguments over 1 million iterations. Positional arguments complete in 0.176s real time, hash arguments in 0.795s, and keyword arguments in 1.677s. Keyword syntax imposes the highest performance penalty, exceeding even explicit hash unpacking.

Go MySQL Driver Fails to Scan DATETIME into time.Time

Tobi Lütke's 2012 Gist demonstrates a scanning error in Go's database/sql with the go-mysql-driver when querying a MySQL DATETIME column into a time.Time variable. The driver returns []uint8 instead of a scannable time.Time, causing "unsupported Scan pair" error. This highlights early limitations in Go MySQL driver type conversion for temporal data.

Tobi Lütke's Simple Ruby Class for Graceful Periodic Task Scheduling

Forever is a lightweight Ruby class that schedules recurring tasks via Thread.new loops checking elapsed time against a timespan, executing blocks only when due. It supports multiple independent timers through an array of threads and blocks on all joins in run() until an external INT signal sets $done. Handles clean shutdown via global trap("INT") { $done = true }, with 1-second sleep granularity for low CPU usage.

JavaScript Utility for Precise Date Range Selectors in Reporting

This CoffeeScript function generates start and end timestamps for common reporting periods like Yesterday, Last 7 days, This Week, Last Week, This Month, and Last Month. It resets the current date to midnight, computes boundaries using millisecond offsets for days, and derives month starts/ends by manipulating day-of-month offsets. The output is an object mapping period names to [start, end] timestamp arrays, enabling quick access to standardized timespans.

Minimal JSONP Client via Dynamic Script Injection

Provides a concise JavaScript implementation of JSONP using dynamic script element insertion to bypass same-origin policy for cross-domain API calls. Generates unique callback names, appends them to the request URL, defines global callback handlers that process responses and self-cleanup, then fetches and logs recent tweets from Twitter. Demonstrates practical usage with Twitter's user_timeline endpoint returning JSON arrays processed via forEach.

JavaScript for-loop closures capture shared variable reference, not snapshot values

In JavaScript, functions created inside a for loop share the same lexical scope for the loop variable `c`, so all closures reference its final value rather than individual iterations. This behavior occurs because JavaScript has function-level scope, not block-level, causing unexpected outputs when invoking the functions. Fixes include using `forEach`, `map`, or shadowing the variable inside each closure with `var c = ary[i]`, though traditional loops may be faster for performance-critical code.

Redis-Based Hierarchical Stats Aggregation for Shopify Shops

Tobi Lütke prototypes a lightweight stats server using Redis for Shopify, aggregating metrics like hits, visits, and traffic in time-based keys from year down to hour granularity per shop. The incr method supports counters across hierarchies and optional set collections for unique items like referrers or search terms. Usage tracks request objects, new sessions, and categorizes traffic sources via a mock Request object.

Tobi Lütke's Ruby Wrapper for SmartMTA SendLabs REST API

Tobi Lütke published a minimal Ruby class, SmartMta, leveraging HTTParty to interact with SmartMTA's SendLabs REST API. The sole method, add_sender, posts an email address to the /senders endpoint using an API key for authentication. It raises an error unless the API returns 'OK', enforcing strict success validation.

ActiveMerchant Extension Enables PayPal Express Recurring Payments via NVP API

Tobi Lütke's GitHub Gist provides a Ruby module extending ActiveMerchant with PaypalExpressRecurringNvGateway for handling recurring payments using PayPal's Express Checkout NVP API. It supports key operations like setting up billing agreements, creating/managing recurring profiles, updating details, and billing outstanding amounts with options for trials, shipping, taxes, and failure handling. The implementation leverages PaypalNvCommonAPI and includes both live and sandbox redirect URLs for seamless integration into Rails applications.

RSpec Mock Error Exposes Private pretty_print Call in Money Gem Allocation Test

Tobi Lütke's GitHub Gist captures a failing RSpec test in money_spec.rb for the Money gem's allocate method. The test expects Money.ca_dollar(0.05).allocate([1]) to return [Money.ca_dollar(0.05)], verifying currency preservation across interest parties. Failure stems from a private method `pretty_print` invoked on an RSpec::Mocks::ErrorGenerator instance, likely during inspection or output formatting.

Ruby JSON Gem Serializes Time Objects as Strings Before Core Mixins Loaded

In REE 1.8.7, requiring 'json' allows Time.now.to_json to produce a string representation, which JSON.parse deserializes back to String rather than Time. Loading the 'json/add/core' mixin afterward fixes deserialization to restore Time objects. This reveals JSON's core extensions for native types like Time are not automatically included on initial require.

Minimal JavaScript Test Framework with Inline Execution

Tobi Lütke's Gist presents a compact, self-contained JavaScript test runner that executes in a browser environment. It defines a TestCase constructor that iterates over an object of test functions, invoking assertions like assertEqual and assertNotEqual, which track success and failure counts via console and document output. The example demonstrates one passing and one failing test, printing real-time progress dots and 'f's before a final summary.

Early Shopify Product Listing Controller Optimizes Pagination and Multi-Format Responses with Eager Loading

This Ruby on Rails controller action fetches paginated products for a shop using dynamic includes and conditions from params. It computes total count separately for pagination, applies fixed sorting by title and vendor, and preloads associations like images, variants, and options based on response format. Supports HTML (with vendors/types), XML, JSON, and CSV exports, demonstrating efficient querying and format-specific optimizations in pre-ActiveRecord 3 era.

Rails Accelerated Belongs-To Optimizes Common Association Lookups via Current Scope Caching

Tobi Lütke's accelerate.rb defines an accelerated_belongs_to method that dynamically generates an optimized belongs_to association for Rails models. It requires the associated class to implement a 'current' class method, then aliases the original association and redefines it to return the cached 'current' instance if its ID matches the foreign key, avoiding redundant database queries. This pattern accelerates frequent lookups of the "current" related record, such as the active shop or user in a session.