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
github.com

The shell variable PS1 holds your bash prompt. You might want to change it to serve your needs best. Here is how to: General non-printing escape sequences in your...

=> ✔ mycomputer ~/projects/platforms master > _ # Arne's epic timestamped prompt with return status indicator and status-colored (green if fresh, or red if unstaged, or yellow if staged) git branch:

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...

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...

...absence of error end end end Standard validations can be tested with less code The shoulda-matchers gem gives you some RSpec matchers to test the application of standard Rails...

...validations. Under the hood should-matchers uses the same recipe as outlined above (set invalid state, run validations, check for message, etc.), but your tests will have a lot less...

...line goes from baseline up to the capital top. That's because text usually starts with a capital letter, plus descenders are far less frequent than ascenders.

...center an icon (or any "blockish" inline element, really) with the capital letters of surrounding text. This works well with our modern approach to SVG icons, or e.g. for custom...

When you need the DOM node of a tag (e.g. to read extra attributes, or to modify the DOM near it), you can usually reference it via document.currentScript. However, document.currentScript is unsupported in ancient browsers, like Internet Explorer 11 or wkhtmltopdf's Webkit engine. If you are not running async scripts, you can easily polyfill it: document.scripts[document.scripts.length - 1] It works because document.scripts grows with each tag that was evaluated. That is also the reason why this solution will not work reliably for async code. Demo: https://codepen.io/foobear/pen/poRLxQm

...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. Learn Prompts that work Start broad, then narrow down. Good first questions for an...

stackoverflow.com

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

...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...

makandra dev
stackoverflow.com

...you to find a parental element using CSS or XPath. If you previously did something like this: field.find(:xpath, './ancestor::div[contains(@class, "form-group")]') ..and prefer CSS, you may...

...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...

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...

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

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...

...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...

...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

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...