jQuery's deferred objects behave somewhat like standard promises, but not really. One of many subtle differences is that there...

Current webkit browsers like Chrome and Safari have a special variable in their consoles that refers to the selected DOM...

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.

Angular's location provider stalls links to the current URL, i.e. window.location. As soon as the $location service is activated...

mathiasbynens.github.io

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

Let's say you want to find the element with the text hello in the following DOM tree: hello

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

stackoverflow.com

From Rails 3.0.9, there is a method Hash#to_query that will turn a Hash into a query string:

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

CSS4 comes with :has. E.g. h1:has(b) would select all tags that contain a tag. This is implemented in...

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

makandra dev
github.com

A JS library that allows you to embed an iframe that automatically shrinks or expands to match its content.

With "attaching an event handler once" you possibly mean one of these two things: Register a function for an event...

makandra dev
github.com

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

github.com

Ag (aka "the silver searcher") is a very fast replacement for grep. It will parse your .gitignore for additional speedup...

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

If you have jQuery code like this: if (condition) { $element.show(); } else { $element.hide(); } ... you can shorten this to: $element.toggle(condition);

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