When a user shares your content, a snippet with title, image, link and description appears in her timeline. By default social networks will use the window title, the first image...

...the current URL and some random text snippet for this purpose. This is often not what you want. Luckily Facebook, Twitter, etc. lets you control how your content appears in...

makandra dev

...do not use request.xhr? to decide that. Use respond_to. I've too often seen code like this: def show # ... if request.xhr? render json: @user.as_json else # renders default HTML...

...just plain wrong. Web browsers often fetch JSON via XHR, but they (should) also send the correct Accept HTTP header to tell the server the data they expect to receive...

...is how to view what Capybara is rendering. Rendered text (what the user actually sees) puts page.text Prints just the visible text body, completely stripped of HTML tags and hidden...

...cluttered with excessive blank lines, you can easily avoid printing them: puts page.body.gsub(/^\s*$/, '').squeeze("\n") Advanced DOM parsing with Nokogiri If the raw HTML is too massive to read...

github.com

...enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture. Testing is not...

...just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the language...

Static error pages To add a few basic styles to the default error pages in Rails, just edit the default templates in public, e.g. public/404.html. A limitation to these default...

...templates is that they're just static files. You cannot use Haml, Rails helpers or your application layout here. If you need Rails to render your error pages, you need...

...an extra rendering step just for your JavaScript. An example would be: function logBoxHeight() { box.classList.add('super-big'); console.log(box.offsetHeight); // Forces the browser to re-render *now* } Verdict: Make sure you...

...always first read, then write style-relevant values. How to debug: Chrome shows warning icons in the event list in the Timeline for scripts that cause layout trashing. Performance issue...

To make CSS rules dependent on the screen size, we use media queries: @media (max-width: 500px) { // rules for screen widths of 500px or smaller } Browsers will automatically enable and...

...disable the conditional rules as the screen width changes. To detect responsive breakpoints from JavaScript, you may use the global matchMedia() function. It is supported in all browsers:

...quick navigation keys. I use the following extra keybinds; they work really well. Prefix set to Alt+Q (in addition to Ctrl+B). Prefix, then Alt+WASD to navigate agents...

Prefix, then Alt+1..9 to jump to specific agents. Why are they so great? Navigation is quick and smooth: Press and hold Alt with your thumb, and...

baeldung.com

...measurement metrics in Linux. These are the differences: Code Name Description vsz virtual memory size Total amount of memory a process may hypothetically access. Includes swapped memory, memory from external...

...libraries and allocated memory that’s not used. rss resident set size Total amount of non-swapped used physical memory. Includes memory from external shared libraries. pss proportional share size...

phusion.github.io

Traveling Ruby is a project which supplies self-contained, "portable" Ruby binaries: Ruby binaries that can run on any Linux distribution and any OS X machine. This allows Ruby app...

...to bundle these binaries with their Ruby app, so that they can distribute a single package to end users, without needing end users to first install Ruby or gems...

digitalocean.com

...to be done separatly for each node version on your system, though. Install yarn 1 system-wide via apt The yarn package depends on the nodejs debian package, but with...

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn.gpg >/dev/null echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update...

...Adding Records via XHR and JS Example For the following examples we use a simple data model where a user has zero or more tasks. class ExampleMigration < ActiveRecord::Migration...

...user.tasks.build } end def update load_user @user.attributes = user_params if @user.save flash[:notice] = 'User saved successfully.' redirect_to(edit_variant_1_user_path(@user)) else flash[:notice] = 'User could not...

#!/usr/bin/env ruby require_relative "../config/boot" require "active_support/continuous_integration" ActiveSupport::ContinuousIntegration.run do step "Setup", "bin/setup --skip-server" step "Security: Rubygems audit", "bundle", "audit" step "Security: NPM audit", "npm", "audit"

#!/usr/bin/env ruby require_relative "../config/boot" require "active_support/continuous_integration" ActiveSupport::ContinuousIntegration.run do step "Setup", "bin/setup --skip-server" step "Style: Ruby", "bin/rubocop" step "Style: JS", "npx prettier", ".", "--check" step "Style: CSS...

...it. This lesson covers how we get notified about exceptions and how tools like Sentry keep the noise down. Important Work on this lesson in advisor mode. Learning goals

...can explain why an application must report its errors somewhere, and what happens to an exception in production when nobody is notified. You can explain how our teams handle incoming...

...command on a server which continues to run after the SSH session is closed. Consider systemd-run as alternative. It will turn every command in a systemd service unit:

...openssl speed` as unit run-benchmark.service $ sudo systemd-run --unit=run-benchmark openssl speed # Query the current status $ systemctl status run-benchmark.service ● run-benchmark.service - /usr/bin/openssl speed Loaded: loaded (/run/systemd/transient/run-benchmark.service; transient) Transient: yes

stackoverflow.com

window.getSelection().toString(); Browser support: IE9+, Android 4.3+, Safari...

google.com

Surprisingly exhaustive new icon set by Google. Available as PNG, SVG and as a icon font. Comment from Henning I tried using the icon set in a project. I found...

...the quality, selection and handling far worse than what we are used to in FontAwesome...

curl http://ipecho.net/plain; echo

polymer-project.org

The Paper elements are a set of UI elements that implement the material design system...

google.com

Impressive set of design guidelines from Google...

robots.thoughtbot.com

Declare an enum attribute where the values map to integers in the database, but can be queried by name.

kadin.sdf-us.org

...the dot-underscore (._foo, ._bar, etc.) files created by (badly-behaved) Mac OS X systems on non-AFP server volumes...

makandra dev
compass-style.org

Since we are migrating from our homegrown mixins.sass and helpers.sass to Compass, here is a list of all the mixins provided by Compass...

looah.com

...about what HTTP was designed for. The original post has been removed for some stupid gender discussion...