Expecting a primitive value as an argument to a method invocation is easy: expect(object).to receive(:foo).with('arg1...
When building a form with a file select field, you may want to offer your users a live preview before...
When your application crawls twitter profiles for tweets, it might throw HTTP 401 (Unauthorized) errors. Those can happen for a...
Instead of using this hack you might want to use MariaDB 10.x which can work with both old and...
OAuth requires a set of params to be carried along requests, among which a nonce. Some libraries pass these along...
Awesome is a very good tiling window manager that provides neat features like automatic layouting of windows, good multi-display...
You can use JavaScript to get or set cookie values on the client. Using the vanilla JavaScript API
jQuery's deferred objects behave somewhat like standard promises, but not really. One of many subtle differences is that there...
This card existed before, but was outdated due to browser implementation changes. The information below is validated for the current...
The NestedHash class allows you to read and write hashes of any depth. Examples: hash = {} NestedHash.write hash, 'a', 'b', 'c...
You can find out about disk space usage of all tables within your database by running this: SELECT table_name...
The attached Coffeescript helper will let you create mouse events: $element = $('div') Trigger.mouseover($element) Trigger.mouseenter($element) Trigger.mousedown($element) Trigger.mouseup($element...
Enter any command into explainshell and it will explain it to you: split into separate commands (if present), with each...
Sometimes you might want to check a short link for it's destination before clicking on it. Additional you get...
Some modern Javascript APIs return iterators instead of arrays. In plain Javascript you can loop through an iterator using
To upload a file via AJAX (e.g. from an ) you need to wrap your params in a FormData object.
If you want to inspect the compiled code of your erb (or haml) templates, you can run the following code...
Stackprof is a sampling call-stack profile for Ruby 2.1+. Instead of tracking all method calls, it will simply collect...
Don't write resources :people, :concerns => :trashable Write resources :people do concerns :trashable end Why Writing a controller...
Let's say you want to find the element with the text hello in the following DOM tree: hello
Imagine you have a list you want to render inline on large screens, but stacked on small screens. high
TL;DR There are three dimensions you can control when scoping routes: path helpers, URL segments, and controller/view module.
Our preferred way of testing ActiveRecord is to simply create/update/destroy the record and then check if the expected behavior has...
Validations should be covered by a model's spec. This card shows how to test an individual validation. This is...