...pageview', { 'page': '/YOUR-CUSTOM-PATH' }); With Unpoly With Unpoly you want to trigger an Analytics pageview whenever a major content fragment is replaced. See Unpoly instructions here. Legacy snippet Change this:
...share a state in Ruby with global variables. Even if you should avoid them whenever possible, for debugging an application this could be temporary quite handy. Example: class User
when you use your class as hash keys or arrays override eql? whenever eql? is overridden, override hash accordingly Here is an example implementation for a basic class...
...care about the (longer) value and just stores the date part. This means that whenever you pass a time that is within X hours away from midnight (where X is...
...with a throttling mechanism. Touch events can still be cancelled, mark them as passive whenever you can! On Chrome, touchstart and touchmove is passive by default Because of the slow...
...iterates over all cleaners and executes your statement for each of them. This means whenever you use this direct call in your code, you actually perform this on a list...
Be careful not to accidentally call any method directly on the DatabaseCleaner module whenever you want to specify different configurations for multiple databases. This will overwrite any individual configuration...
Whenever you create a table from a database migration, remember to add updated_at and created_at timestamps to that table. Without those timestamps, investigating future bug reports will be...
...the Module class. This method can be overwritten for module instances and is called whenever the module is included somewhere: module Greet def self.included(base) puts "Greet is included into...
...but you need to call regularly from your preferred scheduler. For example, when using whenever, you should have something like this in your schedule.rb: every :day, at: '05:00', roles...
...from summertime to wintertime in different locations, etc.). Try to avoid using time zones whenever possible. When you want to only deal with day times, the handy gem Tod (Time...
...scripts (I use ~/bin/update-chromedriver) and give execute permissions (e.g. via chmod +x ~/bin/update-chromedriver). Then, whenever your Chrome is updated, run update-chromedriver and after one second you are ready to...
...examples with your expectations & implement them. Do so in whatever order works for you. Whenever you notice a new requirement, add it as a new scenario or example. While following...
...the PDFKit middleware on your development, you might experience that your application "locks up" whenever you request a .pdf route. This behavior is caused by a deadlock: The Rails process...
SVG is an acronym for "scalable vector graphics". SVGs should be used whenever an image can be described with vector instructions like "draw a line there" or "fill that space...
Background Ubuntu always sets the primary display to the 1st (i.e. internal) display whenever I connect to a new Dock/Hub. I want my primary display to be the large...
Best solution: overflow: hidden This is the only reliably working property, use it whenever you can. Caution: This will literally cut off any content that leaves the container. You...
...by RSpec anymore as can be read in the documentation link above. Model specs Whenever you have to use the same cookie dependent logic between controllers and some controller helpers...
...names on localhost. This is annoying, since you will sign out your current user whenever you switch to another app. A better way is to use our own daho.im service...
...one from the storage or store the original file in the storage. That means, whenever retrieve_from_store! is called on the uploader, a hook also calls retrieve_versions_from...
...This will also change your Ruby version, but only the one you are using whenever no other version is specified, e.g. via a .ruby-version file or RBENV_VERSION variable...
...config --global core.hooksPath ~/.githooks Store the above snippet to ~/.githooks/pre-push chmod +x ~/.githooks/pre-push Execution Whenever you push, Rubocop will automatically run, and prevent the push if unsuccessful. Note that Rubocop...
}, "active_workers": 0 }, "timestamps": { "sidekiq_performed": "2016-11-10 17:51:03", "whenever_ran": "2016-11-10 17:51:02", "requested": "2016-11-10 17:56:45" } }
...controller rendering the monitoring output as JSON class MonitoringController < ApplicationController def status data = { timestamps: { whenever_ran: Redis.current.get('monitoring:timestamp:whenever_ran'), sidekiq_performed: Redis.current.get('monitoring:timestamp:sidekiq_performed'), requested: Time.now.to...
...If you set the :validate option to true, then associated objects will be validated whenever you save this object. By default, this is false: associated objects will not be validated...
Whenever you have to deal with randomness in a jasmine test there are some spy strategies to help you out! Let's say we have a method Random.shuffle(array) to...