##Ubuntu Server
sudo apt-get install g++ curl libssl-dev apache2-utils git-core make
cd /usr/local/src
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
tar -xvzf node-v0.10.28.tar.gz
cd node-v0.10.28
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Example of Singleton design pattern | |
# Copyright (C) 2011 Radek Pazdera | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. |
getJSON = function(url,data){ | |
return new Promise(function(resolve,reject) | |
{ | |
var req = new XMLHttpRequest(); | |
req.open('GET', url, true); | |
req.onreadystatechange = function () { | |
if (req.readyState == 4) { | |
if(req.status == 200) | |
resolve(JSON.parse(req.responseText)); | |
else |
http://apassant.net/2012/01/16/timeout-for-html5-localstorage/ | |
var hours = 24; // Reset when storage is more than 24hours | |
var now = new Date().getTime(); | |
var setupTime = localStorage.getItem('setupTime'); | |
if (setupTime == null) { | |
localStorage.setItem('setupTime', now) | |
} else { | |
if(now-setupTime > hours*60*60*1000) { | |
localStorage.clear() |