makandra dev

...babysitting Claude Code (default mode) and giving the LLM a loaded gun (bypassPermissions / --dangerously-skip-permissions). When the agent proposes a tool call that requires confirmation, a secondary Claude instance...

...receives it to decide whether to confirm or deny: Generally speaking, reversible, reading commands like git diff are allowed while irreversible commands like an rm -rf are prevented.

makandra dev

Getting parseable output back from an LLM has two halves: shaping the request, then parsing the response. Even with Ollama's format: parameter set, models leak conversational preamble like Sure...

Message types Ollama's chat endpoint takes a messages array with four roles: system, user, assistant and tool. The following message pattern works well for us: one system message...

...by default, effectively allowing anyone to upload an unlimited amount of files to your storage. The DirectUploadController from @rails/activestorage bypasses your form controller because it uploads the file using an...

...AJAX request that runs directly, before any form roundtrip happens. This is a comfortable solution to allow in-form uploads with progress, errors etc. Otherwise, the file would be uploaded...

...Saving files to a directory that is not shared between deploys or servers If you save your uploads to a made up directory like "RAILS_ROOT/uploads", this directory goes away...

...after every deploy (since every release gets a new). Also this directory is not shared between multiple application servers, so your uploads are randomly saved to one local filesystem or...

...the agent's help, from the route to the response. You can find where something is implemented, and learn a project's conventions and vocabulary. You can explain why an...

...agent sometimes describes code that isn't there, and verify its claims against the actual code. You can keep an exploration session useful by scoping your questions so the context...

makandra dev

Hybrid search runs a vector query and a keyword query in parallel against the same documents and merges the two ranked search results. Reach for it once either approach alone...

...performs better with extracted keywords ("parental leave department"), unless you have a very elaborate analyzer (stop-word filter, stemming, language-aware tokenization, etc.). Document and Query Embeddings need different instructions...

dev.to

...you read this file with the Nokogiri default (DOM) parser, it creates a tree structure with all branches and leaves. It allows you to easily navigate through it via css/xpath...

The only problem is that if you read the whole file into memory, it takes a significant amount of RAM. It is really ineffective to pay for a server...

makandra dev

git checkout is the swiss army of git commands. If you prefer a semantically more meaningful command for restoring tasks, use git restore instead. With this command you...

... do unstaging - git restore --staged ... discard staged changes - git restore --staged --worktree ... discard unstaged changes - git restore ... restore deleted files - git restore ... restore historic versions - git restore --source

stackoverflow.com

When you want to find out the data type of an attribute, you can just use ActiveRecord's columns_hash...

...building a web application, one is tempted to claim it "done" too early. Make sure you check this list. Different screen sizes and browsers Desktops, tablets and mobile devices have...

...state while requests are loading. If you cannot implement this for every interaction, focus on slow-loading links and forms. Use Responsive Images to give each user only the image...

makandra dev
stackoverflow.com

...it's present inside the first 4k of you page. If you put it somewhere in the bottom of your head section (or in the body) move it to top...

...UA-Compatible is ignored if it's put inside IE conditional comments. Also, you shouldn't have any text before the doctype declaration. If you've got any HTML comments...

Haml 3.1.2 displays single quotes in FormBuilder#text_ field html escaped. You may see something like that: David's Chapter Looking at the page's HTML, your field's...

...that well: how to align on a plan before code is written, how to shape the agent's behavior, how to make it verify its own work, and how to...

...keep a session productive. Important Work on this lesson in builder mode. Learning goals You can explain when planning with an agent pays off and when it is overhead, and...

...Everything you build from here on attaches to it — Rails renders HTML, your CSS selects it, your JavaScript walks it. Important Work on this lesson in teacher mode. Note

...things beginners get wrong: headings are for structure, not for size ( because it's a sub-section, not because you wanted smaller text), and an element must be closed inside...

...detailed error message, you can do a Hash#decent_fetch (with the attached code). some_hash.fetch('missing_key') # => KeyError: key not found: "missing_key" some_hash.decent_fetch('missing_key') # => KeyError: Key "missing...

...found in {"id"=>"96814974590_10152840169159591", "created_time"=>"2014-11-18T20:30:41+0000", "story"=>"Audi Deutschland commented on a photo."} You could put this code in an initializer:

...can do it like this: def classes_defining_method(method_name) method_name = method_name.to_sym ObjectSpace.each_object(Module).select do |mod| instance_methods = mod.instance_methods.map(&:to_sym) # strings in old Rubies...

...symbols in new Rubies (instance_methods & [method_name]).any? && mod.instance_method(method_name).owner == mod end end So, when we want to know all classes that define a to_s...

askubuntu.com

Adobe no longer supports their PDF reader on Linux and the official page does not offer it for download. \ However, some files may not display properly on Ubuntu's default...

...PDF reader Evince or PDF forms may not work as expected. Hence, you may still need to use it. Here is how to install the Adobe Reader (acroread) if you...

makandra dev

To change RAM size, VDISK size or VCPU count of an openstack instance you have to use nova resize. You can't change for e.g. just the RAM size with...

...a parameter, you have to assign a new/other flavor. If there is no suitable flavor for the new properties of the VM, create a new one. nova resize [--poll]

...more complicates it is easier to understand and to process. Note: In case a string does not match the pattern, .match will return nil. With Ruby 2.4 the result of...

...transformed to a Hash with named_captures. This allows you to use methods like slice or fetch on the result. Example with a multiple assignment PRODUCT_PATTERN = /\A(.+) S\/N...

...and — more and more — code that an agent wrote for you. Reviewing is a skill of its own. This lesson teaches you what to look for, how to write useful...

...code review is for: a code base that gets better over time, knowledge that spreads, bugs caught before users find them. You can review a change in order of importance...

TypeScript basically uses structural typing, which is conceptually quite similar to duck typing, but with static compile-time type checking. We'll explore what this means in practice.

...a superset of JavaScript, meaning TypeScript compiles down to native JavaScript syntax and checks type consistency only at compile time. Idea of Structural Typing TypeScript only wants to know whether...

...but does not have to be. It's actually very easy when done right. Summary (tl;dr) Here's the short version: Define a table_name_prefix method in the...

...not define any table_name_prefix in ActiveRecord classes inside of it. If this sounds familiar, we have a card about using it already. This card explains why you want...

Let's say you need to revert a migration that happened a while back. You'd create a new migration that removes what was added back then in the up...

...do that. Especially when the up/down paths already contained some logic (that executed update statements on the created column, for example), copying does not feel right. Someone already added the...

...following places and uses the first implementation it finds: Methods from the object's singleton class (an unnamed class that only exists for that object) Methods from prepended modules (Ruby...

...from the object's class Methods from included modules Methods from the class hierarchy (superclass and its ancestors) Example Let's say we have the following class hierarchy: class Superclass...