tl;dr You can use attribute? as shorthanded version of attribute.present?, except for numeric attributes and associations. Technical Details

Today in computer: In Coffeescript, on and yes are aliases for true. off and no are aliases for false.

devdocs.io

All browsers + IE9 know the CSS :empty selector. It lets you hide an element when it has no content, i.e...

This should be fixed in the latest LTS-branches of our mysql2 fork, 0.2.x-lts and 0.3.x-lts...

After performing a live migration of a VM you may encounter issues with the clock of the migrated VM. The...

I needed to make sure that an element is visible and not overshadowed by an element that has a higher...

aws.amazon.com

Amazon Elastic Transcoder is video transcoding in the cloud. It is designed to be a highly scalable, easy to use...

Starting with Ruby 2.0 you can define methods with keyword arguments. In 2.1+ required keyword arguments can be defined by...

dev.mysql.com

Directly from the MySql docs: There are three likely causes for this error message. Usually it indicates network connectivity trouble...

...your session in a previous request. Working around the issue You can avoid that behavior by stubbing the controller's session and querying that stub: persisted_session = ActionController::TestSession.new controller.stub...

If you need to enable NewRelic monitoring on certain machines within the same Rails environment, a simple solution is to...

...caused by the random order of hash elements of the params hash. class Feedback belongs_to :user def role=(value) @role = value self.email = find_email_by_name(user.name) end

...work on a large application where a lot of code depends on the indeterministic behavior above, and it would be too much work to refactor the whole app for a...

Xfce gives you a million options to configure your panels. Together with Xfce's sometimes arcane configuration UI, this can...

api.jquery.com

jQuery's removeClass removes the given class string from an element collection. If you want to remove multiple/unknown classes matching...

github.com

...JSON generation from a large, nested Ruby hash down from 200ms to 2ms. Its behavior differs from the default JSON.dump or to_json behavior in that it serializes Ruby symbols...

There are different ways to run rake: On Rails 4.1+ projects, you have Spring and its binstubs which dramatically improve...

makandra dev

The bash offers control over the behavior of autocompletion. The most primitive example is this (just run it in your bash; if you want it available everywhere, put the complete...

...pattern and many more. complete -p gives you a list of currently defined autocompletions. Behold, thou might not define multiple completions for one command. I recently built a script that...

makandra dev
github.com

FactoryBot allows to create traits from Enums since version 6.0.0 The automatic definition of traits for Active Record enum attributes...

...session using the database. This could be the rails server, rubymine and many more. Beside terminating the session connection manually you can also find out the pid and kill the...

On application servers, gems are usually bundled into the project directory, at a location shared across deployments. This is usually...

This is a bookmarklet you can add to Chrome or Firefox which will allow you to create a story in...

...its internal state. It is usually sufficient to use the then() function. Where promiseState() becomes useful is when writing unit tests for a function that returns a promise.

To parse XML-documents, I recommend the gem nokogiri. A few hints: xml = Nokogiri::XML(" foo bar ") parses an xml...

...supports standard Hash.new forms There's also a Concurrent::Cache class that sort of behaves like an unordered Hash, but is much faster. Info If you're using Rails you...