Any form fields where users enter numbers should be an . Numeric inputs have several benefits over : On mobile or tablet devices, number fields show a special virtual keyboard that shows...

...mostly digit buttons. Decimal values will be formatted using the user's language settings. For example, German users will see 1,23 for . Values in the JavaScript API or when...

makandra dev
gist.github.com

...cases beyond that to make your life easier. For this cheatsheat I tried to structure the most useful commands by different use cases, such that a practical oriented overview of...

...some commands I added some tips for their usage and further details on their subcommands For most of the commands shortly explained here, there are some examples along with a...

gedd.ski

...intrinsic width of your content play together. The attached article explains the differences. In summary: If a flex-basis is set, that is used as the basis

...basis is set, the width is used as the basis If neither flex-basis nor width is set, the content's computed width is used as the basis

...consider processing your images with libvips instead of ImageMagick. Reasons for libvips There are several upsides to using libvips over ImageMagick: libvips is considerably faster and uses less memory.

...has a large attack surface that has repeatedly caused security incidents in the past (compare ImageMagick CVEs with libvips CVEs). Ubuntu is sometimes slow to fix the numerous ImageMagick vulnerabilities...

...be answered with an empty response if the underlying content hasn't changed. This saves CPU time and reduces the bandwidth cost for a request/response exchange to about 1 KB...

...can be considered secure. Random masking of CSRF tokens was introduced to mitigate BREACH, a side-channel attack against HTTPS that was published in 2013. BREACH is pretty hard to...

Jasmine specs for the frontend often need some DOM elements to work with. Because creating them is such a common task, we should have an efficient way to do it...

...Let's say I need this HTML structure: item 1 item 2 This card compares various approaches to fabricating DOM elements for testing. Constructing individual elements While you can use...

...operators typeof and instanceof which work very differently. JavaScript has some primitive types, like string literals, that are not objects (as opposed to Ruby, where every value is an object...

...Some values are sometimes a primitive value (e.g. "foo") and sometimes an object (new String("foo")) and each form requires different checks There are three different types for null (null...

api.rubyonrails.org

...However, you need to be aware of the overall transaction nesting constellation, because creating proper sub-transactions can lead to unwanted or too early triggering of after_commit callbacks:

...project> Country.first.name # => "Afghanistan will not change" Wait. What happened to the rollback in the after_save-callback? From the Rails docs: Transaction calls can be nested. By default, this makes...

By default, Rails views escape HTML in any strings you insert. If you want to insert HTML verbatim, you need to call #html_safe. However, #html_safe does not "unescape...

...a string. It merely marks a string as safe for unescaped insertion. How html_safe works Calling html_safe on a String returns a new object that looks and acts...

TL;DR When using Cache-Control on a Rails application, make sure the Vary: Accept header is set. Proxy caching is a good feature to serve your publicly visible application...

...server SHOULD include a Vary header field with any cacheable response that is subject to server-driven negotiation. Doing so allows a cache to properly interpret future requests on that...

...is hard coded. A popular example is extension_allowlist, which returns an array of strings and let's you only upload files that have a filename with an extension that...

...matches an entry in that array. Another useful validation can be size_range, which gives you a little bit of control over how your storage gets polluted.

thegnar.com

View specs are a powerful tool to test several rendering paths by their cases instead of using a more costing feature spec. This is especially useful because they become quite...

...used with Capybara::Node::Finders and Capybara::RSpecMatchers. This allows to wirte view unit specs as you can isolate specific parts of the rendered view and then use readable and...

makandra dev

This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the ActiveRecord ORM used with Ruby on Rails, but the techniques...

We will be using this example tree (from the acts_as_nested_set docs): root | +-- Child 1 | | | +-- Child 1.1 | | | +-- Child 1.2 | +-- Child 2 | +-- Child 2.1 | +-- Child 2.2

...update your window title whenever you switch directories, simply specify a PROMPT_COMMAND environment variable. set-window-title() { echo -en "\033]0;$(pwd | sed -e "s;^$HOME;~;")\a" } if [[ "$PROMPT...

...COMMAND" ]]; then export PROMPT_COMMAND="$PROMPT_COMMAND;set-window-title" else export PROMPT_COMMAND=set-window-title fi You may put that into your ~/.bashrc to persist and automatically activate...

I recently stumbled upon the Rails feature composed_of. One of our applications dealt with a lot of addresses and they were implemented as 7 separate columns in the DB...

...and Rails models. This seemed like a perfect use case to try out this feature. TLDR The feature is still a VERY leaky abstraction. I ran into a lot of...

github.com

For my computer science bachelor's thesis I programmed and evaluated a CLI Test Case Prioritization (TCP) tool for makandra. It has been written as a Ruby Gem and was...

...as T2 > T3> T1 > T4 > T5 > T6. Selection of a strategy In the preselection coverage-, search-based, model- and combinations of different prioritization methods. History- and fault-based approaches could...

makandra dev

This is a presentation from 2019-01-21. Summary We want to move away from jQuery in future projects Motivations are performance, bundle size and general trends for the web...

...can polyfill the missing pieces Unpoly 0.60.0 works with or without jQuery Is jQuery slow? From: Sven To: unpoly@googlegroups.com Subject: performance on smartphones and tablets Hello I just used your...

Slides for Henning's talk on Sep 21st 2017. Understanding sync vs. async control flow Talking to synchronous (or "blocking") API print('script start') html = get('/foo') print(html)

Script outputs 'script start', (long delay), '...

...', 'script end'. Talking to asynchronous (or "evented") API print('script start') get('foo', done: function(html) { print(html) }) print('script end')

This is an attempt to list some of those things: On the server Always optimize: Don't do stupid things with the database. Avoid "n + 1" queries. Don...

...Use form models. Optimize on demand: Don't optimize without knowing what's actually slow. Measure first, for example by using a performance monitoring tool like NewRelic, Scout, AppSignal, Skylight...

Spreewald comes with a selector_for helper that matches an English term like the user's profile into a CSS selector. This is useful for steps that refer to a...

...particular section of the page, like the following: Then I should see "Bruce" within the user's profile ^^^^^^^^^^^^^^^^^^ If you're too lazy to manually translate English to a CSS...

github.com

The maintenance mode is enabled on all application server as soon as the file /public/system/maintenance.html is present. Installation Add this line to your application's Gemfile: gem 'capistrano...

...application's web interface by writing a #{maintenance_basename}.html file to each web server. The servers must be configured to detect the presence of this file, and if it...

...the everyday use without any parameter tweaking I'm using a collection of tiny scripts in my ~/bin folder that can then be used as bash functions. And: It's...

...video-to-audio /path/to/cake.mp4 cake.mp3 audio-to-audio /path/to/cake.mp3 cake.aac image-to-image /path/to/cake.png cake.jpg stateDiagram-v2 text --> image: Dall-E 3 text --> audio: GPT TTS image --> text: GPT Vision...

Code splitting is a feature of esbuild that can keep huge libraries out of the main bundle. How code splitting works Like Webpack esbuild lets you use the await import...

...code on demand: // application.js const { fun } = await import('library.js') fun() However, esbuild's code splitting is disabled by default. The code above would simply inline (copy) library.js into application.js:

Note: Consider using MATE instead of Gnome 3 on newer system Awesome is a very good tiling window manager that provides neat features like automatic layouting of windows, good multi...

Improve your font-rendering Copy /etc/xdg/awesome/rc.lua to ~/.config/awesome/rc.lua. Take a look, it's pretty self-explanatory. You can instantly apply changes by reloading Awesome with Meta-Ctrl-R.