To delay your entire Jasmine test suite until the DOM is ready, add the following: beforeAll(function(done) { $(done); });

When you have a localized website, you may want to redirect users to their preferred language when they visit the...

github.com

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

You can use JavaScript to get or set cookie values on the client. Using the vanilla JavaScript API

gist.github.com

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

The attached Coffeescript helper will let you create mouse events: $element = $('div') Trigger.mouseover($element) Trigger.mouseenter($element) Trigger.mousedown($element) Trigger.mouseup($element...

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.

mathiasbynens.github.io

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

A HTTP 302 Found redirect to PATCH and DELETE requests will be followed with PATCH or DELETE. Redirect responses to...

makandra dev

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

During debugging you might pepper your code with lines like these: console.log('foo = ' + foo + ', bar = ' + bar) I recommend to use...

There are cases when you need to select DOM elements without jQuery, such as: when jQuery is not available

Until recently, you could open a new tab via window.open when using execute_script in Selenium tests. It no longer...

Regular expressions in Javascript are represented by a RegExp object. There also is a regex literal as in many other...

makandra dev
github.com

Note This card does not reflect the current state of lazy loading technologies. The native lazy attribute could be used...

While you usually do not need a Content-Type on GET request (which have a blank body), an external API...

You can say this in Javascript: $.fn.jquery => "1.11.1"

Our applications not only need to be functional, they need to be fast. But, to quote Donald Knuth, premature optimization...

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

makandra dev
blog.getbootstrap.com

Moved from Less to Sass. Bootstrap now compiles faster than ever thanks to Libsass, and we join...

hacks.mozilla.org

Unfortunately, Web APIs haven’t provided the functionality to copy text to the clipboard through JavaScript, which is why visiting...

You can include files from app/assets or from the public folder with javascript_include_tag. The subtle difference that tells...