Important You should only implement an implicit conversion method if your object already behaves like the target type. You never create a new object in an implicit conversion method...
...either return self or not be implemented at all. Obviously, this is the reason behind this recent card about Ruby implicitly converting a hash to keyword arguments. It's not...
Here is how to use Chromedriver without libraries like selenium-webdriver. This can be useful for debugging. The following example...
Watch Solving bizarre authorization requirements with Rails Read the Consul README Read the assignable_values README Understand how Consul...
...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...
Webpacker uses Babel and Webpack to transpile modern JavaScript down to EcmaScript 5. Depending on what browser a project needs...
2013-02-20 (Tobias) ... with exactly the following rows 2012-06-20 (Henning) Better normalization (more consistent for expected/real input, gets rid of nbsps) 2012-06-01 (Tobias)
...wildcard support (partial matches) 2012-05-25 (Tobias) Better error output; "should not see" now fails if any of the rows is present; cells are now matched exactly, wildcard for...
To do so, call clear_active_connections! before your thread terminates: Thread.new do begin User.first # first database access makes a new connection ensure ActiveRecord::Base.clear_active_connections! end
Expecting a primitive value as an argument to a method invocation is easy: expect(object).to receive(:foo).with('arg1...
...make block elements take up much more space than desired, even stretching their container beyond the screen edge on small screens. min-width is defined to win against competing width...
Sometimes it's necessary for you to check which ports are in use on your local machine and which process...
Looking at the source code of the validates_numericality_of validator, it becomes clear that it converts the attribute in question to either an integer or float: if configuration[:only...
...ActiveRecord::Errors.default_error_messages[:not_a_number]) next end raw_value = raw_value.to_i else begin raw_value = Kernel.Float(raw_value.to_s) rescue ArgumentError, TypeError record.errors.add(attr_name, configuration[:message] || ActiveRecord::Errors.default...
...Although this may be useful for debugging, when writing custom steps you may be better off using XPath...
How a macro can dynamically define a method that can be overridden with super in the same class.
Some pseudo-elements need to be addressed with vendor prefixes. E.g. ::selection is not supported by Firefox, you need to...
If you want to collapse/expand elements with dynamic content (and thus unknown height), you can not transition between height: 0...
Git commits should be very deliberate, and only contain changes that you really want to be in there. In order...
The change_column method for rails migrations support casting with a custom SQL statement. This allows us to change a...
Whenever you create a table from a database migration, remember to add updated_at and created_at timestamps to that...
ActiveModel supplies an errors object that behaves similar to a Hash. It can be used to add errors to a record, as well as to query the record for registered...
...read and write access by methods like File.open and File.read. def exclusively_locked_access begin @file_locked = true File.open(F"#{file_path}.lock"), 'w+') do |f| f.flock(File::LOCK_EX...
...that block make sure to do that manually and preferably wrap it it with begin and rescue if something might go wrong: begin f = File.open(file, File::CREAT) f.flock(File...
PostgreSQL can cosplay as a full-text search engine. It doesn't have the features or fidelity of ElasticSearch or...
...like using the /slackfont command. Fonts need to be installed on your machine. Webfonts beyond those provided by Slack won't magically work unless you install them locally.
...why we should always use ===, never == Testing the type of a value Understand the benefit of LoDash's _.isEqual What the f*ck JavaScript? Understand that there is no way...
...a callback function which can write it to console.log. Understand why each code block behaves the way it does: Variant 1: Iterating with forEach's callback function const callbacks...
Sometimes we write plain SQL queries in migrations so we don't have to mock ActiveRecord classes. These two migrations...