ruby-doc.org

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

...there" or "fill that space" (they're not suited for photographs and the like). Benefits are the MUCH smaller file size and the crisp and sharp rendering at any scale...

...actually all browsers pretend to support SVG, some barely complex use cases get you beyond common browser support. In the basic scenario, you use SVGs instead of PNG or JPG...

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

...future we will be able to transition to display: none by using the transition-behavior: allow-discrete property. This will delay the display change until the transition ends. This is...

Expecting a primitive value as an argument to a method invocation is easy: expect(object).to receive(:foo).with('arg1...

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

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

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

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

github.com

...for the event to be processed before continuing - the event could prevent the default behavior. Luckily there is a concept called passive event listeners which is supported by all modern...

...see a performance gain when declaring scroll events as passive. To improve the scrolling behavior you should still try to keep the execution time of your handler to a minimum...

makandra dev

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

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

makandra Curriculum

...have one of the following workflow states: draft pending published declined A movie always begins as a draft and then transitions through the states as it's getting reviewed. This...

...the old versions you wish to remove. Keep at least one recent, working kernel besides the one you are currently running. Address Metapackage Conflict (GA vs. HWE)

makandra dev
github.com

...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 prompt have to be...

makandra dev
github.com

...only a millisecond or two: class FatModelMaterializedJson < ApplicationRecord def self.refresh ActiveRecord::Base.connection.execute(<<~SQL) DO $$ BEGIN IF ( (SELECT last_refreshed_at FROM aggregated_names LIMIT 1) < (SELECT MAX(updated_at) FROM...

...default when assigning attributes. It works good for a small number of attributes, but becomes more difficult to read when using multiple attributes. Example: class User def initialize(salutation, first...

@newsletter = newsletter end end User.new( 'Mr.', 'John', 'Doe', 'Potsdamer Platz 1', '10117', 'Berlin', '+49 0151 1122334455', 'john.doe@example.com', true ) Using keyword arguments Using keyword arguments is easier for others...

...a publicly available service) Understand that Safari and mobile Safari (for iOS) usually lag behind other browsers when it comes to feature support. "Transpilation" and "polyfills" are both techniques to...

...ES versions at the top. English MDN Web API Reference MDN is maybe the best reference for JavaScript, HTML and CSS features. Google my-feature mdn is a quick way...

Occasionally you need to do something directly on the server -- like having all records recalculate something that cannot be done...

digitalocean.com

I recommend install Node.js using nvm. This way you can have multiple Node versions in your ~/.nvm. You also won...

...Tue, 09 Oct 2018 In most of the cases it would be better to use Date.strptime as you can provide a date or time pattern to match against. Date.strptime('Foobar...

...already_read" : 0, "request_body_fully_read" : true, "request_body_type" : "NO_BODY", "response_begun" : false, "session" : { "gupid" : "18asd3ed-U4FSeggT0O", "pid" : 4273 }, "last_data_send_time" : null, tells me, that...

...blocks or confusingly sometimes also procs Those with "method semantics", called lambdas lambdas They behave like Ruby method definitions: They are strict about their arguments. return means "exit the lambda...

...the lambda literal -> (since Ruby 1.9.1) test = ->(arg) do puts arg end blocks They behave like do-blocks or simply "segments of code": They try to be smart about their...