Skip to content

Instantly share code, notes, and snippets.

@JGarrido
JGarrido / $q.allComplete.js
Last active September 7, 2016 00:54
Here's my implementation of `Q.allSettled` for AngularJS, which I've named `allComplete`. Due to a bug in this Gist editor, I had to give this gist a .js extension file name, but this would typically go within your services.js file (depending on your project structure).
angular.module('App.services', ['ngResource'])
.config( function($provide) {
$provide.decorator("$q", ["$delegate", function($delegate) {
var $q = $delegate;
$q.allComplete = function(promises) {
if(!angular.isArray(promises)) {
throw Error("$q.allComplete only accepts an array.");
}
@JGarrido
JGarrido / app.js
Last active September 5, 2017 15:24
Nodetube: A basic, updated version of the tutorial at http://net.tutsplus.com/tutorials/javascript-ajax/how-to-scrape-web-pages-with-node-js-and-jquery/. This gets you about halfway through Step 3 of the tutorial, and is updated to reflect the change in markup structure of youtube.com (this is parsing the 'non-authenticated' markup, which is dif…
/**
* Module dependencies.
*/
var express = require('express')
, jsdom = require('jsdom')
, request = require('request')
, url = require('url')
, http = require('http')
, path = require('path')