Skip to content

Instantly share code, notes, and snippets.

@sesteva
sesteva / quick_sort.js
Created April 30, 2020 22:09 — forked from pedrombafonso/quick_sort.js
Quick sort Sorts JSON complex type arrays by property
function partition ( list, prop, begin, end, pivot ) {
var piv = list[pivot];
swap (list, pivot, end-1 );
var store = begin;
var ix;
for ( ix = begin; ix < end - 1; ++ix ) {
if ( list[ix][prop] <= piv[prop] ) {
swap (list, store, ix );
++store;
}
@sesteva
sesteva / TraceKitSupplement.js
Created April 25, 2017 21:41 — forked from devinrhode2/TraceKitSupplement.js
Stuff I've added to my error reporting/handling stuff in addition to TraceKit.js, ideally in a few months I don't write any of this code
function exceptionalException(message) {
'use strict';
if (exceptionalException.emailErrors !== false) {
exceptionalException.emailErrors = confirm('We had an error reporting an error! Please email us so we can fix it?');
}
}
//test
//exceptionalException('try 1!');
//exceptionalException('try 2!');

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.