This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('lodash'); | |
var request = require('request'); | |
var Promise = require('es6-promise').Promise; | |
var use_data_uris = true; | |
request('https://marketplace-dev.allizom.org/api/v1/rocketfuel/collections/curated/', function (err, res, body) { | |
var data = JSON.parse(body).apps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getInstalled() { | |
return new Promise(function (resolve, reject) { | |
// Don't call `navigator.mozApps.getInstalled` if the page isn't | |
// visible or if the `navigator.mozApps` API isn't available. | |
if (document.hidden || !navigator.mozApps) { | |
return reject(); | |
} | |
// Get list of installed apps. | |
var mozGetInstalled = navigator.mozApps.getInstalled(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var http = require('http'); | |
var request = require('request'); | |
var zlib = require('zlib'); | |
// res.headers = { | |
// "Date": "Thu, 03 Apr 2014 00:05:39 GMT", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var http = require('http'); | |
var request = require('request'); | |
var zlib = require('zlib'); | |
// res.headers = { | |
// "Date": "Thu, 03 Apr 2014 00:05:39 GMT", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkOnline() { | |
// `navigator.onLine` is always accurate in Chrome, | |
// but of course it's *never* accurate in Firefox | |
// (bug 654579, bug 756364). Yeah, I know - sad times. | |
return new Promise(function (resolve, reject) { | |
var i = new Image(); | |
i.src = document.querySelector('head [rel*=icon]').href + '?' + +new Date(); | |
i.onload = function () { | |
resolve(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkOnline() { | |
// `navigator.onLine` is always accurate in Chrome, | |
// but of course it's *never* accurate in Firefox | |
// (bug 654579, bug 756364). Yeah, I know - sad times. | |
return new Promise(function (resolve, reject) { | |
var i = new Image(); | |
i.src = '/dummy.gif?' + +new Date(); | |
i.onload = function () { | |
resolve(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* If you need the string representation, there is a handy | |
* 'unicode' property you can query on the returned object. | |
* | |
* @param {string} from is a HEX code you want to start from. | |
* @param {string} to is a HEX code you want to end with. | |
* @return {array} the unicode range from - to. | |
**/ | |
function unicodeSequence(from, to) { | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('es6-promise').Promise; | |
var promises = []; | |
promises.push(new Promise(function(resolve, reject) { | |
setTimeout(function(){ | |
resolve(1); | |
}, 5000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf.urls import patterns, url | |
from django.views.generic import RedirectView | |
from . import views | |
def redirect_doc(uri): | |
return RedirectView.as_view( | |
url='https://developer.mozilla.org/docs%s' % uri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(driven) %% python submitapp.py /opt/seamission-cli | |
******************** | |
Create your manifest | |
******************** | |
Enter app name: Forecast | |
Enter app description: Real-time weather on your phone | |
Enter version (default: 1.0): 2.0 | |
Enter developer name: Forecast.io | |
Enter developer URL: http://forecast.io/ |