github.com

fake_stripe spins up a local server that acts like Stripe’s and also serves a fake version of Stripe.js...

When you run rake db:rollback and nothing happens, you are probably missing the latest migration file (or have not...

guides.rubyonrails.org

ActiveRecord offers an explain method similar to using EXPLAIN SQL statements on the database. However, this approach will explain all...

When dealing with time zones in Rails, there is one key fact to keep in mind: Rails has configurable time...

Expecting a primitive value as an argument to a method invocation is easy: expect(object).to receive(:foo).with('arg1...

Cucumber's docstrings let you add long strings to a step like this: # foo.feature Given this text: """ First line

OAuth requires a set of params to be carried along requests, among which a nonce. Some libraries pass these along...

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...

gist.github.com

The NestedHash class allows you to read and write hashes of any depth. Examples: hash = {} NestedHash.write hash, 'a', 'b', 'c...

makandra Operations

To see all jails: fail2ban status Our $JAIL is usually ssh. To see which IPs are banned currently: fail2ban-client...

puppet.com

Don't use exec without user parameter If you use exec without user parameter, the command will get executed as...

makandra Operations

If you want to perform a failover on another haproxy backend server this is the way you should do it...

makandra Operations

We want to make the following firewall rule to be applyable to different network interfaces (for e.g. different environments...

RSpec provides a nice diff when certain matchers fail. Here is an example where this diff is helpful while comparing...

mathiasbynens.github.io

This will give the target site full access to your Javascript environment through window.opener, if the target is on the...

Don't write resources :people, :concerns => :trashable Write resources :people do concerns :trashable end Why Writing a controller...

nginx.org

If you want to configure your nginx to drop connections to a specific location, you can do so by responding...

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...

RSpec supports a one-liner syntax for setting an expectation on the subject: describe Array do describe "when first created...

Validations should be covered by a model's spec. This card shows how to test an individual validation. This is...

If you expect method calls in RSpec 3, be aware that the argument matchers use very liberal equality rules (more...

makandra dev

In JavaScript we often use Immediately Invoked Function Expessions (or IIFEs) to prevent local variables from bleeding into an outside...