Skip to content

Instantly share code, notes, and snippets.

@mzabriskie
mzabriskie / abort.js
Created March 18, 2015 15:35
axios abort request
/**
* The problem with using Promises for a request API is that Promises
* make it difficult to abort the request. Typically when using XHR
* some factory will wrap the actual XHR, but ultimately will return
* the XHR object.
*
* ```
* var request = performRequest('/user/12345');
* request.abort();
* ```
@JunichiIto
JunichiIto / alias_matchers.md
Last active October 21, 2024 00:54
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@mikaelbr
mikaelbr / destructuring.js
Last active August 20, 2024 11:27
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",