Skip to content

Instantly share code, notes, and snippets.

View juandopazo's full-sized avatar

Juan Dopazo juandopazo

View GitHub Profile
CancellablePromise.all = function (values) {
var CancellablePromise = this;
var child;
var children = [];
return new CancellablePromise(function (resolve, reject) {
if (!A.Lang.isArray(values)) {
reject(new TypeError('CancellablePromise.all expects an array of values or promises'));
return;
}
CancellablePromise.all = function (values) {
var CancellablePromise = this;
var child;
var children = [];
return new CancellablePromise(function (resolve, reject) {
if (!A.Lang.isArray(values)) {
reject(new TypeError('CancellablePromise.all expects an array of values or promises'));
return;
}
@juandopazo
juandopazo / gist:8028026
Last active December 31, 2015 18:39 — forked from ericf/gist:8026041
'use strict';
var fs = require('fs'),
path = require('path'),
parseCSS = require('css-parse'),
Promise = require('es6-promise').Promise;
module.exports = function gridUnits(pureDir, callback) {
readUnits(path.join(pureDir, 'grids-units.css'))
.then(parseCSS)
Y.io.xhr = function (uri, options) {
options = options || {};
return new Y.Promise(function (resolve, reject) {
var io = Y.io(url, {
// reference options directly to avoid insertion of unwanted options
// into Y.io()
method: options.method,
data: options.data,
headers: options.headers,
@juandopazo
juandopazo / device.js
Created May 10, 2012 16:37 — forked from rwaldron/device.js
Fat Arrows and Classes-as-Prototype-sugar make a beautiful future for JavaScript
var stream = require("fake-stream-lib"),
Emitter = require("events").EventEmitter,
util = require("util");
// Today...
function Device( opts ) {
this.value = null;
<!DOCTYPE html>
<html>
<head>
<title>ScrollView With Pagination</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>
/* Avoid resource latency for these, since they hide unenhanced content */
.yui3-js-enabled .yui3-scrollview-loading {
visibility:hidden;