Sometimes you just want to have a small web server that serves files to test something. Serve the current directory...
There are many solutions, but a very concise one is this: hash.merge!(hash) do |key, old_value, new_value|
Sometimes you want to know exactly how many objects exist within your running Ruby process. Here is how: stats = {} ObjectSpace.each...
By pressing Ctrl + Shift + V you can select a recently copied string for pasting.
This is basically Ruby-native syntax for andand.
Ruby has a set of methods to convert an object to another representation. Most of them come in explicit and...
When you make a simple TCP connection to a remote server (like telnet), your client won't normally notice when...
You want to test your 1GE or 10GE internet uplink? We needed to ensure we have full 10GE to the...
When dealing with AR scopes, you can remove conditions, order, etc by using the unscope method. It is available on...
PostgreSQL's array data type is pretty useful, but manipulating values of arrays can be awkward because of its syntax...
Rails 4 introduced raising an error on pending migrations. This is most annoying when you are crafting a migration but...
Ruby allows multiple assignment: a, b, c = o In order to prove multiple values from a single object, Ruby calls...
Our applications not only need to be functional, they need to be fast. But, to quote Donald Knuth, premature optimization...
When a method has keyword arguments, Ruby offers implicit conversion of a Hash argument into keyword arguments. This conversion is...
Writing ruby methods that accept both optional and keyword arguments is dangerous and should be avoided. This confusing behavior will...
Starting with Rails 4.0, when you get an exception reported via the ExceptionNotification gem, you will only see a very...
Starting with Ruby 1.9, most #each methods can be called without a block, and will return an enumerator. This is...
Rails 5 will introduce ActiveRecord::Relation#or. On Rails 4 and 3.2 you can use the activerecord_any_of gem...
To safely transport an arbitrary string within a URL, you need to percent-encode characters that have a particular meaning...
As the web is being used for more and more tasks, expectations rise. Not only should web pages offer rich...
While debugging an intricate issue with failed HTTP requests I have come to appreciate the more advanced features of the...
With ngAnimate, you can easily animate certain events (see directive support). We'll make use of ngClass animations to style...
If you have problems installing a gem and get a error collect2: error: ld returned 1 exit status it's...
SitePrism gives you a simple, clean and semantic DSL for describing your site using the Page Object Model pattern, for...