You can define what will be printed by checking View -> Preview Page Breaks and then moving around the blue borders...

Connect to your memcached host. (AWS elasticache is memcached) telnet foohost23.cs2631.0001.euw1.cache.amazonaws.com 11211 Once you're connected, find out which 'slabs...

This might seem obvious, but I'm rejecting stories because of this on a regular basis. Whenever a list (e.g...

ruby-doc.org

Ruby has the class Rational which allows you to store exact fractions. Any calculation on these variables will now use...

...visibilitychange event to be notified if visibility changes. This allows your background tab to become completely passive: function pulse() { // do expensive thing } let pulseInterval function schedulePulse() { if (document.hidden) { if (pulseInterval...

Sometimes you accidentally generate entries in the bash history that you do not want to have there (e.g. commands with...

The Truemail gem (not to be confused with truemail.io) allows validating email addresses, e.g. when users enter them into a...

This only works when you actually have a session ID (not the case for Rails' CookieStore, for example): request.session_options...

You can use the config.x configuration in combination with config_for to configure global settings for your Rails 4.2+ application...

The DB schema is the most important source of truth for your application and should be very self-explanatory. If...

Apache HTTP server benchmarking tool (ab) is a nice tool to test performance on sites delivered by HTTP. If the site you're about to test is placed behind a...

...value_2;cookie_name_3=cookie_value_3 ... Open a terminal and run your benchmark: ab -n 100 -c 10 -C $cookie_string http://your_site/admin/site-to-load. man ab to find...

kernel.org

...John Doe <user@example.com> Date: Thu Dec 23 13:37:00 2010 +0100 make everything better Once you are done bisecting you can go back with git bisect reset

Sometimes you need to remove high Unicode characters from a string, so all characters have a code point between 0...

...be guessable, but exposing your dev server to the internet is generally not the best idea. In my tests I was not easily able to get a better errors console...

...to cache or persist it, you can use to_pem: certificate_data = certificate.to_pem # => "-----BEGIN CERTIFICATE-----\nMIIHQDCCBiigAwIBAgIQD9B43Ujxor1NDyupa2A4/jANBgkqh..." You can then instantiate a Certificate from that string: certificate = OpenSSL::X509::Certificate.new...

has_many :images, through: :album_images end # Join model class AlbumImage < ActiveRecord::Base belongs_to :album belongs_to :image end Destroying a record in this setup will only remove...

...the record itself, and leave orphaned join records behind. image = Image.last image.destroy # removes only the `image` record, # but none of the associated `album_image` join records Good

Event delegation is a pattern where a container element has a single event listener that handles events for all descendants...

Git commits should be very deliberate, and only contain changes that you really want to be in there. In order...

mitrev.net

user&.name # => nil This might remind you of andand, and indeed it behaves very similar. The only difference is in handling of false, as false.andand.class returns false (intercepts...

Note netstat has mostly been superseeded by its more modern rewrite ss which nowadays comes pre-installed rather than netstat...

makandra dev

Starting with Ruby 1.9, most #each methods can be called without a block, and will return an enumerator. This is...

I often see the use of || to set a default value for a variable that might be nil, null or...

A common task in web applications is to add client-side JavaScript behavior to existing HTML elements. For instance, in Working with the DOM you built a movie counter...

✔️ Reliable invocation Using the HTML markup above should always result in the same behavior. Components are usually invoked when a particular CSS selector matches a new DOM element. This...

makandra dev

There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...