The SQL code generated by Graticule's spherical distance computation is insufficient and can lead to NULL distances in edge cases. The reason for this is that MySQL is performing...
...several sine and cosine computations which can result in slight rounding errors -- which is usually okay. Rarely, though, for the exact center of the given circle, it is then asked...
Given those modules: module A def foo; end def bar; end end module B end When you want to call...
The need for clearfix hacks has been greatly reduced since we could layout with Flexbox or CSS Grid. However, when you do need a clearfix, there's no reason to...
...hack anymore. You can just give the clearing container display: flow-root. This is supported by all browsers except IE11...
...MySQL and you know the "error" is okay (e.g. you've executed the same statement at the same time on 2 masters which sync each other), you can skip this...
...error and continue with the replication without having to set up the slave from the ground up. stop slave; set global sql_slave_skip_counter = 1; start slave;
You can use three different versions of the regular expression syntax in grep: basic: -G extended: -E(POSIX) perl: -P (PCRE) Difference between basic and extended: In basic regular expressions...
...the meta-characters '?', '+', '{', '|', '(', and ')' loose their special meaning; instead use the backslashed versions '?', '+', '{', '|', '(', and ')'. Difference between extended (POSIX) and perl (PCRE): E.g. \d is not supported in POSIX.
RubyMine offers you to exclude directories from search, meaning faster search results and less "noise" in the list of result. Right-click a folder in your project tree and click...
...and other directories that you don't need to access during development and whose search results are irrelevant. They won't be deleted but simply ignored when searching across a...
...check checkboxes. But there's one problem, if you want to test a custom styled checkbox, which hides its -Tag: The methods cannot (un)check checkboxes without an visible .
...error message will be something like: Unable to find visible checkbox "Some label" that is not disabled Solution 1 Use the keyword argument allow_label_click: true within the method...
Sometimes, the rails dev server doesn't terminate properly. This can for example happen when the dev server runs in a RubyMine terminal. When this happens, the old dev server...
...blocks port 3000, so when you try to start a new server, you get the error: Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE)
...written in pure Ruby and integrates with Rails applications. It provides features as automatic sizing of dots and lines (the more values, the thinner the graph's elements), custom or...
...predefined themes, different styles (bar, line, dot and many more) and multiple graphs in one chart. Installation In your Gemfile: gem 'rmagick', :require => false gem 'gruff' Then run bundle install...
...entering only http://example.com/). If you want to make a request to that site's web server without actually talking to www.example.com (e.g. because this is a load balancer...
...s address but you want to access one specific machine), you cannot just request machine1.example.com or localhost as the above vhost will redirect your request. When talking HTTP 1.1, your...
A datetime in MySQL does not have a zone. It just stores the literal string "2010-05-01 12:00:00". That means that Rails must make...
...mode Rails assumes that your application lives in the same time zone as your server's local zone settings. In this mode ActiveRecord will not try to convert times coming...
How to ignore new files Globally Add the path(s) to your file(s) which you would like to ignore...
...filled out at the same time, there is no built-in validation. I've seen different solutions in the wild, each with different downsides: Private method referenced via validate: works...
...name, :nickname, xor_presence: true end Validator Here is the validator class; put it somewhere in your project. class XorPresenceValidator < ActiveModel::Validator def initialize(options) @attributes = Array.wrap(options[:attributes]).freeze...
can’t find executable rails for rails-3.2.3 (Gem::Exception) ... one of several...
...things might be wrong. You're using RVM It's possible that you have a system-wide gem executable (like rails) that requires a gem that is not available in...
On your local system that only hosts non-critical development data and only you have access to, you can store MySQL's root password in your home directory so you...
...out of the question if there's any confidential data in your databases. Assuming diligent screen-locking, an encrypted hard disk and correct permissions set on your credential file, it...
If you want to to create maps within SASS/SCSS-files, it normally works like this: $some-map: (key1: value1, key2: value2) However, some maps can get big really fast, if they...
...since 2011 and it hasn't been resolved since then. Writing a map likes this: $some-map: ( key1: value1, key2: value2 ) confuses the SASS-parser and you will get an...
A comprehensive introduction to sending HTML emails. Intro: HTML email: Two words that, when combined, brings tears to a developer’s eyes. If you’re a web developer, it’s...
...in your career, whether you like it or not. Coding HTML email is old school. Think back to 1999, when we called ourselves “webmasters” and used Frontpage, WYSIWYG editors and...
Sometimes it is useful to define a named scope by implementing a static method with the scope's name on the scoped class. For instance, when a method should decide...
...which existing scope should be the next link in the scope chain. Take this class for example: class Meal < ActiveRecord::Base named_scope :for_date, lambda { |date| :conditions => { :date => date...
Spreewald's patiently repeats the given block again and again until it either passes or times out. Be careful to give patiently a block that can actually be repeated. E.g...
...the field variable that was defined outside of the block (it's the variable set from the Given block's arguments). Because of this, during the first repetition the value...
...run rake and your code is causing an exception which is not the one shown in your terminal. Rails tries to catch this exception and clean up constants but -- while...
...it's still booting up -- fails on this which causes another exception: rake aborted! cannot remove Object::ClassMethods Running rake with the --trace parameter will give you no love; the...
SVG files are often much larger than necessary, containing comments, metadata, hidden elements etc. Optimize them with this tool. Web UI: https://jakearchibald.github.io/svgomg/ Binary: https://github.com/svg/svgo
...for a properly scaling SVG, you need to keep the viewBox attribute. There's an option --disable=removeViewBox for this...
Capistrano automatically logs each (successful) deployment into a file on your application servers. It is located at the root of your server's project folder, i.e. the parent of releases...
...and current, like so: /var/www/your-project$ ls current log releases repo revisions.log <--- here shared Each line in that file contains the deployed branch, commit, release ID, and username (was read from...
Having a unique selector for an element is useful to later select it from JavaScript or to update a fragment with an Unpoly. Haml lets you use square brackets ([]) to...
...with ActiveRecord instances, which have a persisted #id and will hence generate the same selector over multiple renderings of the same view. Example - @users.each do |user| .row[user] = user.name
...the transcluded content before adding it to the DOM. # Directive template: """ """ transclude: true link: (scope, element, attributes, _controller, transclude) -> transclude (content) -> # Do custom stuff element.find('.wrapper').append(content)
...much more you can do with the transclusion function. For an in-depth introduction, see this Guide to Angular Transclusion. Also read the Angular docs on this...