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
/* | |
1. Install dotjs (https://addons.mozilla.org/en-US/firefox/addon/dotjs/ for Firefox or https://github.com/defunkt/dotjs for Chrome) | |
2. Put the contents of this file at ~/.js/default.js | |
*/ | |
const API_URL = 'http://localhost:7000/'; | |
function getData(e, comment) { |
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
.throbber { | |
animation(unquote('.9s spin infinite steps(30)')); | |
border: 4px solid cyan; | |
border-left-color: transparent; | |
border-radius: 150px; | |
border-top-color: transparent; | |
bottom: 0; | |
display: block; | |
height: 33px; | |
left: 0; |
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
/* | |
Usage: | |
<div class="throbber"><b></b><b></b><b></b></div> | |
*/ | |
.throbber { | |
position: absolute; |
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 reqResponse(xhr) { | |
var data = xhr.responseText; | |
if ((xhr.getResponseHeader('Content-Type') || '').split(';', 1)[0].indexOf('json') !== -1) { | |
try { | |
return JSON.parse(data); | |
} catch(e) { | |
// Oh well. | |
return {}; | |
} | |
} |
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 $(sel) { | |
if (!sel) { | |
return $.body; | |
} | |
var r = document.querySelectorAll(sel); | |
return r.length == 1 ? r[0] : Array.prototype.slice.call(r); | |
} | |
$.doc = document; | |
$.body = document.body; |
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
#!/usr/bin/env bash | |
pushd lib/packages | |
if [ -e "slimerjs" ] | |
then | |
echo "Directory 'slimerjs' exists" | |
else | |
echo "Creating 'slimerjs' directory" | |
mkdir slimerjs |
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
#!/usr/bin/env bash | |
sudo apt-get update | |
sudo apt-get install xvfb | |
curl -k -O http://download.slimerjs.org/v0.9/0.9.0/slimerjs-0.9.0-linux-x86_64.tar.bz2 | |
tar -xjpvf slimerjs-0.9.0-linux-x86_64.tar.bz2 | |
rm slimerjs-0.9.0-linux-x86_64.tar.bz2 | |
mv slimerjs-0.9.0 slimerjs | |
echo "console.log('SlimerJS installed OK'); slimer.exit();" > test.js | |
sudo xvfb-run slimerjs/slimerjs test.js |
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
diff --git a/hearth/media/js/requests.js b/hearth/media/js/requests.js | |
index a959070..f6f6743 100644 | |
--- a/hearth/media/js/requests.js | |
+++ b/hearth/media/js/requests.js | |
@@ -26,7 +26,7 @@ define('requests', | |
} | |
} | |
- function _ajax(type, url, data) { | |
+ function _ajax(type, url, data, headers) { |
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
// Get list of cache keys sorted by timestamp. | |
var keysAsc = _.sortBy(_.pairs(cache), function (x) { | |
return x[1].__time; // Timestamp | |
}).map(function(x) { | |
return x[0]; // URL | |
}); | |
// Keep popping off expired keys until we're under the quota. | |
var i = 0; | |
while (JSON.stringify(cache).length >= settings.offline_cache_limit_request) { |
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 request = require('request'); | |
var Promise = require('es6-promise').Promise; | |
var promisesApps = []; | |
promisesApps.push(new Promise(function (resolveApp, rejectApp) { | |
var urls = [ | |
'https://marketplace-dev.mozflare.net/img/uploads/addon_icons/405/405402-64.png?modified=1384390457', | |
'https://marketplace-dev.mozflare.net/img/uploads/previews/full/81/81268.png?modified=1368635236' | |
]; |
OlderNewer