{
    "version": "https://jsonfeed.org/version/1",
    "title": "Rybarix",
    "home_page_url": "https://rybarix.com",
    "description": "Learnings and dev logs from rybarix.com",
    "author": {
        "name": "Sandro Rybarik",
        "url": "https://rybarix.com"
    },
    "items": [
        {
            "id": "https://rybarix.com/tils/uperfect-coil-whine.html",
            "content_html": "<p>If you have problem with uperfect monitor and you are using with MacBook then this is for you.</p>\n<p>The coil whine is present when the display is powered only from MacBook.</p>\n<p>Uperfect monitors support power pass through which actually removes the coil whine.</p>\n<p>So plug MacBook power source into the monitor and connect monitor to the MacBook. This way the mac gets all the power and the monitor won&#39;t whine.</p>\n",
            "url": "https://rybarix.com/tils/uperfect-coil-whine.html",
            "title": "Uperfect external monitor with coil whine",
            "date_modified": "2026-03-17T00:00:00.000Z",
            "tags": [
                "TIL"
            ]
        },
        {
            "id": "https://rybarix.com/tils/swift-state.html",
            "content_html": "<h2><code>@State</code></h2>\n<p>Marks view&#39;s property as reactive. Like React&#39;s <code>useState()</code> or Vue&#39;s <code>ref()</code>.<br>Triggers rendering when changed.</p>\n<h2><code>@Binding</code></h2>\n<p>Same concept as <code>v-model</code> in Vue. Marks view&#39;s property for 2-way binding.<br>Modifying the property inside view will propagate changes outside.</p>\n<h2><code>ObservableObject</code> Protocol and <code>@ObservedObject</code></h2>\n<pre><code class=\"language-swift\">class OrderModelController: ObservableObject {\n    // @Published notifies watchers when order is modified\n    @Published var order: Order\n}\n\n\nclass SomeView: View {\n    // This may cause issues during re-render when the @ObservedObject is owned by view and is not injected\n    @ObservedObject var orderController = OrderModelController.load()\n    // ^ Use @StateObject in this case.\n}\n</code></pre>\n<hr>\n<p>In general you want something like this:</p>\n<pre><code class=\"language-swift\">// SomeView.swift\nclass SomeView: View {\n    @ObservedObject var injectedState: MyState\n    init(myState: MyState) {\n        self.injectedState = myState\n    }\n}\n\n// SomeModel.swift\nclass SomeModel: ObservableObject {\n    @Published var stateVariable: MyState\n\n    init() {\n        // initialize model\n    }\n}\n\n// We are sharing the state from top to the bottom.\n// This prop drilling can be mitigated by\n// Entrypoint\n// MyApp.swift\n@main\nstruct MyApp: App {\n    @StateObject private var myState: MyState\n\n    init() {\n        self._myState = StateObject(wrappedValue: MyState())\n    }\n\n    var body: some View {\n        // View here\n    }\n}\n</code></pre>\n",
            "url": "https://rybarix.com/tils/swift-state.html",
            "title": "Swift state management",
            "date_modified": "2026-02-23T00:00:00.000Z",
            "tags": [
                "TIL"
            ]
        },
        {
            "id": "https://rybarix.com/tils/simpler-sql.html",
            "content_html": "<p>How to make SQL more readable?</p>\n<p>Is it even good question when it is closer to english than any other <em>programming</em> language?</p>\n<p>My bet (and hope) is that SQL will be more common knowledge as spreadsheet formulas are.</p>\n<p>It&#39;s expressive and quite powerful and get works done. I would say that it is much more easier to write than it is to read.</p>\n<p>Composing queries in your head will make sense to you as you go step by step. Reading others larger SQL statements <em>will</em> be challenging as you try understand how the other person went to solve a problem.</p>\n<p>Quite a lot of &quot;Explain SQL AI&quot; solutions popped up lately. And I get it that there is a need to break down the SQL to natural language. But the question is: Can you trust it? Nope.</p>\n<p>So, we are not leaving the code anytime soon. And that&#39;s good thing! How to present SQL to novices or people new to the field?</p>\n<p>If only there was a SQL to Spreadsheet formulas translation. But there isn&#39;t and it wouldn&#39;t make things easier based on my experience with large nested formulas from complicated spreadsheets.</p>\n<p>Currently, my best solution is to break the SQL query into series of simpler steps and display it as a visual graph.\nWhere you start at the left and work towards to the right. It&#39;s not perfect but it is deterministic and doesn&#39;t hide any details. The vision is to invite users to learn not isolate them. At the end of the day, who would take responsibility for outputs that they can&#39;t verify or trust?</p>\n<p><img src=\"/imgs/sqlflow.png\" alt=\"Sql diagram\"></p>\n<p>A nice side-effect of this approach is the ability to run query partially and understand the temporary results. It&#39;s not perfect but it&#39;s much better than big SQL snippet.</p>\n",
            "url": "https://rybarix.com/tils/simpler-sql.html",
            "title": "Simpler SQL",
            "date_modified": "2026-02-17T00:00:00.000Z",
            "tags": [
                "TIL"
            ]
        },
        {
            "id": "https://rybarix.com/tils/rs-enum-mem.html",
            "content_html": "<p>Something not immediately obvious but obvious after thinking about it for a minute is memory size of tagged unions.</p>\n<p>Each Token will take up 40B + size of enum discriminant - 1B (tag) which will be aligned to 8B because entire structure needs to be aligned by the highest data type size (usize or String (ptr inside is 8B)) which is 8B.</p>\n<pre><code class=\"language-rs\">struct Span {\n    line: usize,   // 8 bytes\n    column: usize, // 8 bytes\n}\n\nenum Token {\n    Identifier {\n        name: String,  // 24 bytes\n        location: Span // 16 bytes\n    },\n    Number {\n        value: i32,    // 4 bytes\n        raw: String    // 24 bytes\n    },\n    If(Span),          // 16 bytes\n}\n</code></pre>\n",
            "url": "https://rybarix.com/tils/rs-enum-mem.html",
            "title": "Rust enums cost",
            "date_modified": "2026-02-04T00:00:00.000Z",
            "tags": [
                "TIL"
            ]
        },
        {
            "id": "https://rybarix.com/dev/lang/init.html",
            "content_html": "<p>I was thinking about this for more than one year now.</p>\n<p>It is time to give it a shot and create brand new scripting language that is secure by default.</p>\n<p>What security means in this context?</p>\n<ul>\n<li>capbalities for io, networking etc.</li>\n<li>safe to run untrusted code</li>\n<li>memory limits and fuel backed into runtime</li>\n<li>embeddable into server environments allowing user scripting</li>\n<li>allow injecting host functions into the runtime</li>\n</ul>\n<p>The main goal is to have runtime and allow user scripting without relying on OS APIs.</p>\n<p>Every single general-purpose programming language assume that code is written by trusted programmer.</p>\n<p>If it was easy to turn any programming language into safe one, this page wouldn&#39;t exist.</p>\n<p>Why not WASM?</p>\n<p>WASM is promising runtime and combined with WASI, it should be useful for sandboxing other programming languages.</p>\n<p>But using WASM prevents to see what would be possible if langauge itself was built with sandboxing in mind from day 1.</p>\n",
            "url": "https://rybarix.com/dev/lang/init.html",
            "title": "Sandbox-first language",
            "date_modified": "2026-02-04T00:00:00.000Z",
            "tags": [
                "Dev Log"
            ]
        },
        {
            "id": "https://rybarix.com/tils/ai-anthropo.html",
            "content_html": "<p>You can&#39;t talk to the AI without treating it like a human.</p>\n<p>They say: &quot;Treat it like a tool&quot;.</p>\n<p>But how can you instruct the tool without &quot;talking&quot; it to it like a human?!</p>\n",
            "url": "https://rybarix.com/tils/ai-anthropo.html",
            "title": "Can you treat AI as a tool?",
            "date_modified": "2026-01-13T00:00:00.000Z",
            "tags": [
                "TIL"
            ]
        }
    ]
}