Skip to content

Instantly share code, notes, and snippets.

View michael-benin-CN's full-sized avatar

Michael Benin michael-benin-CN

View GitHub Profile
@main-font-size: 16px;
.x-rem (@property, @value) {
// This is a workaround, inspired by https://github.com/borodean/less-properties
@px-fallback: @value * @main-font-size;
-: ~`(function () { return ';@{property}: @{px-fallback}'; }())`;
-: ~`(function () { return ';@{property}: @{value}rem'; }())`;
}
var express = require('express');
var Promise = require('es6-promise').Promise;
var http = require('http');
var app = express();
var getJSON = function(options) {
console.log('CALLING ' + options['host']);
var promise = new Promise(function(resolve, reject) {
var req = http.get(options, function(res) {
var Promise = require('bluebird');
var promiseWhile = function(condition, action) {
var resolver = Promise.defer();
var loop = function() {
if (!condition()) return resolver.resolve();
return Promise.cast(action())
.then(loop)
.catch(resolver.reject);