init
This commit is contained in:
commit
3e1087fd70
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# https://git-scm.com/docs/gitignore
|
||||
# https://help.github.com/articles/ignoring-files
|
||||
# Example .gitignore files: https://github.com/github/gitignore
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
.idea
|
||||
/.idea
|
38
app.js
Normal file
38
app.js
Normal file
@ -0,0 +1,38 @@
|
||||
/*var app = require('express').createServer();
|
||||
app.get('/', function(req, res) {
|
||||
res.send('Hello from <a href="http://appfog.com">AppFog.com</a>');
|
||||
});
|
||||
app.listen(process.env.VCAP_APP_PORT || 3000);*/
|
||||
|
||||
|
||||
var express = require('express'), path = require('path'), http = require('http');
|
||||
var app = express();
|
||||
app.configure(function() {
|
||||
app.set('port', process.env.VCAP_APP_PORT || 3000);
|
||||
app.use(express.logger('dev'));
|
||||
/* 'default', 'short', 'tiny', 'dev' */
|
||||
app.use(express.methodOverride());
|
||||
app.use(express.bodyParser());
|
||||
app.use(function(req, res, next) {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "X-Requested-With");
|
||||
next();
|
||||
});
|
||||
app.use(app.router);
|
||||
app.use(express.static(path.join(__dirname, 'www')));
|
||||
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Routing handlers
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* create the server
|
||||
*/
|
||||
http.createServer(app).listen(app.get('port'), function() {
|
||||
console.log("Express server listening on port " + app.get('port'));
|
||||
});
|
||||
|
2
app/Robots.txt
Normal file
2
app/Robots.txt
Normal file
@ -0,0 +1,2 @@
|
||||
User-Agent: *
|
||||
Disallow: /
|
390
app/app.js
Normal file
390
app/app.js
Normal file
@ -0,0 +1,390 @@
|
||||
(function () {
|
||||
|
||||
var lastGBP = 0.0,
|
||||
lastUSD = 0.0,
|
||||
_fasttimer, _slowTimer, myBTC = 3.49524333;
|
||||
var lows = {
|
||||
gbp: 0,
|
||||
usd: 0
|
||||
},
|
||||
highs = {
|
||||
gbp: 0,
|
||||
usd: 0
|
||||
};
|
||||
|
||||
var list = [{
|
||||
title: '101B ends',
|
||||
y: 2013,
|
||||
m: 9,
|
||||
d: 24,
|
||||
add: 1001
|
||||
},
|
||||
{
|
||||
title: 'Ends',
|
||||
y: 2016,
|
||||
m: 4,
|
||||
d: 4
|
||||
}];
|
||||
|
||||
MicroEvent.mixin(this);
|
||||
var self = this;
|
||||
|
||||
var addDays = function (myDate, days) {
|
||||
return new Date(myDate.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
};
|
||||
|
||||
var getDays = function (startdate, enddate) {
|
||||
var r, s, e;
|
||||
s = startdate.getTime();
|
||||
e = enddate.getTime();
|
||||
r = (e - s) / (24 * 60 * 60 * 1000);
|
||||
return r;
|
||||
};
|
||||
|
||||
var tick = function () {
|
||||
var today = new Date();
|
||||
var start101 = new Date();
|
||||
var end101;
|
||||
var endContract = new Date();
|
||||
var third = new Date();
|
||||
start101.setFullYear(2013, 9, 24);
|
||||
end101 = addDays(start101, 1001);
|
||||
endContract.setFullYear(2016, 4, 4);
|
||||
third.setFullYear(2013, 7, 25);
|
||||
$('#one').text('101B ends: ' + Math.ceil(getDays(today,
|
||||
end101)) + " days / " + Math.ceil(getDays(today,
|
||||
end101) / 7) + " weeks");
|
||||
$('#two').text('Ends: ' + Math.ceil(getDays(today,
|
||||
endContract)) + " days / " + Math.ceil(getDays(today,
|
||||
endContract) / 7) + " weeks");
|
||||
$('#three').hide();
|
||||
};
|
||||
|
||||
var get_weather = function () {
|
||||
navigator.geolocation.getCurrentPosition(show_weather);
|
||||
};
|
||||
|
||||
this.bind('displayWeather', function (data) {
|
||||
$('#weather').html(data.currently.summary + ' ' + data.currently.temperature + '°c <em>' + data.daily.summary + '</em>');
|
||||
});
|
||||
|
||||
var show_weather = function (position) {
|
||||
var latitude = position.coords.latitude;
|
||||
var longitude = position.coords.longitude;
|
||||
// let's show a map or do something interesting!
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/' + latitude.toString() + ',' + longitude.toString() + '?units=uk2',
|
||||
data: '',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
context: $('body'),
|
||||
contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
},
|
||||
success: function (data) {
|
||||
self.trigger('displayWeather', data);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var updateBTC = function (g, u) {
|
||||
var title, total, elm = $('#btc');
|
||||
if (lastGBP !== 0) {
|
||||
|
||||
elm.removeClass();
|
||||
if (g > lastGBP) {
|
||||
elm.addClass('up');
|
||||
} else if (g < lastGBP) {
|
||||
elm.addClass('down');
|
||||
}
|
||||
|
||||
} else {
|
||||
lows.gbp = g;
|
||||
lows.usd = u;
|
||||
|
||||
highs.gbp = g;
|
||||
highs.usd = u;
|
||||
}
|
||||
|
||||
lastGBP = g;
|
||||
lastUSD = u;
|
||||
|
||||
if (g < lows.gbp) lows.gbp = g;
|
||||
if (u < lows.usd) lows.usd = u;
|
||||
|
||||
if (highs.gbp < g) highs.gbp = g;
|
||||
if (highs.usd < u) highs.usd = u;
|
||||
|
||||
total = myBTC * g;
|
||||
|
||||
title = "High: $" + parseFloat(highs.usd.toFixed(2)) + " / Low $" + parseFloat(lows.usd.toFixed(2));
|
||||
elm.html("$" + parseFloat(u.toFixed(2)) + " / £" + parseFloat(g.toFixed(2)) + " (£" + parseFloat(total.toFixed(2)) + ")");
|
||||
elm.prop('title', title);
|
||||
};
|
||||
|
||||
var updateFX = function (data) {
|
||||
var elm = $('#fx');
|
||||
elm.html("£1 = $" + parseFloat(data.gpbe.toFixed(2)) + " = " + parseFloat(data.sekex.toFixed(2)) + " SEK");
|
||||
};
|
||||
|
||||
this.bind('updateFX', function (data) {
|
||||
$('#fx').html("£1 = $" + parseFloat(data.gpbe.toFixed(2)) + " = " + parseFloat(data.sekex.toFixed(2)) + " SEK");
|
||||
});
|
||||
|
||||
|
||||
var btcValue = function () {
|
||||
var url = '/btc';
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
var gbp = data.bpi.GBP.rate_float,
|
||||
usd = data.bpi.USD.rate_float;
|
||||
|
||||
updateBTC(gbp, usd);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.bind('getBTC', function () {
|
||||
btcValue();
|
||||
});
|
||||
|
||||
var getFX = function () {
|
||||
var url = '/fx';
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
var gpbex = (1 / data.rates.GBP);
|
||||
var sekex = (gpbex * data.rates.SEK);
|
||||
var fxdata = {
|
||||
usd: 1,
|
||||
gbp: data.rates.GBP,
|
||||
sek: data.rates.SEK,
|
||||
gpbe: gpbex,
|
||||
sekex: sekex
|
||||
};
|
||||
self.trigger('updateFX', fxdata);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.bind('getFX', function () {
|
||||
getFX();
|
||||
});
|
||||
|
||||
var getNextTrainTime = function (toStation, fromStation) {
|
||||
var url = '/getnexttraintimes?from=' + fromStation + '&to=' + toStation;
|
||||
var target = fromStation + toStation;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
},
|
||||
success: function (data) {
|
||||
updateTrain(target, data);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var updateTrain = function (n, obj) {
|
||||
var elm = $('#' + n);
|
||||
|
||||
var output, status;
|
||||
|
||||
output = (obj.eta == "On Time") ? obj.eta : obj.sta;
|
||||
status = (obj.eta == "On Time") ? 'delayed' : 'ontime';
|
||||
|
||||
elm.html(output);
|
||||
elm.prop('class', status);
|
||||
};
|
||||
|
||||
var getTrainsCB = function (results) {
|
||||
var dest$ = $('#trainResults');
|
||||
var html = new EJS({url: '/template/trains.ejs'}).render(results);
|
||||
|
||||
dest$.empty();
|
||||
dest$.append(html);
|
||||
dest$.toggle();
|
||||
};
|
||||
|
||||
var getTrains = function (from, to) {
|
||||
var url = '/gettrains?from=' + from + "&to=" + to;
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
getTrainsCB(data);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var formatPassword = function (data) {
|
||||
|
||||
var dest$ = $('#passwordOut');
|
||||
var html = new EJS({url: '/template/password.ejs'}).render(data);
|
||||
dest$.empty();
|
||||
dest$.append(html);
|
||||
dest$.show();
|
||||
};
|
||||
|
||||
var generatePassword = function (from, to) {
|
||||
var url = '/generate';
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
formatPassword(data);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
tick();
|
||||
get_weather();
|
||||
self.trigger('getBTC');
|
||||
self.trigger('getFX');
|
||||
getNextTrainTime('dbe', 'glq');
|
||||
getNextTrainTime('glq', 'dbe');
|
||||
|
||||
// start 15 minute timer
|
||||
|
||||
_fastTimer = setInterval(function () {
|
||||
self.trigger('getBTC');
|
||||
getNextTrainTime('dbe', 'glq');
|
||||
getNextTrainTime('glq', 'dbe');
|
||||
}, (60000));
|
||||
|
||||
_slowTimer = setInterval(function () {
|
||||
|
||||
self.trigger('getFX');
|
||||
get_weather();
|
||||
}, (60000 * 15));
|
||||
|
||||
$('#dbeglq').on('click', function () {
|
||||
self.trigger('getTrains', 'dbe', 'glq');
|
||||
});
|
||||
|
||||
$('#glqdbe').on('click', function () {
|
||||
self.trigger('getTrains', 'glq', 'dbe');
|
||||
});
|
||||
|
||||
$('#newPassword').on('click', function () {
|
||||
generatePassword();
|
||||
});
|
||||
|
||||
this.bind('getTrains', function (start, end) {
|
||||
getTrains(start, end);
|
||||
});
|
||||
|
||||
document.title = 'Slack';
|
||||
})();
|
||||
|
||||
var popitout = function (url) {
|
||||
var newwindow = window.open(url, 'name', 'height=600,width=570');
|
||||
if (window.focus) {
|
||||
newwindow.focus()
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var popitoutSmall = function (url) {
|
||||
var newwindow = window.open(url, 'name', 'height=400,width=520');
|
||||
if (window.focus) {
|
||||
newwindow.focus()
|
||||
}
|
||||
return false;
|
||||
};
|
10
app/app.min.js
vendored
Normal file
10
app/app.min.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
(function(){var c=0,m=0,g=0,n=0,h=0;MicroEvent.mixin(this);var e=this,k=function(a,b){var d;d=a.getTime();return(b.getTime()-d)/864E5};this.bind("displayWeather",function(a){console.log("Update weather event:");$("#weather").html(a.currently.summary+" "+a.currently.temperature+"°c <em>"+a.daily.summary+"</em>")});var p=function(a){$.ajax({type:"GET",url:"https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/"+a.coords.latitude.toString()+","+a.coords.longitude.toString()+"?units=uk2",
|
||||
data:"",dataType:"jsonp",timeout:1E4,context:$("body"),contentType:"application/json",headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(a){e.trigger("displayWeather",a)},error:function(a,d){console.log("ajax error");console.log(a);console.log(d)}})},t=function(){$.ajax({type:"GET",url:"/btc",data:"",dataType:"json",timeout:1E4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS",
|
||||
"Access-Control-Allow-Headers":"Content-Type"},success:function(a){var b=a.bpi.GBP.rate_float;a=a.bpi.USD.rate_float;var d,q,f=$("#btc");0!==c?(f.removeClass(),b>c?f.addClass("up"):b<c&&f.addClass("down")):(m=b,g=a,n=b,h=a);c=b;b<m&&(m=b);a<g&&(g=a);n<b&&(n=b);h<a&&(h=a);q=3.49524333*b;d="High: $"+parseFloat(h.toFixed(2))+" / Low $"+parseFloat(g.toFixed(2));f.html("$"+parseFloat(a.toFixed(2))+" / £"+parseFloat(b.toFixed(2))+" (£"+parseFloat(q.toFixed(2))+")");f.prop("title",d)},error:function(a,
|
||||
b){console.log("ajax error");console.log(a);console.log(b)}})};this.bind("getBTC",function(){console.log("BTC Event");t()});var r=function(){$.ajax({type:"GET",url:"/fx",data:"",dataType:"json",timeout:1E4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(a){var b=1/a.rates.GBP;a=b*a.rates.SEK;$("#fx").html("£1 = $"+parseFloat(b.toFixed(2))+" = "+parseFloat(a.toFixed(2))+
|
||||
" SEK")},error:function(a,b){console.log("ajax error");console.log(a);console.log(b)}})},l=function(a,b){var d=b+a;$.ajax({type:"GET",url:"/getnexttraintimes?from="+b+"&to="+a,data:"",dataType:"json",timeout:1E4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(a){var b=$("#"+d),c;c="On Time"==a.eta?a.eta:a.sta;a="On Time"==a.eta?"delayed":"ontime";b.html(c);b.prop("class",a)},
|
||||
error:function(a,b){console.log("ajax error");console.log(a);console.log(b)}})},u=function(a,b){$.ajax({type:"GET",url:"/gettrains?from="+a+"&to="+b,data:"",dataType:"json",timeout:1E4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(a){var b=$("#trainResults");a=(new EJS({url:"/template/trains.ejs"})).render(a);b.empty();b.append(a);b.toggle()},error:function(a,b){console.log("ajax error");
|
||||
console.log(a);console.log(b)}})},v=function(a,b){$.ajax({type:"GET",url:"/generate",data:"",dataType:"json",timeout:1E4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(a){var b=$("#passwordOut");a=(new EJS({url:"/template/password.ejs"})).render(a);b.empty();b.append(a);b.show()},error:function(a,b){console.log("ajax error");console.log(a);console.log(b)}})};(function(){var a=
|
||||
new Date,b=new Date,c=new Date,e=new Date;b.setFullYear(2013,9,24);b=new Date(b.getTime()+864864E5);c.setFullYear(2016,4,4);e.setFullYear(2013,7,25);$("#one").text("101B ends: "+Math.ceil(k(a,b))+" days / "+Math.ceil(k(a,b)/7)+" weeks");$("#two").text("Ends: "+Math.ceil(k(a,c))+" days / "+Math.ceil(k(a,c)/7)+" weeks");$("#three").hide()})();navigator.geolocation.getCurrentPosition(p);e.trigger("getBTC");r();l("dbe","glq");l("glq","dbe");_fastTimer=setInterval(function(){e.trigger("getBTC");l("dbe",
|
||||
"glq");l("glq","dbe")},6E4);setInterval(function(){r();navigator.geolocation.getCurrentPosition(p)},9E5);$("#dbeglq").on("click",function(){e.trigger("getTrains","dbe","glq")});$("#glqdbe").on("click",function(){e.trigger("getTrains","glq","dbe")});$("#newPassword").on("click",function(){v()});this.bind("getTrains",function(a,b){u(a,b)});document.title="Slack"})();
|
||||
var popitout=function(c){c=window.open(c,"name","height=600,width=570");window.focus&&c.focus();return!1},popitoutSmall=function(c){c=window.open(c,"name","height=400,width=520");window.focus&&c.focus();return!1};
|
1
app/app.min.js.map
Normal file
1
app/app.min.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["app.js"],"names":["_slowTimer","lastGBP","lastUSD","myBTC","lows","gbp","usd","highs","addDays","myDate","days","Date","getTime","getDays","startdate","enddate","r","s","e","tick","today","start101","end101","endContract","third","setFullYear","$","text","Math","ceil","hide","get_weather","navigator","geolocation","getCurrentPosition","show_weather","position","latitude","coords","longitude","ajax","type","url","toString","data","dataType","timeout","context","contentType","headers","Access-Control-Allow-Origin","Access-Control-Allow-Methods","Access-Control-Allow-Headers","success","calc","currently","temperature","html","summary","parseInt","daily","error","xhr","console","log","updateBTC","g","u","title","total","elm","removeClass","addClass","parseFloat","toFixed","prop","updateFX","gpbe","sekex","btcValue","bpi","GBP","rate_float","USD","getFX","gpbex","rates","SEK","fxdata","sek","getDBEGLQ","updateTrain","getGLQDBE","n","obj","output","status","eta","sta","_fastTimer","setInterval","popitout","newwindow","window","open","focus","popitoutSmall"],"mappings":"CAAA,WAEI,GAEgBA,GAFZC,EAAU,EACVC,EAAU,EACcC,EAAO,WAC/BC,GACIC,IAAK,EACLC,IAAK,GAETC,GACIF,IAAK,EACLC,IAAK,GAiBTE,EAAU,SAAUC,EAAQC,GAC5B,MAAO,IAAIC,MAAKF,EAAOG,UAAmB,GAAPF,EAAY,GAAK,GAAK,MAGzDG,EAAU,SAAUC,EAAWC,GAC/B,GAAIC,GAAGC,EAAGC,CAIV,OAHAD,GAAIH,EAAUF,UACdM,EAAIH,EAAQH,UACZI,GAAKE,EAAID,GAAK,OAGdE,EAAO,WACP,GAAIC,GAAQ,GAAIT,MACZU,EAAW,GAAIV,MACfW,EAAS,GAAIX,MACbY,EAAc,GAAIZ,MAClBa,EAAQ,GAAIb,KAChBU,GAASI,YAAY,KAAM,EAAG,IAC9BH,EAASd,EAAQa,EAAU,MAC3BE,EAAYE,YAAY,KAAM,EAAG,IACjCD,EAAMC,YAAY,KAAM,EAAG,IAC3BC,EAAE,QAAQC,KAAK,cAAgBC,KAAKC,KAAKhB,EAAQO,EAC7CE,IAAW,WAAaM,KAAKC,KAAKhB,EAAQO,EAC1CE,GAAU,GAAK,UACnBI,EAAE,QAAQC,KAAK,SAAWC,KAAKC,KAAKhB,EAAQO,EACxCG,IAAgB,WAAaK,KAAKC,KAAKhB,EAAQO,EAC/CG,GAAe,GAAK,UACxBG,EAAE,UAAUI,QAGZC,EAAc,WACdC,UAAUC,YAAYC,mBAAmBC,IAEzCA,EAAe,SAAUC,GACzB,GAAIC,GAAWD,EAASE,OAAOD,SAC3BE,EAAYH,EAASE,OAAOC,SAEhCb,GAAEc,MACEC,KAAM,MACNC,IAAK,qEAAuEL,EAASM,WAAa,IAAMJ,EAAUI,WAClHC,KAAM,GACNC,SAAU,QACVC,QAAS,IACTC,QAASrB,EAAE,QACXsB,YAAa,mBACbC,SACIC,8BAA+B,IAC/BC,+BAAgC,kCAChCC,+BAAgC,gBAGpCC,QAAS,SAAUT,GAGf,GAAIU,GAAS,EAAM,GAAOV,EAAKW,UAAUC,YAAc,GACvD9B,GAAE,YAAY+B,KAAKb,EAAKW,UAAUG,QAAU,IAAMC,SAASL,GAAQ,mBAA0BV,EAAKgB,MAAMF,QAAU,UAGtHG,MAAO,SAAUC,EAAKrB,GAClBsB,QAAQC,IAAI,cACZD,QAAQC,IAAIF,GACZC,QAAQC,IAAIvB,OAKpBwB,EAAY,SAAUC,EAAGC,GACzB,GAAIC,GAAOC,EAAOC,EAAM5C,EAAE,OACV,KAAZzB,GAEAqE,EAAIC,cACAL,EAAIjE,EACJqE,EAAIE,SAAS,MACFvE,EAAJiE,GACPI,EAAIE,SAAS,UAIjBpE,EAAKC,IAAM6D,EACX9D,EAAKE,IAAM6D,EAEX5D,EAAMF,IAAM6D,EACZ3D,EAAMD,IAAM6D,GAGhBlE,EAAUiE,EACVhE,EAAUiE,EAEND,EAAI9D,EAAKC,MAAKD,EAAKC,IAAM6D,GACzBC,EAAI/D,EAAKE,MAAKF,EAAKE,IAAM6D,GAEzB5D,EAAMF,IAAM6D,IAAG3D,EAAMF,IAAM6D,GAC3B3D,EAAMD,IAAM6D,IAAG5D,EAAMD,IAAM6D,GAE/BE,EAAQlE,EAAQ+D,EAEhBE,EAAQ,UAAYK,WAAWlE,EAAMD,IAAIoE,QAAQ,IAAM,WAAaD,WAAWrE,EAAKE,IAAIoE,QAAQ,IAChGJ,EAAIb,KAAK,QAAUgB,WAAWN,EAAEO,QAAQ,IAAM,aAAeD,WAAWP,EAAEQ,QAAQ,IAAM,YAAcD,WAAWJ,EAAMK,QAAQ,IAAM,KAErIJ,EAAIK,KAAK,QAASP,IAIlBQ,EAAW,SAAUhC,GACrB,GAAkB0B,GAAM5C,EAAE,MAE1B4C,GAAIb,KAAK,mBAAqBgB,WAAW7B,EAAKiC,KAAKH,QAAQ,IAAM,MAAQD,WAAW7B,EAAKkC,MAAMJ,QAAQ,IAAM,SAM7GK,EAAW,WACX,GAAIrC,GAAM,MAEVhB,GAAEc,MACEC,KAAM,MACNC,IAAKA,EACLE,KAAM,GACNC,SAAU,OAEVC,QAAS,IAGTG,SACIC,8BAA+B,IAC/BC,+BAAgC,kCAChCC,+BAAgC,gBAGpCC,QAAS,SAAUT,GAEf,GAAIvC,GAAMuC,EAAKoC,IAAIC,IAAIC,WACnB5E,EAAMsC,EAAKoC,IAAIG,IAAID,UAEvBjB,GAAU5D,EAAKC,IAEnBuD,MAAO,SAAUC,EAAKrB,GAClBsB,QAAQC,IAAI,cACZD,QAAQC,IAAIF,GACZC,QAAQC,IAAIvB,OAMpB2C,EAAQ,WACR,GAAI1C,GAAM,KAEVhB,GAAEc,MACEC,KAAM,MACNC,IAAKA,EACLE,KAAM,GACNC,SAAU,OAEVC,QAAS,IAGTG,SACIC,8BAA+B,IAC/BC,+BAAgC,kCAChCC,+BAAgC,gBAGpCC,QAAS,SAAUT,GAEf,GAAIyC,GAAS,EAAIzC,EAAK0C,MAAML,IACxBH,EAASO,EAAQzC,EAAK0C,MAAMC,IAC5BC,GACAlF,IAAK,EACLD,IAAKuC,EAAK0C,MAAML,IAChBQ,IAAK7C,EAAK0C,MAAMC,IAChBV,KAAMQ,EACNP,MAAOA,EAKXF,GAASY,IAEb3B,MAAO,SAAUC,EAAKrB,GAClBsB,QAAQC,IAAI,cACZD,QAAQC,IAAIF,GACZC,QAAQC,IAAIvB,OAMpBiD,EAAY,WAEZ,GAAIhD,GAAM,SAEVhB,GAAEc,MACEC,KAAM,MACNC,IAAKA,EACLE,KAAM,GACNC,SAAU,OAEVC,QAAS,IAGTG,SACIC,8BAA+B,IAC/BC,+BAAgC,kCAChCC,+BAAgC,gBAGpCC,QAAS,SAAUT,GACfmB,QAAQC,IAAIpB,GAEZ+C,EAAY,SAAS/C,IAGzBiB,MAAO,SAAUC,EAAKrB,GAClBsB,QAAQC,IAAI,cACZD,QAAQC,IAAIF,GACZC,QAAQC,IAAIvB,OAKpBmD,EAAY,WAEZ,GAAIlD,GAAM,SAEVhB,GAAEc,MACEC,KAAM,MACNC,IAAKA,EACLE,KAAM,GACNC,SAAU,OAEVC,QAAS,IAGTG,SACIC,8BAA+B,IAC/BC,+BAAgC,kCAChCC,+BAAgC,gBAGpCC,QAAS,SAAUT,GACfmB,QAAQC,IAAIpB,GAEZ+C,EAAY,SAAS/C,IAGzBiB,MAAO,SAAUC,EAAKrB,GAClBsB,QAAQC,IAAI,cACZD,QAAQC,IAAIF,GACZC,QAAQC,IAAIvB,OAKpBkD,EAAc,SAAUE,EAAGC,GAC3B,GAEIC,GAAQC,EAFP1B,EAAM5C,EAAE,IAAImE,EAKjBE,GAAqB,WAAXD,EAAIG,IAAoBH,EAAIG,IAAMH,EAAII,IAChDF,EAAqB,WAAXF,EAAIG,IAAoB,UAAY,SAE9C3B,EAAIb,KAAKsC,GAETzB,EAAIK,KAAK,QAASqB,GAItB7E,KACAY,IACAgD,IACAK,IACAM,IACAE,IAIAO,WAAaC,YAAY,WACrBrB,IACAW,IACAE,KACD,KAEH5F,EAAaoG,YAAY,WAErBhB,IACArD,KACD,OAIP,IAAIsE,UAAW,SAAU3D,GAKrB,MAJA4D,WAAYC,OAAOC,KAAK9D,EAAK,OAAQ,wBACjC6D,OAAOE,OACPH,UAAUG,SAEP,GAGPC,cAAgB,SAAUhE,GAK1B,MAJA4D,WAAYC,OAAOC,KAAK9D,EAAK,OAAQ,wBACjC6D,OAAOE,OACPH,UAAUG,SAEP"}
|
7
app/coins.js
Normal file
7
app/coins.js
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Created by martind on 14/11/14.
|
||||
*/
|
||||
var coins = {
|
||||
bought:
|
||||
|
||||
}
|
170
app/css/clock.css
Normal file
170
app/css/clock.css
Normal file
@ -0,0 +1,170 @@
|
||||
@media (min-width:800px) {
|
||||
body {
|
||||
font-family: 'Roboto Slab', "Helvetica Neue", Helvetica, Arial;
|
||||
}
|
||||
|
||||
#clock {
|
||||
font-family: 'Share Tech Mono';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 800px;
|
||||
height: 300px;
|
||||
background-color: #212121;
|
||||
font-size: 180px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#clockDisplay {
|
||||
margin-top: 50;
|
||||
}
|
||||
|
||||
#weather {
|
||||
position: absolute;
|
||||
top: 300px;
|
||||
left: 0;
|
||||
width: 800px;
|
||||
height: 150px;
|
||||
background-color: #312121;
|
||||
}
|
||||
|
||||
#misc {
|
||||
position: absolute;
|
||||
top: 450px;
|
||||
left: 0;
|
||||
width: 800px;
|
||||
height: 150px;
|
||||
background-color: #213121;
|
||||
}
|
||||
|
||||
.weatherBit {
|
||||
color: #fff;
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
.wday {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width:1024px){
|
||||
|
||||
body {
|
||||
font-family: 'Roboto Slab', "Helvetica Neue", Helvetica, Arial;
|
||||
background-color: #212121;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#clock {
|
||||
font-family: 'Share Tech Mono';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1024px;
|
||||
height: 384px;
|
||||
background-color: #212121;
|
||||
font-size: 180px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#clockDisplay {
|
||||
margin-top: 50;
|
||||
}
|
||||
|
||||
#weather {
|
||||
position: absolute;
|
||||
top: 384px;
|
||||
left: 0;
|
||||
width: 1024px;
|
||||
height: 192px;
|
||||
background-color: #312121;
|
||||
}
|
||||
|
||||
#misc {
|
||||
position: absolute;
|
||||
top: 576px;
|
||||
left: 0;
|
||||
width: 1024px;
|
||||
height: 192px;
|
||||
background-color: #213121;
|
||||
}
|
||||
|
||||
.weatherBit {
|
||||
color: #fff;
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
.wday {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@media (min-width:1280px){
|
||||
|
||||
body {
|
||||
font-family: 'Roboto Slab', "Helvetica Neue", Helvetica, Arial;
|
||||
background-color: #212121;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#clock {
|
||||
font-family: 'Share Tech Mono';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 512px;
|
||||
background-color: #212121;
|
||||
font-size: 300px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#clockDisplay {
|
||||
margin-top: 50;
|
||||
}
|
||||
|
||||
#weather {
|
||||
position: absolute;
|
||||
top: 512px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 256px;
|
||||
background-color: #312121;
|
||||
}
|
||||
|
||||
#misc {
|
||||
position: absolute;
|
||||
top: 768px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 256px;
|
||||
background-color: #213121;
|
||||
}
|
||||
|
||||
.weatherBit {
|
||||
color: #fff;
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
.wday {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
3053
app/css/mui.css
Normal file
3053
app/css/mui.css
Normal file
File diff suppressed because it is too large
Load Diff
1
app/css/mui.min.css
vendored
Normal file
1
app/css/mui.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
app/gfx/information-icon-24.png
Normal file
BIN
app/gfx/information-icon-24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
app/gfx/information-icon-32.png
Normal file
BIN
app/gfx/information-icon-32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
app/gfx/popout.png
Normal file
BIN
app/gfx/popout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 B |
12
app/index.html
Normal file
12
app/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Silvrtree</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
</head>
|
||||
<body>
|
||||
silvrtree
|
||||
</body>
|
||||
</html>
|
89
app/jessica.html
Normal file
89
app/jessica.html
Normal file
@ -0,0 +1,89 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="viewport" content="width=360; initial-scale=1;">
|
||||
<meta charset="UTF-8">
|
||||
<title>Trains</title>
|
||||
|
||||
<meta name="Author" content="" />
|
||||
<link rel="stylesheet" type="text/css" href="css/mui.css">
|
||||
<style>
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
|
||||
.dates {
|
||||
padding: 2px;
|
||||
border: solid 1px #80007e;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#btc, #fx {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.up, .ontime {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.down, .delayed {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.nochange {
|
||||
color: #000000;
|
||||
}
|
||||
.password {
|
||||
border: 1px solid #cccccc;
|
||||
background-color: #efefef;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<div class="mui-text-headline mui-text-accent">Trains</div>
|
||||
</div>
|
||||
<div id="container" class="mui-panel">
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-3" id="pygglcC">Paisley > GLC <span id="pygglc">-- : --</span> <img src="gfx/information-icon-24.png" id="pygglcB"></div>
|
||||
<div class="mui-col-md-3" id="glcptkC">GLC > Partick <span id="glcptk">-- : --</span> <img src="gfx/information-icon-24.png" id="glcptkB"></div>
|
||||
<div class="mui-col-md-3" id="ptkdbeC">Partick > DBE <span id="ptkdbe">-- : --</span> <img src="gfx/information-icon-24.png" id="ptkdbeB"></div>
|
||||
<div class="mui-col-md-3" id="glqdbeC">GLQ > DBE <span id="glqdbe">-- : --</span> <img src="gfx/information-icon-24.png" id="glqdbeB"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mui-panel">
|
||||
<div class="mui-row" id="trainResults">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id='weather' class="mui-panel"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
<script src="libs/ejs.js"></script>
|
||||
<script src="js/jessica.js"></script>
|
||||
</html>
|
114
app/js/clock.js
Normal file
114
app/js/clock.js
Normal file
@ -0,0 +1,114 @@
|
||||
/**
|
||||
* Created by marti on 29/02/2016.
|
||||
*/
|
||||
|
||||
|
||||
(function () {
|
||||
|
||||
var storedData;
|
||||
var self = this;
|
||||
var weatherCount = 0;
|
||||
var skycons = new Skycons({"color": "white"});
|
||||
|
||||
MicroEvent.mixin(this);
|
||||
|
||||
function getData() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/today/data',
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
timeout: 10000,
|
||||
context: $('body'),
|
||||
contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
storedData = data;
|
||||
startWeather();
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateWeather() {
|
||||
$('#wCtext').empty().html(storedData.data.weather.currently);
|
||||
$('#wLtext').empty().html(storedData.data.weather.later);
|
||||
$('#wTtext').empty().html(storedData.data.weather.today);
|
||||
// $('#wDaily').empty();
|
||||
|
||||
for (var t = 0; t < storedData.data.weather.data.daily.data.length; t++) {
|
||||
var m = 'icon' + (t + 1).toString();
|
||||
var d = '#d' + (t + 1).toString();
|
||||
var ts = parseInt(storedData.data.weather.data.daily.data[t].time) * 1000;
|
||||
var n = Date.create(ts).format('{weekday}');
|
||||
|
||||
skycons.add(m, storedData.data.weather.data.daily.data[t].icon);
|
||||
$(d).empty().html(n);
|
||||
}
|
||||
skycons.play();
|
||||
|
||||
$('#wLater').hide();
|
||||
$('#wToday').hide();
|
||||
$('#wDaily').hide();
|
||||
}
|
||||
|
||||
function switchWeather() {
|
||||
|
||||
weatherCount++;
|
||||
weatherCount = weatherCount < 4 ? weatherCount : 0;
|
||||
|
||||
$('#wCurrent').toggle(weatherCount == 0);
|
||||
$('#wLater').toggle(weatherCount == 1);
|
||||
$('#wToday').toggle(weatherCount == 2);
|
||||
$('#wDaily').toggle(weatherCount == 3);
|
||||
|
||||
}
|
||||
|
||||
// event bus
|
||||
|
||||
this.bind('switchWeather', function () {
|
||||
switchWeather();
|
||||
});
|
||||
|
||||
// timers
|
||||
function startWeather() {
|
||||
|
||||
updateWeather();
|
||||
setInterval(function () {
|
||||
self.trigger('switchWeather');
|
||||
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
function startClock() {
|
||||
setInterval(function () {
|
||||
var n = Date.create(new Date()).format('{hh}:{mm}:{ss}');
|
||||
$('#clockDisplay').html(n);
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
setInterval(function () {
|
||||
getData()
|
||||
}, 900000);
|
||||
}
|
||||
|
||||
startClock();
|
||||
getData();
|
||||
refresh();
|
||||
$('#misc').html($( window ).width());
|
||||
|
||||
|
||||
|
||||
})();
|
||||
|
424
app/js/jessica.js
Normal file
424
app/js/jessica.js
Normal file
@ -0,0 +1,424 @@
|
||||
(function () {
|
||||
|
||||
var lastGBP = 0.0,
|
||||
lastUSD = 0.0,
|
||||
_fasttimer, _slowTimer, myBTC =3.49524333;
|
||||
var lows = {
|
||||
gbp: 0,
|
||||
usd: 0
|
||||
},
|
||||
highs = {
|
||||
gbp: 0,
|
||||
usd: 0
|
||||
};
|
||||
|
||||
|
||||
var list = [{
|
||||
title: '101B ends',
|
||||
y: 2013,
|
||||
m: 9,
|
||||
d: 24,
|
||||
add: 1001
|
||||
},
|
||||
{
|
||||
title: 'Ends',
|
||||
y: 2015,
|
||||
m: 4,
|
||||
d: 10
|
||||
}];
|
||||
var addDays = function (myDate, days) {
|
||||
return new Date(myDate.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
};
|
||||
|
||||
var getDays = function (startdate, enddate) {
|
||||
var r, s, e;
|
||||
s = startdate.getTime();
|
||||
e = enddate.getTime();
|
||||
r = (e - s) / (24 * 60 * 60 * 1000);
|
||||
return r;
|
||||
};
|
||||
var tick = function () {
|
||||
var today = new Date();
|
||||
var start101 = new Date();
|
||||
var end101 = new Date();
|
||||
var endContract = new Date();
|
||||
var third = new Date();
|
||||
start101.setFullYear(2013, 9, 24);
|
||||
end101 = addDays(start101, 1001);
|
||||
endContract.setFullYear(2015, 4, 10);
|
||||
third.setFullYear(2013, 7, 25);
|
||||
$('#one').text('101B ends: ' + Math.ceil(getDays(today,
|
||||
end101)) + " days / " + Math.ceil(getDays(today,
|
||||
end101) / 7) + " weeks");
|
||||
$('#two').text('Ends: ' + Math.ceil(getDays(today,
|
||||
endContract)) + " days / " + Math.ceil(getDays(today,
|
||||
endContract) / 7) + " weeks");
|
||||
$('#three').hide();
|
||||
};
|
||||
|
||||
var get_weather = function () {
|
||||
navigator.geolocation.getCurrentPosition(show_weather);
|
||||
};
|
||||
var show_weather = function (position) {
|
||||
var latitude = position.coords.latitude;
|
||||
var longitude = position.coords.longitude;
|
||||
// let's show a map or do something interesting!
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/' + latitude.toString() + ',' + longitude.toString(),
|
||||
data: '',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
context: $('body'),
|
||||
contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
|
||||
var calc = ((5.0 / 9.0 * (data.currently.temperature - 32)));
|
||||
$('#weather').html(data.currently.summary + " " + parseInt(calc) + '°c ' + '<em>' + data.daily.summary + '</em>');
|
||||
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var updateBTC = function (g, u) {
|
||||
var title, total, elm = $('#btc');
|
||||
if (lastGBP !== 0) {
|
||||
|
||||
elm.removeClass();
|
||||
if (g > lastGBP) {
|
||||
elm.addClass('up');
|
||||
} else if (g < lastGBP) {
|
||||
elm.addClass('down');
|
||||
}
|
||||
|
||||
} else {
|
||||
lows.gbp = g;
|
||||
lows.usd = u;
|
||||
|
||||
highs.gbp = g;
|
||||
highs.usd = u;
|
||||
}
|
||||
|
||||
lastGBP = g;
|
||||
lastUSD = u;
|
||||
|
||||
if (g < lows.gbp) lows.gbp = g;
|
||||
if (u < lows.usd) lows.usd = u;
|
||||
|
||||
if (highs.gbp < g) highs.gbp = g;
|
||||
if (highs.usd < u) highs.usd = u;
|
||||
|
||||
total = myBTC * g;
|
||||
|
||||
title = "High: $" + parseFloat(highs.usd.toFixed(2)) + " / Low $" + parseFloat(lows.usd.toFixed(2));
|
||||
elm.html("$" + parseFloat(u.toFixed(2)) + " / £" + parseFloat(g.toFixed(2)) + " (£" + parseFloat(total.toFixed(2)) + ")");
|
||||
|
||||
elm.prop('title', title);
|
||||
};
|
||||
|
||||
|
||||
var updateFX = function (data) {
|
||||
var title, total, elm = $('#fx');
|
||||
//title = "High: $" + parseFloat(highs.usd.toFixed(2)) + " / Low $" + parseFloat(lows.usd.toFixed(2));
|
||||
elm.html("£1 = $" + parseFloat(data.gpbe.toFixed(2)) + " = " + parseFloat(data.sekex.toFixed(2)) + " SEK");
|
||||
|
||||
// elm.prop('title', title);
|
||||
};
|
||||
|
||||
|
||||
var btcValue = function () {
|
||||
var url = '/btc';
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
var gbp = data.bpi.GBP.rate_float,
|
||||
usd = data.bpi.USD.rate_float;
|
||||
|
||||
updateBTC(gbp, usd);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var getFX = function () {
|
||||
var url = '/fx';
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
//console.log(data);
|
||||
var gpbex = (1 / data.rates.GBP);
|
||||
var sekex = (gpbex * data.rates.SEK);
|
||||
var fxdata = {
|
||||
usd: 1,
|
||||
gbp: data.rates.GBP,
|
||||
sek: data.rates.SEK,
|
||||
gpbe: gpbex,
|
||||
sekex: sekex
|
||||
};
|
||||
// console.log(fxdata);
|
||||
//var fxdata = data.bpi.GBP.rate_float, usd = data.bpi.USD.rate_float;
|
||||
|
||||
updateFX(fxdata);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var getNextTrainTime = function(toStation,fromStation)
|
||||
{
|
||||
var url = '/getnexttraintimes?from=' + fromStation + '&to=' + toStation ;
|
||||
var target = fromStation + toStation;
|
||||
console.log('Target: ' + target);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
|
||||
updateTrain(target,data);
|
||||
//updateFX(fxdata);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var updateTrain = function (n, obj) {
|
||||
var elm = $('#'+n);
|
||||
|
||||
var output, status;
|
||||
|
||||
|
||||
output = (obj.eta == "On Time") ? obj.eta : obj.sta;
|
||||
status = (obj.eta == "On Time") ? 'delayed' : 'ontime';
|
||||
|
||||
elm.html(output);
|
||||
|
||||
elm.prop('class', status);
|
||||
};
|
||||
|
||||
var getTrainsCB = function (results) {
|
||||
var dest$ = $('#trainResults');
|
||||
var html = new EJS({url: '/template/trains.ejs'}).render(results);
|
||||
|
||||
// console.log(html);
|
||||
dest$.empty();
|
||||
dest$.append(html);
|
||||
// dest$.toggle();
|
||||
|
||||
};
|
||||
|
||||
var getTrains = function(from, to) {
|
||||
var url = '/gettrains?from=' + from + "&to=" + to;
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
//console.log(data);
|
||||
|
||||
// updateTrain('glqdbe',data);
|
||||
getTrainsCB(data);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var formatPassword = function (data) {
|
||||
|
||||
|
||||
var dest$ = $('#passwordOut');
|
||||
var html = new EJS({url: '/template/password.ejs'}).render(data);
|
||||
|
||||
console.log(html);
|
||||
dest$.empty();
|
||||
dest$.append(html);
|
||||
dest$.show();
|
||||
};
|
||||
|
||||
|
||||
var generatePassword = function(from, to) {
|
||||
var url = '/generate';
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
|
||||
formatPassword(data);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
tick();
|
||||
get_weather();
|
||||
// btcValue();
|
||||
// getFX();
|
||||
//getDBEGLQ();
|
||||
//getGLQDBE();
|
||||
getNextTrainTime('glc','pyg');
|
||||
getNextTrainTime('dbe','glq');
|
||||
getNextTrainTime('ptk','glc');
|
||||
getNextTrainTime('dbe','ptk');
|
||||
|
||||
|
||||
|
||||
// start 15 minute timer
|
||||
|
||||
_fastTimer = setInterval(function () {
|
||||
//btcValue();
|
||||
// getDBEGLQ();
|
||||
// getGLQDBE();
|
||||
getNextTrainTime('glc','pyg');
|
||||
getNextTrainTime('dbe','glq');
|
||||
getNextTrainTime('ptk','glc');
|
||||
getNextTrainTime('dbe','ptk');
|
||||
}, (60000));
|
||||
|
||||
_slowTimer = setInterval(function () {
|
||||
|
||||
// getFX();
|
||||
get_weather();
|
||||
}, (60000 * 15));
|
||||
|
||||
|
||||
|
||||
$('#glqdbeB').on('click',function(){
|
||||
getTrains('glq','dbe');
|
||||
});
|
||||
|
||||
$('#pygglcB').on('click',function(){
|
||||
getTrains('pyg','glc');
|
||||
});
|
||||
|
||||
$('#glcptkB').on('click',function(){
|
||||
getTrains('glc','ptk');
|
||||
});
|
||||
|
||||
$('#ptkdbeB').on('click',function(){
|
||||
getTrains('ptk','dbe');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})();
|
||||
|
||||
var popitout = function (url) {
|
||||
newwindow = window.open(url, 'name', 'height=600,width=570');
|
||||
if (window.focus) {
|
||||
newwindow.focus()
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var popitoutSmall = function (url) {
|
||||
newwindow = window.open(url, 'name', 'height=400,width=520');
|
||||
if (window.focus) {
|
||||
newwindow.focus()
|
||||
}
|
||||
return false;
|
||||
};
|
54
app/js/temp.js
Normal file
54
app/js/temp.js
Normal file
@ -0,0 +1,54 @@
|
||||
var app = angular.module( "Temp", [])
|
||||
.controller("TempController", function( $scope, tempService) {
|
||||
|
||||
$scope.tempData = [];
|
||||
|
||||
loadRemoteData();
|
||||
|
||||
function applyRemoteData(newData)
|
||||
{
|
||||
$scope.tempData = newData;
|
||||
}
|
||||
|
||||
function loadRemoteData() {
|
||||
console.log('Loading data...');
|
||||
tempService.getTemp()
|
||||
.then(
|
||||
function(tempData) {
|
||||
applyRemoteData(tempData);
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
).service(
|
||||
"tempService",
|
||||
function($http, $q) {
|
||||
return({getTemp:getTemp});
|
||||
|
||||
function getTemp() {
|
||||
var request = $http({
|
||||
method: "get",
|
||||
url:"http://api.silvrtree.co.uk/temp/all",
|
||||
params: {
|
||||
/* action:"get"*/
|
||||
}
|
||||
});
|
||||
return (request.then(handleSuccess, handleError));
|
||||
}
|
||||
|
||||
|
||||
function handleError(response) {
|
||||
if ( !angular.isObject(response.data) || !response.data.message) {
|
||||
return( $q.reject("An unknown error occured"));
|
||||
}
|
||||
|
||||
return($q.reject(response.data.message));
|
||||
}
|
||||
|
||||
function handleSuccess(response)
|
||||
{
|
||||
return(response.data);
|
||||
}
|
||||
|
||||
}
|
||||
);
|
47
app/js/tempSocket.js
Normal file
47
app/js/tempSocket.js
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
(function () {
|
||||
console.log('Starting socket?');
|
||||
var url = "ws://api.silvrtree.co.uk:8039";
|
||||
|
||||
var wsCtor = window['MozWebSocket'] ? MozWebSocket : WebSocket;
|
||||
this.socket = new wsCtor(url, 'stream');
|
||||
|
||||
|
||||
|
||||
|
||||
this.handleData = function(d) {
|
||||
switch(d.id) {
|
||||
case 'LightingDataReceived':
|
||||
// this.updateLighting(d.sensorData.d);
|
||||
break;
|
||||
case 'ProjectorDataReceived':
|
||||
// this.updateProj(d.sensorData.d);
|
||||
break;
|
||||
case 'HeatingDataReceived':
|
||||
break;
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.handleWebsocketMessage = function (message) {
|
||||
try {
|
||||
var command = JSON.parse(message.data);
|
||||
}
|
||||
catch (e) { /* do nothing */
|
||||
}
|
||||
|
||||
if (command) {
|
||||
//this.dispatchCommand(command);
|
||||
this.handleData(command);
|
||||
}
|
||||
};
|
||||
|
||||
this.handleWebsocketClose = function () {
|
||||
alert("WebSocket Connection Closed.");
|
||||
};
|
||||
|
||||
this.socket.onmessage = this.handleWebsocketMessage.bind(this);
|
||||
this.socket.onclose = this.handleWebsocketClose.bind(this);
|
||||
})();
|
68
app/js/weight.js
Normal file
68
app/js/weight.js
Normal file
@ -0,0 +1,68 @@
|
||||
var app = angular.module("Weight", []);
|
||||
app.controller("WeightController", function ($scope, weightService) {
|
||||
$scope.newWeight = 0.0;
|
||||
|
||||
$scope.weightData = [];
|
||||
|
||||
$scope.submitForm = function () {
|
||||
"use strict";
|
||||
console.log('Submitting..');
|
||||
console.log($scope.newWeight);
|
||||
$http({method: 'post', url: '/weight', params: {weight: $scope.newWeight}});
|
||||
};
|
||||
|
||||
loadRemoteData();
|
||||
|
||||
function applyRemoteData(newData) {
|
||||
$scope.weightData = newData;
|
||||
}
|
||||
|
||||
function loadRemoteData() {
|
||||
weightService.getWeight()
|
||||
.then(
|
||||
function (weightData) {
|
||||
applyRemoteData(weightData);
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
app.service(
|
||||
"weightService",
|
||||
function ($http, $q) {
|
||||
return ({getWeight: getWeight});
|
||||
|
||||
function getWeight() {
|
||||
var request = $http({
|
||||
method: "get",
|
||||
url: "/weight/all",
|
||||
params: {
|
||||
/* action:"get"*/
|
||||
}
|
||||
});
|
||||
return (request.then(handleSuccess, handleError));
|
||||
}
|
||||
|
||||
function setWeight(w) {
|
||||
"use strict";
|
||||
|
||||
$http({method: 'post', url: '/weight', params: {weight: w}});
|
||||
|
||||
}
|
||||
|
||||
function handleError(response) {
|
||||
if (!angular.isObject(response.data) || !response.data.message) {
|
||||
return ( $q.reject("An unknown error occured"));
|
||||
}
|
||||
|
||||
return ($q.reject(response.data.message));
|
||||
}
|
||||
|
||||
function handleSuccess(response) {
|
||||
return (response.data);
|
||||
}
|
||||
|
||||
}
|
||||
);
|
505
app/libs/ejs.js
Normal file
505
app/libs/ejs.js
Normal file
@ -0,0 +1,505 @@
|
||||
(function(){
|
||||
|
||||
|
||||
var rsplit = function(string, regex) {
|
||||
var result = regex.exec(string),retArr = new Array(), first_idx, last_idx, first_bit;
|
||||
while (result != null)
|
||||
{
|
||||
first_idx = result.index; last_idx = regex.lastIndex;
|
||||
if ((first_idx) != 0)
|
||||
{
|
||||
first_bit = string.substring(0,first_idx);
|
||||
retArr.push(string.substring(0,first_idx));
|
||||
string = string.slice(first_idx);
|
||||
}
|
||||
retArr.push(result[0]);
|
||||
string = string.slice(result[0].length);
|
||||
result = regex.exec(string);
|
||||
}
|
||||
if (! string == '')
|
||||
{
|
||||
retArr.push(string);
|
||||
}
|
||||
return retArr;
|
||||
},
|
||||
chop = function(string){
|
||||
return string.substr(0, string.length - 1);
|
||||
},
|
||||
extend = function(d, s){
|
||||
for(var n in s){
|
||||
if(s.hasOwnProperty(n)) d[n] = s[n]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EJS = function( options ){
|
||||
options = typeof options == "string" ? {view: options} : options
|
||||
this.set_options(options);
|
||||
if(options.precompiled){
|
||||
this.template = {};
|
||||
this.template.process = options.precompiled;
|
||||
EJS.update(this.name, this);
|
||||
return;
|
||||
}
|
||||
if(options.element)
|
||||
{
|
||||
if(typeof options.element == 'string'){
|
||||
var name = options.element
|
||||
options.element = document.getElementById( options.element )
|
||||
if(options.element == null) throw name+'does not exist!'
|
||||
}
|
||||
if(options.element.value){
|
||||
this.text = options.element.value
|
||||
}else{
|
||||
this.text = options.element.innerHTML
|
||||
}
|
||||
this.name = options.element.id
|
||||
this.type = '['
|
||||
}else if(options.url){
|
||||
options.url = EJS.endExt(options.url, this.extMatch);
|
||||
this.name = this.name ? this.name : options.url;
|
||||
var url = options.url
|
||||
//options.view = options.absolute_url || options.view || options.;
|
||||
var template = EJS.get(this.name /*url*/, this.cache);
|
||||
if (template) return template;
|
||||
if (template == EJS.INVALID_PATH) return null;
|
||||
try{
|
||||
this.text = EJS.request( url+(this.cache ? '' : '?'+Math.random() ));
|
||||
}catch(e){}
|
||||
|
||||
if(this.text == null){
|
||||
throw( {type: 'EJS', message: 'There is no template at '+url} );
|
||||
}
|
||||
//this.name = url;
|
||||
}
|
||||
var template = new EJS.Compiler(this.text, this.type);
|
||||
|
||||
template.compile(options, this.name);
|
||||
|
||||
|
||||
EJS.update(this.name, this);
|
||||
this.template = template;
|
||||
};
|
||||
/* @Prototype*/
|
||||
EJS.prototype = {
|
||||
/**
|
||||
* Renders an object with extra view helpers attached to the view.
|
||||
* @param {Object} object data to be rendered
|
||||
* @param {Object} extra_helpers an object with additonal view helpers
|
||||
* @return {String} returns the result of the string
|
||||
*/
|
||||
render : function(object, extra_helpers){
|
||||
object = object || {};
|
||||
this._extra_helpers = extra_helpers;
|
||||
var v = new EJS.Helpers(object, extra_helpers || {});
|
||||
return this.template.process.call(object, object,v);
|
||||
},
|
||||
update : function(element, options){
|
||||
if(typeof element == 'string'){
|
||||
element = document.getElementById(element)
|
||||
}
|
||||
if(options == null){
|
||||
_template = this;
|
||||
return function(object){
|
||||
EJS.prototype.update.call(_template, element, object)
|
||||
}
|
||||
}
|
||||
if(typeof options == 'string'){
|
||||
params = {}
|
||||
params.url = options
|
||||
_template = this;
|
||||
params.onComplete = function(request){
|
||||
var object = eval( request.responseText )
|
||||
EJS.prototype.update.call(_template, element, object)
|
||||
}
|
||||
EJS.ajax_request(params)
|
||||
}else
|
||||
{
|
||||
element.innerHTML = this.render(options)
|
||||
}
|
||||
},
|
||||
out : function(){
|
||||
return this.template.out;
|
||||
},
|
||||
/**
|
||||
* Sets options on this view to be rendered with.
|
||||
* @param {Object} options
|
||||
*/
|
||||
set_options : function(options){
|
||||
this.type = options.type || EJS.type;
|
||||
this.cache = options.cache != null ? options.cache : EJS.cache;
|
||||
this.text = options.text || null;
|
||||
this.name = options.name || null;
|
||||
this.ext = options.ext || EJS.ext;
|
||||
this.extMatch = new RegExp(this.ext.replace(/\./, '\.'));
|
||||
}
|
||||
};
|
||||
EJS.endExt = function(path, match){
|
||||
if(!path) return null;
|
||||
match.lastIndex = 0
|
||||
return path+ (match.test(path) ? '' : this.ext )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* @Static*/
|
||||
EJS.Scanner = function(source, left, right) {
|
||||
|
||||
extend(this,
|
||||
{left_delimiter: left +'%',
|
||||
right_delimiter: '%'+right,
|
||||
double_left: left+'%%',
|
||||
double_right: '%%'+right,
|
||||
left_equal: left+'%=',
|
||||
left_comment: left+'%#'})
|
||||
|
||||
this.SplitRegexp = left=='[' ? /(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/ : new RegExp('('+this.double_left+')|(%%'+this.double_right+')|('+this.left_equal+')|('+this.left_comment+')|('+this.left_delimiter+')|('+this.right_delimiter+'\n)|('+this.right_delimiter+')|(\n)') ;
|
||||
|
||||
this.source = source;
|
||||
this.stag = null;
|
||||
this.lines = 0;
|
||||
};
|
||||
|
||||
EJS.Scanner.to_text = function(input){
|
||||
if(input == null || input === undefined)
|
||||
return '';
|
||||
if(input instanceof Date)
|
||||
return input.toDateString();
|
||||
if(input.toString)
|
||||
return input.toString();
|
||||
return '';
|
||||
};
|
||||
|
||||
EJS.Scanner.prototype = {
|
||||
scan: function(block) {
|
||||
scanline = this.scanline;
|
||||
regex = this.SplitRegexp;
|
||||
if (! this.source == '')
|
||||
{
|
||||
var source_split = rsplit(this.source, /\n/);
|
||||
for(var i=0; i<source_split.length; i++) {
|
||||
var item = source_split[i];
|
||||
this.scanline(item, regex, block);
|
||||
}
|
||||
}
|
||||
},
|
||||
scanline: function(line, regex, block) {
|
||||
this.lines++;
|
||||
var line_split = rsplit(line, regex);
|
||||
for(var i=0; i<line_split.length; i++) {
|
||||
var token = line_split[i];
|
||||
if (token != null) {
|
||||
try{
|
||||
block(token, this);
|
||||
}catch(e){
|
||||
throw {type: 'EJS.Scanner', line: this.lines};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
EJS.Buffer = function(pre_cmd, post_cmd) {
|
||||
this.line = new Array();
|
||||
this.script = "";
|
||||
this.pre_cmd = pre_cmd;
|
||||
this.post_cmd = post_cmd;
|
||||
for (var i=0; i<this.pre_cmd.length; i++)
|
||||
{
|
||||
this.push(pre_cmd[i]);
|
||||
}
|
||||
};
|
||||
EJS.Buffer.prototype = {
|
||||
|
||||
push: function(cmd) {
|
||||
this.line.push(cmd);
|
||||
},
|
||||
|
||||
cr: function() {
|
||||
this.script = this.script + this.line.join('; ');
|
||||
this.line = new Array();
|
||||
this.script = this.script + "\n";
|
||||
},
|
||||
|
||||
close: function() {
|
||||
if (this.line.length > 0)
|
||||
{
|
||||
for (var i=0; i<this.post_cmd.length; i++){
|
||||
this.push(pre_cmd[i]);
|
||||
}
|
||||
this.script = this.script + this.line.join('; ');
|
||||
line = null;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
EJS.Compiler = function(source, left) {
|
||||
this.pre_cmd = ['var ___ViewO = [];'];
|
||||
this.post_cmd = new Array();
|
||||
this.source = ' ';
|
||||
if (source != null)
|
||||
{
|
||||
if (typeof source == 'string')
|
||||
{
|
||||
source = source.replace(/\r\n/g, "\n");
|
||||
source = source.replace(/\r/g, "\n");
|
||||
this.source = source;
|
||||
}else if (source.innerHTML){
|
||||
this.source = source.innerHTML;
|
||||
}
|
||||
if (typeof this.source != 'string'){
|
||||
this.source = "";
|
||||
}
|
||||
}
|
||||
left = left || '<';
|
||||
var right = '>';
|
||||
switch(left) {
|
||||
case '[':
|
||||
right = ']';
|
||||
break;
|
||||
case '<':
|
||||
break;
|
||||
default:
|
||||
throw left+' is not a supported deliminator';
|
||||
break;
|
||||
}
|
||||
this.scanner = new EJS.Scanner(this.source, left, right);
|
||||
this.out = '';
|
||||
};
|
||||
EJS.Compiler.prototype = {
|
||||
compile: function(options, name) {
|
||||
options = options || {};
|
||||
this.out = '';
|
||||
var put_cmd = "___ViewO.push(";
|
||||
var insert_cmd = put_cmd;
|
||||
var buff = new EJS.Buffer(this.pre_cmd, this.post_cmd);
|
||||
var content = '';
|
||||
var clean = function(content)
|
||||
{
|
||||
content = content.replace(/\\/g, '\\\\');
|
||||
content = content.replace(/\n/g, '\\n');
|
||||
content = content.replace(/"/g, '\\"');
|
||||
return content;
|
||||
};
|
||||
this.scanner.scan(function(token, scanner) {
|
||||
if (scanner.stag == null)
|
||||
{
|
||||
switch(token) {
|
||||
case '\n':
|
||||
content = content + "\n";
|
||||
buff.push(put_cmd + '"' + clean(content) + '");');
|
||||
buff.cr();
|
||||
content = '';
|
||||
break;
|
||||
case scanner.left_delimiter:
|
||||
case scanner.left_equal:
|
||||
case scanner.left_comment:
|
||||
scanner.stag = token;
|
||||
if (content.length > 0)
|
||||
{
|
||||
buff.push(put_cmd + '"' + clean(content) + '")');
|
||||
}
|
||||
content = '';
|
||||
break;
|
||||
case scanner.double_left:
|
||||
content = content + scanner.left_delimiter;
|
||||
break;
|
||||
default:
|
||||
content = content + token;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(token) {
|
||||
case scanner.right_delimiter:
|
||||
switch(scanner.stag) {
|
||||
case scanner.left_delimiter:
|
||||
if (content[content.length - 1] == '\n')
|
||||
{
|
||||
content = chop(content);
|
||||
buff.push(content);
|
||||
buff.cr();
|
||||
}
|
||||
else {
|
||||
buff.push(content);
|
||||
}
|
||||
break;
|
||||
case scanner.left_equal:
|
||||
buff.push(insert_cmd + "(EJS.Scanner.to_text(" + content + ")))");
|
||||
break;
|
||||
}
|
||||
scanner.stag = null;
|
||||
content = '';
|
||||
break;
|
||||
case scanner.double_right:
|
||||
content = content + scanner.right_delimiter;
|
||||
break;
|
||||
default:
|
||||
content = content + token;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (content.length > 0)
|
||||
{
|
||||
// Chould be content.dump in Ruby
|
||||
buff.push(put_cmd + '"' + clean(content) + '")');
|
||||
}
|
||||
buff.close();
|
||||
this.out = buff.script + ";";
|
||||
var to_be_evaled = '/*'+name+'*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {'+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";
|
||||
|
||||
try{
|
||||
eval(to_be_evaled);
|
||||
}catch(e){
|
||||
if(typeof JSLINT != 'undefined'){
|
||||
JSLINT(this.out);
|
||||
for(var i = 0; i < JSLINT.errors.length; i++){
|
||||
var error = JSLINT.errors[i];
|
||||
if(error.reason != "Unnecessary semicolon."){
|
||||
error.line++;
|
||||
var e = new Error();
|
||||
e.lineNumber = error.line;
|
||||
e.message = error.reason;
|
||||
if(options.view)
|
||||
e.fileName = options.view;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//type, cache, folder
|
||||
/**
|
||||
* Sets default options for all views
|
||||
* @param {Object} options Set view with the following options
|
||||
* <table class="options">
|
||||
<tbody><tr><th>Option</th><th>Default</th><th>Description</th></tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td>'<'</td>
|
||||
<td>type of magic tags. Options are '<' or '['
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cache</td>
|
||||
<td>true in production mode, false in other modes</td>
|
||||
<td>true to cache template.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
*
|
||||
*/
|
||||
EJS.config = function(options){
|
||||
EJS.cache = options.cache != null ? options.cache : EJS.cache;
|
||||
EJS.type = options.type != null ? options.type : EJS.type;
|
||||
EJS.ext = options.ext != null ? options.ext : EJS.ext;
|
||||
|
||||
var templates_directory = EJS.templates_directory || {}; //nice and private container
|
||||
EJS.templates_directory = templates_directory;
|
||||
EJS.get = function(path, cache){
|
||||
if(cache == false) return null;
|
||||
if(templates_directory[path]) return templates_directory[path];
|
||||
return null;
|
||||
};
|
||||
|
||||
EJS.update = function(path, template) {
|
||||
if(path == null) return;
|
||||
templates_directory[path] = template ;
|
||||
};
|
||||
|
||||
EJS.INVALID_PATH = -1;
|
||||
};
|
||||
EJS.config( {cache: true, type: '<', ext: '.ejs' } );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* By adding functions to EJS.Helpers.prototype, those functions will be available in the
|
||||
* views.
|
||||
* @init Creates a view helper. This function is called internally. You should never call it.
|
||||
* @param {Object} data The data passed to the view. Helpers have access to it through this._data
|
||||
*/
|
||||
EJS.Helpers = function(data, extras){
|
||||
this._data = data;
|
||||
this._extras = extras;
|
||||
extend(this, extras );
|
||||
};
|
||||
/* @prototype*/
|
||||
EJS.Helpers.prototype = {
|
||||
/**
|
||||
* Renders a new view. If data is passed in, uses that to render the view.
|
||||
* @param {Object} options standard options passed to a new view.
|
||||
* @param {optional:Object} data
|
||||
* @return {String}
|
||||
*/
|
||||
view: function(options, data, helpers){
|
||||
if(!helpers) helpers = this._extras
|
||||
if(!data) data = this._data;
|
||||
return new EJS(options).render(data, helpers);
|
||||
},
|
||||
/**
|
||||
* For a given value, tries to create a human representation.
|
||||
* @param {Object} input the value being converted.
|
||||
* @param {Object} null_text what text should be present if input == null or undefined, defaults to ''
|
||||
* @return {String}
|
||||
*/
|
||||
to_text: function(input, null_text) {
|
||||
if(input == null || input === undefined) return null_text || '';
|
||||
if(input instanceof Date) return input.toDateString();
|
||||
if(input.toString) return input.toString().replace(/\n/g, '<br />').replace(/''/g, "'");
|
||||
return '';
|
||||
}
|
||||
};
|
||||
EJS.newRequest = function(){
|
||||
var factories = [function() { return new ActiveXObject("Msxml2.XMLHTTP"); },function() { return new XMLHttpRequest(); },function() { return new ActiveXObject("Microsoft.XMLHTTP"); }];
|
||||
for(var i = 0; i < factories.length; i++) {
|
||||
try {
|
||||
var request = factories[i]();
|
||||
if (request != null) return request;
|
||||
}
|
||||
catch(e) { continue;}
|
||||
}
|
||||
}
|
||||
|
||||
EJS.request = function(path){
|
||||
var request = new EJS.newRequest()
|
||||
request.open("GET", path, false);
|
||||
|
||||
try{request.send(null);}
|
||||
catch(e){return null;}
|
||||
|
||||
if ( request.status == 404 || request.status == 2 ||(request.status == 0 && request.responseText == '') ) return null;
|
||||
|
||||
return request.responseText
|
||||
}
|
||||
EJS.ajax_request = function(params){
|
||||
params.method = ( params.method ? params.method : 'GET')
|
||||
|
||||
var request = new EJS.newRequest();
|
||||
request.onreadystatechange = function(){
|
||||
if(request.readyState == 4){
|
||||
if(request.status == 200){
|
||||
params.onComplete(request)
|
||||
}else
|
||||
{
|
||||
params.onComplete(request)
|
||||
}
|
||||
}
|
||||
}
|
||||
request.open(params.method, params.url)
|
||||
request.send(null)
|
||||
}
|
||||
|
||||
|
||||
})();
|
1
app/libs/ejs_production.js
Normal file
1
app/libs/ejs_production.js
Normal file
File diff suppressed because one or more lines are too long
55
app/libs/microevent.js
Normal file
55
app/libs/microevent.js
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* MicroEvent - to make any js object an event emitter (server or browser)
|
||||
*
|
||||
* - pure javascript - server compatible, browser compatible
|
||||
* - dont rely on the browser doms
|
||||
* - super simple - you get it immediatly, no mistery, no magic involved
|
||||
*
|
||||
* - create a MicroEventDebug with goodies to debug
|
||||
* - make it safer to use
|
||||
*/
|
||||
|
||||
var MicroEvent = function(){};
|
||||
MicroEvent.prototype = {
|
||||
bind : function(event, fct){
|
||||
this._events = this._events || {};
|
||||
this._events[event] = this._events[event] || [];
|
||||
this._events[event].push(fct);
|
||||
},
|
||||
unbind : function(event, fct){
|
||||
this._events = this._events || {};
|
||||
if( event in this._events === false ) return;
|
||||
this._events[event].splice(this._events[event].indexOf(fct), 1);
|
||||
},
|
||||
trigger : function(event /* , args... */){
|
||||
this._events = this._events || {};
|
||||
if( event in this._events === false ) return;
|
||||
for(var i = 0; i < this._events[event].length; i++){
|
||||
this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* mixin will delegate all MicroEvent.js function in the destination object
|
||||
*
|
||||
* - require('MicroEvent').mixin(Foobar) will make Foobar able to use MicroEvent
|
||||
*
|
||||
* @param {Object} the object which will support MicroEvent
|
||||
*/
|
||||
MicroEvent.mixin = function(destObject){
|
||||
var props = ['bind', 'unbind', 'trigger'];
|
||||
for(var i = 0; i < props.length; i ++){
|
||||
if( typeof destObject === 'function' ){
|
||||
destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
|
||||
}else{
|
||||
destObject[props[i]] = MicroEvent.prototype[props[i]];
|
||||
}
|
||||
}
|
||||
return destObject;
|
||||
}
|
||||
|
||||
// export in common js
|
||||
if( typeof module !== "undefined" && ('exports' in module)){
|
||||
module.exports = MicroEvent;
|
||||
}
|
109
app/libs/password.js
Normal file
109
app/libs/password.js
Normal file
@ -0,0 +1,109 @@
|
||||
Array.prototype.random = function () {
|
||||
return this[Math.floor((Math.random()*this.length))];
|
||||
};
|
||||
|
||||
var alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9'];
|
||||
var whitespace = ['.','~','#','!','$','+','-','+'];
|
||||
var numbers = ['0','1','2','3','4','5','6','7','8','9'];
|
||||
var left = ["Alabama",
|
||||
"Alaska",
|
||||
"Arizona",
|
||||
"Arkansas",
|
||||
"California",
|
||||
"Colorado",
|
||||
"Connecticut",
|
||||
"Delaware",
|
||||
"Florida",
|
||||
"Georgia",
|
||||
"Idaho",
|
||||
"Illinois",
|
||||
"Indiana",
|
||||
"Iowa",
|
||||
"Kansas",
|
||||
"Kentucky",
|
||||
"Louisiana",
|
||||
"Maine",
|
||||
"Maryland",
|
||||
"Michigan",
|
||||
"Minnesota",
|
||||
"Missouri",
|
||||
"Montana",
|
||||
"Nebraska",
|
||||
"Nevada",
|
||||
"New Hampshire",
|
||||
"New Jersey",
|
||||
"New Mexico",
|
||||
"New York",
|
||||
"North Carolina",
|
||||
"North Dakota",
|
||||
"Ohio",
|
||||
"Oklahoma",
|
||||
"Oregon",
|
||||
"Palau",
|
||||
"Pennsylvania",
|
||||
"Puerto Rico",
|
||||
"Rhode Island",
|
||||
"South Carolina",
|
||||
"South Dakota",
|
||||
"Tennessee",
|
||||
"Texas",
|
||||
"Utah",
|
||||
"Vermont",
|
||||
"Virgin Islands",
|
||||
"Virginia",
|
||||
"Washington",
|
||||
"West Virginia",
|
||||
"Wisconsin",
|
||||
"Wyoming",
|
||||
"Glasgow",
|
||||
"Inverness",
|
||||
"Edinburgh",
|
||||
"Dumbarton",
|
||||
"Balloch",
|
||||
"Renton",
|
||||
"Helensburgh",
|
||||
"Cardross",
|
||||
"Dundee",
|
||||
"Aberdeen",
|
||||
"Paisley",
|
||||
"Hamilton",
|
||||
"Greenock",
|
||||
"Falkirk",
|
||||
"Irvine",
|
||||
"Clydebank",
|
||||
"Renfrew",
|
||||
"Barrhead",
|
||||
"Erskine",
|
||||
"London",
|
||||
"Hammersmith",
|
||||
"Islington"
|
||||
|
||||
];
|
||||
|
||||
var right = ['Aganju', 'Cygni', 'Akeron', 'Antares', 'Aragoth', 'Arduinne', 'Ardus', 'Aquitaine', 'Carpenter', 'Beta Hydri', 'Cooper', 'Dahin', 'Capella', 'Endriago', 'Gallina', 'Fenris', 'Freya', 'Glenn', 'Grissom', 'Tau Ceti', 'Jotunheim', 'Kailaasa', 'Lagarto', 'Muspelheim', 'Nifleheim', 'Odin Rex', 'Primus', 'Vega', 'Ragnarok', 'Shepard', 'Slayton', 'Tarsis', 'Mercury', 'Venus', 'Mars', 'Earth', 'Terra', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Europa', 'Ganymede', 'Callisto', 'Titan', 'Juno', 'Eridanus', 'Cassiopeia', 'Scorpius', 'Crux', 'Cancer', 'Taurus', 'Lyra', 'Andromeda', 'Virgo', 'Aquarius', 'Cygnus', 'Corvus', 'Taurus', 'Draco', 'Perseus', 'Pegasus', 'Gemini', 'Columbia', 'Bootes', 'Orion', 'Deneb'];
|
||||
|
||||
var numberCluster = function() {
|
||||
return numbers.random() + numbers.random() + numbers.random();
|
||||
};
|
||||
|
||||
var randomAmount = function(i) {
|
||||
var str='';
|
||||
|
||||
for (var t=0;t<i;t++) {
|
||||
str = str + alpha.random();
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
var str = left.random() + ' ' + right.random() + ' ' + numberCluster() + ' ' + numberCluster() ;
|
||||
|
||||
str = str.split(' ').join(whitespace.random());
|
||||
|
||||
console.log(str);
|
||||
|
||||
str = randomAmount(10);
|
||||
console.log(str);
|
||||
|
||||
|
||||
|
730
app/libs/skycons.js
Normal file
730
app/libs/skycons.js
Normal file
@ -0,0 +1,730 @@
|
||||
(function(global) {
|
||||
"use strict";
|
||||
|
||||
/* Set up a RequestAnimationFrame shim so we can animate efficiently FOR
|
||||
* GREAT JUSTICE. */
|
||||
var requestInterval, cancelInterval;
|
||||
|
||||
(function() {
|
||||
var raf = global.requestAnimationFrame ||
|
||||
global.webkitRequestAnimationFrame ||
|
||||
global.mozRequestAnimationFrame ||
|
||||
global.oRequestAnimationFrame ||
|
||||
global.msRequestAnimationFrame ,
|
||||
caf = global.cancelAnimationFrame ||
|
||||
global.webkitCancelAnimationFrame ||
|
||||
global.mozCancelAnimationFrame ||
|
||||
global.oCancelAnimationFrame ||
|
||||
global.msCancelAnimationFrame ;
|
||||
|
||||
if(raf && caf) {
|
||||
requestInterval = function(fn, delay) {
|
||||
var handle = {value: null};
|
||||
|
||||
function loop() {
|
||||
handle.value = raf(loop);
|
||||
fn();
|
||||
}
|
||||
|
||||
loop();
|
||||
return handle;
|
||||
};
|
||||
|
||||
cancelInterval = function(handle) {
|
||||
caf(handle.value);
|
||||
};
|
||||
}
|
||||
|
||||
else {
|
||||
requestInterval = setInterval;
|
||||
cancelInterval = clearInterval;
|
||||
}
|
||||
}());
|
||||
|
||||
/* Catmull-rom spline stuffs. */
|
||||
/*
|
||||
function upsample(n, spline) {
|
||||
var polyline = [],
|
||||
len = spline.length,
|
||||
bx = spline[0],
|
||||
by = spline[1],
|
||||
cx = spline[2],
|
||||
cy = spline[3],
|
||||
dx = spline[4],
|
||||
dy = spline[5],
|
||||
i, j, ax, ay, px, qx, rx, sx, py, qy, ry, sy, t;
|
||||
|
||||
for(i = 6; i !== spline.length; i += 2) {
|
||||
ax = bx;
|
||||
bx = cx;
|
||||
cx = dx;
|
||||
dx = spline[i ];
|
||||
px = -0.5 * ax + 1.5 * bx - 1.5 * cx + 0.5 * dx;
|
||||
qx = ax - 2.5 * bx + 2.0 * cx - 0.5 * dx;
|
||||
rx = -0.5 * ax + 0.5 * cx ;
|
||||
sx = bx ;
|
||||
|
||||
ay = by;
|
||||
by = cy;
|
||||
cy = dy;
|
||||
dy = spline[i + 1];
|
||||
py = -0.5 * ay + 1.5 * by - 1.5 * cy + 0.5 * dy;
|
||||
qy = ay - 2.5 * by + 2.0 * cy - 0.5 * dy;
|
||||
ry = -0.5 * ay + 0.5 * cy ;
|
||||
sy = by ;
|
||||
|
||||
for(j = 0; j !== n; ++j) {
|
||||
t = j / n;
|
||||
|
||||
polyline.push(
|
||||
((px * t + qx) * t + rx) * t + sx,
|
||||
((py * t + qy) * t + ry) * t + sy
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
polyline.push(
|
||||
px + qx + rx + sx,
|
||||
py + qy + ry + sy
|
||||
);
|
||||
|
||||
return polyline;
|
||||
}
|
||||
|
||||
function downsample(n, polyline) {
|
||||
var len = 0,
|
||||
i, dx, dy;
|
||||
|
||||
for(i = 2; i !== polyline.length; i += 2) {
|
||||
dx = polyline[i ] - polyline[i - 2];
|
||||
dy = polyline[i + 1] - polyline[i - 1];
|
||||
len += Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
len /= n;
|
||||
|
||||
var small = [],
|
||||
target = len,
|
||||
min = 0,
|
||||
max, t;
|
||||
|
||||
small.push(polyline[0], polyline[1]);
|
||||
|
||||
for(i = 2; i !== polyline.length; i += 2) {
|
||||
dx = polyline[i ] - polyline[i - 2];
|
||||
dy = polyline[i + 1] - polyline[i - 1];
|
||||
max = min + Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if(max > target) {
|
||||
t = (target - min) / (max - min);
|
||||
|
||||
small.push(
|
||||
polyline[i - 2] + dx * t,
|
||||
polyline[i - 1] + dy * t
|
||||
);
|
||||
|
||||
target += len;
|
||||
}
|
||||
|
||||
min = max;
|
||||
}
|
||||
|
||||
small.push(polyline[polyline.length - 2], polyline[polyline.length - 1]);
|
||||
|
||||
return small;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Define skycon things. */
|
||||
/* FIXME: I'm *really really* sorry that this code is so gross. Really, I am.
|
||||
* I'll try to clean it up eventually! Promise! */
|
||||
var KEYFRAME = 500,
|
||||
STROKE = 0.08,
|
||||
TAU = 2.0 * Math.PI,
|
||||
TWO_OVER_SQRT_2 = 2.0 / Math.sqrt(2);
|
||||
|
||||
function circle(ctx, x, y, r) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, r, 0, TAU, false);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
function line(ctx, ax, ay, bx, by) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(ax, ay);
|
||||
ctx.lineTo(bx, by);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function puff(ctx, t, cx, cy, rx, ry, rmin, rmax) {
|
||||
var c = Math.cos(t * TAU),
|
||||
s = Math.sin(t * TAU);
|
||||
|
||||
rmax -= rmin;
|
||||
|
||||
circle(
|
||||
ctx,
|
||||
cx - s * rx,
|
||||
cy + c * ry + rmax * 0.5,
|
||||
rmin + (1 - c * 0.5) * rmax
|
||||
);
|
||||
}
|
||||
|
||||
function puffs(ctx, t, cx, cy, rx, ry, rmin, rmax) {
|
||||
var i;
|
||||
|
||||
for(i = 5; i--; )
|
||||
puff(ctx, t + i / 5, cx, cy, rx, ry, rmin, rmax);
|
||||
}
|
||||
|
||||
function cloud(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 30000;
|
||||
|
||||
var a = cw * 0.21,
|
||||
b = cw * 0.12,
|
||||
c = cw * 0.24,
|
||||
d = cw * 0.28;
|
||||
|
||||
ctx.fillStyle = color;
|
||||
puffs(ctx, t, cx, cy, a, b, c, d);
|
||||
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
puffs(ctx, t, cx, cy, a, b, c - s, d - s);
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
}
|
||||
|
||||
function sun(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 120000;
|
||||
|
||||
var a = cw * 0.25 - s * 0.5,
|
||||
b = cw * 0.32 + s * 0.5,
|
||||
c = cw * 0.50 - s * 0.5,
|
||||
i, p, cos, sin;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(cx, cy, a, 0, TAU, false);
|
||||
ctx.stroke();
|
||||
|
||||
for(i = 8; i--; ) {
|
||||
p = (t + i / 8) * TAU;
|
||||
cos = Math.cos(p);
|
||||
sin = Math.sin(p);
|
||||
line(ctx, cx + cos * b, cy + sin * b, cx + cos * c, cy + sin * c);
|
||||
}
|
||||
}
|
||||
|
||||
function moon(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 15000;
|
||||
|
||||
var a = cw * 0.29 - s * 0.5,
|
||||
b = cw * 0.05,
|
||||
c = Math.cos(t * TAU),
|
||||
p = c * TAU / -16;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
cx += c * b;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(cx, cy, a, p + TAU / 8, p + TAU * 7 / 8, false);
|
||||
ctx.arc(cx + Math.cos(p) * a * TWO_OVER_SQRT_2, cy + Math.sin(p) * a * TWO_OVER_SQRT_2, a, p + TAU * 5 / 8, p + TAU * 3 / 8, true);
|
||||
ctx.closePath();
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function rain(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 1350;
|
||||
|
||||
var a = cw * 0.16,
|
||||
b = TAU * 11 / 12,
|
||||
c = TAU * 7 / 12,
|
||||
i, p, x, y;
|
||||
|
||||
ctx.fillStyle = color;
|
||||
|
||||
for(i = 4; i--; ) {
|
||||
p = (t + i / 4) % 1;
|
||||
x = cx + ((i - 1.5) / 1.5) * (i === 1 || i === 2 ? -1 : 1) * a;
|
||||
y = cy + p * p * cw;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, y - s * 1.5);
|
||||
ctx.arc(x, y, s * 0.75, b, c, false);
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
function sleet(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 750;
|
||||
|
||||
var a = cw * 0.1875,
|
||||
b = TAU * 11 / 12,
|
||||
c = TAU * 7 / 12,
|
||||
i, p, x, y;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s * 0.5;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
for(i = 4; i--; ) {
|
||||
p = (t + i / 4) % 1;
|
||||
x = Math.floor(cx + ((i - 1.5) / 1.5) * (i === 1 || i === 2 ? -1 : 1) * a) + 0.5;
|
||||
y = cy + p * cw;
|
||||
line(ctx, x, y - s * 1.5, x, y + s * 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
function snow(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 3000;
|
||||
|
||||
var a = cw * 0.16,
|
||||
b = s * 0.75,
|
||||
u = t * TAU * 0.7,
|
||||
ux = Math.cos(u) * b,
|
||||
uy = Math.sin(u) * b,
|
||||
v = u + TAU / 3,
|
||||
vx = Math.cos(v) * b,
|
||||
vy = Math.sin(v) * b,
|
||||
w = u + TAU * 2 / 3,
|
||||
wx = Math.cos(w) * b,
|
||||
wy = Math.sin(w) * b,
|
||||
i, p, x, y;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s * 0.5;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
for(i = 4; i--; ) {
|
||||
p = (t + i / 4) % 1;
|
||||
x = cx + Math.sin((p + i / 4) * TAU) * a;
|
||||
y = cy + p * cw;
|
||||
|
||||
line(ctx, x - ux, y - uy, x + ux, y + uy);
|
||||
line(ctx, x - vx, y - vy, x + vx, y + vy);
|
||||
line(ctx, x - wx, y - wy, x + wx, y + wy);
|
||||
}
|
||||
}
|
||||
|
||||
function fogbank(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 30000;
|
||||
|
||||
var a = cw * 0.21,
|
||||
b = cw * 0.06,
|
||||
c = cw * 0.21,
|
||||
d = cw * 0.28;
|
||||
|
||||
ctx.fillStyle = color;
|
||||
puffs(ctx, t, cx, cy, a, b, c, d);
|
||||
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
puffs(ctx, t, cx, cy, a, b, c - s, d - s);
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
}
|
||||
|
||||
/*
|
||||
var WIND_PATHS = [
|
||||
downsample(63, upsample(8, [
|
||||
-1.00, -0.28,
|
||||
-0.75, -0.18,
|
||||
-0.50, 0.12,
|
||||
-0.20, 0.12,
|
||||
-0.04, -0.04,
|
||||
-0.07, -0.18,
|
||||
-0.19, -0.18,
|
||||
-0.23, -0.05,
|
||||
-0.12, 0.11,
|
||||
0.02, 0.16,
|
||||
0.20, 0.15,
|
||||
0.50, 0.07,
|
||||
0.75, 0.18,
|
||||
1.00, 0.28
|
||||
])),
|
||||
downsample(31, upsample(16, [
|
||||
-1.00, -0.10,
|
||||
-0.75, 0.00,
|
||||
-0.50, 0.10,
|
||||
-0.25, 0.14,
|
||||
0.00, 0.10,
|
||||
0.25, 0.00,
|
||||
0.50, -0.10,
|
||||
0.75, -0.14,
|
||||
1.00, -0.10
|
||||
]))
|
||||
];
|
||||
*/
|
||||
|
||||
var WIND_PATHS = [
|
||||
[
|
||||
-0.7500, -0.1800, -0.7219, -0.1527, -0.6971, -0.1225,
|
||||
-0.6739, -0.0910, -0.6516, -0.0588, -0.6298, -0.0262,
|
||||
-0.6083, 0.0065, -0.5868, 0.0396, -0.5643, 0.0731,
|
||||
-0.5372, 0.1041, -0.5033, 0.1259, -0.4662, 0.1406,
|
||||
-0.4275, 0.1493, -0.3881, 0.1530, -0.3487, 0.1526,
|
||||
-0.3095, 0.1488, -0.2708, 0.1421, -0.2319, 0.1342,
|
||||
-0.1943, 0.1217, -0.1600, 0.1025, -0.1290, 0.0785,
|
||||
-0.1012, 0.0509, -0.0764, 0.0206, -0.0547, -0.0120,
|
||||
-0.0378, -0.0472, -0.0324, -0.0857, -0.0389, -0.1241,
|
||||
-0.0546, -0.1599, -0.0814, -0.1876, -0.1193, -0.1964,
|
||||
-0.1582, -0.1935, -0.1931, -0.1769, -0.2157, -0.1453,
|
||||
-0.2290, -0.1085, -0.2327, -0.0697, -0.2240, -0.0317,
|
||||
-0.2064, 0.0033, -0.1853, 0.0362, -0.1613, 0.0672,
|
||||
-0.1350, 0.0961, -0.1051, 0.1213, -0.0706, 0.1397,
|
||||
-0.0332, 0.1512, 0.0053, 0.1580, 0.0442, 0.1624,
|
||||
0.0833, 0.1636, 0.1224, 0.1615, 0.1613, 0.1565,
|
||||
0.1999, 0.1500, 0.2378, 0.1402, 0.2749, 0.1279,
|
||||
0.3118, 0.1147, 0.3487, 0.1015, 0.3858, 0.0892,
|
||||
0.4236, 0.0787, 0.4621, 0.0715, 0.5012, 0.0702,
|
||||
0.5398, 0.0766, 0.5768, 0.0890, 0.6123, 0.1055,
|
||||
0.6466, 0.1244, 0.6805, 0.1440, 0.7147, 0.1630,
|
||||
0.7500, 0.1800
|
||||
],
|
||||
[
|
||||
-0.7500, 0.0000, -0.7033, 0.0195, -0.6569, 0.0399,
|
||||
-0.6104, 0.0600, -0.5634, 0.0789, -0.5155, 0.0954,
|
||||
-0.4667, 0.1089, -0.4174, 0.1206, -0.3676, 0.1299,
|
||||
-0.3174, 0.1365, -0.2669, 0.1398, -0.2162, 0.1391,
|
||||
-0.1658, 0.1347, -0.1157, 0.1271, -0.0661, 0.1169,
|
||||
-0.0170, 0.1046, 0.0316, 0.0903, 0.0791, 0.0728,
|
||||
0.1259, 0.0534, 0.1723, 0.0331, 0.2188, 0.0129,
|
||||
0.2656, -0.0064, 0.3122, -0.0263, 0.3586, -0.0466,
|
||||
0.4052, -0.0665, 0.4525, -0.0847, 0.5007, -0.1002,
|
||||
0.5497, -0.1130, 0.5991, -0.1240, 0.6491, -0.1325,
|
||||
0.6994, -0.1380, 0.7500, -0.1400
|
||||
]
|
||||
],
|
||||
WIND_OFFSETS = [
|
||||
{start: 0.36, end: 0.11},
|
||||
{start: 0.56, end: 0.16}
|
||||
];
|
||||
|
||||
function leaf(ctx, t, x, y, cw, s, color) {
|
||||
var a = cw / 8,
|
||||
b = a / 3,
|
||||
c = 2 * b,
|
||||
d = (t % 1) * TAU,
|
||||
e = Math.cos(d),
|
||||
f = Math.sin(d);
|
||||
|
||||
ctx.fillStyle = color;
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(x , y , a, d , d + Math.PI, false);
|
||||
ctx.arc(x - b * e, y - b * f, c, d + Math.PI, d , false);
|
||||
ctx.arc(x + c * e, y + c * f, b, d + Math.PI, d , true );
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
ctx.fill();
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function swoosh(ctx, t, cx, cy, cw, s, index, total, color) {
|
||||
t /= 2500;
|
||||
|
||||
var path = WIND_PATHS[index],
|
||||
a = (t + index - WIND_OFFSETS[index].start) % total,
|
||||
c = (t + index - WIND_OFFSETS[index].end ) % total,
|
||||
e = (t + index ) % total,
|
||||
b, d, f, i;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
if(a < 1) {
|
||||
ctx.beginPath();
|
||||
|
||||
a *= path.length / 2 - 1;
|
||||
b = Math.floor(a);
|
||||
a -= b;
|
||||
b *= 2;
|
||||
b += 2;
|
||||
|
||||
ctx.moveTo(
|
||||
cx + (path[b - 2] * (1 - a) + path[b ] * a) * cw,
|
||||
cy + (path[b - 1] * (1 - a) + path[b + 1] * a) * cw
|
||||
);
|
||||
|
||||
if(c < 1) {
|
||||
c *= path.length / 2 - 1;
|
||||
d = Math.floor(c);
|
||||
c -= d;
|
||||
d *= 2;
|
||||
d += 2;
|
||||
|
||||
for(i = b; i !== d; i += 2)
|
||||
ctx.lineTo(cx + path[i] * cw, cy + path[i + 1] * cw);
|
||||
|
||||
ctx.lineTo(
|
||||
cx + (path[d - 2] * (1 - c) + path[d ] * c) * cw,
|
||||
cy + (path[d - 1] * (1 - c) + path[d + 1] * c) * cw
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
for(i = b; i !== path.length; i += 2)
|
||||
ctx.lineTo(cx + path[i] * cw, cy + path[i + 1] * cw);
|
||||
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
else if(c < 1) {
|
||||
ctx.beginPath();
|
||||
|
||||
c *= path.length / 2 - 1;
|
||||
d = Math.floor(c);
|
||||
c -= d;
|
||||
d *= 2;
|
||||
d += 2;
|
||||
|
||||
ctx.moveTo(cx + path[0] * cw, cy + path[1] * cw);
|
||||
|
||||
for(i = 2; i !== d; i += 2)
|
||||
ctx.lineTo(cx + path[i] * cw, cy + path[i + 1] * cw);
|
||||
|
||||
ctx.lineTo(
|
||||
cx + (path[d - 2] * (1 - c) + path[d ] * c) * cw,
|
||||
cy + (path[d - 1] * (1 - c) + path[d + 1] * c) * cw
|
||||
);
|
||||
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
if(e < 1) {
|
||||
e *= path.length / 2 - 1;
|
||||
f = Math.floor(e);
|
||||
e -= f;
|
||||
f *= 2;
|
||||
f += 2;
|
||||
|
||||
leaf(
|
||||
ctx,
|
||||
t,
|
||||
cx + (path[f - 2] * (1 - e) + path[f ] * e) * cw,
|
||||
cy + (path[f - 1] * (1 - e) + path[f + 1] * e) * cw,
|
||||
cw,
|
||||
s,
|
||||
color
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var Skycons = function(opts) {
|
||||
this.list = [];
|
||||
this.interval = null;
|
||||
this.color = opts && opts.color ? opts.color : "black";
|
||||
this.resizeClear = !!(opts && opts.resizeClear);
|
||||
};
|
||||
|
||||
Skycons.CLEAR_DAY = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
sun(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.CLEAR_NIGHT = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
moon(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.PARTLY_CLOUDY_DAY = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
sun(ctx, t, w * 0.625, h * 0.375, s * 0.75, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.375, h * 0.625, s * 0.75, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.PARTLY_CLOUDY_NIGHT = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
moon(ctx, t, w * 0.667, h * 0.375, s * 0.75, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.375, h * 0.625, s * 0.75, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.CLOUDY = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
cloud(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.RAIN = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
rain(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.SLEET = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
sleet(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.SNOW = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
snow(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.WIND = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
swoosh(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, 0, 2, color);
|
||||
swoosh(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, 1, 2, color);
|
||||
};
|
||||
|
||||
Skycons.FOG = function(ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h),
|
||||
k = s * STROKE;
|
||||
|
||||
fogbank(ctx, t, w * 0.5, h * 0.32, s * 0.75, k, color);
|
||||
|
||||
t /= 5000;
|
||||
|
||||
var a = Math.cos((t ) * TAU) * s * 0.02,
|
||||
b = Math.cos((t + 0.25) * TAU) * s * 0.02,
|
||||
c = Math.cos((t + 0.50) * TAU) * s * 0.02,
|
||||
d = Math.cos((t + 0.75) * TAU) * s * 0.02,
|
||||
n = h * 0.936,
|
||||
e = Math.floor(n - k * 0.5) + 0.5,
|
||||
f = Math.floor(n - k * 2.5) + 0.5;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = k;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
line(ctx, a + w * 0.2 + k * 0.5, e, b + w * 0.8 - k * 0.5, e);
|
||||
line(ctx, c + w * 0.2 + k * 0.5, f, d + w * 0.8 - k * 0.5, f);
|
||||
};
|
||||
|
||||
Skycons.prototype = {
|
||||
_determineDrawingFunction: function(draw) {
|
||||
if(typeof draw === "string")
|
||||
draw = Skycons[draw.toUpperCase().replace(/-/g, "_")] || null;
|
||||
|
||||
return draw;
|
||||
},
|
||||
add: function(el, draw) {
|
||||
var obj;
|
||||
|
||||
if(typeof el === "string")
|
||||
el = document.getElementById(el);
|
||||
|
||||
// Does nothing if canvas name doesn't exists
|
||||
if(el === null)
|
||||
return;
|
||||
|
||||
draw = this._determineDrawingFunction(draw);
|
||||
|
||||
// Does nothing if the draw function isn't actually a function
|
||||
if(typeof draw !== "function")
|
||||
return;
|
||||
|
||||
obj = {
|
||||
element: el,
|
||||
context: el.getContext("2d"),
|
||||
drawing: draw
|
||||
};
|
||||
|
||||
this.list.push(obj);
|
||||
this.draw(obj, KEYFRAME);
|
||||
},
|
||||
set: function(el, draw) {
|
||||
var i;
|
||||
|
||||
if(typeof el === "string")
|
||||
el = document.getElementById(el);
|
||||
|
||||
for(i = this.list.length; i--; )
|
||||
if(this.list[i].element === el) {
|
||||
this.list[i].drawing = this._determineDrawingFunction(draw);
|
||||
this.draw(this.list[i], KEYFRAME);
|
||||
return;
|
||||
}
|
||||
|
||||
this.add(el, draw);
|
||||
},
|
||||
remove: function(el) {
|
||||
var i;
|
||||
|
||||
if(typeof el === "string")
|
||||
el = document.getElementById(el);
|
||||
|
||||
for(i = this.list.length; i--; )
|
||||
if(this.list[i].element === el) {
|
||||
this.list.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
},
|
||||
draw: function(obj, time) {
|
||||
var canvas = obj.context.canvas;
|
||||
|
||||
if(this.resizeClear)
|
||||
canvas.width = canvas.width;
|
||||
|
||||
else
|
||||
obj.context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
obj.drawing(obj.context, time, this.color);
|
||||
},
|
||||
play: function() {
|
||||
var self = this;
|
||||
|
||||
this.pause();
|
||||
this.interval = requestInterval(function() {
|
||||
var now = Date.now(),
|
||||
i;
|
||||
|
||||
for(i = self.list.length; i--; )
|
||||
self.draw(self.list[i], now);
|
||||
}, 1000 / 60);
|
||||
},
|
||||
pause: function() {
|
||||
var i;
|
||||
|
||||
if(this.interval) {
|
||||
cancelInterval(this.interval);
|
||||
this.interval = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
global.Skycons = Skycons;
|
||||
}(this));
|
200
app/libs/view.js
Normal file
200
app/libs/view.js
Normal file
@ -0,0 +1,200 @@
|
||||
EJS.Helpers.prototype.date_tag = function(name, value , html_options) {
|
||||
if(! (value instanceof Date))
|
||||
value = new Date()
|
||||
|
||||
var month_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
||||
var years = [], months = [], days =[];
|
||||
var year = value.getFullYear();
|
||||
var month = value.getMonth();
|
||||
var day = value.getDate();
|
||||
for(var y = year - 15; y < year+15 ; y++)
|
||||
{
|
||||
years.push({value: y, text: y})
|
||||
}
|
||||
for(var m = 0; m < 12; m++)
|
||||
{
|
||||
months.push({value: (m), text: month_names[m]})
|
||||
}
|
||||
for(var d = 0; d < 31; d++)
|
||||
{
|
||||
days.push({value: (d+1), text: (d+1)})
|
||||
}
|
||||
var year_select = this.select_tag(name+'[year]', year, years, {id: name+'[year]'} )
|
||||
var month_select = this.select_tag(name+'[month]', month, months, {id: name+'[month]'})
|
||||
var day_select = this.select_tag(name+'[day]', day, days, {id: name+'[day]'})
|
||||
|
||||
return year_select+month_select+day_select;
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.form_tag = function(action, html_options) {
|
||||
|
||||
|
||||
html_options = html_options || {};
|
||||
html_options.action = action
|
||||
if(html_options.multipart == true) {
|
||||
html_options.method = 'post';
|
||||
html_options.enctype = 'multipart/form-data';
|
||||
}
|
||||
|
||||
return this.start_tag_for('form', html_options)
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.form_tag_end = function() { return this.tag_end('form'); }
|
||||
|
||||
EJS.Helpers.prototype.hidden_field_tag = function(name, value, html_options) {
|
||||
return this.input_field_tag(name, value, 'hidden', html_options);
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.input_field_tag = function(name, value , inputType, html_options) {
|
||||
|
||||
html_options = html_options || {};
|
||||
html_options.id = html_options.id || name;
|
||||
html_options.value = value || '';
|
||||
html_options.type = inputType || 'text';
|
||||
html_options.name = name;
|
||||
|
||||
return this.single_tag_for('input', html_options)
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.is_current_page = function(url) {
|
||||
return (window.location.href == url || window.location.pathname == url ? true : false);
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.link_to = function(name, url, html_options) {
|
||||
if(!name) var name = 'null';
|
||||
if(!html_options) var html_options = {}
|
||||
|
||||
if(html_options.confirm){
|
||||
html_options.onclick =
|
||||
" var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} "
|
||||
html_options.confirm = null;
|
||||
}
|
||||
html_options.href=url
|
||||
return this.start_tag_for('a', html_options)+name+ this.tag_end('a');
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.submit_link_to = function(name, url, html_options){
|
||||
if(!name) var name = 'null';
|
||||
if(!html_options) var html_options = {}
|
||||
html_options.onclick = html_options.onclick || '' ;
|
||||
|
||||
if(html_options.confirm){
|
||||
html_options.onclick =
|
||||
" var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} "
|
||||
html_options.confirm = null;
|
||||
}
|
||||
|
||||
html_options.value = name;
|
||||
html_options.type = 'submit'
|
||||
html_options.onclick=html_options.onclick+
|
||||
(url ? this.url_for(url) : '')+'return false;';
|
||||
//html_options.href='#'+(options ? Routes.url_for(options) : '')
|
||||
return this.start_tag_for('input', html_options)
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.link_to_if = function(condition, name, url, html_options, post, block) {
|
||||
return this.link_to_unless((condition == false), name, url, html_options, post, block);
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.link_to_unless = function(condition, name, url, html_options, block) {
|
||||
html_options = html_options || {};
|
||||
if(condition) {
|
||||
if(block && typeof block == 'function') {
|
||||
return block(name, url, html_options, block);
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
} else
|
||||
return this.link_to(name, url, html_options);
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.link_to_unless_current = function(name, url, html_options, block) {
|
||||
html_options = html_options || {};
|
||||
return this.link_to_unless(this.is_current_page(url), name, url, html_options, block)
|
||||
}
|
||||
|
||||
|
||||
EJS.Helpers.prototype.password_field_tag = function(name, value, html_options) { return this.input_field_tag(name, value, 'password', html_options); }
|
||||
|
||||
EJS.Helpers.prototype.select_tag = function(name, value, choices, html_options) {
|
||||
html_options = html_options || {};
|
||||
html_options.id = html_options.id || name;
|
||||
html_options.value = value;
|
||||
html_options.name = name;
|
||||
|
||||
var txt = ''
|
||||
txt += this.start_tag_for('select', html_options)
|
||||
|
||||
for(var i = 0; i < choices.length; i++)
|
||||
{
|
||||
var choice = choices[i];
|
||||
var optionOptions = {value: choice.value}
|
||||
if(choice.value == value)
|
||||
optionOptions.selected ='selected'
|
||||
txt += this.start_tag_for('option', optionOptions )+choice.text+this.tag_end('option')
|
||||
}
|
||||
txt += this.tag_end('select');
|
||||
return txt;
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.single_tag_for = function(tag, html_options) { return this.tag(tag, html_options, '/>');}
|
||||
|
||||
EJS.Helpers.prototype.start_tag_for = function(tag, html_options) { return this.tag(tag, html_options); }
|
||||
|
||||
EJS.Helpers.prototype.submit_tag = function(name, html_options) {
|
||||
html_options = html_options || {};
|
||||
//html_options.name = html_options.id || 'commit';
|
||||
html_options.type = html_options.type || 'submit';
|
||||
html_options.value = name || 'Submit';
|
||||
return this.single_tag_for('input', html_options);
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.tag = function(tag, html_options, end) {
|
||||
if(!end) var end = '>'
|
||||
var txt = ' '
|
||||
for(var attr in html_options) {
|
||||
if(html_options[attr] != null)
|
||||
var value = html_options[attr].toString();
|
||||
else
|
||||
var value=''
|
||||
if(attr == "Class") // special case because "class" is a reserved word in IE
|
||||
attr = "class";
|
||||
if( value.indexOf("'") != -1 )
|
||||
txt += attr+'=\"'+value+'\" '
|
||||
else
|
||||
txt += attr+"='"+value+"' "
|
||||
}
|
||||
return '<'+tag+txt+end;
|
||||
}
|
||||
|
||||
EJS.Helpers.prototype.tag_end = function(tag) { return '</'+tag+'>'; }
|
||||
|
||||
EJS.Helpers.prototype.text_area_tag = function(name, value, html_options) {
|
||||
html_options = html_options || {};
|
||||
html_options.id = html_options.id || name;
|
||||
html_options.name = html_options.name || name;
|
||||
value = value || ''
|
||||
if(html_options.size) {
|
||||
html_options.cols = html_options.size.split('x')[0]
|
||||
html_options.rows = html_options.size.split('x')[1];
|
||||
delete html_options.size
|
||||
}
|
||||
|
||||
html_options.cols = html_options.cols || 50;
|
||||
html_options.rows = html_options.rows || 4;
|
||||
|
||||
return this.start_tag_for('textarea', html_options)+value+this.tag_end('textarea')
|
||||
}
|
||||
EJS.Helpers.prototype.text_tag = EJS.Helpers.prototype.text_area_tag
|
||||
|
||||
EJS.Helpers.prototype.text_field_tag = function(name, value, html_options) { return this.input_field_tag(name, value, 'text', html_options); }
|
||||
|
||||
EJS.Helpers.prototype.url_for = function(url) {
|
||||
return 'window.location="'+url+'";'
|
||||
}
|
||||
EJS.Helpers.prototype.img_tag = function(image_location, alt, options){
|
||||
options = options || {};
|
||||
options.src = image_location
|
||||
options.alt = alt
|
||||
return this.single_tag_for('img', options)
|
||||
}
|
184
app/lot.csv
Normal file
184
app/lot.csv
Normal file
@ -0,0 +1,184 @@
|
||||
14-Nov-2014,36,32,38,48,17,8,5
|
||||
11-Nov-2014,46,14,36,2,21,11,7
|
||||
07-Nov-2014,32,13,38,46,25,10,1
|
||||
04-Nov-2014,1,13,6,26,17,3,5
|
||||
31-Oct-2014,10,41,13,20,33,9,3
|
||||
28-Oct-2014,45,17,40,10,15,1,2
|
||||
24-Oct-2014,42,20,3,30,9,6,1
|
||||
21-Oct-2014,40,33,27,20,21,3,10
|
||||
17-Oct-2014,49,13,48,1,40,8,10
|
||||
14-Oct-2014,15,23,32,4,5,7,3
|
||||
10-Oct-2014,29,42,47,45,6,9,10
|
||||
07-Oct-2014,38,30,21,9,28,8,1
|
||||
03-Oct-2014,13,23,50,48,4,10,5
|
||||
30-Sep-2014,33,13,15,3,42,5,7
|
||||
26-Sep-2014,46,35,47,13,27,1,2
|
||||
23-Sep-2014,13,35,14,29,12,1,7
|
||||
19-Sep-2014,6,34,8,38,48,9,3
|
||||
16-Sep-2014,4,30,35,50,29,4,2
|
||||
12-Sep-2014,31,9,33,26,13,7,11
|
||||
09-Sep-2014,15,35,19,8,24,10,8
|
||||
05-Sep-2014,18,50,23,46,1,9,3
|
||||
02-Sep-2014,39,45,25,31,5,8,1
|
||||
29-Aug-2014,32,38,26,9,2,3,6
|
||||
26-Aug-2014,36,48,45,10,22,11,4
|
||||
22-Aug-2014,29,17,49,35,4,1,2
|
||||
19-Aug-2014,11,34,47,4,7,7,8
|
||||
15-Aug-2014,4,21,30,5,23,10,8
|
||||
12-Aug-2014,22,19,7,16,33,5,2
|
||||
08-Aug-2014,29,21,35,46,43,1,9
|
||||
05-Aug-2014,5,21,42,7,19,11,5
|
||||
01-Aug-2014,50,44,46,48,24,10,5
|
||||
29-Jul-2014,40,23,35,10,43,9,3
|
||||
25-Jul-2014,10,24,9,12,43,5,9
|
||||
22-Jul-2014,1,43,50,45,24,5,8
|
||||
18-Jul-2014,1,41,43,11,29,3,11
|
||||
15-Jul-2014,18,27,15,34,20,1,3
|
||||
11-Jul-2014,38,35,5,49,22,7,4
|
||||
08-Jul-2014,24,18,22,8,27,11,4
|
||||
04-Jul-2014,47,18,43,39,4,6,2
|
||||
01-Jul-2014,39,25,18,22,27,5,10
|
||||
27-Jun-2014,39,34,45,33,31,2,10
|
||||
24-Jun-2014,20,1,7,21,48,4,7
|
||||
20-Jun-2014,5,38,49,15,25,1,2
|
||||
17-Jun-2014,48,13,37,40,11,8,9
|
||||
13-Jun-2014,16,22,28,46,18,11,9
|
||||
10-Jun-2014,12,18,21,33,32,1,11
|
||||
06-Jun-2014,34,40,25,7,49,9,11
|
||||
03-Jun-2014,2,39,32,15,44,5,10
|
||||
30-May-2014,27,41,24,45,5,7,6
|
||||
27-May-2014,16,13,26,25,7,1,6
|
||||
23-May-2014,31,3,47,8,34,11,9
|
||||
'20-May-2014', 5, 33, 36, 38, 47, 4, 9
|
||||
'16-May-2014', 23, 26, 29, 37, 40, 3, 4
|
||||
'13-May-2014', 4, 13, 30, 34, 47, 2, 6
|
||||
'09-May-2014', 3, 21, 26, 28, 45, 7, 10
|
||||
'06-May-2014', 5, 19, 24, 31, 37, 1, 9
|
||||
'02-May-2014', 4, 30, 31, 38, 42, 2, 11
|
||||
'29-Apr-2014', 18, 23, 26, 35, 44, 3, 11
|
||||
'25-Apr-2014', 13, 21, 24, 44, 49, 1, 9
|
||||
'22-Apr-2014', 13, 15, 20, 24, 46, 1, 8
|
||||
'18-Apr-2014', 21, 24, 31, 39, 47, 3, 7
|
||||
'15-Apr-2014', 3, 14, 26, 47, 50, 7, 11
|
||||
'11-Apr-2014', 8, 12, 19, 30, 33, 4, 11
|
||||
'08-Apr-2014', 11, 18, 29, 42, 49, 4, 11
|
||||
'04-Apr-2014', 6, 10, 28, 45, 50, 10, 11
|
||||
'01-Apr-2014', 16, 18, 26, 38, 44, 8, 10
|
||||
'28-Mar-2014', 3, 4, 19, 28, 43, 3, 7
|
||||
'25-Mar-2014', 7, 20, 26, 28, 50, 2, 8
|
||||
'21-Mar-2014', 7, 30, 37, 39, 42, 5, 7
|
||||
'18-Mar-2014', 8, 27, 34, 36, 39, 5, 10
|
||||
'14-Mar-2014', 6, 24, 25, 27, 30, 5, 9
|
||||
'11-Mar-2014', 1, 4, 23, 33, 44, 7, 8
|
||||
'07-Mar-2014', 5, 10, 38, 40, 41, 1, 8
|
||||
'04-Mar-2014', 3, 5, 22, 27, 44, 1, 6
|
||||
'28-Feb-2014', 12, 32, 38, 43, 44, 2, 7
|
||||
'25-Feb-2014', 21, 25, 28, 35, 42, 4, 6
|
||||
'21-Feb-2014', 13, 17, 28, 30, 32, 5, 7
|
||||
'18-Feb-2014', 23, 26, 36, 37, 49, 6, 7
|
||||
'14-Feb-2014', 19, 39, 4, 2, 6, 2, 7
|
||||
'11-Feb-2014', 47, 25, 8, 17, 41, 1, 2
|
||||
'07-Feb-2014', 17, 19, 47, 3, 46, 9, 10
|
||||
'04-Feb-2014', 37, 1, 33, 21, 38, 8, 4
|
||||
'31-Jan-2014', 10, 15, 31, 8, 16, 8, 9
|
||||
'28-Jan-2014', 18, 23, 48, 20, 42, 2, 9
|
||||
'24-Jan-2014', 19, 41, 35, 34, 5, 1, 5
|
||||
'21-Jan-2014', 4, 42, 35, 48, 12, 5, 8
|
||||
'17-Jan-2014', 26, 19, 33, 42, 32, 10, 4
|
||||
'14-Jan-2014', 25, 18, 20, 26, 37, 11, 10
|
||||
'10-Jan-2014', 1, 27, 2, 11, 29, 10, 1
|
||||
'07-Jan-2014', 2, 45, 20, 27, 33, 6, 10
|
||||
'03-Jan-2014', 3, 44, 27, 38, 31, 3, 8
|
||||
'31-Dec-2013', 29, 45, 24, 20, 13, 7, 3
|
||||
'27-Dec-2013', 1, 22, 6, 13, 28, 10, 5
|
||||
'24-Dec-2013', 5, 31, 43, 50, 19, 6, 2
|
||||
'20-Dec-2013', 13, 22, 17, 43, 12, 10, 3
|
||||
'17-Dec-2013', 41, 6, 8, 37, 27, 7, 10
|
||||
'13-Dec-2013', 24, 22, 23, 1, 31, 6, 11
|
||||
'10-Dec-2013', 49, 50, 24, 6, 35, 7, 1
|
||||
'06-Dec-2013', 18, 31, 36, 2, 1, 7, 10
|
||||
'03-Dec-2013', 32, 6, 29, 15, 13, 2, 9
|
||||
'29-Nov-2013', 2, 7, 10, 23, 43, 4, 7
|
||||
'26-Nov-2013', 19, 23, 27, 42, 44, 3, 5
|
||||
'22-Nov-2013', 13, 25, 26, 40, 50, 8, 9
|
||||
'19-Nov-2013', 14, 15, 19, 36, 45, 1, 10
|
||||
'15-Nov-2013', 3, 13, 15, 29, 42, 1, 4
|
||||
'12-Nov-2013', 14, 29, 37, 40, 48, 2, 11
|
||||
'08-Nov-2013', 20, 28, 35, 42, 43, 8, 10
|
||||
'05-Nov-2013', 6, 12, 13, 35, 38, 2, 3
|
||||
'01-Nov-2013', 7, 19, 29, 30, 33, 3, 8
|
||||
'29-Oct-2013', 9, 10, 30, 32, 37, 2, 6
|
||||
'25-Oct-2013', 2, 3, 10, 31, 38, 6, 10
|
||||
'22-Oct-2013', 29, 33, 39, 41, 44, 9, 11
|
||||
'18-Oct-2013', 5, 25, 36, 46, 47, 2, 6
|
||||
'15-Sep-2013', 18, 27, 39, 43, 47, 4, 7
|
||||
'11-Oct-2013', 6, 12, 17, 23, 43, 5, 9
|
||||
'08-Oct-2013', 23, 24, 26, 33, 42, 3, 5
|
||||
'04-Oct-2013', 6, 20, 24, 35, 50, 5, 10
|
||||
'01-Oct-2013', 19, 23, 25, 44, 48, 8, 9
|
||||
'27-Sep-2013', 11, 15, 38, 41, 43, 2, 6
|
||||
'24-Sep-2013', 10, 20, 26, 28, 43, 9, 11
|
||||
'20-Sep-2013', 5, 11, 35, 38, 45, 2, 3
|
||||
'17-Sep-2013', 13, 17, 21, 42, 44, 9, 11
|
||||
'13-Sep-2013', 4, 6, 14, 27, 33, 5, 10
|
||||
'10-Sep-2013', 7, 11, 14, 28, 30, 2, 10
|
||||
'06-Sep-2013', 11, 23, 25, 32, 37, 4, 7
|
||||
'03-Sep-2013', 5, 9, 16, 18, 42, 7, 9
|
||||
'30-Aug-2013', 2, 17, 25, 36, 45, 5, 9
|
||||
'27-Aug-2013', 7, 30, 38, 40, 43, 2, 6
|
||||
'23-Aug-2013', 1, 6, 26, 30, 37, 5, 8
|
||||
'20-Aug-2013', 5, 11, 42, 49, 50, 8, 11
|
||||
'16-Aug-2013', 20, 24, 27, 37, 39, 5, 10
|
||||
'13-Aug-2013', 5, 17, 20, 47, 50, 1, 4
|
||||
'09-Aug-2013', 4, 7, 9, 23, 24, 8, 9
|
||||
'06-Aug-2013', 17, 47, 16, 49, 31, 3, 11
|
||||
'02-Aug-2013', 42, 36, 48, 37, 21, 7, 4
|
||||
'30-Jul-2013', 3, 14, 4, 11, 43, 1, 6
|
||||
'26-Jul-2013', 23, 38, 29, 12, 49, 4, 3
|
||||
'23-Jul-2013', 19, 14, 44, 16, 15, 4, 5
|
||||
'19-Jul-2013', 24, 35, 13, 26, 16, 5, 2
|
||||
'16-Jul-2013', 50, 34, 47, 19, 23, 4, 6
|
||||
'12-Jul-2013', 26, 42, 33, 18, 32, 3, 2
|
||||
'09-Jul-2013', 18, 16, 38, 49, 31, 10, 4
|
||||
'05-Jul-2013', 28, 4, 33, 12, 15, 1, 10
|
||||
'02-Jul-2013', 14, 13, 11, 28, 30, 4, 5
|
||||
'28-Jun-2013', 15, 1, 47, 28, 35, 7, 1
|
||||
'25-Jun-2013', 4, 13, 35, 27, 5, 2, 1
|
||||
'21-Jun-2013', 30, 11, 36, 45, 10, 1, 2
|
||||
'18-Jun-2013', 24, 33, 17, 41, 44, 11, 1
|
||||
'14-Jun-2013', 41, 25, 48, 10, 47, 6, 10
|
||||
'11-Jun-2013', 7, 9, 25, 5, 41, 5, 1
|
||||
'07-Jun-2013', 14, 26, 45, 50, 7, 2, 7
|
||||
'04-Jun-2013', 34, 33, 40, 31, 37, 6, 1
|
||||
'31-May-2013', 29, 43, 28, 34, 27, 10, 5
|
||||
'28-May-2013', 34, 38, 13, 8, 26, 3, 11
|
||||
'24-May-2013', 22, 17, 40, 7, 27, 2, 3
|
||||
'21-May-2013', 29, 19, 8, 28, 7, 9, 5
|
||||
'17-May-2013', 25, 24, 50, 6, 20, 9, 10
|
||||
'14-May-2013', 24, 7, 8, 36, 27, 11, 5
|
||||
'10-May-2013', 48, 35, 45, 1, 32, 4, 11
|
||||
'07-May-2013', 43, 27, 13, 28, 42, 4, 6
|
||||
'03-May-2013', 5, 49, 34, 3, 40, 2, 3
|
||||
'30-Apr-2013', 13, 50, 40, 43, 36, 9, 5
|
||||
'26-Apr-2013', 40, 38, 16, 24, 11, 2, 5
|
||||
'23-Apr-2013', 50, 4, 1, 7, 10, 4, 11
|
||||
'19-Apr-2013', 1, 46, 8, 42, 48, 4, 7
|
||||
'16-Apr-2013', 33, 50, 22, 1, 11, 4, 6
|
||||
'12-Apr-2013', 28, 45, 15, 5, 10, 3, 9
|
||||
'09-Apr-2013', 15, 44, 48, 38, 35, 10, 5
|
||||
'05-Apr-2013', 32, 1, 17, 39, 11, 7, 2
|
||||
'02-Apr-2013', 17, 12, 41, 29, 25, 1, 4
|
||||
'29-Mar-2013', 44, 30, 46, 43, 13, 9, 5
|
||||
'26-Mar-2013', 44, 30, 26, 42, 4, 6, 11
|
||||
'22-Mar-2013', 27, 32, 12, 34, 49, 9, 8
|
||||
'19-Mar-2013', 44, 32, 19, 37, 35, 9, 1
|
||||
'15-Mar-2013', 24, 14, 39, 4, 21, 10, 3
|
||||
'12-Mar-2013', 50, 4, 10, 2, 22, 5, 8
|
||||
'08-Mar-2013', 20, 42, 23, 28, 3, 8, 11
|
||||
'05-Mar-2013', 33, 31, 19, 8, 39, 7, 2
|
||||
'01-Mar-2013', 1, 11, 36, 29, 42, 4, 5
|
||||
'26-Feb-2013', 12, 13, 17, 3, 30, 6, 2
|
||||
'22-Feb-2013', 15, 37, 36, 16, 28, 2, 11
|
||||
'19-Feb-2013', 28, 30, 44, 12, 15, 9, 8
|
||||
'15-Feb-2013', 2, 4, 42, 28, 22, 4, 9
|
||||
'12-Feb-2013', 28, 25, 5, 11, 16, 7, 9
|
|
1
app/newermobile.htm
Normal file
1
app/newermobile.htm
Normal file
File diff suppressed because one or more lines are too long
64
app/newmobile.htm
Normal file
64
app/newmobile.htm
Normal file
@ -0,0 +1,64 @@
|
||||
<html><head><title>Slack</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="viewport" content="width=320; initial-scale=1.0;">
|
||||
<style>
|
||||
body,ul,ol,dl,h1,h2,h3,h4,h5,h6,td,th,
|
||||
caption,pre,p,blockquote,input,textarea,a,.l,.r,.m2 {
|
||||
font: 105% 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
|
||||
}
|
||||
body{background-color: #fff;};
|
||||
|
||||
a {color:#ff0000;text-decoration:underline;white-space: nowrap;margin:5px;padding:2px;}
|
||||
a:visited {color:purple;}
|
||||
a:hover {color:#CC0000;}
|
||||
|
||||
.m {text-align:center; font-weight:900;font-size: 120%;color: #888;}
|
||||
.l{font-style:italic;text-align:left;font-weight:900;font-size:110%;color: #888;}
|
||||
.r{text-align:right;border-bottom:1px solid #888;}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class='m'>Slack - I have plenty of talent and vision I just don't give a damn</div>
|
||||
|
||||
|
||||
|
||||
<div class='l'>Starting Points/Metasites</div>
|
||||
<div class='r'><a href='https://kanbanflow.com/m'>Kanban flow</a> /
|
||||
<a href="https://en.m.wikipedia.org/wiki/Main_Page">Wikipedia</a> /
|
||||
<a href="http://iphone.facebook.com/#/home.php">Facebook</a> / <a href="http://www.yahoo.com/">Yahoo!</a> / <a href="http://www.talk3g.co.uk/forumdisplay.php?f=100">Talk3G</a> / <a href="http://www.unmajestic.com/home/bookmarkshome.htm">Bookmarks</a> / <a href="http://iphone.ebay.com/">Ebay</a> / <a href="http://www.evernote.com/m">Evernote</a> / <a href="http://mobile.wikipedia.org/">Wikipedia</a> / <a href="http://mobile.twitter.com/">Twitter</a> / <a href="http://m.foursquare.com/">Foursquare</a></div>
|
||||
|
||||
<div class='l'>News</div>
|
||||
<div class='r'><a href='http://m.bbc.co.uk/'>BBC News</a> / <a href='http://m.guardian.co.uk/'>Guardian</a> / <a href='http://m.telegraph.co.uk/'>Telegraph</a> / <a href="http://m.wsj.com/home-page">WSJ</a> / <a href="http://mobile.bloomberg.com/">Bloomberg</a> / <a href='http://m.wired.com/'>Wired</a></div>
|
||||
|
||||
|
||||
<div class='l'>Travel</div>
|
||||
<div class='r'>
|
||||
<a href="http://www.bbc.co.uk/travel/glasgowandwestscotland/incidents/road">travel news</a> / <a href="http://m.nationalrail.co.uk/pj/ldbboard/dep/DBE/WES/To">DBE->WES</a> / <a href="http://m.nationalrail.co.uk/pj/ldbboard/dep/WES/DBE/To">WES->DBE</a> / <a href="http://m.nationalrail.co.uk/pj/ldbboard/dep/DBE">Dumbarton East Trains</a> / <a href="http://m.nationalrail.co.uk/pj/ldbboard/dep/GLQ">Queen Street Trains</a> / <a href="http://m.nationalrail.co.uk/pj/ldbboard/dep/CHC">Charing Cross</a> / <a href='http://m.thetrainline.com/dsb/timetable/jsp/mobile_portal.jsp'>The Trainline</a> / <a href="http://m.kayak.co.uk/">Kayak</a> / <a href='http://www.laterooms.com/'>Laterooms</a> / <a href="http://www.travelocity.com/MobileHotel">Travelocity</a> / <a href="http://reservation.travel.com/m/">Travel.com</a> / <a href='http://www.tripadvisor.com/'>Trip Advisor</a> / <a href="http://www.landings.com/_landings/pages/commercial.html">Airlines</a> / <a href="http://mobile.flightstats.com/go/Mobile/home.do">Landings</a> / <a href="http://www.lib.utexas.edu/Libs/PCL/Map_collection/map_sites/map_sites.html#general">Maps</a> / <a href="http://www.sitesatlas.com/Maps/">Maps2</a> / <a href="http://www.itn.net/">ITN</a> / <a href="http://bahn.hafas.de/bin/query.exe/en">HAFAS</a> / <a href="http://bahn.hafas.de/bin/query.exe/en" alt='DieBahn' title='DieBahn'>Eurotrains</a> / <a href="http://www.cwrr.com/nmra/travelreg.html">RailUSA</a> / <a href="http://www.trainweb.com/frames_travel.html">TrainWeb</a> / <a href="http://www.cwrr.com/nmra/travelw2.html">RailWorld</a> / <a href="http://www.xe.com/currency/gbp-british-pound?c=SEK">Currency Converter</a> / <a href="http://www.cia.gov/cia/publications/factbook/index.html">CIA</a> / <a href="http://maps.google.com/">GMaps</a> / <a href="http://mtrvl.com/">Mobile Travel Aid</a> / <a href="https://www.tfl.gov.uk/plan-a-journey/">TfL Route Planner</a> / <a href="http://www.norwegian.com/uk/">Norwegian</a> / <a href='http://m.tripit.com/'>TripIt</a> / <a href='http://www.ichotelsgroup.com/wireless/pc/us/en/home.action?cm_sp=IMMerch-_-PC_US_en-_-MobileDemoButton'>Priority Club</a> / <a href='http://www.urbanspoon.com/m'>Urban Spoon</a> / <a href='http://pda.continental.com'>Continental Flight Checker</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class='l'>Weather Reports</div>
|
||||
<div class='r'>
|
||||
<a href="http://i.wund.com/cgi-bin/findweather/getForecast?brand=iphone&query=dumbarton%2C+uk">WU Dumbarton Weather</a> / <a href="http://weather.yahoo.com/forecast/UKXX0663.html?unit=c">Y! Dumbarton Weather</a> / <a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G82%201RG">Dumbarton Weather</a> / <a href="http://i.wund.com/cgi-bin/findweather/getForecast?brand=iphone&query=glasgow%2C+uk">WU Glasgow Weather</a> / <a href="http://weather.yahoo.com/Glasgow-United-Kingdom/UKXX0061/forecast.html?unit=c">Y! Glasgow Weather</a> / <a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G9%202SU">Glasgow Weather</a> /<a href="http://i.wund.com/">WU Elsewhere</a> / <a href="http://www.nowcast.co.uk/lightning/">Live Lightning</a> / <a href="http://www.upminsterweather.co.uk/test/lightning.htm">Other Live Lightning</a> / <a href="http://www.meteorologica.info/freedata_lightning.htm">Closer Live Lightning</a>
|
||||
</div>
|
||||
|
||||
<div class='l'>Job Searching</div>
|
||||
<div class='r'>
|
||||
<a href="http://forums.contractoruk.com/index.php">Contractor UK</a> / <a href="http://www.monster.co.uk/">monster</a> / <a href="http://www.cwjobs.co.uk/">cwjobs</a> / <a href="http://www.s1jobs.com/myaccount/">s1jobs</a> / <a href="http://www.jobserve.com/mobile/phone/mobilehomepage.aspx">jobserve</a> / <a href="http://www.jobsite.co.uk/mobile/">jobsite</a> / <a href="http://www.itjobswatch.co.uk/contracts/scotland/asp.do">IT Jobs Watch Scotland</a>
|
||||
</div>
|
||||
<div class='l'>Entertainment</div>
|
||||
<div class='r'>
|
||||
<a href="http://genre.amazingradio.co.uk:8000/stream.mp3?arplayer=1">Amazing Radio Chill</a> / <a href="http://www.whatsonglasgow.co.uk/">Whats on In Glasgow</a> / <a href="http://www.5pm.co.uk/Search/Event/">Local Events</a> / <a href="http://www.cineworld.co.uk/cinemas/28?fallback=false&isMobileAgent=false">Cineworld</a> / <a href="http://www.showcasecinemas.co.uk/showtimes/default.asp?selectTheatre=8508">Showcase</a> / <a href="http://uk.rottentomatoes.com/">Rotten Tomatoes</a> / <a href="http://www.metacritic.com/">Metacritic</a> / <a href="http://m.runpee.com/">RunPee</a> / <a href="http://www.imdb.com/">Imdb</a> / <a href="http://www.epguides.com/">EPGuides</a> / <a href="http://eztv.it">Eztv</a> / <a href="http://www.mininova.org">Mininova</a> / <a href="http://www.scrapetorrent.com">Scrapetorrent</a> / <a href="http://www.solidrockglasgow.com/">solid</a> / <a href="https://www.google.co.uk/search?q=cathouse+glasgow&oq=cathouse+glasgow&aqs=chrome..69i57j0l5.2799j0j4&sourceid=chrome&es_sm=119&ie=UTF-8">catty</a> / <a href="http://www.vegasscotland.co.uk/">vegas</a> / <a href="http://www.clubnoir.co.uk/calendar.html?c=view&event_id=15">noir</a> / <a href='http://www.amazon.com/gp/aw/h.html'>Amazon</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class='l'>Personal / Money</div>
|
||||
<div class='r'><a href="http://www.paypal.com/">Paypal</a> / <a href="http://www.halifax.co.uk/">Halifax</a> / <a href="http://www.bullbearings.co.uk/stock.portfolio.php">Bullbearings</a> / <a href="http://www.fidelity.co.uk/">Fidelity</a> / <a href="http://www.contractorumbrella.com/">Contractor Umbrella</a> / <a href="https://www99.americanexpress.com/myca/mobl/us/?r=l_l">American Express</a> / <a href='http://rates.fxcm.com/rates_a'>Exchange Rates</a>
|
||||
</div>
|
||||
|
||||
|
||||
</body></html>
|
663
app/oldslack.htm
Normal file
663
app/oldslack.htm
Normal file
@ -0,0 +1,663 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Slack</title>
|
||||
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
<style type="text/css" media="all">
|
||||
body {
|
||||
text-align: center;
|
||||
background: #C9C5C2;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: left;
|
||||
position: relative;
|
||||
width: 960px;
|
||||
background: #FFF;
|
||||
border: 2px solid #FFF;
|
||||
-moz-box-shadow: 3px 3px 3px #aaa;
|
||||
-webkit-box-shadow: 3px 3px 3px #aaa;
|
||||
box-shadow: 3px 3px 3px #aaa;
|
||||
margin: 18px auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body,
|
||||
ul,
|
||||
ol,
|
||||
dl,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
td,
|
||||
th,
|
||||
caption,
|
||||
pre,
|
||||
p,
|
||||
blockquote,
|
||||
input,
|
||||
textarea {
|
||||
font: .9em 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
text-decoration: underline;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
|
||||
color: #FFF;
|
||||
margin: 0;
|
||||
padding: 9px 0;
|
||||
}
|
||||
|
||||
h1 a,
|
||||
h1 a:visited {
|
||||
color: #EEE;
|
||||
}
|
||||
|
||||
h1 a:hover {
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 18px;
|
||||
background: teal;
|
||||
border-bottom: 3px solid #80007e;
|
||||
padding: 9px 0 9px 9px;
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 12px;
|
||||
background: #DDD;
|
||||
border-bottom: 1px solid #80007e;
|
||||
color: #333;
|
||||
margin-top: 0;
|
||||
padding: 9px 0 9px 9px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-spacing: 10px;
|
||||
}
|
||||
|
||||
th {
|
||||
width: 33%;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
line-height: 24px;
|
||||
border-bottom: 1px solid #80007e;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
td {
|
||||
vertical-align: top;
|
||||
background: #FFF;
|
||||
padding: 0 0 6px;
|
||||
}
|
||||
|
||||
td.footer {
|
||||
background: #8abbd7;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.red:hover {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.floatright {
|
||||
float: right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.floatleft {
|
||||
float: left;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
.red {
|
||||
color: #C00;
|
||||
}
|
||||
|
||||
.dates {
|
||||
padding: 2px;
|
||||
border: solid 1px #80007e;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#btc,
|
||||
#fx {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.up {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.down {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.nochange {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
s0 {
|
||||
border: solid 1px rgb(0, 128, 0);
|
||||
}
|
||||
|
||||
s1 {
|
||||
border: solid 1px rgb(4, 124, 0);
|
||||
}
|
||||
|
||||
s2 {
|
||||
border: solid 1px rgb(8, 120, 0);
|
||||
}
|
||||
|
||||
s3 {
|
||||
border: solid 1px rgb(16, 116, 0);
|
||||
}
|
||||
|
||||
s4 {
|
||||
border: solid 1px rgb(20, 112, 0);
|
||||
}
|
||||
|
||||
s5 {
|
||||
border: solid 1px rgb(24, 108, 0);
|
||||
}
|
||||
|
||||
s6 {
|
||||
border: solid 1px rgb(28, 104, 0);
|
||||
}
|
||||
|
||||
s7 {
|
||||
border: solid 1px rgb(32, 100, 0);
|
||||
}
|
||||
|
||||
s8 {
|
||||
border: solid 1px rgb(36, 96, 0);
|
||||
}
|
||||
|
||||
s9 {
|
||||
border: solid 1px rgb(40, 92, 0);
|
||||
}
|
||||
|
||||
s10 {
|
||||
border: solid 1px rgb(44, 88, 0);
|
||||
}
|
||||
|
||||
s11 {
|
||||
border: solid 1px rgb(48, 84, 0);
|
||||
}
|
||||
|
||||
s12 {
|
||||
border: solid 1px rgb(52, 80, 0);
|
||||
}
|
||||
|
||||
s13 {
|
||||
border: solid 1px rgb(56, 76, 0);
|
||||
}
|
||||
|
||||
s14 {
|
||||
border: solid 1px rgb(60, 72, 0);
|
||||
}
|
||||
|
||||
s15 {
|
||||
border: solid 1px rgb(64, 68, 0);
|
||||
}
|
||||
|
||||
s16 {
|
||||
border: solid 1px rgb(68, 64, 0);
|
||||
}
|
||||
|
||||
s17 {
|
||||
border: solid 1px rgb(72, 60, 0);
|
||||
}
|
||||
|
||||
s18 {
|
||||
border: solid 1px rgb(76, 56, 0);
|
||||
}
|
||||
|
||||
s19 {
|
||||
border: solid 1px rgb(80, 52, 0);
|
||||
}
|
||||
|
||||
s20 {
|
||||
border: solid 1px rgb(84, 48, 0);
|
||||
}
|
||||
|
||||
s21 {
|
||||
border: solid 1px rgb(88, 44, 0);
|
||||
}
|
||||
|
||||
s22 {
|
||||
border: solid 1px rgb(92, 40, 0);
|
||||
}
|
||||
|
||||
s23 {
|
||||
border: solid 1px rgb(96, 36, 0);
|
||||
}
|
||||
|
||||
s24 {
|
||||
border: solid 1px rgb(100, 32, 0);
|
||||
}
|
||||
|
||||
s25 {
|
||||
border: solid 1px rgb(104, 28, 0);
|
||||
}
|
||||
|
||||
s26 {
|
||||
border: solid 1px rgb(108, 26, 0);
|
||||
}
|
||||
|
||||
s27 {
|
||||
border: solid 1px rgb(112, 22, 0);
|
||||
}
|
||||
|
||||
s28 {
|
||||
border: solid 1px rgb(116, 18, 0);
|
||||
}
|
||||
|
||||
s29 {
|
||||
border: solid 1px rgb(120, 12, 0);
|
||||
}
|
||||
|
||||
s30 {
|
||||
border: solid 1px rgb(124, 8, 0);
|
||||
}
|
||||
|
||||
s31 {
|
||||
border: solid 1px rgb(128, 4, 0);
|
||||
}
|
||||
|
||||
s32 {
|
||||
border: solid 1px rgb(128, 0, 0);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="title">Slack - I have plenty of talent and vision I just don't give a damn</h1>
|
||||
|
||||
<div>
|
||||
<h2><span id='one' class='dates'>----</span><span> </span><span
|
||||
id='two' class='dates'>----</span><span> </span> <span
|
||||
id='three' class='dates'>----</span>
|
||||
</h2>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Starting Points/Metasites</th>
|
||||
<th>Tools</th>
|
||||
<th>Bitcoin <span id="btc"></span></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Starting Points/Metasites -->
|
||||
<ul>
|
||||
<li><a href="https://feedly.com/#my">Feedly</a></li>
|
||||
<li><a href="https://www.reddit.com">Reddit</a></li>
|
||||
<li><a href="http://www.facebook.com/">Facebook</a></li>
|
||||
<li><a href="http://www.yahoo.com/">Yahoo!</a></li>
|
||||
<li><a href="https://stackedit.io/editor">Journal Editor</a></li>
|
||||
<li><a href="http://www.unmajestic.com/home/bookmarks.php">Slack Bookmarks</a></li>
|
||||
<li><a href="http://www.rssmix.com/u/7711845">Paleo Mix</a></li>
|
||||
<li><a href="http://status.hivehome.com/">Hive Status</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- tools -->
|
||||
<ul>
|
||||
<li><a href='https://kanbanflow.com'>Kanban Flow</a></li>
|
||||
<li><a href="https://www.linode.com/">Linode</a></li>
|
||||
<li><a href="http://www.colorzilla.com/gradient-editor/">CSS Gradient Generator</a></li>
|
||||
<li><a href="http://utilities-online.info/xmltojson">XML to JSON</a></li>
|
||||
<li><a href="http://shancarter.com/data_converter">CSV to JSON</a></li>
|
||||
<li><a href="http://cubic-bezier.com/">Cubic Bezier</a></li>
|
||||
<li><a href="http://gskinner.com/RegExr/">RegEx Tool</a></li>
|
||||
<li><a href="http://closure-compiler.appspot.com/home">Closure Compiler</a></li>
|
||||
<li><a href="http://jsonlint.com/">JSON Lint</a></li>
|
||||
<li><a href="http://jsoneditoronline.org/">JSON Editor</a></li>
|
||||
<li><a href="http://www.base64decode.org/">Base64 Decoder</a></li>
|
||||
<li><a href="http://jsbeautifier.org/">JS Beautifier</a></li>
|
||||
<li><a href="http://spritepad.wearekiss.com/">Spritepad</a></li>
|
||||
<li><a href="http://draeton.github.com/stitches/">Sprite Sheet Generator</a></li>
|
||||
<li><a href="http://www.cleancss.com/">CSS Optimizer</a></li>
|
||||
<li><a href="http://fontello.com/">Icon Font Generator</a></li>
|
||||
<li><a href="http://html2jade.aaron-powell.com/">HTML to Jade</a></li>
|
||||
<li><a href="http://cdnjs.com//">Cloudflare JS CDN</a></li>
|
||||
<li><a href="http://www.willpeavy.com/minifier/">HTML Minifier</a></li>
|
||||
<li><a href='https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet'>XSS Cheat Sheet</a></li>
|
||||
<li><a href='http://jsfiddle.net/'>JSFiddle</a></li>
|
||||
<li><a href="http://jsbin.com/">JS Bin</a></li>
|
||||
<li><a href='https://draftin.com/documents'>Draftin</a></li>
|
||||
<li><a href="https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html">Android Asset</a></li>
|
||||
<li><a href="https://xkpasswd.net/s/">Password Generator</a></li>
|
||||
<li><a href="https://howsecureismypassword.net/">Password Checker</a></li>
|
||||
<li><a href="https://archive.today">Archive Today</a></li>
|
||||
<li><a href="http://staticmapmaker.com/google/">Static Map Generator</a></li>
|
||||
<li><a href="https://httpbin.org/">AJAX Endpoints</a></li>
|
||||
<li><a href="https://tools.bartlweb.net/webssh/">WebSSH</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Bitcoin -->
|
||||
<ul>
|
||||
<li><a href="https://www.bitstamp.net">Bitstamp</a></li>
|
||||
<li><a href="https://www.kraken.net">Kraken</a></li>
|
||||
<li><a href="https://cryptowat.ch/">Cryptowat.ch</a></li>
|
||||
<li><a href="http://www.coindesk.com/price/">BTC Chart</a></li>
|
||||
<li><a href="https://bitcoinwisdom.com/">BTC Chart 2</a></li>
|
||||
<li><a href="http://bitcoinity.org/markets/bitstamp/USD">BitStamp Chart</a></li>
|
||||
<li><a href="http://btc-chart.com/market/bitstamp/86400">Bitstamp Chart 2</a></li>
|
||||
<li><a href="https://bitbargain.co.uk">BitBargin UK</a></li>
|
||||
<li><a href="https://yacuna.com/">Yacuna UK</a></li>
|
||||
<li><a href="http://blockchain.info/">Blockchain</a></li>
|
||||
<li><a href="http://bitminter.com/">Bitminter</a></li>
|
||||
<li><a href="http://preev.com/">BTC Exchange Rate</a></li>
|
||||
<li><a href="http://www.silvrtree.co.uk/watch.html">CFT Watcher</a>
|
||||
<span style="cursor: pointer;" onclick="popitoutSmall('http://www.silvrtree.co.uk/watch.html');"><img
|
||||
src="gfx/popout.png" width='10' height="10"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Package Tracking</th>
|
||||
<th>Weather Reports</th>
|
||||
<th>Free Email WEBpages</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Package Tracking -->
|
||||
<ul>
|
||||
<li><a href="http://m.ups.com/">UPS</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Weather Reports -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G82%201RG">Dumbarton
|
||||
Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=dumbarton,%20uk&wuSelect=WEATHER">WU
|
||||
Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://weather.yahoo.com/forecast/UKXX0663.html?unit=c">Y! Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G9%202SU">Glasgow
|
||||
Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=glasgow,%20uk&wuSelect=WEATHER">WU
|
||||
Glasgow Weather</a>
|
||||
</li>
|
||||
<li><a href="http://www.nowcast.co.uk/lightning/">Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.upminsterweather.co.uk/test/live_lightning.htm">Other Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.meteorologica.info/freedata_lightning.htm">Closer Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.malvernwx.co.uk/lightning_data/lightning.htm">Multiple Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.blitzortung.org/Webpages/index.php">European Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.madpaddler.net/wxlightning.php">East Kilbride Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.bordersweather.co.uk/wxlightning.php">Borders Lightning</a>
|
||||
</li>
|
||||
<li><a href='http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=map&lang=en'>Best Live Lightning</a></li>
|
||||
<li><a href="http://www.madpaddler.net/wxais.php">Ships</a></li>
|
||||
<li><a href='http://www.raintoday.co.uk/'>Rain Today</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Free Email WEBpages -->
|
||||
<ul>
|
||||
<li><a href="http://gmail.google.com/">Gmail</a></li>
|
||||
<li>
|
||||
<a href="http://www.unmajestic.com/webmail/">Unmajestic Webmail</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.artizanconsulting.co.uk/webmail/">Artizan Webmail</a>
|
||||
</li>
|
||||
<li><a href="http://mail.yahoo.com">Yahoo Mail</a></li>
|
||||
<li>
|
||||
<a href="https://www.guerrillamail.com/">Guerrilla Mail Anti Spam</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Job Searching</th>
|
||||
<th>Entertainment</th>
|
||||
<th>Travel <span id="fx"></span></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Real News Related -->
|
||||
<ul>
|
||||
<li><a href='https://worksheets.computerfutures.com/'>CF Timesheets</a></li>
|
||||
<li><a href="http://www.monster.co.uk/">monster</a></li>
|
||||
<li><a href="http://www.cwjobs.co.uk/">cwjobs</a></li>
|
||||
<li><a href="http://www.s1jobs.com/myaccount/">s1jobs</a></li>
|
||||
<li><a href="http://www.jobserve.com/">jobserve</a></li>
|
||||
<li><a href="http://www.jobsite.co.uk/jbe/myprofile/">jobsite</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.itjobswatch.co.uk/contracts/scotland/asp.do">IT Jobs Watch Scotland</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Entertainment -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://genre.amazingradio.co.uk:8000/stream.mp3?arplayer=1">Amazing Radio Chill</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.cineworld.co.uk/cinemas/28?fallback=false&isMobileAgent=false">Cineworld</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.showcasecinemas.co.uk/showtimes/default.asp?selectTheatre=8508">Showcase</a>
|
||||
</li>
|
||||
<li><a href="http://www.imdb.com/">Imdb</a></li>
|
||||
<li><a href="http://www.epguides.com/">EPGuides</a></li>
|
||||
<li><a href="http://eztv.it">Eztv</a></li>
|
||||
<li><a href="http://www.mininova.org">Mininova</a></li>
|
||||
<li><a href="http://www.scrapetorrent.com">Scrapetorrent</a></li>
|
||||
<li>
|
||||
<a href="http://glasgow.myvillage.com/events">Whats on In Glasgow</a>
|
||||
</li>
|
||||
<li><a href="http://www.5pm.co.uk/Search/Event/">Local Events</a>
|
||||
</li>
|
||||
<li><a href="http://necta.jansenit.com:8000/necta192.mp3">Nectarine</a>
|
||||
</li>
|
||||
<li><a href="/playlists/str.pls">STR - Space Travel Radio</a>
|
||||
</li>
|
||||
<li><a href="/playlists/musik.drumstep.pls">musik.drumstep</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Travel -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href='http://www.journeycheck.com/firstscotrail'>Journey Check</a>
|
||||
<a href="http://www.bbc.co.uk/travel/2650802/incidents/road">BBC Road
|
||||
news</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/DBE/WES/To?ar=true">DBE->WES</a> /
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=DBE&to=WES">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true">WES->DBE</a>
|
||||
<span style="cursor: pointer;" onclick="popitout('http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true#skip-content-hold');"><img
|
||||
src="gfx/popout.png" width='10' height="10"></span> /
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=WES&to=DBE">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=DBE">DBE Board</a> /
|
||||
<a href="http://www.stationboard.uk/index.php?view=desktop&station1=DBE&direction=departures">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=GLQ">GLQ Trains</a> /
|
||||
<a href="http://www.stationboard.uk/index.php?view=desktop&station1=GLQ&direction=departures">Adv</a> /
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=GLQ&to=DBE">GLQ->DBE</a>
|
||||
</li>
|
||||
<li><a href="http://www.kayak.co.uk/">Kayak</a></li>
|
||||
<li><a href="http://www.travelocity.co.uk/">Travelocity</a></li>
|
||||
<li><a href="http://www.travel.com/sitemap.htm">Travel.com</a></li>
|
||||
<li>
|
||||
<a href="http://www.landings.com/_landings/pages/commercial.html">Airlines</a>
|
||||
</li>
|
||||
<li><a href="http://www.flightstats.com">Landings</a></li>
|
||||
<li>
|
||||
<a href="http://www.lib.utexas.edu/Libs/PCL/Map_collection/map_sites/map_sites.html#general">Maps</a>
|
||||
</li>
|
||||
<li><a href="http://www.sitesatlas.com/Maps/">Maps2</a></li>
|
||||
<li><a href="http://www.itn.net/">ITN</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">HAFAS</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">DieBahn</a></li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelreg.html">RailUSA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.trainweb.com/frames_travel.html">TrainWeb</a>
|
||||
</li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelw2.html">RailWorld</a>
|
||||
</li>
|
||||
<li><a href="http://www.xe.net/currency/">Currency Converter</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.cia.gov/cia/publications/factbook/index.html">CIA</a>
|
||||
</li>
|
||||
<li><a href="http://maps.google.com/">GMaps</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Computer Software, etc.</th>
|
||||
<th>Reference & Special sites</th>
|
||||
<th>Earth and Beyond</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Computer Software, etc. -->
|
||||
<ul>
|
||||
<li><a href="">Portable Apps</a></li>
|
||||
<li><a href="http://www.newfreeware.com/">NewFreeware</a></li>
|
||||
<li>
|
||||
<a href="http://www.makeuseof.com/tag/portable-software-usb/">Portable Software</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.portablefreeware.com/">Portable Freeware Collection</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Reference and Special sites -->
|
||||
<ul>
|
||||
<li><a href="http://www.glossarist.com/default.asp">Glossaries</a>
|
||||
</li>
|
||||
<li><a href="http://www.convert-me.com/en/">Converters</a></li>
|
||||
<li>
|
||||
<a href="http://decoder.americom.com/cgi-bin/decoder.cgi">DECODE</a>
|
||||
</li>
|
||||
<li><a href="http://www.rxlist.com/">Drugs</a></li>
|
||||
<li><a href="http://www.ncbi.nlm.nih.gov/PubMed/">Medline</a></li>
|
||||
<li>
|
||||
<a href="http://www.logos.it/dictionary/owa/sp?lg=EN">Translation</a>
|
||||
</li>
|
||||
<li><a href="http://www.onelook.com/">One Look</a></li>
|
||||
<li><a href="http://www.defenselink.mil/">US Military</a></li>
|
||||
<li><a href="http://www.fedworld.gov/">US Fed</a></li>
|
||||
<li><a href="http://www.ih2000.net/ira/legal.htm">Legal</a></li>
|
||||
<li><a href="http://www.nih.gov/">NIH</a></li>
|
||||
<li><a href="http://www.refdesk.com/">RefDESK</a></li>
|
||||
<li><a href="http://www.britannica.com/">Britannica</a></li>
|
||||
<li><a href="http://www.capitolimpact.com/gw/">States</a></li>
|
||||
<li><a href="http://www.packtrack.com/">PackTrack</a></li>
|
||||
<li><a href="http://www.acronymfinder.com/">Acronym</a></li>
|
||||
<li><a href="http://www.visualthesaurus.com/">V-Thes</a></li>
|
||||
<li>
|
||||
<a href="http://www.timelineindex.com/content/home/forced">Timelines</a>
|
||||
</li>
|
||||
<li><a href="http://en.wikipedia.org/wiki/Main_Page">Wikipedia</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Good Reading Misc. -->
|
||||
<ul>
|
||||
<li><a href="http://enbarsenal.com">ENB Arsenal</a></li>
|
||||
<li><a href="http://enb.wikia.com/">ENB Wikia</a></li>
|
||||
<li><a href="http://enb.gearlist.co.uk/">Gear List</a></li>
|
||||
<li><a href='http://forum.enb-emulator.com/'>Emu Forum</a></li>
|
||||
<li><a href="http://net-7.org/wiki/index.php?title=Main_Page">Net 7 Wiki</a></li>
|
||||
<li><a href="http://spaceengineers.wikia.com/wiki/Space_Engineers_Wiki">Space Engineers Wiki</a></li>
|
||||
<li><a href="http://forums.keenswh.com/">Space Engineers Forum</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="footer">
|
||||
<div id='weather'></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="container"></div>
|
||||
</body>
|
||||
<script src="app.js"></script>
|
||||
|
||||
</html>
|
0
app/password.html
Normal file
0
app/password.html
Normal file
14
app/password.new.html
Normal file
14
app/password.new.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Password Generator</title>
|
||||
<meta name="Author" content=""/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src='libs/password.js'></script>
|
||||
</body>
|
||||
</html>
|
414
app/slack.htm
Normal file
414
app/slack.htm
Normal file
@ -0,0 +1,414 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="viewport" content="width=360; initial-scale=1;">
|
||||
<meta charset="UTF-8">
|
||||
<title>Slack</title>
|
||||
|
||||
<meta name="Author" content="" />
|
||||
<link rel="stylesheet" type="text/css" href="css/mui.css">
|
||||
<style>
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
|
||||
.dates {
|
||||
padding: 2px;
|
||||
border: solid 1px #80007e;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#btc, #fx {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.up, .ontime {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.down, .delayed {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.nochange {
|
||||
color: #000000;
|
||||
}
|
||||
.password {
|
||||
border: 1px solid #cccccc;
|
||||
background-color: #efefef;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<div class="mui-text-headline mui-text-accent">Slack - I have plenty of talent and vision I just don't give a damn</div>
|
||||
</div>
|
||||
<div id="container" class="mui-panel">
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-3" id="one"></div>
|
||||
<div class="mui-col-md-3 " id="two"></div>
|
||||
<div class="mui-col-md-3 " id="three"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mui-panel">
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Starting Points/Metasites</div>
|
||||
<ul>
|
||||
<li><a href="https://feedly.com/#my">Feedly</a></li>
|
||||
<li><a href="https://www.reddit.com">Reddit</a></li>
|
||||
<li><a href="http://www.facebook.com/">Facebook</a></li>
|
||||
<li><a href="http://www.yahoo.com/">Yahoo!</a></li>
|
||||
<li><a href="https://stackedit.io/editor">Journal Editor</a></li>
|
||||
<li><a href="http://www.unmajestic.com/home/bookmarks.php">Slack Bookmarks</a></li>
|
||||
<li><a href="http://www.rssmix.com/u/7711845">Paleo Mix</a></li>
|
||||
<li><a href="http://status.hivehome.com/">Hive Status</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Tools</div>
|
||||
<ul>
|
||||
<li><a href='https://kanbanflow.com'>Kanban Flow</a></li>
|
||||
<li><a href="https://www.linode.com/">Linode</a></li>
|
||||
<li><a href="http://www.colorzilla.com/gradient-editor/">CSS Gradient Generator</a></li>
|
||||
<li><a href="http://utilities-online.info/xmltojson">XML to JSON</a></li>
|
||||
<li><a href="http://shancarter.com/data_converter">CSV to JSON</a></li>
|
||||
<li><a href="http://cubic-bezier.com/">Cubic Bezier</a></li>
|
||||
<li><a href="http://gskinner.com/RegExr/">RegEx Tool</a></li>
|
||||
<li><a href="http://closure-compiler.appspot.com/home">Closure Compiler</a></li>
|
||||
<li><a href="http://jsonlint.com/">JSON Lint</a></li>
|
||||
<li><a href="http://jsoneditoronline.org/">JSON Editor</a></li>
|
||||
<li><a href="http://www.base64decode.org/">Base64 Decoder</a></li>
|
||||
<li><a href="http://jsbeautifier.org/">JS Beautifier</a></li>
|
||||
<li><a href="http://spritepad.wearekiss.com/">Spritepad</a></li>
|
||||
<li><a href="http://draeton.github.com/stitches/">Sprite Sheet Generator</a></li>
|
||||
<li><a href="http://www.cleancss.com/">CSS Optimizer</a></li>
|
||||
<li><a href="http://fontello.com/">Icon Font Generator</a></li>
|
||||
<li><a href="http://html2jade.aaron-powell.com/">HTML to Jade</a></li>
|
||||
<li><a href="http://cdnjs.com//">Cloudflare JS CDN</a></li>
|
||||
<li><a href="http://www.willpeavy.com/minifier/">HTML Minifier</a></li>
|
||||
<li><a href='https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet'>XSS Cheat Sheet</a></li>
|
||||
<li><a href='http://jsfiddle.net/'>JSFiddle</a></li>
|
||||
<li><a href="http://jsbin.com/">JS Bin</a></li>
|
||||
<li><a href='https://draftin.com/documents'>Draftin</a></li>
|
||||
<li><a href="https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html">Android Asset</a></li>
|
||||
<li><a href="https://xkpasswd.net/s/">Password Generator</a></li>
|
||||
<li><a href="https://howsecureismypassword.net/">Password Checker</a></li>
|
||||
<li><a href="https://archive.today">Archive Today</a></li>
|
||||
<li><a href="http://staticmapmaker.com/google/">Static Map Generator</a></li>
|
||||
<li><a href="https://httpbin.org/">AJAX Endpoints</a></li>
|
||||
<li><a href="https://tools.bartlweb.net/webssh/">WebSSH</a></li>
|
||||
|
||||
<li><span id='newPassword'>Generate Password</span></li>
|
||||
</ul>
|
||||
<div id='passwordOut' class='password' style='display:none;'></div>
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Bitcoin <span id="btc"></span></div>
|
||||
<ul>
|
||||
<li><a href="https://www.bitstamp.net">Bitstamp</a></li>
|
||||
<li><a href="https://www.kraken.net">Kraken</a></li>
|
||||
<li><a href="https://cryptowat.ch/">Cryptowat.ch</a></li>
|
||||
<li><a href="http://www.coindesk.com/price/">BTC Chart</a></li>
|
||||
<li><a href="https://bitcoinwisdom.com/">BTC Chart 2</a></li>
|
||||
<li><a href="http://bitcoinity.org/markets/bitstamp/USD">BitStamp Chart</a></li>
|
||||
<li><a href="http://btc-chart.com/market/bitstamp/86400">Bitstamp Chart 2</a></li>
|
||||
<li><a href="https://bitbargain.co.uk">BitBargin UK</a></li>
|
||||
<li><a href="https://yacuna.com/">Yacuna UK</a></li>
|
||||
<li><a href="http://blockchain.info/">Blockchain</a></li>
|
||||
<li><a href="http://bitminter.com/">Bitminter</a></li>
|
||||
<li><a href="http://preev.com/">BTC Exchange Rate</a></li>
|
||||
<li><a href="http://www.silvrtree.co.uk/watch.html">CFT Watcher</a>
|
||||
<span style="cursor: pointer;"
|
||||
onclick="popitoutSmall('http://www.silvrtree.co.uk/watch.html');"><img
|
||||
src="gfx/popout.png"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Package Tracking</div>
|
||||
<!-- Computer News -->
|
||||
<ul><li><a href="http://m.ups.com/">UPS</a></li></ul>
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Weather</div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G82%201RG">Dumbarton
|
||||
Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=dumbarton,%20uk&wuSelect=WEATHER">WU
|
||||
Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://weather.yahoo.com/forecast/UKXX0663.html?unit=c">Y! Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G9%202SU">Glasgow
|
||||
Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=glasgow,%20uk&wuSelect=WEATHER">WU
|
||||
Glasgow Weather</a>
|
||||
</li>
|
||||
<li><a href="http://www.nowcast.co.uk/lightning/">Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.upminsterweather.co.uk/test/live_lightning.htm">Other Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.meteorologica.info/freedata_lightning.htm">Closer Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.malvernwx.co.uk/lightning_data/lightning.htm">Multiple Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.blitzortung.org/Webpages/index.php">European Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.madpaddler.net/wxlightning.php">East Kilbride Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.bordersweather.co.uk/wxlightning.php">Borders Lightning</a>
|
||||
</li>
|
||||
<li><a href='http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=map&lang=en'>Best Live Lightning</a></li>
|
||||
<li><a href="http://www.madpaddler.net/wxais.php">Ships</a></li>
|
||||
<li><a href='http://www.raintoday.co.uk/'>Rain Today</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Free Email WEBpages</div>
|
||||
<!-- Free Email WEBpages -->
|
||||
<ul>
|
||||
<li><a href="http://gmail.google.com/">Gmail</a></li>
|
||||
<li>
|
||||
<a href="http://www.unmajestic.com/webmail/">Unmajestic Webmail</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.artizanconsulting.co.uk/webmail/">Artizan Webmail</a>
|
||||
</li>
|
||||
<li><a href="http://mail.yahoo.com">Yahoo Mail</a></li>
|
||||
<li>
|
||||
<a href="https://www.guerrillamail.com/">Guerrilla Mail Anti Spam</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Job Searching</div>
|
||||
<ul>
|
||||
<li><a href='https://worksheets.computerfutures.com/'>CF Timesheets</a></li>
|
||||
<li><a href="http://www.monster.co.uk/">monster</a></li>
|
||||
<li><a href="http://www.cwjobs.co.uk/">cwjobs</a></li>
|
||||
<li><a href="http://www.s1jobs.com/myaccount/">s1jobs</a></li>
|
||||
<li><a href="http://www.jobserve.com/">jobserve</a></li>
|
||||
<li><a href="http://www.jobsite.co.uk/jbe/myprofile/">jobsite</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.itjobswatch.co.uk/contracts/scotland/asp.do">IT Jobs Watch Scotland</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Entertainment</div>
|
||||
<!-- Entertainment -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://genre.amazingradio.co.uk:8000/stream.mp3?arplayer=1">Amazing Radio Chill</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.cineworld.co.uk/cinemas/28?fallback=false&isMobileAgent=false">Cineworld</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.showcasecinemas.co.uk/showtimes/default.asp?selectTheatre=8508">Showcase</a>
|
||||
</li>
|
||||
<li><a href="http://www.imdb.com/">Imdb</a></li>
|
||||
<li><a href="http://www.epguides.com/">EPGuides</a></li>
|
||||
<li><a href="http://eztv.it">Eztv</a></li>
|
||||
<li><a href="http://www.mininova.org">Mininova</a></li>
|
||||
<li><a href="http://www.scrapetorrent.com">Scrapetorrent</a></li>
|
||||
<li>
|
||||
<a href="http://glasgow.myvillage.com/events">Whats on In Glasgow</a>
|
||||
</li>
|
||||
<li><a href="http://www.5pm.co.uk/Search/Event/">Local Events</a>
|
||||
</li>
|
||||
<li><a href="http://necta.jansenit.com:8000/necta192.mp3">Nectarine</a>
|
||||
</li>
|
||||
<li><a href="/playlists/str.pls">STR - Space Travel Radio</a>
|
||||
</li>
|
||||
<li><a href="/playlists/musik.drumstep.pls">musik.drumstep</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Travel <span id="fx"></div>
|
||||
<!-- Travel -->
|
||||
<span>DBEGLQ: <span id="dbeglq">---</span></span> <span>GLQDBE: <span id="glqdbe">---</span></span>
|
||||
<div id='trainResults' style='display:none'></div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href='http://www.journeycheck.com/firstscotrail'>Journey Check</a>
|
||||
<a href="http://www.bbc.co.uk/travel/2650802/incidents/road">BBC Road
|
||||
news</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/DBE/WES/To?ar=true">DBE->WES</a>
|
||||
/
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=DBE&to=WES">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true">WES->DBE</a>
|
||||
<span style="cursor: pointer;"
|
||||
onclick="popitout('http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true#skip-content-hold');"><img
|
||||
src="gfx/popout.png"></span>
|
||||
/
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=WES&to=DBE">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=DBE">DBE Board</a>
|
||||
/
|
||||
<a href="http://www.stationboard.uk/index.php?view=desktop&station1=DBE&direction=departures">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=GLQ">GLQ Trains</a> /
|
||||
<a href="http://www.stationboard.uk/index.php?view=desktop&station1=GLQ&direction=departures">Adv</a> /
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=GLQ&to=DBE">GLQ->DBE</a>
|
||||
</li>
|
||||
<li><a href="http://www.kayak.co.uk/">Kayak</a></li>
|
||||
<li><a href="http://www.travelocity.co.uk/">Travelocity</a></li>
|
||||
<li><a href="http://www.travel.com/sitemap.htm">Travel.com</a></li>
|
||||
<li>
|
||||
<a href="http://www.landings.com/_landings/pages/commercial.html">Airlines</a>
|
||||
</li>
|
||||
<li><a href="http://www.flightstats.com">Landings</a></li>
|
||||
<li>
|
||||
<a href="http://www.lib.utexas.edu/Libs/PCL/Map_collection/map_sites/map_sites.html#general">Maps</a>
|
||||
</li>
|
||||
<li><a href="http://www.sitesatlas.com/Maps/">Maps2</a></li>
|
||||
<li><a href="http://www.itn.net/">ITN</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">HAFAS</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">DieBahn</a></li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelreg.html">RailUSA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.trainweb.com/frames_travel.html">TrainWeb</a>
|
||||
</li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelw2.html">RailWorld</a>
|
||||
</li>
|
||||
<li><a href="http://www.xe.net/currency/">Currency Converter</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.cia.gov/cia/publications/factbook/index.html">CIA</a>
|
||||
</li>
|
||||
<li><a href="http://maps.google.com/">GMaps</a></li>
|
||||
<li><a href='https://unop.uk/tube/'>Tube Status</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Computer Software, etc.</div>
|
||||
<ul>
|
||||
<li><a href="">Portable Apps</a></li>
|
||||
<li><a href="http://www.newfreeware.com/">NewFreeware</a></li>
|
||||
<li>
|
||||
<a href="http://www.makeuseof.com/tag/portable-software-usb/">Portable Software</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.portablefreeware.com/">Portable Freeware Collection</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Reference & Special sites</div>
|
||||
<!-- Reference and Special sites -->
|
||||
<ul>
|
||||
<li><a href="http://www.glossarist.com/default.asp">Glossaries</a>
|
||||
</li>
|
||||
<li><a href="http://www.convert-me.com/en/">Converters</a></li>
|
||||
<li>
|
||||
<a href="http://decoder.americom.com/cgi-bin/decoder.cgi">DECODE</a>
|
||||
</li>
|
||||
<li><a href="http://www.rxlist.com/">Drugs</a></li>
|
||||
<li><a href="http://www.ncbi.nlm.nih.gov/PubMed/">Medline</a></li>
|
||||
<li>
|
||||
<a href="http://www.logos.it/dictionary/owa/sp?lg=EN">Translation</a>
|
||||
</li>
|
||||
<li><a href="http://www.onelook.com/">One Look</a></li>
|
||||
<li><a href="http://www.defenselink.mil/">US Military</a></li>
|
||||
<li><a href="http://www.fedworld.gov/">US Fed</a></li>
|
||||
<li><a href="http://www.ih2000.net/ira/legal.htm">Legal</a></li>
|
||||
<li><a href="http://www.nih.gov/">NIH</a></li>
|
||||
<li><a href="http://www.refdesk.com/">RefDESK</a></li>
|
||||
<li><a href="http://www.britannica.com/">Britannica</a></li>
|
||||
<li><a href="http://www.capitolimpact.com/gw/">States</a></li>
|
||||
<li><a href="http://www.packtrack.com/">PackTrack</a></li>
|
||||
<li><a href="http://www.acronymfinder.com/">Acronym</a></li>
|
||||
<li><a href="http://www.visualthesaurus.com/">V-Thes</a></li>
|
||||
<li>
|
||||
<a href="http://www.timelineindex.com/content/home/forced">Timelines</a>
|
||||
</li>
|
||||
<li><a href="http://en.wikipedia.org/wiki/Main_Page">Wikipedia</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Earth and Beyond</div>
|
||||
<!-- Good Reading Misc. -->
|
||||
<ul>
|
||||
<li><a href="http://enbarsenal.com">ENB Arsenal</a></li>
|
||||
<li><a href="http://enb.wikia.com/">ENB Wikia</a></li>
|
||||
<li><a href="http://enb.gearlist.co.uk/">Gear List</a></li>
|
||||
<li><a href='http://forum.enb-emulator.com/'>Emu Forum</a></li>
|
||||
<li><a href="http://net-7.org/wiki/index.php?title=Main_Page">Net 7 Wiki</a></li>
|
||||
<li><a href="http://spaceengineers.wikia.com/wiki/Space_Engineers_Wiki">Space Engineers Wiki</a></li>
|
||||
<li><a href="http://forums.keenswh.com/">Space Engineers Forum</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id='weather' class="mui-panel"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
<script src="libs/ejs.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</html>
|
12
app/slack.new.html
Normal file
12
app/slack.new.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Untitled Document</title>
|
||||
<meta name="Author" content=""/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
2
app/template/password.ejs
Normal file
2
app/template/password.ejs
Normal file
@ -0,0 +1,2 @@
|
||||
<div>Long: <%=long%></div>
|
||||
<div>Short: <%=short%></div>
|
17
app/template/trains.ejs
Normal file
17
app/template/trains.ejs
Normal file
@ -0,0 +1,17 @@
|
||||
<div><%=locationName%> TO <%=filterLocationName%></div>
|
||||
<table class="mui-table mui-table-bordered">
|
||||
<tr><th>Destination</th>
|
||||
<th>Time</th>
|
||||
<th>Status</th>
|
||||
<th>Platform</th></tr>
|
||||
|
||||
<% trainServices.forEach(function (item) { %>
|
||||
<tr>
|
||||
<td><%=item.destination[0].locationName%></td>
|
||||
<td><%=item.sta%></td>
|
||||
<td><%=item.eta%></td>
|
||||
<td><%=item.platform%></td>
|
||||
</tr>
|
||||
<% }) %>
|
||||
|
||||
</table>
|
33
app/template/watchlist.ejs
Normal file
33
app/template/watchlist.ejs
Normal file
@ -0,0 +1,33 @@
|
||||
<%
|
||||
var d = new Date();
|
||||
%>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Item</th>
|
||||
<th>Cost</th>
|
||||
<th>BTC</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<% for( var i=0;i<items.length;i++)
|
||||
{
|
||||
|
||||
var coins = items[i].usd / usd;
|
||||
var v = coins * gbp;
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td><%=link_to(items[i].title, items[i].url)%></td>
|
||||
<td>$<%=items[i].usd.toFixed(2) %></td>
|
||||
<td><%=coins.toFixed(4) %></td>
|
||||
<td>£<%=v.toFixed(2) %></td>
|
||||
</tr>
|
||||
<%
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
%>
|
||||
|
||||
</table>
|
||||
Last Update <%=d.toLocaleString()%>
|
222
app/watch.html
Normal file
222
app/watch.html
Normal file
@ -0,0 +1,222 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<script src="watchlist.json.js"></script>
|
||||
<script src="libs/ejs.js"></script>
|
||||
<script src="libs/view.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
<style type="text/css" media="all">
|
||||
body {
|
||||
text-align: center;
|
||||
background: #C9C5C2;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: left;
|
||||
position: relative;
|
||||
width: 960px;
|
||||
background: #FFF;
|
||||
border: 2px solid #FFF;
|
||||
-moz-box-shadow: 3px 3px 3px #aaa;
|
||||
-webkit-box-shadow: 3px 3px 3px #aaa;
|
||||
box-shadow: 3px 3px 3px #aaa;
|
||||
margin: 18px auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body, ul, ol, dl, h1, h2, h3, h4, h5, h6, td, th, caption, pre, p, blockquote, input, textarea {
|
||||
font: .9em 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
text-decoration: underline;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
|
||||
color: #FFF;
|
||||
margin: 0;
|
||||
padding: 9px 0;
|
||||
}
|
||||
|
||||
h1 a, h1 a:visited {
|
||||
color: #EEE;
|
||||
}
|
||||
|
||||
h1 a:hover {
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 18px;
|
||||
background: teal;
|
||||
border-bottom: 3px solid #80007e;
|
||||
padding: 9px 0 9px 9px;
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 12px;
|
||||
background: #DDD;
|
||||
border-bottom: 1px solid #80007e;
|
||||
color: #333;
|
||||
margin-top: 0;
|
||||
padding: 9px 0 9px 9px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-spacing: 10px;
|
||||
}
|
||||
|
||||
th {
|
||||
width: 33%;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
line-height: 24px;
|
||||
border-bottom: 1px solid #80007e;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
td {
|
||||
vertical-align: top;
|
||||
background: #FFF;
|
||||
padding: 0 0 6px;
|
||||
}
|
||||
|
||||
td.footer {
|
||||
background: #8abbd7;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.red:hover {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.floatright {
|
||||
float: right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.floatleft {
|
||||
float: left;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
a:hover, .red {
|
||||
color: #C00;
|
||||
}
|
||||
|
||||
.dates {
|
||||
padding: 2px;
|
||||
border: solid 1px #80007e;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#btc {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.up {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.down {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.nochange {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="area">
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
|
||||
var elm = $('#area');
|
||||
var updateDisplay = function()
|
||||
{
|
||||
var html = new EJS({url: '/template/watchlist.ejs'}).render(list);
|
||||
elm.html(html);
|
||||
};
|
||||
|
||||
|
||||
var btcValue = function() {
|
||||
// console.log("getting btc");
|
||||
|
||||
var url = '/btc';
|
||||
|
||||
// let's show a map or do something interesting!
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
list.gbp = data.bpi.GBP.rate_float;
|
||||
list.usd = data.bpi.USD.rate_float;
|
||||
console.log(list);
|
||||
updateDisplay();
|
||||
//updateBTC(gbp,usd);
|
||||
//$('#weather').text(data.currently.summary + " " + ((5.0 / 9.0 * (data.currently.temperature - 32))));
|
||||
},
|
||||
error: function(xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
btcValue();
|
||||
|
||||
var _timer = setInterval(function(){btcValue()},(60000));
|
||||
|
||||
</script>
|
||||
</html>
|
36
app/watchlist.json.js
Normal file
36
app/watchlist.json.js
Normal file
@ -0,0 +1,36 @@
|
||||
var list={
|
||||
|
||||
items:[
|
||||
{
|
||||
title:'DMC-GM1',
|
||||
url:'http://coinsfortech.com/shop/panasonic-lumix-dmc-gm1-with-12-32mm-lens/',
|
||||
usd:508.00
|
||||
},
|
||||
{
|
||||
title:'Intel NUC D54250WYK',
|
||||
url:'http://coinsfortech.com/shop/intel-nuc-kit-d54250wyk-mini-desktop-pc/',
|
||||
usd:496.00
|
||||
},
|
||||
{
|
||||
title:'Moto 360 Smart Watch',
|
||||
url:'http://coinsfortech.com/shop/moto-360-smart-watch/',
|
||||
usd:355.00
|
||||
},
|
||||
{
|
||||
title:'Nikon D600 24-85mm lens kit',
|
||||
url:'http://coinsfortech.com/shop/nikon-d600-24-85mm-lens-ki/',
|
||||
usd:2048.00
|
||||
},
|
||||
{
|
||||
title:'Nikon D5300 18-55mm and 55-200mm Twin Lens Kit',
|
||||
url:'http://coinsfortech.com/shop/nikon-d5300-18-55mm-and-55-200mm-twin-lens-kit/',
|
||||
usd:882.00
|
||||
},
|
||||
{
|
||||
title:'Full NUC @ e4btc.com',
|
||||
url:'https://e4btc.com/cart',
|
||||
usd:668.542
|
||||
|
||||
}
|
||||
]
|
||||
};
|
22
data.json
Normal file
22
data.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"last": 0,
|
||||
"data": {
|
||||
"trains": {
|
||||
"last": "2016-02-19T23:45:42.573Z",
|
||||
"data": []
|
||||
},
|
||||
"weather": {
|
||||
"currently": "Partly Cloudy",
|
||||
"today": "Mixed precipitation throughout the week, with temperatures peaking at 9°C on Monday.",
|
||||
"alerts": {}
|
||||
},
|
||||
"history": [
|
||||
"19 February 1972 saw the death of John Grierson, the film director and producer.",
|
||||
"He was a pioneer of documentary film making, and founder of the British documentary film movement. In 1926, he is credited with being the first person to use the word \"documentary\", in an article he wrote about Robert Flaherty's film, Moana, adapting it from the French word, \"documentaire\", which was used to describe travelogues.",
|
||||
"In 1928, he founded the Empire Marketing Board, the first British film company devoted to documentaries. In 1933, he began working for the GPO's film unit, during which time he produced two of British cinema's most famous documentary films, Song of Ceylon and Night Mail.",
|
||||
"In 1939, he left Britain for Canada, setting up the National Film Board of Canada. Grierson later produced the Oscar winning film Seawards the Great Ships.",
|
||||
"Today in 1314, James Douglas retook Roxburgh Castle and razed it to the ground. The Black Douglas, as he was known, and sixty men gained access to the castle by climbing the castle walls using hooked scaling ladders."
|
||||
]
|
||||
},
|
||||
"expire": 3600000
|
||||
}
|
51
ecosystem.json
Normal file
51
ecosystem.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
/**
|
||||
* Application configuration section
|
||||
* http://pm2.keymetrics.io/docs/usage/application-declaration/
|
||||
*/
|
||||
apps: [
|
||||
// First application
|
||||
{
|
||||
"name": "Silvrtree",
|
||||
"script": "web-server.js",
|
||||
"cwd": "/var/www/silvrtree",
|
||||
"watch": true,
|
||||
"max_restarts": 10,
|
||||
"merge_logs" : true,
|
||||
"autorestart" : false,
|
||||
"restart_delay" : 3500,
|
||||
"max_memory_restart" : "300M",
|
||||
env: {
|
||||
COMMON_VARIABLE: "true"
|
||||
},
|
||||
env_production: {
|
||||
NODE_ENV: "production"
|
||||
}
|
||||
}
|
||||
],
|
||||
/**
|
||||
* Deployment section
|
||||
* http://pm2.keymetrics.io/docs/usage/deployment/
|
||||
*/
|
||||
deploy: {
|
||||
production: {
|
||||
user: "node",
|
||||
host: "212.83.163.1",
|
||||
ref: "origin/master",
|
||||
repo: "git@github.com:repo.git",
|
||||
path: "/var/www/production",
|
||||
"post-deploy": "npm install ; pm2 startOrRestart ecosystem.json --env production"
|
||||
},
|
||||
dev: {
|
||||
user: "node",
|
||||
host: "212.83.163.1",
|
||||
ref: "origin/master",
|
||||
repo: "git@github.com:repo.git",
|
||||
path: "/var/www/development",
|
||||
"post-deploy": "npm install ; pm2 startOrRestart ecosystem.json --env dev",
|
||||
env: {
|
||||
NODE_ENV: "dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
lib/btc.js
Normal file
46
lib/btc.js
Normal file
@ -0,0 +1,46 @@
|
||||
var http = require('http');
|
||||
var btcCache = {};
|
||||
exports.doBTC = function (req,res) {
|
||||
console.log('Bitcoin request');
|
||||
function btcQuery(callback, r) {
|
||||
var req = r;
|
||||
var options = {
|
||||
host: 'api.coindesk.com',
|
||||
// port: 80,
|
||||
path: '/v1/bpi/currentprice.json',
|
||||
// method: 'GET',
|
||||
headers: {
|
||||
/* 'Content-Type': 'application/json',
|
||||
'Content-Length': Buffer.byteLength(data)*/
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
http.request(options).on('response', function (response) {
|
||||
var data = '';
|
||||
response.on("data", function (chunk) {
|
||||
data += chunk;
|
||||
});
|
||||
response.on('end', function () {
|
||||
callback(JSON.parse(data), r);
|
||||
});
|
||||
}).end();
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
if (now - GLOBAL.lastcheck > (59000 )) {
|
||||
btcQuery(function (a, b) {
|
||||
// console.log(a);
|
||||
console.log('Got btc data.')
|
||||
btcCache = a;
|
||||
GLOBAL.lastcheck = now;
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(btcCache));
|
||||
}, res)
|
||||
}
|
||||
else {
|
||||
console.log("Using cache");
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(btcCache));
|
||||
}
|
||||
};
|
2
lib/btc.min.js
vendored
Normal file
2
lib/btc.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var http=require("http"),btcCache={};exports.doBTC=function(e,o){function n(e,o){var n={host:"api.coindesk.com",path:"/v1/bpi/currentprice.json",headers:{}};http.request(n).on("response",function(n){var r="";n.on("data",function(e){r+=e}),n.on("end",function(){e(JSON.parse(r),o)})}).end()}console.log("Bitcoin request");var r=new Date;r-GLOBAL.lastcheck>59e3?n(function(e){console.log(e),btcCache=e,GLOBAL.lastcheck=r,o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(btcCache))},o):(console.log("Using cache"),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(btcCache)))};
|
||||
//# sourceMappingURL=btc.min.js.map
|
1
lib/btc.min.js.map
Normal file
1
lib/btc.min.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["btc.js"],"names":["http","require","btcCache","exports","doBTC","req","res","btcQuery","callback","r","options","host","path","headers","request","on","response","data","chunk","JSON","parse","end","console","log","now","Date","GLOBAL","lastcheck","a","setHeader","stringify"],"mappings":"AAAC,GAAIA,MAAOC,QAAQ,QAChBC,WACJC,SAAQC,MAAQ,SAAUC,EAAIC,GAEtB,QAASC,GAASC,EAAUC,GACxB,GACIC,IACAC,KAAM,mBAENC,KAAM,4BAENC,WAOJb,MAAKc,QAAQJ,GAASK,GAAG,WAAY,SAAUC,GAC3C,GAAIC,GAAO,EACXD,GAASD,GAAG,OAAQ,SAAUG,GAC1BD,GAAQC,IAEZF,EAASD,GAAG,MAAO,WACfP,EAASW,KAAKC,MAAMH,GAAOR,OAEhCY,MAvBPC,QAAQC,IAAI,kBA0BZ,IAAIC,GAAM,GAAIC,KACVD,GAAME,OAAOC,UAAY,KACzBpB,EAAS,SAAUqB,GACfN,QAAQC,IAAIK,GACZ1B,SAAW0B,EACXF,OAAOC,UAAYH,EACnBlB,EAAIuB,UAAU,eAAgB,oBAC9BvB,EAAIe,IAAIF,KAAKW,UAAU5B,YACxBI,IAGHgB,QAAQC,IAAI,eACZjB,EAAIuB,UAAU,eAAgB,oBAC9BvB,EAAIe,IAAIF,KAAKW,UAAU5B"}
|
184
lib/calHandler.js
Normal file
184
lib/calHandler.js
Normal file
@ -0,0 +1,184 @@
|
||||
var request = require('request');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
var STRING = require('string');
|
||||
var util = require('util');
|
||||
var Elapsed = require('elapsed');
|
||||
require('sugar-date');
|
||||
|
||||
function processICAL(ical) {
|
||||
"use strict";
|
||||
logger.info('+ processICAL');
|
||||
var workingBlock = [];
|
||||
var segments = {
|
||||
meetingStartID: "DTSTART;TZID=Europe/London:",
|
||||
meetingStartAlt: 'DTSTART:',
|
||||
meetingEndID: "DTEND;TZID=Europe/London:",
|
||||
meetingEndAlt: 'DTEND:',
|
||||
meetingDescID: "DESCRIPTION:",
|
||||
summaryID: 'SUMMARY:',
|
||||
begin: 'BEGIN:VEVENT',
|
||||
end: 'END:VEVENT',
|
||||
beginAlarm: 'BEGIN:VALARM',
|
||||
recur : 'RRULE'
|
||||
};
|
||||
|
||||
function processBlock(block) {
|
||||
var workBlock = {summary: '', dtstart: null, dtend: null, description: '', timeStart : null, timeEnd : null, duration:0, combined:''};
|
||||
var alarmFlag = false, ws, blockStep;
|
||||
for (var step = 0; step < block.length; step++) {
|
||||
blockStep = block[step];
|
||||
if (blockStep.indexOf(segments.summaryID) >= 0) {
|
||||
workBlock.summary = STRING(block[step].split(segments.summaryID)[1]).collapseWhitespace().s;
|
||||
}
|
||||
if (blockStep.indexOf(segments.meetingStartID) >= 0) {
|
||||
ws = STRING(block[step].split(segments.meetingStartID)[1]).collapseWhitespace().s;
|
||||
workBlock.dtstart = Date.create(ws);
|
||||
}
|
||||
if (blockStep.indexOf(segments.meetingEndID) >= 0) {
|
||||
ws = STRING(block[step].split(segments.meetingEndID)[1]).collapseWhitespace().s;
|
||||
workBlock.dtend = Date.create(ws);
|
||||
}
|
||||
if (blockStep.indexOf(segments.meetingStartAlt) >= 0) {
|
||||
ws = STRING(block[step].split(segments.meetingStartAlt)[1]).collapseWhitespace().s;
|
||||
workBlock.dtstart = Date.create(ws);
|
||||
}
|
||||
if (blockStep.indexOf(segments.meetingEndAlt) >= 0) {
|
||||
ws = STRING(block[step].split(segments.meetingEndAlt)[1]).collapseWhitespace().s;
|
||||
workBlock.dtend = Date.create(ws);
|
||||
}
|
||||
if (blockStep.indexOf(segments.meetingDescID) >= 0) {
|
||||
if (!alarmFlag) {
|
||||
workBlock.description = STRING(block[step].split(segments.meetingDescID)[1]).collapseWhitespace().s;
|
||||
}
|
||||
}
|
||||
if (blockStep.indexOf(segments.beginAlarm) >= 0) {
|
||||
alarmFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (workBlock.dtstart !== null ){
|
||||
workBlock.timeStart = workBlock.dtstart.format('{12hr}:{mm}:{ss} {tt}');
|
||||
workBlock.combined = '<em>' + workBlock.timeStart + '</em> - ';
|
||||
}
|
||||
workBlock.combined = workBlock.combined + workBlock.summary;
|
||||
if (workBlock.dtend !== null ){
|
||||
workBlock.timeEnd = workBlock.dtend.format('{12hr}:{mm}:{ss} {tt}');
|
||||
}
|
||||
if (workBlock.dtstart !== null && workBlock.dtend !== null) {
|
||||
var elapsedTime = new Elapsed(workBlock.dtstart, workBlock.dtend);
|
||||
workBlock.duration = elapsedTime.optimal;
|
||||
workBlock.combined = workBlock.combined + ', ' + elapsedTime.optimal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return workBlock;
|
||||
}
|
||||
|
||||
var lines = ical.split('\r\n'), l = lines.length, counter = 0;
|
||||
|
||||
while (counter < l) {
|
||||
if (lines[counter].indexOf(segments.begin) < 0) {
|
||||
counter++;
|
||||
} else {
|
||||
var subcounter = 0, subBlock = [];
|
||||
while (subcounter < 75) {
|
||||
if (lines[counter + subcounter].indexOf(segments.end) < 0) {
|
||||
subBlock.push(lines[counter + subcounter]);
|
||||
subcounter++;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
counter = counter + subcounter;
|
||||
var b = processBlock(subBlock);
|
||||
if (b.dtstart !== null) {
|
||||
workingBlock.push(b);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
logger.info('- processICAL');
|
||||
// if (workingBlock.dtstart == null) return {};
|
||||
|
||||
return workingBlock;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
jsonBlock: [],
|
||||
getTodaysSimple: function () {
|
||||
"use strict";
|
||||
logger.info('+ getTodaysSimple');
|
||||
var today = {
|
||||
entries: []
|
||||
};
|
||||
|
||||
for (var t = 0; t < this.jsonBlock.length; t++) {
|
||||
if (this.jsonBlock[t].dtstart.isToday()) {
|
||||
|
||||
today.entries.push(this.jsonBlock[t]);
|
||||
}
|
||||
}
|
||||
// logger.debug(today);
|
||||
logger.info('- getTodaysSimple');
|
||||
return today;
|
||||
},
|
||||
getTodaysMeetings: function () {
|
||||
"use strict";
|
||||
logger.info('+ getTodaysMeetings');
|
||||
var today = {
|
||||
previous: [], upcoming: [], current: {}
|
||||
};
|
||||
var now = new Date();
|
||||
|
||||
for (var t = 0; t < this.jsonBlock.length; t++) {
|
||||
if (this.jsonBlock[t].dtstart.isToday()) {
|
||||
|
||||
if (this.jsonBlock[t].dtstart.isAfter(now)) {
|
||||
today.upcoming.push(this.jsonBlock[t]);
|
||||
}
|
||||
else {
|
||||
today.previous.push(this.jsonBlock[t]);
|
||||
}
|
||||
|
||||
if (now.isBetween(this.jsonBlock[t].dtstart, this.jsonBlock[t].dtend)) {
|
||||
today.current = this.jsonBlock[t];
|
||||
}
|
||||
}
|
||||
}
|
||||
// logger.debug(today);
|
||||
logger.info('- getTodaysMeetings');
|
||||
return today;
|
||||
}, getSimpleCalV2: function (url, cb) {
|
||||
"use strict";
|
||||
var self = this;
|
||||
|
||||
// var calJson = [];
|
||||
|
||||
request(url, function (err, res, body) {
|
||||
if (err) {
|
||||
logger.error('Get remote Calendar Request failed');
|
||||
// callback.call(null, new Error('Request failed'));
|
||||
return;
|
||||
}
|
||||
|
||||
self.jsonBlock = processICAL(body);
|
||||
|
||||
// logger.debug(self.jsonBlock);
|
||||
var st = self.getTodaysSimple();
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
cb(st);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Created by Martin on 16/02/2016.
|
||||
*/
|
||||
};
|
28
lib/caltest.js
Normal file
28
lib/caltest.js
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Created by Martin on 15/02/2016.
|
||||
*/
|
||||
var http = require('http'), request = require('request'), calHandler = require('./calHandler'), util = require('util');
|
||||
var jsonfile = require('jsonfile');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
|
||||
require('sugar-date');
|
||||
|
||||
var file = __dirname + '/' + 'cal.json';
|
||||
|
||||
function saveData(v) {
|
||||
jsonfile.writeFileSync(file, v);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getCal: function () {
|
||||
|
||||
|
||||
calHandler.getSimpleCalV2('https://www.tripit.com/feed/ical/private/DB96E4BB-94A9BD8F9CC1CF51C6CC0D920840F4F5/tripit.ics', function(v) {
|
||||
logger.debug(v) ;
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.getCal();
|
49
lib/clean.js
Normal file
49
lib/clean.js
Normal file
@ -0,0 +1,49 @@
|
||||
var http = require('http'), sys = require('sys');
|
||||
|
||||
module.exports = {
|
||||
|
||||
cleanit: function (req, res) {
|
||||
var r = {
|
||||
// from http://tim.mackey.ie/CleanWordHTMLUsingRegularExpressions.aspx
|
||||
msoTags: /<[\/]?(font|span|xml|del|ins|[ovwxp]:\w+)[^>]*?>/g,
|
||||
msoAttributes: /<([^>]*)(?:class|lang|style|size|face|[ovwxp]:\w+)=(?:'[^']*'|""[^""]*""|[^\s>]+)([^>]*)>/,
|
||||
msoParagraphs: /<([^>]*)(?:|[p]:\w+)=(?:'[^']*'|""[^""]*""|[^\s>]+)([^>]*)>/g,
|
||||
crlf: /(\\r\\n)/g
|
||||
};
|
||||
|
||||
var front = '<?xml version="1.0" encoding="utf-8"?>\r\n <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r\n <html xmlns="http://www.w3.org/1999/xhtml">\r\n <head>\r\n <title>Spellbinder - Chapter </title>\r\n <link rel="stylesheet" type="text/css" href="imperaWeb.css"/>\r\n <link rel="stylesheet" type= "application/vnd.adobe-page-template+xml" href= "page-template.xpgt"/>\r\n </head>\r\n <body>\r\n <div id="text">\r\n <div class="section" id="xhtmldocuments">\r\n';
|
||||
var back = ' </div> </div> </body> </html> ';
|
||||
var source = req.body.source;
|
||||
// console.log(source);
|
||||
|
||||
var output = source.replace(r.msoTags, "");
|
||||
output = output.replace(r.msoParagraphs, '<p>');
|
||||
output = output.replace(/(\r\n)/g, " ");
|
||||
output = output.replace(/(\\r\\n)/g, " ");
|
||||
|
||||
output = output.replace(/<i><\/i>/g, "");
|
||||
output = output.replace(/[“|”]/g, '"');
|
||||
output = output.replace(/’/g, "'");
|
||||
output = output.replace(/…/g, "…");
|
||||
output = output.replace(/<i>(.*?)<\/i>/g, "<em>$1</em>");
|
||||
output = output.replace(/<b>(.*?)<\/b>/g, "<strong>$1</strong>");
|
||||
output = output.replace(/<p>\*\*\*<\/p>/g, "<p class='break'>* * *</p>");
|
||||
|
||||
output = output.replace(/<p>CHAPTER\s(\d.?)<\/p>/, "<h1>$1</h1>");
|
||||
output = output.replace(/<p>( |\s|<em>\s<\/em>)<\/p>/g, "");
|
||||
output = output.replace(/ /g, " ");
|
||||
|
||||
output = output.replace(/<p><em>\s<\/em><\/p>/g, "");
|
||||
output = output.replace(/<p>\s<\/p>/g, "");
|
||||
|
||||
output = output.replace(/\s+/g, " ");
|
||||
output = output.replace(/<\/p>/g, "</p>\r\n");
|
||||
|
||||
|
||||
|
||||
// sys.puts(sys.inspect(output, false, null));
|
||||
|
||||
res.setHeader('Content-Type', 'application/html');
|
||||
res.end(front + output + back);
|
||||
}
|
||||
};
|
135
lib/events.js
Normal file
135
lib/events.js
Normal file
@ -0,0 +1,135 @@
|
||||
var http = require('http'), request = require('request'), cheerio = require('cheerio');
|
||||
|
||||
var eventTimer = 0;
|
||||
var eventCache = {
|
||||
last: 0,
|
||||
data: {},
|
||||
expire: ((60 * 1000) * 60) * 12,
|
||||
cinema: {}
|
||||
};
|
||||
// 'cwr':{data: {}, last:0};
|
||||
|
||||
var cinemas = [{id: 'cwr', url: 'https://film.list.co.uk/cinema/14982-cineworld-renfrew-street/'},
|
||||
{id: 'gsc', url: 'https://film.list.co.uk/cinema/13590-cineworld-glasgow-science-centre/'},
|
||||
{id: 'pho', url: 'https://film.list.co.uk/cinema/12500-showcase-cinema-paisley/'}];
|
||||
|
||||
module.exports = {
|
||||
getEvents: function (req, res) {
|
||||
|
||||
console.log('Getting events...');
|
||||
var j = [], url = 'https://www.list.co.uk/events/days-out/when:this%20weekend/location:Dumbarton(55.9460,-4.5556)/distance:20/';
|
||||
|
||||
var now = new Date();
|
||||
|
||||
if ((now - eventCache.last) > eventCache.expire) {
|
||||
request(url, function (err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
$ = cheerio.load(body);
|
||||
// console.log($);
|
||||
// TODO: scraping goes here!
|
||||
|
||||
$('.resultsRow').each(function (div) {
|
||||
var item = {};
|
||||
var eventSummary = $(this).find('.eventSummary').first();
|
||||
var byDate = $(this).find('.byDate').first();
|
||||
|
||||
var title = eventSummary.find('.head').first();
|
||||
var description = eventSummary.find('P').first();
|
||||
var link = ' https://www.list.co.uk' + eventSummary.find('A').first().attr('href');
|
||||
|
||||
var price = byDate.find('.price').first();
|
||||
var dt = byDate.find('.dtstart').first().attr('title');
|
||||
|
||||
item.title = title.text();
|
||||
item.description = description.text();
|
||||
item.link = link;
|
||||
item.price = price.text();
|
||||
item.date = dt;
|
||||
|
||||
j.push(item);
|
||||
});
|
||||
|
||||
eventCache.last = now;
|
||||
eventCache.data = j;
|
||||
|
||||
res.render('pages/events', eventCache);
|
||||
|
||||
});
|
||||
} else {
|
||||
console.log('Using event cache...');
|
||||
|
||||
res.render('pages/events', eventCache);
|
||||
}
|
||||
|
||||
},
|
||||
doGetCinema: function (id) {
|
||||
var cinemaID = cinemas[id].id;
|
||||
var url = cinemas[id].url;
|
||||
var thisCinema = eventCache[cinemaID] || {data: {}, last: 0};
|
||||
console.log(cinemaID);
|
||||
console.log(url);
|
||||
var j = [];
|
||||
|
||||
var now = new Date();
|
||||
|
||||
if ((now - thisCinema.last) > eventCache.expire) {
|
||||
request(url, function (err, resp, body) {
|
||||
console.log('Working');
|
||||
if (err)
|
||||
throw err;
|
||||
$ = cheerio.load(body);
|
||||
|
||||
$('.byEvent').each(function (div) {
|
||||
var item = {};
|
||||
var title = $(this).find('H4').first();
|
||||
var eventSummary = $(this).find('.eventSummary').first();
|
||||
|
||||
var description = eventSummary.find('P').first();
|
||||
var link = ' https://www.list.co.uk' + eventSummary.find('A').first().attr('href');
|
||||
|
||||
item.title = title.text();
|
||||
item.description = description.text();
|
||||
item.link = link;
|
||||
|
||||
j.push(item);
|
||||
});
|
||||
|
||||
thisCinema.last = now;
|
||||
thisCinema.data = j;
|
||||
|
||||
eventCache[cinemaID] = thisCinema;
|
||||
console.log('returning');
|
||||
|
||||
return thisCinema;
|
||||
|
||||
});
|
||||
} else {
|
||||
console.log('Using event cache...');
|
||||
return thisCinema;
|
||||
}
|
||||
},
|
||||
getCinema: function (req, res) {
|
||||
var id = parseInt(req.params.id);
|
||||
console.log('Getting cinema: ' +id);
|
||||
|
||||
var output = module.exports.doGetCinema(id);
|
||||
res.render('pages/cinema', output);
|
||||
},
|
||||
preLoad: function () {
|
||||
var output = module.exports.doGetCinema(0);
|
||||
output = module.exports.doGetCinema(1);
|
||||
output = module.exports.doGetCinema(2);
|
||||
|
||||
setTimeout(function () {
|
||||
module.exports.preLoad();
|
||||
}, eventCache.expire);
|
||||
}
|
||||
};
|
||||
|
||||
setTimeout(function () {
|
||||
console.log('Pre loading cinemas...');
|
||||
module.exports.preLoad();
|
||||
}, 10000);
|
||||
|
||||
|
46
lib/fx.js
Normal file
46
lib/fx.js
Normal file
@ -0,0 +1,46 @@
|
||||
var http = require('http');
|
||||
var fxCache = {};
|
||||
exports.doFx = function (req,res) {
|
||||
console.log('FX request');
|
||||
function fxQuery(callback, r) {
|
||||
var req = r;
|
||||
var options = {
|
||||
host: 'openexchangerates.org',
|
||||
// port: 80,
|
||||
path: '/api/latest.json?app_id=0eb932cee3bc40259f824d4b4c96c7d2',
|
||||
// method: 'GET',
|
||||
headers: {
|
||||
/* 'Content-Type': 'application/json',
|
||||
'Content-Length': Buffer.byteLength(data)*/
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
http.request(options).on('response', function (response) {
|
||||
var data = '';
|
||||
response.on("data", function (chunk) {
|
||||
data += chunk;
|
||||
});
|
||||
response.on('end', function () {
|
||||
callback(JSON.parse(data), r);
|
||||
});
|
||||
}).end();
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
if (now - GLOBAL.lastcheck > (60000 * 14)) {
|
||||
fxQuery(function (a, b) {
|
||||
console.log(a);
|
||||
fxCache = a;
|
||||
GLOBAL.lastcheck = now;
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(fxCache));
|
||||
}, res);
|
||||
}
|
||||
else {
|
||||
console.log("Using cache");
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(fxCache));
|
||||
}
|
||||
|
||||
};
|
2
lib/fx.min.js
vendored
Normal file
2
lib/fx.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var http=require("http"),fxCache={};exports.doFx=function(e,o){function n(e,o){var n={host:"openexchangerates.org",path:"/api/latest.json?app_id=0eb932cee3bc40259f824d4b4c96c7d2",headers:{}};http.request(n).on("response",function(n){var r="";n.on("data",function(e){r+=e}),n.on("end",function(){e(JSON.parse(r),o)})}).end()}console.log("FX request");var r=new Date;r-GLOBAL.lastcheck>84e4?n(function(e){console.log(e),fxCache=e,GLOBAL.lastcheck=r,o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(fxCache))},o):(console.log("Using cache"),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(fxCache)))};
|
||||
//# sourceMappingURL=fx.min.js.map
|
1
lib/fx.min.js.map
Normal file
1
lib/fx.min.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["fx.js"],"names":["http","require","fxCache","exports","doFx","req","res","fxQuery","callback","r","options","host","path","headers","request","on","response","data","chunk","JSON","parse","end","console","log","now","Date","GLOBAL","lastcheck","a","setHeader","stringify"],"mappings":"AAAC,GAAIA,MAAOC,QAAQ,QAChBC,UACJC,SAAQC,KAAO,SAAUC,EAAIC,GAErB,QAASC,GAAQC,EAAUC,GACvB,GACIC,IACAC,KAAM,wBAENC,KAAM,2DAENC,WAOJb,MAAKc,QAAQJ,GAASK,GAAG,WAAY,SAAUC,GAC3C,GAAIC,GAAO,EACXD,GAASD,GAAG,OAAQ,SAAUG,GAC1BD,GAAQC,IAEZF,EAASD,GAAG,MAAO,WACfP,EAASW,KAAKC,MAAMH,GAAOR,OAEhCY,MAvBPC,QAAQC,IAAI,aA0BZ,IAAIC,GAAM,GAAIC,KACVD,GAAME,OAAOC,UAAY,KACzBpB,EAAQ,SAAUqB,GACdN,QAAQC,IAAIK,GACZ1B,QAAU0B,EACVF,OAAOC,UAAYH,EACnBlB,EAAIuB,UAAU,eAAgB,oBAC9BvB,EAAIe,IAAIF,KAAKW,UAAU5B,WACxBI,IAGHgB,QAAQC,IAAI,eACZjB,EAAIuB,UAAU,eAAgB,oBAC9BvB,EAAIe,IAAIF,KAAKW,UAAU5B"}
|
9
lib/jade/test.jade
Normal file
9
lib/jade/test.jade
Normal file
@ -0,0 +1,9 @@
|
||||
//
|
||||
Created by marti on 14/02/2016.
|
||||
doctype html
|
||||
html(lang="en")
|
||||
head
|
||||
title
|
||||
Test
|
||||
body
|
||||
h1 Test
|
59
lib/jade/today.jade
Normal file
59
lib/jade/today.jade
Normal file
@ -0,0 +1,59 @@
|
||||
html(lang="en")
|
||||
head
|
||||
meta(charset='utf-8')
|
||||
title
|
||||
Today
|
||||
body
|
||||
h1 Today
|
||||
.stuff
|
||||
| !{data.today}
|
||||
.weather
|
||||
h2 Weather
|
||||
p Currently:
|
||||
= ' ' + data.weather.currently
|
||||
p Today:
|
||||
= ' ' + data.weather.today
|
||||
p Later:
|
||||
= ' ' + data.weather.later
|
||||
|
||||
if data.weather.alerts.length > 0
|
||||
h3 ALERT
|
||||
each alert in data.weather.alerts
|
||||
p(style="color:red;")= alert.title
|
||||
p= alert.description
|
||||
|
||||
.travel
|
||||
h2 Travel
|
||||
if data.trains.data.length > 0
|
||||
each alert in data.trains.data
|
||||
strong= alert.title
|
||||
p= alert.description
|
||||
else
|
||||
p Nothing to report.
|
||||
.calendar
|
||||
if data.cal.entries.length > 0
|
||||
h2 Calendar
|
||||
each line in data.cal.entries
|
||||
p !{line.combined}
|
||||
.swedish
|
||||
h2 Word of the day
|
||||
p(style="font-weight:900;")= data.swedish.xml.words.word
|
||||
p It is an #{data.swedish.xml.words.wordtype} which means '<em>#{data.swedish.xml.words.translation}</em>'.
|
||||
p Example: #{data.swedish.xml.words.fnphrase}
|
||||
p Translated: #{data.swedish.xml.words.enphrase}
|
||||
.history
|
||||
h2 Today in history
|
||||
if data.history.length > 0
|
||||
each line in data.history
|
||||
p= line
|
||||
else
|
||||
p Nothing of note happened today.
|
||||
|
||||
.tv
|
||||
if data.tv.entries.length > 0
|
||||
h2 Todays TV
|
||||
each line in data.tv.entries
|
||||
p !{line.combined}
|
||||
|
||||
|
||||
|
55
lib/microevent.js
Normal file
55
lib/microevent.js
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* MicroEvent - to make any js object an event emitter (server or browser)
|
||||
*
|
||||
* - pure javascript - server compatible, browser compatible
|
||||
* - dont rely on the browser doms
|
||||
* - super simple - you get it immediatly, no mistery, no magic involved
|
||||
*
|
||||
* - create a MicroEventDebug with goodies to debug
|
||||
* - make it safer to use
|
||||
*/
|
||||
|
||||
var MicroEvent = function(){};
|
||||
MicroEvent.prototype = {
|
||||
bind : function(event, fct){
|
||||
this._events = this._events || {};
|
||||
this._events[event] = this._events[event] || [];
|
||||
this._events[event].push(fct);
|
||||
},
|
||||
unbind : function(event, fct){
|
||||
this._events = this._events || {};
|
||||
if( event in this._events === false ) return;
|
||||
this._events[event].splice(this._events[event].indexOf(fct), 1);
|
||||
},
|
||||
trigger : function(event /* , args... */){
|
||||
this._events = this._events || {};
|
||||
if( event in this._events === false ) return;
|
||||
for(var i = 0; i < this._events[event].length; i++){
|
||||
this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* mixin will delegate all MicroEvent.js function in the destination object
|
||||
*
|
||||
* - require('MicroEvent').mixin(Foobar) will make Foobar able to use MicroEvent
|
||||
*
|
||||
* @param {Object} the object which will support MicroEvent
|
||||
*/
|
||||
MicroEvent.mixin = function(destObject){
|
||||
var props = ['bind', 'unbind', 'trigger'];
|
||||
for(var i = 0; i < props.length; i ++){
|
||||
if( typeof destObject === 'function' ){
|
||||
destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
|
||||
}else{
|
||||
destObject[props[i]] = MicroEvent.prototype[props[i]];
|
||||
}
|
||||
}
|
||||
return destObject;
|
||||
}
|
||||
|
||||
// export in common js
|
||||
if( typeof module !== "undefined" && ('exports' in module)){
|
||||
module.exports = MicroEvent;
|
||||
}
|
1
lib/newdata.json
Normal file
1
lib/newdata.json
Normal file
@ -0,0 +1 @@
|
||||
{"last":0,"data":{"trains":{"last":"2016-02-20T00:28:44.255Z","data":[]},"weather":{"currently":"Light Rain. Around 4 to 6 degrees.","today":"Light rain until evening, starting again overnight.","later":"Mixed precipitation throughout the week, with temperatures peaking at 9°C on Monday.","alerts":{}},"history":["King James I was murdered in Perth, by a group led by Sir Robert Graham, today in 1437.","Had it not been for his love of tennis James would have escaped his assassins. Fleeing his killers, he hid in the drain under his tennis court, however this offered no means of escape for the monarch, as he had only recently ordered it to be blocked after losing balls in it.","On 20 February 1472 Orkney and Shetland became part of Scotland. The islands were provided as security for the dowry of Princess Margaret, the prospective wife of James III of Scotland and daughter of King Christian of Norway and Denmark.","Alan Turing Suggests Testing Artificial Intelligence with the Game of Chess","Computer pioneer Alan Turing suggests testing artificial intelligence with the game of chess in a lecture to the London Mathematical Society. Computers, he argued, must like humans be given training before their IQ is tested. A human mathematician has always undergone an extensive training. This training may be regarded as not unlike putting instruction tables into a machine, he said. One must therefore not expect a machine to do a very great deal of building up of instruction tables on its own."],"today":"<strong>February 20</strong> - The 51th day of 2016, and there are 316 days left until the end of the year.","tv":{"entries":[]},"cal":{"entries":[]},"swedish":{"xml":{"$":{"xmlns:wotd":"http://www.transparent.com/word-of-the-day/"},"words":{"date":"02-20-2016","langname":"Swedish","wordtype":"verb","word":"att vänta på","wordsound":"http://wotd.transparent.com/swedish/level-1/sound/00464_WOTD_Swedish_Words.flv","translation":"to wait for","fnphrase":"Vi väntar på bussen.","phrasesound":"http://wotd.transparent.com/swedish/level-1/sound/00464_WOTD_Swedish_Sentences.flv","enphrase":"We are waiting for the bus.","wotd:transliteratedWord":"","wotd:transliteratedSentence":"","notes":""}}}},"expire":3600000}
|
68
lib/password.js
Normal file
68
lib/password.js
Normal file
@ -0,0 +1,68 @@
|
||||
var http = require('http');
|
||||
|
||||
Array.prototype.random = function () {
|
||||
return this[Math.floor((Math.random() * this.length))];
|
||||
};
|
||||
|
||||
var alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
var whitespace = ['.', '~', '#', '!', '$', '+', '-', '+'];
|
||||
var numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
var left = ["Alabama",
|
||||
"Alaska",
|
||||
"Arizona",
|
||||
"Maryland",
|
||||
"Nevada",
|
||||
"Mexico",
|
||||
"Texas",
|
||||
"Utah",
|
||||
"Glasgow",
|
||||
"Inverness",
|
||||
"Edinburgh",
|
||||
"Dumbarton",
|
||||
"Balloch",
|
||||
"Renton",
|
||||
"Cardross",
|
||||
"Dundee",
|
||||
"Paisley",
|
||||
"Hamilton",
|
||||
"Greenock",
|
||||
"Falkirk",
|
||||
"Irvine",
|
||||
"Renfrew",
|
||||
"Erskine",
|
||||
"London",
|
||||
"Hammersmith",
|
||||
"Islington",
|
||||
"Silver", "Black", "Yellow", "Purple", 'White', 'Pink', 'Red', 'Orange','Brown','Green','Blue','Amber','Aqua','Azure','Bronze','Coral','Copper','Crimson','Cyan','Ginger','Gold','Indigo','Jade'
|
||||
|
||||
];
|
||||
|
||||
var right = ['Aganju', 'Cygni', 'Akeron', 'Antares', 'Aragoth', 'Ardus', 'Carpenter', 'Cooper', 'Dahin', 'Capella', 'Endriago', 'Gallina', 'Fenris', 'Freya', 'Glenn', 'Grissom', 'Jotunheim', 'Kailaasa', 'Lagarto', 'Muspelheim', 'Nifleheim', 'Primus', 'Vega', 'Ragnarok', 'Shepard', 'Slayton', 'Tarsis', 'Mercury', 'Venus', 'Mars', 'Earth', 'Terra', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Europa', 'Ganymede', 'Callisto', 'Titan', 'Juno', 'Eridanus', 'Scorpius', 'Crux', 'Cancer', 'Taurus', 'Lyra', 'Andromeda', 'Virgo', 'Aquarius', 'Cygnus', 'Corvus', 'Taurus', 'Draco', 'Perseus', 'Pegasus', 'Gemini', 'Columbia', 'Bootes', 'Orion', 'Deneb', 'Merope'];
|
||||
|
||||
var numberCluster = function () {
|
||||
return numbers.random() + numbers.random() + numbers.random();
|
||||
};
|
||||
|
||||
var randomAmount = function (i) {
|
||||
var str = '';
|
||||
|
||||
for (var t = 0; t < i; t++) {
|
||||
str = str + alpha.random();
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
generate: function (req, res) {
|
||||
var reply = {
|
||||
long: (left.random() + ' ' + right.random() + ' ' + numberCluster() + ' ' + numberCluster()).split(' ').join(whitespace.random()),
|
||||
short: randomAmount(10)
|
||||
};
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(reply));
|
||||
}
|
||||
|
||||
};
|
45
lib/swedishword.js
Normal file
45
lib/swedishword.js
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Created by Martin on 15/02/2016.
|
||||
*/
|
||||
var http = require('http'), request = require('request'), util = require('util');
|
||||
var jsonfile = require('jsonfile');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
var to_json = require('xmljson').to_json;
|
||||
|
||||
require('sugar-date');
|
||||
|
||||
|
||||
var file = __dirname + '/' + 'cal.json';
|
||||
|
||||
function saveData(v) {
|
||||
jsonfile.writeFileSync(file, v);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSwedishWord: function (cb) {
|
||||
|
||||
var t= new Date(), ms = t.getTime();
|
||||
|
||||
|
||||
url = ['http://wotd.transparent.com/rss/swedish-widget.xml?t=', ms].join('');
|
||||
logger.info(url);
|
||||
request(url, function (err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
|
||||
logger.debug(body);
|
||||
|
||||
to_json(body, function (error, data) {
|
||||
console.log(data);
|
||||
if(typeof cb === 'function') {
|
||||
cb(data);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//module.exports.getSwedishWord();
|
1
lib/today.html
Normal file
1
lib/today.html
Normal file
@ -0,0 +1 @@
|
||||
<html lang="en"><head><meta charset="utf-8"/><title><Today></Today></title></head><body><h1>Today</h1><div class="stuff"> <strong>February 20</strong> - The 51th day of 2016, and there are 316 days left until the end of the year.</div><div class="weather"><h2>Weather</h2><p>Currently: Light Rain. Around 4 to 6 degrees.</p><p>Today: Light rain until evening, starting again overnight.</p><p>Later: Mixed precipitation throughout the week, with temperatures peaking at 9°C on Monday.</p></div><div class="travel"><h2>Travel</h2><p>Nothing to report.</p></div><div class="calendar"></div><div class="swedish"><h2>Word of the day</h2><p style="font-weight:900;">att vänta på</p><p>It is an verb which means '<em>to wait for</em>'.</p><p>Example: Vi väntar på bussen.</p><p>Translated: We are waiting for the bus.</p></div><div class="history"><h2>Today in history</h2><p>King James I was murdered in Perth, by a group led by Sir Robert Graham, today in 1437.</p><p>Had it not been for his love of tennis James would have escaped his assassins. Fleeing his killers, he hid in the drain under his tennis court, however this offered no means of escape for the monarch, as he had only recently ordered it to be blocked after losing balls in it.</p><p>On 20 February 1472 Orkney and Shetland became part of Scotland. The islands were provided as security for the dowry of Princess Margaret, the prospective wife of James III of Scotland and daughter of King Christian of Norway and Denmark.</p><p>Alan Turing Suggests Testing Artificial Intelligence with the Game of Chess</p><p>Computer pioneer Alan Turing suggests testing artificial intelligence with the game of chess in a lecture to the London Mathematical Society. Computers, he argued, must like humans be given training before their IQ is tested. A human mathematician has always undergone an extensive training. This training may be regarded as not unlike putting instruction tables into a machine, he said. One must therefore not expect a machine to do a very great deal of building up of instruction tables on its own.</p></div><div class="tv"></div></body></html>
|
463
lib/today.js
Normal file
463
lib/today.js
Normal file
@ -0,0 +1,463 @@
|
||||
/**
|
||||
* Created by marti on 30/01/2016.
|
||||
*/
|
||||
var http = require('http'), request = require('request'), cheerio = require('cheerio'), Forecast = require('forecast.io'), util = require('util'), UltraSES = require('ultrases'), cron = require('node-cron');
|
||||
var jade = require('jade'), _ = require('lodash'), dateFormat = require('dateformat');
|
||||
var jsonfile = require('jsonfile'), fs = require('fs'), STRING = require('string');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
var calHandler = require('./calHandler');
|
||||
var swedishWord = require('./swedishword');
|
||||
|
||||
var todayCache = {
|
||||
last: 0,
|
||||
data: {
|
||||
trains: {last: 0, data: []},
|
||||
weather: {},
|
||||
history: [],
|
||||
today: '',
|
||||
tv:{entries:[]},
|
||||
cal:{entries:[]},
|
||||
swedish:{}
|
||||
},
|
||||
expire: ((60 * 1000) * 60)
|
||||
};
|
||||
|
||||
var trainList = [
|
||||
{id: 'dbeglq', url: 'http://www.journeycheck.com/scotrail/route?from=DBE&to=GLQ&action=search&savedRoute='},
|
||||
{id: 'glqdbe', url: 'http://www.journeycheck.com/scotrail/route?from=GLQ&to=DBE&action=search&savedRoute='}
|
||||
];
|
||||
|
||||
//https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/55.8582846,-4.2593033?units=uk2
|
||||
var forecastOptions = {
|
||||
APIKey: '0657dc0d81c037cbc89ca88e383b6bbf',
|
||||
units: 'uk2'
|
||||
};
|
||||
|
||||
var mailer = new UltraSES({
|
||||
aws: {
|
||||
accessKeyId: 'AKIAJWJS75F7WNCGK64A',
|
||||
secretAccessKey: '8irYxThCp4xxyrbr00HzWcODe2qdNrR7X7S5BKup',
|
||||
"region": "eu-west-1"
|
||||
},
|
||||
defaults: {
|
||||
from: 'Martin Donnelly <martind2000@gmail.com>'
|
||||
}
|
||||
});
|
||||
|
||||
var file = __dirname + '/' + 'newdata.json';
|
||||
var htmlfile = __dirname + '/' + 'today.html';
|
||||
|
||||
function saveData() {
|
||||
logger.info('Saving...');
|
||||
jsonfile.writeFileSync(file, todayCache);
|
||||
}
|
||||
|
||||
function nth(d) {
|
||||
if (d > 3 && d < 21) return 'th'; // thanks kennebec
|
||||
switch (d % 10) {
|
||||
case 1:
|
||||
return "st";
|
||||
case 2:
|
||||
return "nd";
|
||||
case 3:
|
||||
return "rd";
|
||||
default:
|
||||
return "th";
|
||||
}
|
||||
}
|
||||
|
||||
function dayNumber() {
|
||||
var now = new Date();
|
||||
var start = new Date(now.getFullYear(), 0, 0);
|
||||
var diff = now - start;
|
||||
var oneDay = 1000 * 60 * 60 * 24;
|
||||
return Math.floor(diff / oneDay);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
function DayDiff(CurrentDate) {
|
||||
var TYear = CurrentDate.getFullYear();
|
||||
var TDay = new Date("January, 01, " + (parseInt(TYear) + 1));
|
||||
TDay.getFullYear(TYear);
|
||||
var DayCount = (TDay - CurrentDate) / (1000 * 60 * 60 * 24);
|
||||
DayCount = Math.round(DayCount);
|
||||
return (DayCount);
|
||||
}
|
||||
|
||||
Array.prototype.indexOfOld = Array.prototype.indexOf;
|
||||
|
||||
Array.prototype.indexOf = function (e, fn) {
|
||||
if (!fn) {
|
||||
return this.indexOfOld(e)
|
||||
}
|
||||
else {
|
||||
if (typeof fn === 'string') {
|
||||
var att = fn;
|
||||
fn = function (e) {
|
||||
return e[att];
|
||||
}
|
||||
}
|
||||
return this.map(fn).indexOfOld(e);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getClock: function(req, res) {
|
||||
// console.log(todayCache);
|
||||
res.render('pages/clock', todayCache);
|
||||
},
|
||||
getToday: function (req, res) {
|
||||
console.log(todayCache);
|
||||
res.render('pages/today', todayCache);
|
||||
},
|
||||
getData: function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(todayCache));
|
||||
},
|
||||
getTodayDate: function () {
|
||||
var s, d = new Date();
|
||||
todayCache.data.history = [];
|
||||
|
||||
s = '<strong>' + dateFormat(d, "mmmm d") + '</strong> - ';
|
||||
s = s + 'The ' + dayNumber() + nth(dayNumber) + ' day of ' + dateFormat(d, "yyyy") + ', and there are ' + DayDiff(d) + ' days left until the end of the year.';
|
||||
|
||||
logger.debug(s);
|
||||
todayCache.data.today = s;
|
||||
},
|
||||
|
||||
getTechHistory: function () {
|
||||
var url, d, day, month, monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
||||
|
||||
d = new Date();
|
||||
|
||||
month = monthNames[d.getMonth()];
|
||||
|
||||
day = d.getDate();
|
||||
|
||||
url = ['http://www.computerhistory.org/tdih/', month, '/', day].join('');
|
||||
logger.info(url);
|
||||
request(url, function (err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
|
||||
$ = cheerio.load(body);
|
||||
var tdihbody = $('#tdihbody');
|
||||
|
||||
var output = [];
|
||||
|
||||
tdihbody.find('.tdihevent > p').each(function (div) {
|
||||
var s = $(this).text();
|
||||
output.push(STRING(s).collapseWhitespace().s);
|
||||
});
|
||||
todayCache.data.history = todayCache.data.history.concat(output);
|
||||
console.log(todayCache.data.history);
|
||||
});
|
||||
},
|
||||
getHistory: function () {
|
||||
var url, d, day, month, monthNames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
||||
|
||||
d = new Date();
|
||||
|
||||
month = monthNames[d.getMonth()];
|
||||
|
||||
day = d.getDate();
|
||||
|
||||
url = ['http://www.bbc.co.uk/scotland/history/onthisday/', month, '/', day].join('');
|
||||
|
||||
console.log(url);
|
||||
request(url, function (err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
$ = cheerio.load(body);
|
||||
|
||||
var body = $('DIV#bbcPageContent').first();
|
||||
var output = [];
|
||||
|
||||
body.find('.story > p').each(function (div) {
|
||||
|
||||
var s = $(this).text();
|
||||
if (s.indexOf('Today\'s recipe:') == -1) {
|
||||
output.push(s);
|
||||
}
|
||||
});
|
||||
|
||||
todayCache.data.history = todayCache.data.history.concat(output);
|
||||
console.log(todayCache.data.history);
|
||||
module.exports.getTechHistory();
|
||||
|
||||
});
|
||||
},
|
||||
getTrainUpdates: function (id) {
|
||||
console.log('Getting train events...');
|
||||
var url = trainList[id].url;
|
||||
|
||||
var now = new Date();
|
||||
var outputArray = [];
|
||||
// if ((now - eventCache.last) > eventCache.expire) {
|
||||
request(url, function (err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
$ = cheerio.load(body);
|
||||
var lu = $('DIV#LU').first();
|
||||
|
||||
var us = lu.find('.updatesSection').first();
|
||||
us.find('.updateTitle').each(function (div) {
|
||||
var wO = {title: '', description: ''};
|
||||
title = $(this).find('A').first().text().trim();
|
||||
wO.title = title;
|
||||
outputArray.push(wO);
|
||||
});
|
||||
|
||||
us.find('.updateBodyStart').each(function (div) {
|
||||
|
||||
var description = $(this).find('.bodyInner').first().find('.primaryStyle').first().text().trim();
|
||||
var splitDesc = description.split('\r\n');
|
||||
|
||||
var wa = [];
|
||||
for (var i = 0; i < splitDesc.length; i++) {
|
||||
var contentCheck = splitDesc[i].trim();
|
||||
if (contentCheck.indexOf('Impact') > -1) contentCheck = '';
|
||||
if (contentCheck.indexOf('Additional Information') > -1) contentCheck = '';
|
||||
if (contentCheck.indexOf('apologise for the delay') > -1) contentCheck = '';
|
||||
if (contentCheck.indexOf('Delay Repay') > -1) contentCheck = '';
|
||||
if (contentCheck.length > 0) wa.push(contentCheck);
|
||||
}
|
||||
description = wa.join(' ');
|
||||
outputArray[div].description = description;
|
||||
});
|
||||
|
||||
// join arrays
|
||||
|
||||
for (var i = 0; i < outputArray.length; i++) {
|
||||
var flag=false;
|
||||
for (var j = 0; j < todayCache.data.trains.data.length;j++)
|
||||
{
|
||||
flag = _.isEqual(todayCache.data.trains.data[j], outputArray[i])
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
todayCache.data.trains.data.push(outputArray[i]);
|
||||
}
|
||||
}
|
||||
todayCache.data.trains.data = _.uniq(todayCache.data.trains.data);
|
||||
|
||||
});
|
||||
|
||||
todayCache.data.trains.last = now;
|
||||
|
||||
},
|
||||
updateTrains: function () {
|
||||
console.log('Updating trains..');
|
||||
|
||||
todayCache.data.trains.data = [];
|
||||
|
||||
module.exports.getTrainUpdates(0);
|
||||
module.exports.getTrainUpdates(1);
|
||||
|
||||
},
|
||||
|
||||
doGetWeatherOutlook: function () {
|
||||
console.log('Retrieving weather..');
|
||||
var j = {};
|
||||
var forecast = new Forecast(forecastOptions);
|
||||
forecast.get(55.8582846, -4.2593033, {units: 'uk2'}, function (err, res, data) {
|
||||
if (err) throw err;
|
||||
|
||||
var tempMin = parseInt(data.daily.data[0].temperatureMin);
|
||||
var tempMax = parseInt(data.daily.data[0].temperatureMax);
|
||||
|
||||
j.currently = data.currently.summary;
|
||||
j.today = data.daily.data[0].summary;
|
||||
j.later = data.daily.summary;
|
||||
j.alerts = data.alerts || {};
|
||||
j.data = data;
|
||||
|
||||
var fs = STRING(j.currently).endsWith('.') ? '' : '.';
|
||||
if (tempMax == tempMin) {
|
||||
j.currently += fs + ' Around ' + tempMin.toString() + ' degrees.';
|
||||
}
|
||||
else
|
||||
{
|
||||
j.currently += fs + ' Around ' + tempMin.toString() + ' to ' + tempMax.toString() + ' degrees.';
|
||||
}
|
||||
todayCache.data.weather = j;
|
||||
});
|
||||
|
||||
},
|
||||
refreshTrainAndWeather:function() {
|
||||
|
||||
try {
|
||||
module.exports.doGetWeatherOutlook();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
module.exports.updateTrains();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
},
|
||||
preLoadToday: function () {
|
||||
module.exports.getTodayDate();
|
||||
var self = this;
|
||||
|
||||
try {
|
||||
module.exports.doGetWeatherOutlook();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
module.exports.updateTrains();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
module.exports.getHistory();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
calHandler.getSimpleCalV2('http://www.pogdesign.co.uk/cat/download_ics/60cfdff469d0490545d33d7e3b5c0bcc', function(v) {
|
||||
todayCache.data.tv = v;
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
calHandler.getSimpleCalV2('https://calendar.google.com/calendar/ical/martind2000%40gmail.com/private-40cfebc9f7dcfa7fde6b9bf2f0092c93/basic.ics', function(v) {
|
||||
todayCache.data.cal.entries = todayCache.data.cal.entries.concat(v.entries) ;
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
calHandler.getSimpleCalV2('https://calendar.google.com/calendar/ical/mt5pgdhknvgoc8usfnrso9vkv0%40group.calendar.google.com/private-58876002af9f302a593acfa6fa792dcf/basic.ics', function(v) {
|
||||
todayCache.data.cal.entries = todayCache.data.cal.entries.concat(v.entries) ;
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
calHandler.getSimpleCalV2('https://www.tripit.com/feed/ical/private/DB96E4BB-94A9BD8F9CC1CF51C6CC0D920840F4F5/tripit.ics', function(v) {
|
||||
todayCache.data.cal.entries = todayCache.data.cal.entries.concat(v.entries) ;
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
swedishWord.getSwedishWord(function(v) {
|
||||
todayCache.data.swedish = v ;
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// word of the day http://wotd.transparent.com/rss/swedish-widget.xml?t=1455840000000
|
||||
// time stamp
|
||||
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
function sendEmailV1() {
|
||||
|
||||
var now = new Date();
|
||||
|
||||
var email = {
|
||||
to: 'martind2000@gmail.com',
|
||||
subject: 'Today - ' + dateFormat(now, "dddd, mmmm dS, yyyy")
|
||||
};
|
||||
|
||||
var template = {file: __dirname + '/' + 'jade/today.jade', locals: todayCache};
|
||||
|
||||
logger.debug(__dirname);
|
||||
logger.debug(__dirname.substr(__dirname.lastIndexOf('/'), __dirname.length));
|
||||
|
||||
//if (__dirname.substr(__dirname.lastIndexOf('/'),__dirname.length))
|
||||
|
||||
mailer.sendTemplate(email, template, function (err) {
|
||||
if (err) throw err;
|
||||
console.log('compiled template email sent');
|
||||
});
|
||||
|
||||
// saveData();
|
||||
var fn = jade.compileFile(template.file);
|
||||
|
||||
console.log(fn(todayCache));
|
||||
|
||||
// fs.writeFileSync(htmlfile, fn(todayCache));
|
||||
|
||||
}
|
||||
|
||||
function sendEmail() {
|
||||
logger.log('Simple email');
|
||||
var now = new Date();
|
||||
|
||||
var email = {
|
||||
to: 'martind2000@gmail.com',
|
||||
subject: 'Today - ' + dateFormat(now, "dddd, mmmm dS, yyyy")
|
||||
};
|
||||
|
||||
/* mailer.sendText(email, 'Look at this fantastic email body!', function (err) {
|
||||
if (err) throw err;
|
||||
console.log('email sent!');
|
||||
});
|
||||
*/
|
||||
|
||||
saveData();
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
module.exports.preLoadToday();
|
||||
}, 15000);
|
||||
|
||||
|
||||
setTimeout(function () {
|
||||
sendEmailV1();
|
||||
}, 45000);
|
||||
|
||||
cron.schedule('45 6 * * *', function () {
|
||||
module.exports.preLoadToday();
|
||||
return -1;
|
||||
});
|
||||
|
||||
cron.schedule('0 */1 * * *', function () {
|
||||
module.exports.refreshTrainAndWeather();
|
||||
return -1;
|
||||
});
|
||||
|
||||
cron.schedule('0 7 * * *', function () {
|
||||
sendEmailV1();
|
||||
// console.log('tick');
|
||||
return -1;
|
||||
});
|
||||
|
181
lib/train.js
Normal file
181
lib/train.js
Normal file
@ -0,0 +1,181 @@
|
||||
// train.js
|
||||
var http = require('http');
|
||||
var trainCache = {
|
||||
last: {},
|
||||
data: {}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
|
||||
dbe_glq: function (req, res) {
|
||||
|
||||
console.log('DBE:GLQ request');
|
||||
|
||||
var now = new Date();
|
||||
var nowSeconds = (now.getHours() * (60 * 60)) + (now.getMinutes() * 60);
|
||||
console.log('Now Seconds: ' + nowSeconds);
|
||||
if (trainCache.last.dbeglq == null || nowSeconds != trainCache.last.dbeglq) {
|
||||
Query(function (a, b) {
|
||||
|
||||
var ts = a.departures[0].service;
|
||||
var output = {};
|
||||
console.log(ts);
|
||||
|
||||
console.log(ts.sta);
|
||||
|
||||
|
||||
output.sta = ts.sta;
|
||||
output.eta = ts.eta;
|
||||
trainCache.data.dbeglq = output;
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(trainCache.data.dbeglq));
|
||||
}, res, 'huxley.apphb.com', '/next/dbe/to/glq/1?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8');
|
||||
|
||||
}
|
||||
},
|
||||
glq_dbe: function (req, res) {
|
||||
|
||||
console.log('GLQ:DBE request');
|
||||
|
||||
var now = new Date();
|
||||
var nowSeconds = (now.getHours() * (60 * 60)) + (now.getMinutes() * 60);
|
||||
console.log('Now Seconds: ' + nowSeconds);
|
||||
if (trainCache.last.glqdbe == null || nowSeconds != trainCache.last.dbeglq) {
|
||||
Query(function (a, b) {
|
||||
|
||||
var ts = a.departures[0].service;
|
||||
var output = {};
|
||||
console.log(ts);
|
||||
//GLOBAL.lastcheck = now;
|
||||
console.log(ts.sta);
|
||||
console.log(toSeconds(ts.sta));
|
||||
|
||||
output.sta = ts.sta;
|
||||
output.eta = ts.eta;
|
||||
trainCache.data.glqdbe = output;
|
||||
// trainCache.last.glqdbe = toSeconds(ts.sta);
|
||||
// console.log(ts);
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(trainCache.data.glqdbe));
|
||||
}, res, 'huxley.apphb.com', '/next/glq/to/dbe/1?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8');
|
||||
|
||||
}
|
||||
},
|
||||
getTrainTimes: function(req, res) {
|
||||
// console.log(req);
|
||||
console.log('getTrainTimes: ' + JSON.stringify(req.query));
|
||||
if (req.query.hasOwnProperty('from') && req.query.hasOwnProperty('from'))
|
||||
{
|
||||
|
||||
var url = '/all/' + req.query.from + '/to/' + req.query.to + '/10?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8';
|
||||
|
||||
Query(function (a, b) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(a));
|
||||
}, res, 'huxley.apphb.com', url);
|
||||
}
|
||||
else{
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify({}));
|
||||
}
|
||||
|
||||
},
|
||||
getNextTrainTimes: function(req, res) {
|
||||
console.log('getNextTrainTimes: ' + JSON.stringify(req.query));
|
||||
var trainFrom, trainTo, trainToken, url;
|
||||
if (req.query.hasOwnProperty('from') && req.query.hasOwnProperty('from')) {
|
||||
trainFrom = req.query.from;
|
||||
trainTo = req.query.to;
|
||||
trainToken = trainFrom + trainTo;
|
||||
url = '/next/' + trainFrom + '/to/' + trainTo + '/1?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8';
|
||||
console.log('Requesting latest time for : ' + trainToken);
|
||||
|
||||
var now = new Date();
|
||||
var nowSeconds = (now.getHours() * (60 * 60)) + (now.getMinutes() * 60);
|
||||
console.log('Now Seconds: ' + nowSeconds);
|
||||
if (trainCache.last[trainToken] == null || nowSeconds != trainCache.last[trainToken]) {
|
||||
|
||||
Query(function (a, b) {
|
||||
|
||||
var output = {};
|
||||
var ts = a.departures[0].service;
|
||||
if ( ts !== null)
|
||||
{
|
||||
// console.log(ts);
|
||||
//GLOBAL.lastcheck = now;
|
||||
console.log(ts.sta);
|
||||
console.log(toSeconds(ts.sta));
|
||||
|
||||
output.sta = ts.sta;
|
||||
output.eta = (ts.eta !== null ? ts.eta : ts.sta);
|
||||
// trainCache.last.glqdbe = toSeconds(ts.sta);
|
||||
// console.log(ts);
|
||||
} else
|
||||
{
|
||||
console.log('*** NO SERVICE');
|
||||
output.sta = 'No Service';
|
||||
output.eta = 'No Service';
|
||||
}
|
||||
|
||||
trainCache.data[trainToken] = output;
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(trainCache.data[trainToken]));
|
||||
}, res, 'huxley.apphb.com', url);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}, getRoute: function(req, res) {
|
||||
console.log('getRoute: ' + JSON.stringify(req.query));
|
||||
var routeID, data={};
|
||||
if (req.query.hasOwnProperty('route')) {
|
||||
|
||||
routeID = req.query.route;
|
||||
Query(function (a, b) {
|
||||
|
||||
if (a !== null && a.message === null) {
|
||||
data = a;
|
||||
}
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(data));
|
||||
}, res, 'huxley.apphb.com', '/service/' + routeID + '?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
function toSeconds(inval) {
|
||||
var a = inval.split(':');
|
||||
return ((parseInt(a[0]) * (60 * 60)) + (parseInt(a[1]) * 60));
|
||||
|
||||
}
|
||||
|
||||
function Query(callback, r, host, path) {
|
||||
console.log(path);
|
||||
var req = r;
|
||||
var options = {
|
||||
host: host,
|
||||
// port: 80,
|
||||
path: path,
|
||||
//method: 'GET',
|
||||
headers: {}
|
||||
};
|
||||
|
||||
try {
|
||||
http.request(options).on('response', function (response) {
|
||||
var data = '';
|
||||
response.on("data", function (chunk) {
|
||||
data += chunk;
|
||||
});
|
||||
response.on('end', function () {
|
||||
callback(JSON.parse(data), r);
|
||||
});
|
||||
}).end();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
2
lib/train.min.js
vendored
Normal file
2
lib/train.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
function toSeconds(e){var t=e.split(":");return 3600*parseInt(t[0])+60*parseInt(t[1])}function Query(e,t,o,n){console.log(n);var a={host:o,path:n,headers:{}};try{http.request(a).on("response",function(o){var n="";o.on("data",function(e){n+=e}),o.on("end",function(){e(JSON.parse(n),t)})}).end()}catch(s){console.log(s)}}var http=require("http"),trainCache={last:{},data:{}};module.exports={dbe_glq:function(e,t){console.log("DBE:GLQ request");var o=new Date,n=3600*o.getHours()+60*o.getMinutes();console.log("Now Seconds: "+n),(null==trainCache.last.dbeglq||n!=trainCache.last.dbeglq)&&Query(function(e){var o=e.departures[0].service,n={};console.log(o),console.log(o.sta),n.sta=o.sta,n.eta=o.eta,trainCache.data.dbeglq=n,t.setHeader("Content-Type","application/json"),t.end(JSON.stringify(trainCache.data.dbeglq))},t,"huxley.apphb.com","/next/dbe/to/glq/1?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8")},glq_dbe:function(e,t){console.log("GLQ:DBE request");var o=new Date,n=3600*o.getHours()+60*o.getMinutes();console.log("Now Seconds: "+n),(null==trainCache.last.glqdbe||n!=trainCache.last.dbeglq)&&Query(function(e){var o=e.departures[0].service,n={};console.log(o),console.log(o.sta),console.log(toSeconds(o.sta)),n.sta=o.sta,n.eta=o.eta,trainCache.data.glqdbe=n,t.setHeader("Content-Type","application/json"),t.end(JSON.stringify(trainCache.data.glqdbe))},t,"huxley.apphb.com","/next/glq/to/dbe/1?accessToken=215b99fe-b237-4a01-aadc-cf315d6756d8")}};
|
||||
//# sourceMappingURL=train.min.js.map
|
1
lib/train.min.js.map
Normal file
1
lib/train.min.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["train.js"],"names":["toSeconds","inval","a","split","parseInt","Query","callback","r","host","path","console","log","options","headers","http","request","on","response","data","chunk","JSON","parse","end","e","require","trainCache","last","module","exports","dbe_glq","req","res","now","Date","nowSeconds","getHours","getMinutes","dbeglq","ts","departures","service","output","sta","eta","setHeader","stringify","glq_dbe","glqdbe"],"mappings":"AAqEA,QAASA,WAAUC,GACf,GAAIC,GAAID,EAAME,MAAM,IACpB,OAA0B,MAAjBC,SAASF,EAAE,IAAqC,GAAjBE,SAASF,EAAE,IAIvD,QAASG,OAAMC,EAAUC,EAAGC,EAAMC,GAC9BC,QAAQC,IAAIF,EACZ,IACIG,IACAJ,KAAMA,EAENC,KAAMA,EAENI,WAGJ,KACIC,KAAKC,QAAQH,GAASI,GAAG,WAAY,SAAUC,GAC3C,GAAIC,GAAO,EACXD,GAASD,GAAG,OAAQ,SAAUG,GAC1BD,GAAQC,IAEZF,EAASD,GAAG,MAAO,WACfV,EAASc,KAAKC,MAAMH,GAAOX,OAEhCe,MACL,MAAOC,GACLb,QAAQC,IAAIY,IAhGpB,GAAIT,MAAOU,QAAQ,QACfC,YACAC,QACAR,QAGJS,QAAOC,SAIHC,QAAS,SAAUC,EAAKC,GAEpBrB,QAAQC,IAAI,kBAEZ,IAAIqB,GAAM,GAAIC,MACVC,EAA+B,KAAjBF,EAAIG,WAA8C,GAAnBH,EAAII,YACrD1B,SAAQC,IAAI,gBAAkBuB,IACA,MAA1BT,WAAWC,KAAKW,QAAkBH,GAAcT,WAAWC,KAAKW,SAChEhC,MAAM,SAAUH,GAEZ,GAAIoC,GAAKpC,EAAEqC,WAAW,GAAGC,QACrBC,IACJ/B,SAAQC,IAAI2B,GAEZ5B,QAAQC,IAAI2B,EAAGI,KAGfD,EAAOC,IAAMJ,EAAGI,IAChBD,EAAOE,IAAML,EAAGK,IAChBlB,WAAWP,KAAKmB,OAASI,EAEzBV,EAAIa,UAAU,eAAgB,oBAC9Bb,EAAIT,IAAIF,KAAKyB,UAAUpB,WAAWP,KAAKmB,UACxCN,EAAK,mBAAoB,wEAIpCe,QAAS,SAAUhB,EAAKC,GAEpBrB,QAAQC,IAAI,kBAEZ,IAAIqB,GAAM,GAAIC,MACVC,EAA+B,KAAjBF,EAAIG,WAA8C,GAAnBH,EAAII,YACrD1B,SAAQC,IAAI,gBAAkBuB,IACA,MAA1BT,WAAWC,KAAKqB,QAAkBb,GAAcT,WAAWC,KAAKW,SAChEhC,MAAM,SAAUH,GAEZ,GAAIoC,GAAKpC,EAAEqC,WAAW,GAAGC,QACrBC,IACJ/B,SAAQC,IAAI2B,GAEZ5B,QAAQC,IAAI2B,EAAGI,KACfhC,QAAQC,IAAIX,UAAUsC,EAAGI,MAEzBD,EAAOC,IAAMJ,EAAGI,IAChBD,EAAOE,IAAML,EAAGK,IAChBlB,WAAWP,KAAK6B,OAASN,EAGzBV,EAAIa,UAAU,eAAgB,oBAC9Bb,EAAIT,IAAIF,KAAKyB,UAAUpB,WAAWP,KAAK6B,UACxChB,EAAK,mBAAoB"}
|
44
lib/weather.js
Normal file
44
lib/weather.js
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Created by marti on 14/02/2016.
|
||||
*/
|
||||
var http = require('http'), request = require('request'), cheerio = require('cheerio'), Forecast = require('forecast.io'), util = require('util'), UltraSES = require('ultrases'), cron = require('node-cron');
|
||||
var jade = require('jade'), _ = require('lodash'), dateFormat = require('dateformat');
|
||||
var jsonfile = require('jsonfile'), fs = require('fs');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
|
||||
var forecastOptions = {
|
||||
APIKey: '0657dc0d81c037cbc89ca88e383b6bbf',
|
||||
units: 'uk2'
|
||||
};
|
||||
|
||||
var file = __dirname + '/' + 'data.json';
|
||||
function saveData(d) {
|
||||
jsonfile.writeFileSync(file, d);
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
doGetWeatherOutlook: function () {
|
||||
console.log('Retrieving weather..');
|
||||
var j = {};
|
||||
var forecast = new Forecast(forecastOptions);
|
||||
forecast.get(55.8582846, -4.2593033, {units: 'uk2'}, function (err, res, data) {
|
||||
if (err) throw err;
|
||||
console.log(util.inspect(data));
|
||||
saveData(data);
|
||||
j.currently = data.currently.summary;
|
||||
j.today = data.daily.data[0].summary;
|
||||
j.later = data.daily.summary;
|
||||
j.alerts = data.alerts || {};
|
||||
|
||||
// todayCache.data.weather = j;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
module.exports.doGetWeatherOutlook();
|
605
lot.js
Normal file
605
lot.js
Normal file
@ -0,0 +1,605 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var m = [],
|
||||
prev = [],
|
||||
mo = [],
|
||||
star = [],
|
||||
trip = [],
|
||||
results = [],
|
||||
line = [];
|
||||
|
||||
var re = [
|
||||
['05-Jan-2016',6,10,31,36,39,6,10],
|
||||
['01-Jan-2016',4,37,38,39,44,4,7],
|
||||
['29-Dec-2015',5,20,31,32,36,6,7],
|
||||
['25-Dec-2015',3,10,25,27,40,3,9],
|
||||
['22-Dec-2015',18,19,20,40,41,7,10],
|
||||
['18-Dec-2015',6,22,26,29,48,5,6],
|
||||
['15-Dec-2015',8,11,23,27,35,4,11],
|
||||
['11-Dec-2015',3,5,21,40,43,6,11],
|
||||
['08-Dec-2015',12,17,29,38,48,9,11],
|
||||
['04-Dec-2015',8,17,18,27,39,1,7],
|
||||
['01-Dec-2015',2,15,25,35,45,8,10],
|
||||
['27-Nov-2015',16,29,30,37,50,6,8],
|
||||
['24-Nov-2015',9,14,16,17,26,10,11],
|
||||
['20-Nov-2015',4,30,34,46,49,7,8],
|
||||
['17-Nov-2015',6,7,23,37,38,10,11],
|
||||
['13-Nov-2015',10,17,18,33,40,2,8],
|
||||
['10-Nov-2015',6,13,18,39,43,2,8],
|
||||
['06-Nov-2015',3,17,26,38,40,4,10],
|
||||
['03-Nov-2015',8,27,39,46,49,2,6],
|
||||
['30-Oct-2015',8,13,17,21,34,6,7],
|
||||
['27-Oct-2015',11,12,20,25,36,6,9],
|
||||
['23-Oct-2015',7,25,30,32,39,2,8],
|
||||
['20-Oct-2015',17,19,21,30,45,8,10],
|
||||
['16-Oct-2015',7,28,29,43,48,3,10],
|
||||
['13-Oct-2015',12,15,26,29,47,3,11],
|
||||
['09-Oct-2015',01,40,42,43,47,9,11],
|
||||
['06-Oct-2015',11,20,22,29,32,1,8],
|
||||
['02-Oct-2015',7,18,21,32,35,2,11],
|
||||
['29-Sep-2015',11,14,26,29,49,3,9],
|
||||
['25-Sep-2015',13,14,23,30,37,2,8],
|
||||
['22-Sep-2015',14,23,26,27,29,7,10],
|
||||
['18-Sep-2015',7,29,33,34,39,7,8],
|
||||
['15-Sep-2015',8,15,17,44,49,5,8],
|
||||
['11-Sep-2015',10,18,19,29,50,1,9],
|
||||
['08-Sep-2015',14,16,39,40,42,1,4],
|
||||
['04-Sep-2015',8,9,27,45,50,8,10],
|
||||
['01-Sep-2015',6,19,21,27,45,1,8],
|
||||
['28-Aug-2015',11,29,30,31,34,4,7],
|
||||
['25-Aug-2015',27,31,33,42,50,2,5],
|
||||
['21-Aug-2015',4,16,18,43,47,6,10],
|
||||
['18-Aug-2015',7,10,11,12,19,2,9],
|
||||
['14-Aug-2015',4,7,39,44,45,3,5],
|
||||
['11-Aug-2015',2,3,8,15,16,4,11],
|
||||
['07-Aug-2015',1,5,21,39,44,4,11],
|
||||
['04-Aug-2015',10,15,39,45,50,9,10],
|
||||
['31-Jun-2015',16,21,34,40,50,6,9],
|
||||
['28-Jun-2015',23,32,36,43,49,7,8],
|
||||
['24-Jun-2015',2,9,21,35,46,2,11],
|
||||
['21-Jun-2015',14,20,27,29,44,7,10],
|
||||
['17-Jun-2015',1,21,22,43,48,7,9],
|
||||
['14-Jun-2015',6,18,19,34,36,1,8],
|
||||
['10-Jun-2015',5,8,15,35,41,4,5],
|
||||
['07-Jun-2015',6,7,18,33,41,3,10],
|
||||
['03-Jun-2015',11,12,15,18,44,3,9],
|
||||
['30-Jun-2015',11,15,28,34,37,1,8],
|
||||
['26-Jun-2015',3,6,10,19,24,5,7],
|
||||
["23-Jun-2015",4,16,22,38,49,6,9],
|
||||
["19-Jun-2015",7,14,20,31,42,3,9],
|
||||
["16-Jun-2015",10,15,16,36,37,3,9],
|
||||
["12-Jun-2015",5,8,10,11,37,7,9],
|
||||
["09-Jun-2015",5,9,17,32,34,6,8],
|
||||
["05-Jun-2015",2,7,8,45,48,1,9],
|
||||
["02-Jun-2015",23,7,41,29,37,1,8],
|
||||
["29-May-2015",4,20,48,45,3,8,6],
|
||||
["26-May-2015",6,24,7,21,5,6,5],
|
||||
["22-May-2015",18,44,35,24,45,5,11],
|
||||
["19-May-2015",35,37,31,26,30,11,8],
|
||||
["15-May-2015",47,42,44,5,35,9,8],
|
||||
["12-May-2015",29,30,14,46,40,3,6],
|
||||
["08-May-2015",14,19,49,7,47,10,3],
|
||||
["05-May-2015",1,17,10,42,20,9,8],
|
||||
["01-May-2015",19,26,20,25,3,6,10],
|
||||
["28-Apr-2015",36,24,28,26,45,10,7],
|
||||
["24-Apr-2015",31,5,40,29,19,3,10],
|
||||
["21-Apr-2015",14,42,17,6,45,8,1],
|
||||
['17-Apr-2015',2,24,30,34,39,8,11],
|
||||
['14-Apr-2015',24,32,34,35,49,1,2],
|
||||
['10-Apr-2015',22,23,25,30,43,5,9],
|
||||
['07-Apr-2015',39,25,50,44,18,8,5],
|
||||
['03-Apr-2015',39,37,49,29,27,4,2],
|
||||
['31-Mar-2015',8,28,20,24,49,8,9],
|
||||
['27-Mar-2015',30,39,32,44,2,10,6],
|
||||
['24-Mar-2015',40,10,39,24,26,3,10],
|
||||
['20-Mar-2015',3,14,42,48,37,1,10],
|
||||
['17-Mar-2015',11,23,44,38,26,8,1],
|
||||
['13-mar-2015',4,5,18,22,23,1,3],
|
||||
['10-mar-2015',2,6,23,30,31,2,10],
|
||||
['06-mar-2015',23,30,47,49,50,2,7],
|
||||
['03-mar-2015',6,8,11,13,21,7,8],
|
||||
['27-feb-2015',5,14,17,25,47,9,10],
|
||||
['24-feb-2015',3,25,28,34,50,1,11],
|
||||
['20-feb-2015',4,10,14,37,46,4,7],
|
||||
['17-Feb-2015',2,5,18,30,43,1,10],
|
||||
['13-Feb-2015',12,24,39,42,44,3,11],
|
||||
['10-Feb-2015',13,17,20,30,45,9,10],
|
||||
['06-Feb=2015',10,26,30,39,50,7,8],
|
||||
['03-Feb-2015',17,31,33,44,50,7,11],
|
||||
['30-Jan-2015',9,13,15,19,24,3,8],
|
||||
['27-Jan-2015',10,33,5,31,40,10,8],
|
||||
['23-Jan-2015',30,45,29,38,6,8,1],
|
||||
['20-Jan-2015',33,47,15,41,44,10,8],
|
||||
|
||||
['16-Jan-2015', 34, 32, 29, 30, 46, 6, 3],
|
||||
['13-Jan-2015', 34, 31, 21, 8, 17, 10, 9],
|
||||
['09-Jan-2015', 6, 32, 45, 21, 24, 1, 11],
|
||||
['06-Jan-2015', 20, 38, 30, 14, 49, 4, 3],
|
||||
['02-Jan-2015', 24, 25, 49, 28, 22, 3, 6],
|
||||
['30-Dec-2014', 6, 18, 39, 50, 44, 11, 8],
|
||||
['26-Dec-2014', 26, 45, 27, 49, 17, 2, 3],
|
||||
['23-Dec-2014', 49, 25, 9, 19, 8, 10, 2],
|
||||
['19-Dec-2014', 39, 44, 23, 29, 31, 5, 8],
|
||||
['16-Dec-2014', 13, 7, 3, 25, 12, 5, 8],
|
||||
['12-Dec-2014', 28, 2, 15, 31, 37, 4, 6],
|
||||
['09-Dec-2014', 31, 1, 3, 42, 46, 11, 4],
|
||||
['05-Dec-2014', 5, 8, 48, 47, 37, 3, 2],
|
||||
['02-Dec-2014', 15, 25, 3, 49, 44, 9, 1],
|
||||
['28-Nov-2014', 10, 23, 6, 41, 15, 10, 4],
|
||||
['25-Nov-2014', 32, 7, 36, 3, 25, 1, 6],
|
||||
['21-Nov-2014', 28, 32, 7, 37, 4, 5, 10],
|
||||
['18-Nov-2014', 3, 2, 36, 38, 17, 11, 4],
|
||||
['14-Nov-2014', 36, 32, 38, 48, 17, 8, 5],
|
||||
['11-Nov-2014', 46, 14, 36, 2, 21, 11, 7],
|
||||
['07-Nov-2014', 32, 13, 38, 46, 25, 10, 1],
|
||||
['04-Nov-2014', 1, 13, 6, 26, 17, 3, 5],
|
||||
['31-Oct-2014', 10, 41, 13, 20, 33, 9, 3],
|
||||
['28-Oct-2014', 45, 17, 40, 10, 15, 1, 2],
|
||||
['24-Oct-2014', 42, 20, 3, 30, 9, 6, 1],
|
||||
['21-Oct-2014', 40, 33, 27, 20, 21, 3, 10],
|
||||
['17-Oct-2014', 49, 13, 48, 1, 40, 8, 10],
|
||||
['14-Oct-2014', 15, 23, 32, 4, 5, 7, 3],
|
||||
['10-Oct-2014', 29, 42, 47, 45, 6, 9, 10],
|
||||
['07-Oct-2014', 38, 30, 21, 9, 28, 8, 1],
|
||||
['03-Oct-2014', 13, 23, 50, 48, 4, 10, 5],
|
||||
['30-Sep-2014', 33, 13, 15, 3, 42, 5, 7],
|
||||
['26-Sep-2014', 46, 35, 47, 13, 27, 1, 2],
|
||||
['23-Sep-2014', 13, 35, 14, 29, 12, 1, 7],
|
||||
['19-Sep-2014', 6, 34, 8, 38, 48, 9, 3],
|
||||
['16-Sep-2014', 4, 30, 35, 50, 29, 4, 2],
|
||||
['12-Sep-2014', 31, 9, 33, 26, 13, 7, 11],
|
||||
['09-Sep-2014', 15, 35, 19, 8, 24, 10, 8],
|
||||
['05-Sep-2014', 18, 50, 23, 46, 1, 9, 3],
|
||||
['02-Sep-2014', 39, 45, 25, 31, 5, 8, 1],
|
||||
['29-Aug-2014', 32, 38, 26, 9, 2, 3, 6],
|
||||
['26-Aug-2014', 36, 48, 45, 10, 22, 11, 4],
|
||||
['22-Aug-2014', 29, 17, 49, 35, 4, 1, 2],
|
||||
['19-Aug-2014', 11, 34, 47, 4, 7, 7, 8],
|
||||
['15-Aug-2014', 4, 21, 30, 5, 23, 10, 8],
|
||||
['12-Aug-2014', 22, 19, 7, 16, 33, 5, 2],
|
||||
['08-Aug-2014', 29, 21, 35, 46, 43, 1, 9],
|
||||
['05-Aug-2014', 5, 21, 42, 7, 19, 11, 5],
|
||||
['01-Aug-2014', 50, 44, 46, 48, 24, 10],
|
||||
['29-Jul-2014', 40, 23, 35, 10, 43, 9, 3],
|
||||
['25-Jul-2014', 10, 24, 9, 12, 43, 5, 9],
|
||||
['22-Jul-2014', 1, 43, 50, 45, 24, 5, 8],
|
||||
['18-Jul-2014', 1, 41, 43, 11, 29, 3, 11],
|
||||
['15-Jul-2014', 18, 27, 15, 34, 20, 1, 3],
|
||||
['11-Jul-2014', 38, 35, 5, 49, 22, 7, 4],
|
||||
['08-Jul-2014', 24, 18, 22, 8, 27, 11, 4],
|
||||
['04,Jul,2014', 4, 18, 39, 43, 47, 2, 6],
|
||||
['01,Jul,2014', 18, 22, 25, 27, 39, 5, 10],
|
||||
['27,Jun,2014', 31, 33, 34, 39, 45, 2, 10],
|
||||
['24,Jun,2014', 1, 7, 20, 21, 48, 4, 7],
|
||||
['20,Jun,2014', 5, 15, 25, 38, 49, 1, 2],
|
||||
['17,Jun,2014', 11, 13, 37, 40, 48, 8, 9],
|
||||
['13,Jun,2014', 16, 18, 22, 28, 46, 9, 11],
|
||||
['10,Jun,2014', 12, 18, 21, 32, 33, 1, 11],
|
||||
['06,Jun,2014', 7, 25, 34, 40, 49, 9, 11],
|
||||
['03,Jun,2014', 2, 15, 32, 39, 44, 5, 10],
|
||||
['30,May,2014', 5, 24, 27, 41, 45, 6, 7],
|
||||
['27,May,2014', 7, 13, 16, 25, 26, 1, 6],
|
||||
['23,May,2014', 3, 8, 31, 34, 47, 9, 11],
|
||||
['20,May,2014', 5, 33, 36, 38, 47, 4, 9],
|
||||
['16,May,2014', 23, 26, 29, 37, 40, 3, 4],
|
||||
['13,May,2014', 4, 13, 30, 34, 47, 2, 6],
|
||||
['09,May,2014', 3, 21, 26, 28, 45, 7, 10],
|
||||
['06,May,2014', 5, 19, 24, 31, 37, 1, 9],
|
||||
['02,May,2014', 4, 30, 31, 38, 42, 2, 11],
|
||||
['29-Apr-2014', 18, 23, 26, 35, 44, 3, 11],
|
||||
['25-Apr-2014', 13, 21, 24, 44, 49, 1, 9],
|
||||
['22-Apr-2014', 13, 15, 20, 24, 46, 1, 8],
|
||||
['18-Apr-2014', 21, 24, 31, 39, 47, 3, 7],
|
||||
['15-Apr-2014', 3, 14, 26, 47, 50, 7, 11],
|
||||
['11-Apr-2014', 8, 12, 19, 30, 33, 4, 11],
|
||||
['08-Apr-2014', 11, 18, 29, 42, 49, 4, 11],
|
||||
['04-Apr-2014', 6, 10, 28, 45, 50, 10, 11],
|
||||
['01-Apr-2014', 16, 18, 26, 38, 44, 8, 10],
|
||||
['28-Mar-2014', 3, 4, 19, 28, 43, 3, 7],
|
||||
['25-Mar-2014', 7, 20, 26, 28, 50, 2, 8],
|
||||
['21-Mar-2014', 7, 30, 37, 39, 42, 5, 7],
|
||||
['18-Mar-2014', 8, 27, 34, 36, 39, 5, 10],
|
||||
['14-Mar-2014', 6, 24, 25, 27, 30, 5, 9],
|
||||
['11-Mar-2014', 1, 4, 23, 33, 44, 7, 8],
|
||||
['07-Mar-2014', 5, 10, 38, 40, 41, 1, 8],
|
||||
['04-Mar-2014', 3, 5, 22, 27, 44, 1, 6],
|
||||
['28-Feb-2014', 12, 32, 38, 43, 44, 2, 7],
|
||||
['25-Feb-2014', 21, 25, 28, 35, 42, 4, 6],
|
||||
['21-Feb-2014', 13, 17, 28, 30, 32, 5, 7],
|
||||
['18-Feb-2014', 23, 26, 36, 37, 49, 6, 7],
|
||||
['14-Feb-2014', 19, 39, 4, 2, 6, 2, 7],
|
||||
['11-Feb-2014', 47, 25, 8, 17, 41, 1, 2],
|
||||
['07-Feb-2014', 17, 19, 47, 3, 46, 9, 10],
|
||||
['04-Feb-2014', 37, 1, 33, 21, 38, 8, 4],
|
||||
['31-Jan-2014', 10, 15, 31, 8, 16, 8, 9],
|
||||
['28-Jan-2014', 18, 23, 48, 20, 42, 2, 9],
|
||||
['24-Jan-2014', 19, 41, 35, 34, 5, 1, 5],
|
||||
['21-Jan-2014', 4, 42, 35, 48, 12, 5, 8],
|
||||
['17-Jan-2014', 26, 19, 33, 42, 32, 10, 4],
|
||||
['14-Jan-2014', 25, 18, 20, 26, 37, 11, 10],
|
||||
['10-Jan-2014', 1, 27, 2, 11, 29, 10, 1],
|
||||
['07-Jan-2014', 2, 45, 20, 27, 33, 6, 10],
|
||||
['03-Jan-2014', 3, 44, 27, 38, 31, 3, 8],
|
||||
['31-Dec-2013', 29, 45, 24, 20, 13, 7, 3],
|
||||
['27-Dec-2013', 1, 22, 6, 13, 28, 10, 5],
|
||||
['24-Dec-2013', 5, 31, 43, 50, 19, 6, 2],
|
||||
['20-Dec-2013', 13, 22, 17, 43, 12, 10, 3],
|
||||
['17-Dec-2013', 41, 6, 8, 37, 27, 7, 10],
|
||||
['13-Dec-2013', 24, 22, 23, 1, 31, 6, 11],
|
||||
['10-Dec-2013', 49, 50, 24, 6, 35, 7, 1],
|
||||
['06-Dec-2013', 18, 31, 36, 2, 1, 7, 10],
|
||||
['03-Dec-2013', 32, 6, 29, 15, 13, 2, 9],
|
||||
['29-Nov-2013', 2, 7, 10, 23, 43, 4, 7],
|
||||
['26-Nov-2013', 19, 23, 27, 42, 44, 3, 5],
|
||||
['22-Nov-2013', 13, 25, 26, 40, 50, 8, 9],
|
||||
['19-Nov-2013', 14, 15, 19, 36, 45, 1, 10],
|
||||
['15-Nov-2013', 3, 13, 15, 29, 42, 1, 4],
|
||||
['12-Nov-2013', 14, 29, 37, 40, 48, 2, 11],
|
||||
['08-Nov-2013', 20, 28, 35, 42, 43, 8, 10],
|
||||
['05-Nov-2013', 6, 12, 13, 35, 38, 2, 3],
|
||||
['01-Nov-2013', 7, 19, 29, 30, 33, 3, 8],
|
||||
['29-Oct-2013', 9, 10, 30, 32, 37, 2, 6],
|
||||
['25-Oct-2013', 2, 3, 10, 31, 38, 6, 10],
|
||||
['22-Oct-2013', 29, 33, 39, 41, 44, 9, 11],
|
||||
['18-Oct-2013', 5, 25, 36, 46, 47, 2, 6],
|
||||
['15-Sep-2013', 18, 27, 39, 43, 47, 4, 7],
|
||||
['11-Oct-2013', 6, 12, 17, 23, 43, 5, 9],
|
||||
['08-Oct-2013', 23, 24, 26, 33, 42, 3, 5],
|
||||
['04-Oct-2013', 6, 20, 24, 35, 50, 5, 10],
|
||||
['01-Oct-2013', 19, 23, 25, 44, 48, 8, 9],
|
||||
['27-Sep-2013', 11, 15, 38, 41, 43, 2, 6],
|
||||
['24-Sep-2013', 10, 20, 26, 28, 43, 9, 11],
|
||||
['20-Sep-2013', 5, 11, 35, 38, 45, 2, 3],
|
||||
['17-Sep-2013', 13, 17, 21, 42, 44, 9, 11],
|
||||
['13-Sep-2013', 4, 6, 14, 27, 33, 5, 10],
|
||||
['10-Sep-2013', 7, 11, 14, 28, 30, 2, 10],
|
||||
['06-Sep-2013', 11, 23, 25, 32, 37, 4, 7],
|
||||
['03-Sep-2013', 5, 9, 16, 18, 42, 7, 9],
|
||||
['30-Aug-2013', 2, 17, 25, 36, 45, 5, 9],
|
||||
['27-Aug-2013', 7, 30, 38, 40, 43, 2, 6],
|
||||
['23-Aug-2013', 1, 6, 26, 30, 37, 5, 8],
|
||||
['20-Aug-2013', 5, 11, 42, 49, 50, 8, 11],
|
||||
['16-Aug-2013', 20, 24, 27, 37, 39, 5, 10],
|
||||
['13-Aug-2013', 5, 17, 20, 47, 50, 1, 4],
|
||||
['09-Aug-2013', 4, 7, 9, 23, 24, 8, 9],
|
||||
['06-Aug-2013', 17, 47, 16, 49, 31, 3, 11],
|
||||
['02-Aug-2013', 42, 36, 48, 37, 21, 7, 4],
|
||||
['30-Jul-2013', 3, 14, 4, 11, 43, 1, 6],
|
||||
['26-Jul-2013', 23, 38, 29, 12, 49, 4, 3],
|
||||
['23-Jul-2013', 19, 14, 44, 16, 15, 4, 5],
|
||||
['19-Jul-2013', 24, 35, 13, 26, 16, 5, 2],
|
||||
['16-Jul-2013', 50, 34, 47, 19, 23, 4, 6],
|
||||
['12-Jul-2013', 26, 42, 33, 18, 32, 3, 2],
|
||||
['09-Jul-2013', 18, 16, 38, 49, 31, 10, 4],
|
||||
['05-Jul-2013', 28, 4, 33, 12, 15, 1, 10],
|
||||
['02-Jul-2013', 14, 13, 11, 28, 30, 4, 5],
|
||||
['28-Jun-2013', 15, 1, 47, 28, 35, 7, 1],
|
||||
['25-Jun-2013', 4, 13, 35, 27, 5, 2, 1],
|
||||
['21-Jun-2013', 30, 11, 36, 45, 10, 1, 2],
|
||||
['18-Jun-2013', 24, 33, 17, 41, 44, 11, 1],
|
||||
['14-Jun-2013', 41, 25, 48, 10, 47, 6, 10],
|
||||
['11-Jun-2013', 7, 9, 25, 5, 41, 5, 1],
|
||||
['07-Jun-2013', 14, 26, 45, 50, 7, 2, 7],
|
||||
['04-Jun-2013', 34, 33, 40, 31, 37, 6, 1],
|
||||
['31-May-2013', 29, 43, 28, 34, 27, 10, 5],
|
||||
['28-May-2013', 34, 38, 13, 8, 26, 3, 11],
|
||||
['24-May-2013', 22, 17, 40, 7, 27, 2, 3],
|
||||
['21-May-2013', 29, 19, 8, 28, 7, 9, 5],
|
||||
['17-May-2013', 25, 24, 50, 6, 20, 9, 10],
|
||||
['14-May-2013', 24, 7, 8, 36, 27, 11, 5],
|
||||
['10-May-2013', 48, 35, 45, 1, 32, 4, 11],
|
||||
['07-May-2013', 43, 27, 13, 28, 42, 4, 6],
|
||||
['03-May-2013', 5, 49, 34, 3, 40, 2, 3],
|
||||
['30-Apr-2013', 13, 50, 40, 43, 36, 9, 5],
|
||||
['26-Apr-2013', 40, 38, 16, 24, 11, 2, 5],
|
||||
['23-Apr-2013', 50, 4, 1, 7, 10, 4, 11],
|
||||
['19-Apr-2013', 1, 46, 8, 42, 48, 4, 7],
|
||||
['16-Apr-2013', 33, 50, 22, 1, 11, 4, 6],
|
||||
['12-Apr-2013', 28, 45, 15, 5, 10, 3, 9],
|
||||
['09-Apr-2013', 15, 44, 48, 38, 35, 10, 5],
|
||||
['05-Apr-2013', 32, 1, 17, 39, 11, 7, 2],
|
||||
['02-Apr-2013', 17, 12, 41, 29, 25, 1, 4],
|
||||
['29-Mar-2013', 44, 30, 46, 43, 13, 9, 5],
|
||||
['26-Mar-2013', 44, 30, 26, 42, 4, 6, 11],
|
||||
['22-Mar-2013', 27, 32, 12, 34, 49, 9, 8],
|
||||
['19-Mar-2013', 44, 32, 19, 37, 35, 9, 1],
|
||||
['15-Mar-2013', 24, 14, 39, 4, 21, 10, 3],
|
||||
['12-Mar-2013', 50, 4, 10, 2, 22, 5, 8],
|
||||
['08-Mar-2013', 20, 42, 23, 28, 3, 8, 11],
|
||||
['05-Mar-2013', 33, 31, 19, 8, 39, 7, 2],
|
||||
['01-Mar-2013', 1, 11, 36, 29, 42, 4, 5],
|
||||
['26-Feb-2013', 12, 13, 17, 3, 30, 6, 2],
|
||||
['22-Feb-2013', 15, 37, 36, 16, 28, 2, 11],
|
||||
['19-Feb-2013', 28, 30, 44, 12, 15, 9, 8],
|
||||
['15-Feb-2013', 2, 4, 42, 28, 22, 4, 9],
|
||||
['12-Feb-2013', 28, 25, 5, 11, 16, 7, 9]
|
||||
];
|
||||
|
||||
function $(elm) {
|
||||
return document.getElementById(elm);
|
||||
}
|
||||
|
||||
function dynamicSort(property) {
|
||||
var sortOrder = 1;
|
||||
if (property[0] === "-") {
|
||||
sortOrder = -1;
|
||||
property = property.substr(1);
|
||||
}
|
||||
return function (a, b) {
|
||||
var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;
|
||||
return result * sortOrder;
|
||||
}
|
||||
}
|
||||
|
||||
function buildArray() {
|
||||
for (var x = 0; x < 51; x++) {
|
||||
var l = [];
|
||||
for (var y = 0; y < 51; y++) {
|
||||
l.push(0);
|
||||
}
|
||||
m[x] = l;
|
||||
}
|
||||
}
|
||||
|
||||
function buildTable() {
|
||||
var area = $('area');
|
||||
// clean area.
|
||||
/* while (area.lastChild) {
|
||||
area.removeChild(area.lastChild);
|
||||
}
|
||||
*/
|
||||
var table = document.createElement('table');
|
||||
var row = document.createElement('tr');
|
||||
var cell = document.createElement('td');
|
||||
var p = document.createTextNode('---')
|
||||
cell.appendChild(p);
|
||||
row.appendChild(cell);
|
||||
for (var x = 1; x < 50; x++) {
|
||||
var cell = document.createElement('td');
|
||||
var p = document.createTextNode(x)
|
||||
cell.appendChild(p);
|
||||
row.appendChild(cell);
|
||||
}
|
||||
table.appendChild(row);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
for (var y = 0; y < 51; y++) {
|
||||
var row = document.createElement('tr');
|
||||
var cell = document.createElement('td');
|
||||
var p = document.createTextNode('[' + parseInt(y + 1) + ']')
|
||||
cell.appendChild(p);
|
||||
row.appendChild(cell);
|
||||
for (var x = 1; x < 51; x++) {
|
||||
var cell = document.createElement('td');
|
||||
var p = document.createTextNode(m[y][x - 1])
|
||||
cell.appendChild(p);
|
||||
row.appendChild(cell);
|
||||
}
|
||||
table.appendChild(row);
|
||||
}
|
||||
area.appendChild(table);
|
||||
}
|
||||
|
||||
function calc() {
|
||||
var i = 0;
|
||||
for (i = 0; i < re.length - 1; i++) {
|
||||
console.log(re[i]);
|
||||
for (var s = 1; s < 6; s++) {
|
||||
var cv = re[i][s];
|
||||
console.log("row: " + cv);
|
||||
for (var n = 1; n < 6; n++) {
|
||||
if (n != s) {
|
||||
wv = re[i][n];
|
||||
console.log(wv);
|
||||
m[cv - 1][wv - 1]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTable();
|
||||
}
|
||||
|
||||
function othercalc() {
|
||||
var i = 0;
|
||||
// var p = 1 / ((-1)*re.length);
|
||||
var p = 1.0 / (re.length);
|
||||
|
||||
for (i = 0; i < re.length - 1; i++) {
|
||||
// console.log(re[i]);
|
||||
for (var s = 1; s < 6; s++) {
|
||||
var cv = re[i][s];
|
||||
// console.log("row: " + cv);
|
||||
for (var n = 1; n < 6; n++) {
|
||||
if (n != s) {
|
||||
wv = re[i][n];
|
||||
// console.log(wv);
|
||||
// m[cv-1][wv-1]++;
|
||||
var flag = false;
|
||||
for (var t = 0; t < mo.length; t++) {
|
||||
if (mo[t].a == cv && mo[t].b == wv) {
|
||||
flag = true;
|
||||
mo[t].v++;
|
||||
/*
|
||||
if (i < (re.length/2))
|
||||
mo[t].v = mo[t].v - (p * i)
|
||||
else
|
||||
*/
|
||||
mo[t].v = mo[t].v + (p * i);
|
||||
//;
|
||||
//mo[t].v = mo[t].v + 1;
|
||||
// ;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
mo.push({
|
||||
a: cv,
|
||||
b: wv,
|
||||
v: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("******************************************");
|
||||
mo.sort(dynamicSort("v"));
|
||||
|
||||
//for (var t = (mo.length - 20); t < mo.length; t++) {
|
||||
var t = mo.length - 1;
|
||||
while (line.length < 5) {
|
||||
if (line.indexOf(mo[t].a) == -1 && line.length < 5) {
|
||||
line.push(mo[t].a);
|
||||
}
|
||||
if (line.indexOf(mo[t].b) == -1 && line.length < 5) {
|
||||
line.push(mo[t].b);
|
||||
}
|
||||
t = t - 1;
|
||||
}
|
||||
|
||||
// console.log(line);
|
||||
console.log(line.sort());
|
||||
|
||||
for (var t = mo.length-1; t > (mo.length - 3); t--) {
|
||||
// if (mo[t].v >= 3) {
|
||||
if (mo[t].v > 1) {
|
||||
console.log(mo[t].a + ', ' + mo[t].b + ", " + mo[t].v)
|
||||
}
|
||||
}
|
||||
// buildTable();
|
||||
}
|
||||
|
||||
function tripCalc() {
|
||||
var blist = [[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]];
|
||||
var p = 1.0 / (re.length);
|
||||
var a, b, c, cur;
|
||||
//var trip = [];
|
||||
//console.log
|
||||
for (i = 0; i < re.length - 1; i++) {
|
||||
|
||||
for (var t = 0; t < blist.length; t++) {
|
||||
cur = blist[t];
|
||||
|
||||
a = re[i][cur[0] + 1];
|
||||
b = re[i][cur[1] + 1];
|
||||
c = re[i][cur[2] + 1];
|
||||
|
||||
|
||||
// console.log(a + ", " + b + "," + c);
|
||||
|
||||
|
||||
var found = false;
|
||||
for (y = 0; y < trip.length; y++) {
|
||||
var nums = trip[y].nums;
|
||||
|
||||
if (!found) {
|
||||
if ((nums.indexOf(a) != -1) && (nums.indexOf(b) != -1) && (nums.indexOf(c) != -1)) {
|
||||
/* console.log("nums:" + nums);
|
||||
console.log("want: " + a + ", " + b + "," + c);
|
||||
console.log("A:" + nums.indexOf(a));
|
||||
console.log("B:" + nums.indexOf(b));
|
||||
console.log("C:" + nums.indexOf(c));
|
||||
*/
|
||||
|
||||
trip[y].cnt = trip[y].cnt + (p * i);
|
||||
// trip[y].cnt = trip[y].cnt + 1;
|
||||
|
||||
// console.log(">>>" + trip[y].cnt);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
|
||||
//trip.push({nums:[a,b,c],cnt:(p * i)});
|
||||
trip.push({
|
||||
nums: [a, b, c],
|
||||
cnt: 1
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
var max = 0;
|
||||
for (y = 0; y < trip.length; y++) {
|
||||
if (trip[y].cnt > max) max = trip[y].cnt;
|
||||
}
|
||||
console.log("Max: " + max);
|
||||
for (y = 0; y < trip.length; y++) {
|
||||
if (trip[y].cnt == max) console.log(trip[y].cnt + ", " + trip[y].nums);
|
||||
}
|
||||
|
||||
|
||||
// console.log(JSON.stringify(trip));
|
||||
}
|
||||
|
||||
function starcalc() {
|
||||
var i = 0;
|
||||
var p = 1 / re.length;
|
||||
for (i = 0; i < re.length - 1; i++) {
|
||||
// console.log(re[i]);
|
||||
for (var s = 6; s < 8; s++) {
|
||||
var cv = re[i][s];
|
||||
// console.log("row: " + cv);
|
||||
for (var n = 6; n < 8; n++) {
|
||||
if (n != s) {
|
||||
wv = re[i][n];
|
||||
// console.log(wv);
|
||||
// m[cv-1][wv-1]++;
|
||||
var flag = false;
|
||||
for (var t = 0; t < mo.length; t++) {
|
||||
if (mo[t].a == cv && mo[t].b == wv) {
|
||||
flag = true;
|
||||
mo[t].v++;
|
||||
|
||||
mo[t].v = mo[t].v + (p * i);
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
mo.push({
|
||||
a: cv,
|
||||
b: wv,
|
||||
v: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("******************************************");
|
||||
mo.sort(dynamicSort("v"));
|
||||
|
||||
var t = mo.length - 1;
|
||||
|
||||
var starOutput=[];
|
||||
starOutput.push(mo[t].a);
|
||||
starOutput.push(mo[t].b);
|
||||
|
||||
|
||||
|
||||
//console.log('Stars: ' + mo[t].a + ', ' + mo[t].b);
|
||||
|
||||
console.log('Stars: ' + starOutput.sort()[0] + ', ' + starOutput.sort()[1]);
|
||||
for (var t = mo.length - 6; t < mo.length; t++) {
|
||||
if (mo[t].v >= 3) {
|
||||
console.log(mo[t].a + ', ' + mo[t].b + ", " + mo[t].v)
|
||||
}
|
||||
}
|
||||
|
||||
// buildTable();
|
||||
}
|
||||
buildArray();
|
||||
//buildTable();
|
||||
othercalc();
|
||||
console.log("---------------------------------------");
|
||||
starcalc();
|
||||
|
||||
tripCalc();
|
43
package.json
Normal file
43
package.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "silvrtree",
|
||||
"version": "0.1.1",
|
||||
"devDependencies": {
|
||||
"cheerio": "^0.20.0",
|
||||
"dateformat": "^1.0.12",
|
||||
"ejs": "^2.3.4",
|
||||
"forecast.io": "0.0.9",
|
||||
"htmlparser": "^1.7.7",
|
||||
"jade": "^1.11.0",
|
||||
"jsonfile": "^2.2.3",
|
||||
"lodash": "^4.3.0",
|
||||
"log4js": "^0.6.31",
|
||||
"mammoth": "^0.3.25-pre.1",
|
||||
"request": "^2.67.0",
|
||||
"simple-weather": "^1.2.2",
|
||||
"wordsoap": "^0.2.0",
|
||||
"xmljson": "^0.2.0",
|
||||
"xmltojson": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "^1.15.0",
|
||||
"cookie-parser": "^1.4.1",
|
||||
"cookieparser": "^0.1.0",
|
||||
"elapsed": "0.0.7",
|
||||
"errorhandler": "^1.4.3",
|
||||
"express": "^4.13.4",
|
||||
"express-session": "^1.13.0",
|
||||
"ical2json": "^0.2.0",
|
||||
"logger": "0.0.1",
|
||||
"method-override": "^2.3.5",
|
||||
"morgan": "^1.7.0",
|
||||
"node-cron": "^1.0.0",
|
||||
"scrape": "^0.2.3",
|
||||
"string": "^3.3.1",
|
||||
"sugar-date": "^1.5.1",
|
||||
"ultrases": "^0.1.3",
|
||||
"unstyler": "^0.2.2"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node web-server.js"
|
||||
}
|
||||
}
|
49
recipes.json
Normal file
49
recipes.json
Normal file
@ -0,0 +1,49 @@
|
||||
{"recipes":[
|
||||
{"url":"", "title":""},
|
||||
|
||||
|
||||
{"url":"http://www.simplyrecipes.com/recipes/grilled_lime_chicken_with_black_bean_sauce/", "title":"Grilled Lime Chicken with Black Bean Sauce Recipe"},
|
||||
{"url":"http://www.marksdailyapple.com/shakshuka-eggs-poached-in-spicy-tomato-sauce/#axzz29jTSubMo", "title":"Shakshuka (Eggs Poached in Spicy Tomato Sauce) "},
|
||||
{"url":"http://www.marksdailyapple.com/spiced-pork-and-butternut-squash-with-sage/#axzz29jTSubMo", "title":"Spiced Pork and Butternut Squash with Sage"},
|
||||
{"url":"http://www.marksdailyapple.com/dairy-free-green-goddess-dressing/#axzz29jTSubMo", "title":"Dairy-Free Green Goddess Dressing"},
|
||||
{"url":"http://www.marksdailyapple.com/pork-stuffed-jalapeno-peppers/#axzz29jTSubMo", "title":"Pork-Stuffed Jalapeño Peppers"},
|
||||
{"url":"http://www.marksdailyapple.com/herb-chicken-cooked-under-a-brick/#axzz29jTSubMo", "title":"Herb Chicken Cooked Under a Brick"},
|
||||
{"url":"http://www.marksdailyapple.com/balsamic-glazed-drumsticks/#axzz29jTSubMo", "title":"Balsamic-Glazed Drumsticks"},
|
||||
{"url":"http://www.marksdailyapple.com/slow-cooked-coconut-ginger-pork/#axzz29jTSubMo", "title":"Slow-Cooked Coconut Ginger Pork"},
|
||||
{"url":"http://www.marksdailyapple.com/lime-and-basil-beef-kebabs/#axzz29jTSubMo", "title":"Lime and Basil Beef Kebabs"},
|
||||
{"url":"http://www.marksdailyapple.com/taco-bowl-with-crispy-kale-chips/#axzz29jTSubMo", "title":"Taco Bowl with Crispy Kale Chips"},
|
||||
{"url":"http://www.marksdailyapple.com/grilled-eggs-with-mexican-chorizo/#axzz29jTSubMo", "title":"Grilled Eggs with Mexican Chorizo"},
|
||||
{"url":"http://www.marksdailyapple.com/banh-mi-salad/#axzz29jTSubMo", "title":"Banh Mi Salad"},
|
||||
{"url":"http://www.marksdailyapple.com/tender-lemon-parsley-brisket/#axzz29jTSubMo", "title":"Tender Lemon-Parsley Brisket"},
|
||||
{"url":"http://www.marksdailyapple.com/butter-stuffed-chicken-kiev/#axzz29jTSubMo", "title":"Butter-Stuffed Chicken Kiev"},
|
||||
{"url":"http://www.marksdailyapple.com/primal-chicken-tikka-masala/#axzz29jTSubMo", "title":"Primal Chicken Tikka Masala"},
|
||||
{"url":"http://www.nerdfitness.com/blog/2012/02/21/how-to-cook-paleo-spaghetti/", "title":"Paleo Spaghetti"},
|
||||
{"url":"http://www.nerdfitness.com/blog/2011/02/21/a-decent-meal/", "title":"How to Grow Up And Cook a Decent Meal"},
|
||||
{"url":"http://www.marksdailyapple.com/fajita-frittata-with-avocado-salsa/#axzz29jTSubMo", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
{"url":"", "title":""},
|
||||
]}
|
3
routes/btc.js
Normal file
3
routes/btc.js
Normal file
@ -0,0 +1,3 @@
|
||||
/**
|
||||
* Created by martind on 14/11/14.
|
||||
*/
|
74
savetodisk.js
Normal file
74
savetodisk.js
Normal file
@ -0,0 +1,74 @@
|
||||
// Example use of simplecrawler, courtesy of @breck7! Thanks mate. :)
|
||||
|
||||
/**
|
||||
* @param String. Domain to download.
|
||||
* @Param Function. Callback when crawl is complete.
|
||||
*/
|
||||
var downloadSite = function(domain, callback) {
|
||||
var fs = require("node-fs"),
|
||||
url = require("url"),
|
||||
path = require("path"),
|
||||
Crawler = require("simplecrawler").Crawler;
|
||||
|
||||
var myCrawler = new Crawler(domain);
|
||||
myCrawler.interval = 250;
|
||||
myCrawler.maxConcurrency = 5;
|
||||
myCrawler.maxDepth = 1;
|
||||
|
||||
myCrawler.on("fetchcomplete", function(queueItem, responseBuffer, response) {
|
||||
|
||||
// Parse url
|
||||
var parsed = url.parse(queueItem.url);
|
||||
|
||||
// Rename / to index.html
|
||||
if (parsed.pathname === "/") {
|
||||
parsed.pathname = "/index.html";
|
||||
}
|
||||
|
||||
// Where to save downloaded data
|
||||
var outputDirectory = path.join(__dirname, domain);
|
||||
|
||||
// Get directory name in order to create any nested dirs
|
||||
var dirname = outputDirectory + parsed.pathname.replace(/\/[^\/]+$/, "");
|
||||
|
||||
// Path to save file
|
||||
var filepath = 'snapshots/' + outputDirectory + parsed.pathname;
|
||||
|
||||
// Check if DIR exists
|
||||
fs.exists(dirname, function(exists) {
|
||||
|
||||
// If DIR exists, write file
|
||||
if (exists) {
|
||||
fs.writeFile(filepath, responseBuffer, function() {});
|
||||
} else {
|
||||
// Else, recursively create dir using node-fs, then write file
|
||||
fs.mkdir(dirname, 0755, true, function() {
|
||||
fs.writeFile(filepath, responseBuffer, function() {});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
console.log("I just received %s (%d bytes)", queueItem.url, responseBuffer.length);
|
||||
console.log("It was a resource of type %s", response.headers["content-type"]);
|
||||
|
||||
});
|
||||
|
||||
// Fire callback
|
||||
myCrawler.on("complete", function() {
|
||||
callback();
|
||||
});
|
||||
|
||||
// Start Crawl
|
||||
myCrawler.start();
|
||||
|
||||
};
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
console.log("Usage: node savetodisk.js mysite.com");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
downloadSite(process.argv[2], function() {
|
||||
console.log("Done!");
|
||||
});
|
57
scrapetest.js
Normal file
57
scrapetest.js
Normal file
@ -0,0 +1,57 @@
|
||||
var request = require('request');
|
||||
var cheerio = require('cheerio');
|
||||
|
||||
var url = 'https://www.list.co.uk/events/days-out/when:this%20weekend/location:Dumbarton(55.9460,-4.5556)/distance:20/';
|
||||
|
||||
|
||||
var j=[];
|
||||
|
||||
|
||||
request(url, function(err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
$ = cheerio.load(body);
|
||||
console.log($);
|
||||
// TODO: scraping goes here!
|
||||
|
||||
$('.resultsRow').each( function(div)
|
||||
{
|
||||
var item={};
|
||||
var eventSummary = $(this).find('.eventSummary').first();
|
||||
var byDate = $(this).find('.byDate').first();
|
||||
|
||||
var title = eventSummary.find('.head').first();
|
||||
var description = eventSummary.find('P').first();
|
||||
var link = ' https://www.list.co.uk' + eventSummary.find('A').first().attr('href');
|
||||
|
||||
var price = byDate.find('.price').first();
|
||||
var dt = byDate.find('.dtstart').first().attr('title');
|
||||
console.log('+++');
|
||||
// console.log($(this).html());
|
||||
console.log('###');
|
||||
console.log(description.text());
|
||||
console.log(link);
|
||||
console.log('---');
|
||||
|
||||
item.title = title.text();
|
||||
item.description = description.text();
|
||||
item.link = link;
|
||||
item.price = price.text();
|
||||
item.date = dt;
|
||||
|
||||
j.push(item);
|
||||
});
|
||||
|
||||
console.log(j);
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
https://www.list.co.uk/event/351218-pollock-parkrun/
|
||||
|
||||
<div class="eventSummary clearfix noImage">
|
||||
<a href="/event/351218-pollock-parkrun/">
|
||||
<h2 class="head">Pollock parkrun</h2>
|
||||
</a>
|
||||
<p>An informal weekly 5k run in Pollok Country Park. Everyone is welcome, no matter how fast or slow (you're welcome to walk the route, bring your dog or push a buggy), so you can use it as a one-off fitness test, a chance to get some fresh air or come every week to try to beat your personal best time. It's friendly and…</p>
|
||||
</div>*/
|
41
single.js
Normal file
41
single.js
Normal file
@ -0,0 +1,41 @@
|
||||
var express = require('express'), path = require('path'), http = require('http')
|
||||
;
|
||||
var app = express();
|
||||
GLOBAL.lastcheck = 0;
|
||||
var btcCache = {}, fxCache = {} , trainCache = {};
|
||||
|
||||
app.configure(function () {
|
||||
app.set('port', process.env.PORT || 4545);
|
||||
app.set('view engine', 'ejs');
|
||||
app.use(express.logger('dev'));
|
||||
app.use(express.cookieParser());
|
||||
app.use(express.session({secret: '1234567890QWERTY'}));
|
||||
/* 'default', 'short', 'tiny', 'dev' */
|
||||
app.use(express.methodOverride());
|
||||
|
||||
app.use(express.bodyParser());
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "X-Requested-With");
|
||||
next();
|
||||
});
|
||||
app.use(app.router);
|
||||
app.use(express.static(path.join(__dirname, 'app')));
|
||||
app.use(express.errorHandler({dumpExceptions: true, showStack: true}));
|
||||
|
||||
app.get('/temp', function (req, res) {
|
||||
res.render('pages/temp');
|
||||
});
|
||||
|
||||
app.get('/weight', function (req, res) {
|
||||
res.render('pages/weight');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* create the server
|
||||
*/
|
||||
http.createServer(app).listen(app.get('port'), function () {
|
||||
console.log("Express server listening on port " + app.get('port'));
|
||||
});
|
52
snapshot.js
Normal file
52
snapshot.js
Normal file
@ -0,0 +1,52 @@
|
||||
var Crawler = require("simplecrawler"),fs = require('fs');
|
||||
|
||||
|
||||
//var myCrawler = new Crawler("http://www.bbc.co.uk/food/recipes/chicken_piperade_with_23608");
|
||||
|
||||
var myCrawler = new Crawler("www.bbc.co.uk", "/food/recipes/chicken_piperade_with_23608", 80);
|
||||
|
||||
var htmlfile = __dirname + '/' + 'test.html';
|
||||
|
||||
myCrawler.maxDepth = 1;
|
||||
//myCrawler.interval = 10000; // Ten seconds
|
||||
myCrawler.maxConcurrency = 1;
|
||||
|
||||
|
||||
myCrawler.on('crawlstart', function() {
|
||||
console.log('Crawling started...');
|
||||
});
|
||||
|
||||
myCrawler.on('fetchstart ', function(a, b) {
|
||||
console.log('fetchstart ...');
|
||||
console.log(a);
|
||||
console.log(b);
|
||||
});
|
||||
|
||||
myCrawler.on('fetcherror ', function(a, b) {
|
||||
console.log('Crawling error...');
|
||||
console.log(a);
|
||||
console.log(b);
|
||||
});
|
||||
|
||||
myCrawler.on('fetchclienterror ', function(a, b) {
|
||||
console.log('fetchclienterror error...');
|
||||
console.log(a);
|
||||
console.log(b);
|
||||
});
|
||||
|
||||
myCrawler.on('queueadd ', function(a) {
|
||||
console.log('fetchclienterror error...');
|
||||
console.log(a);
|
||||
|
||||
});
|
||||
|
||||
myCrawler.on("fetchcomplete", function(queueItem, responseBuffer, response) {
|
||||
console.log("I just received %s (%d bytes)", queueItem.url, responseBuffer.length);
|
||||
console.log("It was a resource of type %s", response.headers['content-type']);
|
||||
|
||||
// Do something with the data in responseBuffer
|
||||
|
||||
fs.writeFileSync(htmlfile, responseBuffer);
|
||||
});
|
||||
|
||||
myCrawler.start();
|
24
views/pages/cinema.ejs
Normal file
24
views/pages/cinema.ejs
Normal file
@ -0,0 +1,24 @@
|
||||
<% include ../partials/head %>
|
||||
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<div class="mui-text-headline mui-text-accent">Cinema</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="container" class="mui-panel">
|
||||
|
||||
<%
|
||||
for (var i = 0; i < data.length; i++) { %>
|
||||
<div class="mui-row">
|
||||
<div><a href='<%= data[i].link %>'> <%= data[i].title %> </a></div>
|
||||
<p><%= data[i].description %></p>
|
||||
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% include ../partials/cinemas %>
|
||||
<% include ../partials/footer %>
|
54
views/pages/clock.ejs
Normal file
54
views/pages/clock.ejs
Normal file
@ -0,0 +1,54 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
|
||||
</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="viewport" content="width=360; initial-scale=1;">
|
||||
<link href="//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700" rel="stylesheet" type="text/css">
|
||||
<link href='//fonts.googleapis.com/css?family=Share+Tech+Mono' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/clock.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/sugar/1.4.1/sugar.min.js"></script>
|
||||
|
||||
<script src="libs/microevent.js"></script></head>
|
||||
<script src="libs/skycons.js"></script></head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="clock"><div id="clockDisplay"></div></div>
|
||||
<div id="weather">
|
||||
<div id="wCurrent" class="weatherBit">Currently<div id="wCtext">xxx</div></div>
|
||||
<div id="wLater" class="weatherBit">Later<div id="wLtext">xxx</div></div>
|
||||
<div id="wToday" class="weatherBit">Today<div id="wTtext">xxx</div></div>
|
||||
<div id="wDaily"><div id="wTtext">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td><canvas id="icon1" width="95" height="95"></canvas></td>
|
||||
<td><canvas id="icon2" width="95" height="95"></canvas></td>
|
||||
<td><canvas id="icon3" width="95" height="95"></canvas></td>
|
||||
<td><canvas id="icon4" width="95" height="95"></canvas></td>
|
||||
<td><canvas id="icon5" width="95" height="95"></canvas></td>
|
||||
<td><canvas id="icon6" width="95" height="95"></canvas></td>
|
||||
<td><canvas id="icon7" width="95" height="95"></canvas></td>
|
||||
<td><canvas id="icon8" width="95" height="95"></canvas></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="d1" class="wday"></td>
|
||||
<td id="d2" class="wday"></td>
|
||||
<td id="d3" class="wday"></td>
|
||||
<td id="d4" class="wday"></td>
|
||||
<td id="d5" class="wday"></td>
|
||||
<td id="d6" class="wday"></td>
|
||||
<td id="d7" class="wday"></td>
|
||||
<td id="d8" class="wday"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div></div>
|
||||
</div>
|
||||
<div id="misc"></div>
|
||||
</body>
|
||||
<script src="js/clock.js"></script>
|
||||
</html>
|
25
views/pages/events.ejs
Normal file
25
views/pages/events.ejs
Normal file
@ -0,0 +1,25 @@
|
||||
<% include ../partials/head %>
|
||||
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<div class="mui-text-headline mui-text-accent">Events</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="container" class="mui-panel">
|
||||
|
||||
<%
|
||||
for (var i = 0; i < data.length; i++) { %>
|
||||
<div class="mui-row">
|
||||
<div><a href='<%= data[i].link %>'> <%= data[i].title %> </a></div>
|
||||
<p><%= data[i].description %></p>
|
||||
<p><%= data[i].date %></p>
|
||||
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% include ../partials/footer %>
|
363
views/pages/slack.ejs
Normal file
363
views/pages/slack.ejs
Normal file
@ -0,0 +1,363 @@
|
||||
<% include ../partials/head %>
|
||||
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<div class="mui-text-headline mui-text-accent">Slack - I have plenty of talent and vision I just don't give a damn</div>
|
||||
</div>
|
||||
<div id="container" class="mui-panel">
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-3" id="one"></div>
|
||||
<div class="mui-col-md-3 " id="two"></div>
|
||||
<div class="mui-col-md-3 " id="three"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mui-panel">
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Starting Points/Metasites</div>
|
||||
<ul>
|
||||
<li><a href="https://www.silvrtree.co.uk/today">Today</a></li>
|
||||
<li><a href="https://www.silvrtree.co.uk/events">Events</a></li>
|
||||
<li><a href="https://www.silvrtree.co.uk/cinema/0">Cinema</a></li>
|
||||
<li><a href="https://feedly.com/#my">Feedly</a></li>
|
||||
<li><a href="https://www.reddit.com">Reddit</a></li>
|
||||
<li><a href="http://www.facebook.com/">Facebook</a></li>
|
||||
<li><a href="http://www.yahoo.com/">Yahoo!</a></li>
|
||||
<li><a href="https://stackedit.io/editor">Journal Editor</a></li>
|
||||
<li><a href="http://www.unmajestic.com/home/bookmarks.php">Slack Bookmarks</a></li>
|
||||
<li><a href="http://www.rssmix.com/u/7711845">Paleo Mix</a></li>
|
||||
<li><a href="http://status.hivehome.com/">Hive Status</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Tools</div>
|
||||
<ul>
|
||||
<li><a href='https://kanbanflow.com'>Kanban Flow</a></li>
|
||||
<li><a href="https://www.linode.com/">Linode</a></li>
|
||||
<li><a href="http://www.colorzilla.com/gradient-editor/">CSS Gradient Generator</a></li>
|
||||
<li><a href="http://utilities-online.info/xmltojson">XML to JSON</a></li>
|
||||
<li><a href="http://shancarter.com/data_converter">CSV to JSON</a></li>
|
||||
<li><a href="http://cubic-bezier.com/">Cubic Bezier</a></li>
|
||||
<li><a href="http://gskinner.com/RegExr/">RegEx Tool</a></li>
|
||||
<li><a href="http://closure-compiler.appspot.com/home">Closure Compiler</a></li>
|
||||
<li><a href="http://jsonlint.com/">JSON Lint</a></li>
|
||||
<li><a href="http://jsoneditoronline.org/">JSON Editor</a></li>
|
||||
<li><a href="http://www.base64decode.org/">Base64 Decoder</a></li>
|
||||
<li><a href="http://jsbeautifier.org/">JS Beautifier</a></li>
|
||||
<li><a href="http://spritepad.wearekiss.com/">Spritepad</a></li>
|
||||
<li><a href="http://draeton.github.com/stitches/">Sprite Sheet Generator</a></li>
|
||||
<li><a href="http://www.cleancss.com/">CSS Optimizer</a></li>
|
||||
<li><a href="http://fontello.com/">Icon Font Generator</a></li>
|
||||
<li><a href="http://html2jade.aaron-powell.com/">HTML to Jade</a></li>
|
||||
<li><a href="http://cdnjs.com//">Cloudflare JS CDN</a></li>
|
||||
<li><a href="http://www.willpeavy.com/minifier/">HTML Minifier</a></li>
|
||||
<li><a href='https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet'>XSS Cheat Sheet</a></li>
|
||||
<li><a href='http://jsfiddle.net/'>JSFiddle</a></li>
|
||||
<li><a href="http://jsbin.com/">JS Bin</a></li>
|
||||
<li><a href='https://draftin.com/documents'>Draftin</a></li>
|
||||
<li><a href="https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html">Android Asset</a></li>
|
||||
<li><a href="https://xkpasswd.net/s/">Password Generator</a></li>
|
||||
<li><a href="https://howsecureismypassword.net/">Password Checker</a></li>
|
||||
<li><a href="https://archive.today">Archive Today</a></li>
|
||||
<li><a href="http://staticmapmaker.com/google/">Static Map Generator</a></li>
|
||||
<li><a href="https://httpbin.org/">AJAX Endpoints</a></li>
|
||||
<li><a href="https://tools.bartlweb.net/webssh/">WebSSH</a></li>
|
||||
|
||||
<li><span id='newPassword'>Generate Password</span></li>
|
||||
</ul>
|
||||
<div id='passwordOut' class='password' style='display:none;'></div>
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Bitcoin <span id="btc"></span></div>
|
||||
<ul>
|
||||
<li><a href="https://www.bitstamp.net">Bitstamp</a></li>
|
||||
<li><a href="https://www.kraken.net">Kraken</a></li>
|
||||
<li><a href="https://cryptowat.ch/">Cryptowat.ch</a></li>
|
||||
<li><a href="http://www.coindesk.com/price/">BTC Chart</a></li>
|
||||
<li><a href="https://bitcoinwisdom.com/">BTC Chart 2</a></li>
|
||||
<li><a href="http://bitcoinity.org/markets/bitstamp/USD">BitStamp Chart</a></li>
|
||||
<li><a href="http://btc-chart.com/market/bitstamp/86400">Bitstamp Chart 2</a></li>
|
||||
<li><a href="https://bitbargain.co.uk">BitBargin UK</a></li>
|
||||
<li><a href="https://yacuna.com/">Yacuna UK</a></li>
|
||||
<li><a href="http://blockchain.info/">Blockchain</a></li>
|
||||
<li><a href="http://bitminter.com/">Bitminter</a></li>
|
||||
<li><a href="http://preev.com/">BTC Exchange Rate</a></li>
|
||||
<li><a href="http://www.silvrtree.co.uk/watch.html">CFT Watcher</a>
|
||||
<span style="cursor: pointer;"
|
||||
onclick="popitoutSmall('http://www.silvrtree.co.uk/watch.html');"><img
|
||||
src="gfx/popout.png"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Package Tracking</div>
|
||||
<!-- Computer News -->
|
||||
<ul><li><a href="http://m.ups.com/">UPS</a></li></ul>
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Weather</div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G82%201RG">Dumbarton
|
||||
Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=dumbarton,%20uk&wuSelect=WEATHER">WU
|
||||
Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://weather.yahoo.com/forecast/UKXX0663.html?unit=c">Y! Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G9%202SU">Glasgow
|
||||
Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=glasgow,%20uk&wuSelect=WEATHER">WU
|
||||
Glasgow Weather</a>
|
||||
</li>
|
||||
<li><a href="http://www.nowcast.co.uk/lightning/">Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.upminsterweather.co.uk/test/live_lightning.htm">Other Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.meteorologica.info/freedata_lightning.htm">Closer Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.malvernwx.co.uk/lightning_data/lightning.htm">Multiple Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.blitzortung.org/Webpages/index.php">European Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.madpaddler.net/wxlightning.php">East Kilbride Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.bordersweather.co.uk/wxlightning.php">Borders Lightning</a>
|
||||
</li>
|
||||
<li><a href='http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=map&lang=en'>Best Live Lightning</a></li>
|
||||
<li><a href="http://www.madpaddler.net/wxais.php">Ships</a></li>
|
||||
<li><a href='http://www.raintoday.co.uk/'>Rain Today</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Free Email WEBpages</div>
|
||||
<!-- Free Email WEBpages -->
|
||||
<ul>
|
||||
<li><a href="http://gmail.google.com/">Gmail</a></li>
|
||||
<li>
|
||||
<a href="http://www.unmajestic.com/webmail/">Unmajestic Webmail</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.artizanconsulting.co.uk/webmail/">Artizan Webmail</a>
|
||||
</li>
|
||||
<li><a href="http://mail.yahoo.com">Yahoo Mail</a></li>
|
||||
<li>
|
||||
<a href="https://www.guerrillamail.com/">Guerrilla Mail Anti Spam</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Contracting</div>
|
||||
<ul>
|
||||
<li><a href='https://outsauce.backofficeportal.com/Secure/Candidate/Default.aspx'>Outsauce Timesheets</a></li>
|
||||
<li><a href='https://worksheets.computerfutures.com/'>CF Timesheets</a></li>
|
||||
<li><a href="http://www.monster.co.uk/">monster</a></li>
|
||||
<li><a href="http://www.cwjobs.co.uk/">cwjobs</a></li>
|
||||
<li><a href="http://www.s1jobs.com/myaccount/">s1jobs</a></li>
|
||||
<li><a href="http://www.jobserve.com/">jobserve</a></li>
|
||||
<li><a href="http://www.jobsite.co.uk/jbe/myprofile/">jobsite</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.itjobswatch.co.uk/contracts/scotland/asp.do">IT Jobs Watch Scotland</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Entertainment</div>
|
||||
<!-- Entertainment -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://genre.amazingradio.co.uk:8000/stream.mp3?arplayer=1">Amazing Radio Chill</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.cineworld.co.uk/cinemas/28?fallback=false&isMobileAgent=false">Cineworld</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.showcasecinemas.co.uk/showtimes/default.asp?selectTheatre=8508">Showcase</a>
|
||||
</li>
|
||||
<li><a href="http://www.imdb.com/">Imdb</a></li>
|
||||
<li><a href="http://www.epguides.com/">EPGuides</a></li>
|
||||
<li><a href="http://eztv.it">Eztv</a></li>
|
||||
<li><a href="http://www.mininova.org">Mininova</a></li>
|
||||
<li><a href="http://www.scrapetorrent.com">Scrapetorrent</a></li>
|
||||
<li>
|
||||
<a href="http://glasgow.myvillage.com/events">Whats on In Glasgow</a>
|
||||
</li>
|
||||
<li><a href="http://www.5pm.co.uk/Search/Event/">Local Events</a>
|
||||
</li>
|
||||
<li><a href="http://necta.jansenit.com:8000/necta192.mp3">Nectarine</a>
|
||||
</li>
|
||||
<li><a href="/playlists/str.pls">STR - Space Travel Radio</a>
|
||||
</li>
|
||||
<li><a href="/playlists/musik.drumstep.pls">musik.drumstep</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Travel <span id="fx"></div>
|
||||
<!-- Travel -->
|
||||
<span>DBEGLQ: <span id="dbeglq">---</span></span> <span>GLQDBE: <span id="glqdbe">---</span></span>
|
||||
<div id='trainResults' style='display:none'></div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href='http://www.journeycheck.com/firstscotrail'>Journey Check</a>
|
||||
<a href="http://www.bbc.co.uk/travel/2650802/incidents/road">BBC Road
|
||||
news</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/DBE/WES/To?ar=true">DBE->WES</a>
|
||||
/
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=DBE&to=WES">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true">WES->DBE</a>
|
||||
<span style="cursor: pointer;"
|
||||
onclick="popitout('http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true#skip-content-hold');"><img
|
||||
src="gfx/popout.png"></span>
|
||||
/
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=WES&to=DBE">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=DBE">DBE Board</a>
|
||||
/
|
||||
<a href="http://www.stationboard.uk/index.php?view=desktop&station1=DBE&direction=departures">Advanced</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=GLQ">GLQ Trains</a> /
|
||||
<a href="http://www.stationboard.uk/index.php?view=desktop&station1=GLQ&direction=departures">Adv</a> /
|
||||
<a href="http://www.traintime.uk/index.php?view=desktop&from=GLQ&to=DBE">GLQ->DBE</a>
|
||||
</li>
|
||||
<li><a href="http://www.kayak.co.uk/">Kayak</a></li>
|
||||
<li><a href="http://www.travelocity.co.uk/">Travelocity</a></li>
|
||||
<li><a href="http://www.travel.com/sitemap.htm">Travel.com</a></li>
|
||||
<li>
|
||||
<a href="http://www.landings.com/_landings/pages/commercial.html">Airlines</a>
|
||||
</li>
|
||||
<li><a href="http://www.flightstats.com">Landings</a></li>
|
||||
<li>
|
||||
<a href="http://www.lib.utexas.edu/Libs/PCL/Map_collection/map_sites/map_sites.html#general">Maps</a>
|
||||
</li>
|
||||
<li><a href="http://www.sitesatlas.com/Maps/">Maps2</a></li>
|
||||
<li><a href="http://www.itn.net/">ITN</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">HAFAS</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">DieBahn</a></li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelreg.html">RailUSA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.trainweb.com/frames_travel.html">TrainWeb</a>
|
||||
</li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelw2.html">RailWorld</a>
|
||||
</li>
|
||||
<li><a href="http://www.xe.net/currency/">Currency Converter</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.cia.gov/cia/publications/factbook/index.html">CIA</a>
|
||||
</li>
|
||||
<li><a href="http://maps.google.com/">GMaps</a></li>
|
||||
<li><a href='https://unop.uk/tube/'>Tube Status</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Computer Software, etc.</div>
|
||||
<ul>
|
||||
<li><a href="">Portable Apps</a></li>
|
||||
<li><a href="http://www.newfreeware.com/">NewFreeware</a></li>
|
||||
<li>
|
||||
<a href="http://www.makeuseof.com/tag/portable-software-usb/">Portable Software</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.portablefreeware.com/">Portable Freeware Collection</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Reference & Special sites</div>
|
||||
<!-- Reference and Special sites -->
|
||||
<ul>
|
||||
<li><a href="http://www.glossarist.com/default.asp">Glossaries</a>
|
||||
</li>
|
||||
<li><a href="http://www.convert-me.com/en/">Converters</a></li>
|
||||
<li>
|
||||
<a href="http://decoder.americom.com/cgi-bin/decoder.cgi">DECODE</a>
|
||||
</li>
|
||||
<li><a href="http://www.rxlist.com/">Drugs</a></li>
|
||||
<li><a href="http://www.ncbi.nlm.nih.gov/PubMed/">Medline</a></li>
|
||||
<li>
|
||||
<a href="http://www.logos.it/dictionary/owa/sp?lg=EN">Translation</a>
|
||||
</li>
|
||||
<li><a href="http://www.onelook.com/">One Look</a></li>
|
||||
<li><a href="http://www.defenselink.mil/">US Military</a></li>
|
||||
<li><a href="http://www.fedworld.gov/">US Fed</a></li>
|
||||
<li><a href="http://www.ih2000.net/ira/legal.htm">Legal</a></li>
|
||||
<li><a href="http://www.nih.gov/">NIH</a></li>
|
||||
<li><a href="http://www.refdesk.com/">RefDESK</a></li>
|
||||
<li><a href="http://www.britannica.com/">Britannica</a></li>
|
||||
<li><a href="http://www.capitolimpact.com/gw/">States</a></li>
|
||||
<li><a href="http://www.packtrack.com/">PackTrack</a></li>
|
||||
<li><a href="http://www.acronymfinder.com/">Acronym</a></li>
|
||||
<li><a href="http://www.visualthesaurus.com/">V-Thes</a></li>
|
||||
<li>
|
||||
<a href="http://www.timelineindex.com/content/home/forced">Timelines</a>
|
||||
</li>
|
||||
<li><a href="http://en.wikipedia.org/wiki/Main_Page">Wikipedia</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-md-4">
|
||||
<div class="mui-text-title mui-text-black">Earth and Beyond</div>
|
||||
<!-- Good Reading Misc. -->
|
||||
<ul>
|
||||
<li><a href="http://enbarsenal.com">ENB Arsenal</a></li>
|
||||
<li><a href="http://enb.wikia.com/">ENB Wikia</a></li>
|
||||
<li><a href="http://enb.gearlist.co.uk/">Gear List</a></li>
|
||||
<li><a href='http://forum.enb-emulator.com/'>Emu Forum</a></li>
|
||||
<li><a href="http://net-7.org/wiki/index.php?title=Main_Page">Net 7 Wiki</a></li>
|
||||
<li><a href="http://spaceengineers.wikia.com/wiki/Space_Engineers_Wiki">Space Engineers Wiki</a></li>
|
||||
<li><a href="http://forums.keenswh.com/">Space Engineers Forum</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id='weather' class="mui-panel"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
<script src="libs/ejs.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</html>
|
46
views/pages/temp.ejs
Normal file
46
views/pages/temp.ejs
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="Temp">
|
||||
<head>
|
||||
<title>Temp</title>
|
||||
<style>
|
||||
a[ ng-click ] {
|
||||
color: #ff00cc;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<link href="//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" type="text/css" href="css/mui.css">
|
||||
<link rel="stylesheet" type="text/css" href="../css/mui.css">
|
||||
<style>
|
||||
body{font-family:'Roboto Slab', "Helvetica Neue", Helvetica, Arial}ul{margin:0;padding:0}li{display:inline;margin:0;padding:0 4px 0 0}.dates{padding:2px;border:solid 1px #80007e;background-color:#ffffff}#btc,#fx{font-size:75%}.up,.ontime{color:darkgreen}.down,.delayed{color:darkred}.nochange{color:#000000}.password{border:1px solid #cccccc;background-color:#efefef;font-family:monospace;white-space:pre}.mui--text-danger{color:#F44336}
|
||||
</style>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/sugar/1.4.1/sugar.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body ng-controller="TempController">
|
||||
<div class="mui-container">
|
||||
<table class="mui-table">
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>Reading</td>
|
||||
</tr>
|
||||
<tr ng-repeat="entry in tempData" >
|
||||
<td>{{ entry.date }}</td><td>{{ entry.reading }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
<script src="js/temp.js"></script>
|
||||
|
||||
|
||||
|
||||
</html>
|
16
views/pages/today.ejs
Normal file
16
views/pages/today.ejs
Normal file
@ -0,0 +1,16 @@
|
||||
<% include ../partials/head %>
|
||||
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<div class="mui-text-headline mui-text-accent">Today</div>
|
||||
</div>
|
||||
|
||||
<% include ../partials/weather %>
|
||||
<% include ../partials/trains %>
|
||||
<% include ../partials/calendar %>
|
||||
<% include ../partials/history %>
|
||||
<% include ../partials/tv %>
|
||||
|
||||
</div>
|
||||
|
||||
<% include ../partials/footer %>
|
4
views/partials/angular_footer.ejs
Normal file
4
views/partials/angular_footer.ejs
Normal file
@ -0,0 +1,4 @@
|
||||
</body>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/sugar/1.4.1/sugar.min.js"></script>
|
||||
</html>
|
22
views/partials/angular_head.ejs
Normal file
22
views/partials/angular_head.ejs
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="Temp">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="viewport" content="width=360; initial-scale=1;">
|
||||
<meta charset="UTF-8">
|
||||
<title>Events</title>
|
||||
|
||||
<meta name="Author" content="" />
|
||||
<link href="//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" type="text/css" href="css/mui.css">
|
||||
<link rel="stylesheet" type="text/css" href="../css/mui.css">
|
||||
<style>
|
||||
body{font-family:'Roboto Slab', "Helvetica Neue", Helvetica, Arial}ul{margin:0;padding:0}li{display:inline;margin:0;padding:0 4px 0 0}.dates{padding:2px;border:solid 1px #80007e;background-color:#ffffff}#btc,#fx{font-size:75%}.up,.ontime{color:darkgreen}.down,.delayed{color:darkred}.nochange{color:#000000}.password{border:1px solid #cccccc;background-color:#efefef;font-family:monospace;white-space:pre}.mui--text-danger{color:#F44336}
|
||||
</style>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/sugar/1.4.1/sugar.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
13
views/partials/calendar.ejs
Normal file
13
views/partials/calendar.ejs
Normal file
@ -0,0 +1,13 @@
|
||||
<% if (data.cal.entries.length > 0 ) {%>
|
||||
<div id="container" class="mui-panel">
|
||||
<h2>Calendar</h2>
|
||||
<%
|
||||
for (var i = 0; i < data.cal.entries.length; i++) { %>
|
||||
|
||||
<div class="mui-row"><div class="mui-col-md-12"><%- data.cal.entries[i].combined %></div></div>
|
||||
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
|
||||
<% } %>
|
6
views/partials/cinemas.ejs
Normal file
6
views/partials/cinemas.ejs
Normal file
@ -0,0 +1,6 @@
|
||||
<div class="mui-container">
|
||||
<a href="/cinema/0">Cineworld Glasgow</a> /
|
||||
<a href="/cinema/1">Imax Science Centre</a> /
|
||||
<a href="/cinema/2">Showcase Phoenix</a>
|
||||
|
||||
</div>
|
3
views/partials/footer.ejs
Normal file
3
views/partials/footer.ejs
Normal file
@ -0,0 +1,3 @@
|
||||
</body>
|
||||
|
||||
</html>
|
65
views/partials/head.ejs
Normal file
65
views/partials/head.ejs
Normal file
@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<title>Events</title>
|
||||
|
||||
<meta name="Author" content="" />
|
||||
<link href="//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" type="text/css" href="css/mui.css">
|
||||
<link rel="stylesheet" type="text/css" href="../css/mui.css">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto Slab', "Helvetica Neue", Helvetica, Arial;
|
||||
}
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
|
||||
.dates {
|
||||
padding: 2px;
|
||||
border: solid 1px #80007e;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#btc, #fx {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.up, .ontime {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.down, .delayed {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.nochange {
|
||||
color: #000000;
|
||||
}
|
||||
.password {
|
||||
border: 1px solid #cccccc;
|
||||
background-color: #efefef;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.mui--text-danger {
|
||||
color: #F44336;
|
||||
}
|
||||
</style>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
|
||||
<script src="libs/microevent.js"></script></head>
|
||||
|
||||
<body>
|
14
views/partials/history.ejs
Normal file
14
views/partials/history.ejs
Normal file
@ -0,0 +1,14 @@
|
||||
<% if (data.history.length > 0 ) {%>
|
||||
<div id="container" class="mui-panel">
|
||||
<h2>Today in history</h2>
|
||||
<div class="mui-row"><div class="mui-col-md-12">
|
||||
<%
|
||||
for (var i = 0; i < data.history.length; i++) { %>
|
||||
|
||||
<p><%- data.history[i] %></p>
|
||||
|
||||
<% } %>
|
||||
</div></div>
|
||||
</div>
|
||||
|
||||
<% } %>
|
18
views/partials/trains.ejs
Normal file
18
views/partials/trains.ejs
Normal file
@ -0,0 +1,18 @@
|
||||
<% if (data.trains.data.length > 0 ) {%>
|
||||
<div id="container" class="mui-panel">
|
||||
<h2>Travel</h2>
|
||||
<%
|
||||
for (var i = 0; i < data.trains.data.length; i++) { %>
|
||||
|
||||
<div class="mui-row"><div class="mui-col-md-12"><strong><%= data.trains.data[i].title %></strong></div></div>
|
||||
<div class="mui-row"><div class="mui-col-md-12"><%= data.trains.data[i].description %></div></div>
|
||||
|
||||
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
13
views/partials/tv.ejs
Normal file
13
views/partials/tv.ejs
Normal file
@ -0,0 +1,13 @@
|
||||
<% if (data.tv.entries.length > 0 ) {%>
|
||||
<div id="container" class="mui-panel">
|
||||
<h2>TV</h2>
|
||||
<%
|
||||
for (var i = 0; i < data.tv.entries.length; i++) { %>
|
||||
|
||||
<div class="mui-row"><div class="mui-col-md-12"><%- data.tv.entries[i].combined %></div></div>
|
||||
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
|
||||
<% } %>
|
26
views/partials/weather.ejs
Normal file
26
views/partials/weather.ejs
Normal file
@ -0,0 +1,26 @@
|
||||
<div id="container" class="mui-panel">
|
||||
<h2>Weather</h2>
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12">Currently: <%= data.weather.currently %></div>
|
||||
</div>
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12">Today: <%= data.weather.today %></div>
|
||||
</div>
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12">Later: <%= data.weather.later %></div>
|
||||
</div>
|
||||
|
||||
<% if (data.weather.alerts.length > 0) {
|
||||
for (var i = 0; i < data.weather.alerts.length; i++) {
|
||||
%>
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12 mui--text-danger"><%= data.weather.alerts[i].title %></div>
|
||||
<div class="mui-col-md-12"><%= data.weather.alerts[i].description %></div>
|
||||
</div>
|
||||
|
||||
<%
|
||||
}
|
||||
} %>
|
||||
|
||||
</div>
|
106
web-server.js
Normal file
106
web-server.js
Normal file
@ -0,0 +1,106 @@
|
||||
var express = require('express'), path = require('path'), http = require('http'),
|
||||
fx = require('./lib/fx'), btc = require('./lib/btc'), train = require('./lib/train'),
|
||||
password = require('./lib/password') , clean = require('./lib/clean'), events = require('./lib/events'),
|
||||
today = require('./lib/today'),
|
||||
morgan = require('morgan'), cookieParser = require('cookie-parser'),session = require('express-session')
|
||||
methodoverride = require('method-override'), bodyparser = require('body-parser'), errorhandler = require('errorhandler');
|
||||
//train = require('lib/train')
|
||||
/* ,submit = require('./routes/mongo/submit') */
|
||||
;
|
||||
var app = express();
|
||||
GLOBAL.lastcheck = 0;
|
||||
var btcCache = {}, fxCache = {} , trainCache = {};
|
||||
|
||||
//app.configure(function () {
|
||||
app.set('port', process.env.PORT || 9000);
|
||||
app.set('view engine', 'ejs');
|
||||
app.use(morgan('dev'));
|
||||
app.use(cookieParser('your secret here'));
|
||||
app.use(session({
|
||||
secret: '1234567890QWERTY', resave: false,
|
||||
saveUninitialized: false
|
||||
}));
|
||||
/* 'default', 'short', 'tiny', 'dev' */
|
||||
app.use(methodoverride());
|
||||
|
||||
app.use(bodyparser.urlencoded({extended: false}));
|
||||
|
||||
// parse application/json
|
||||
app.use(bodyparser.json());
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "X-Requested-With");
|
||||
next();
|
||||
});
|
||||
// app.use(app.router);
|
||||
app.use(express.static(path.join(__dirname, 'app')));
|
||||
|
||||
app.use(errorhandler({dumpExceptions: true, showStack: true}));
|
||||
|
||||
app.use('/btc', btc.doBTC);
|
||||
|
||||
app.use('/fx', fx.doFx);
|
||||
|
||||
app.use('/dbeglq', train.dbe_glq);
|
||||
app.use('/glqdbe', train.glq_dbe);
|
||||
app.use('/gettrains', train.getTrainTimes);
|
||||
app.use('/getnexttraintimes', train.getNextTrainTimes);
|
||||
app.use('/getroute', train.getRoute);
|
||||
|
||||
app.use('/generate', password.generate);
|
||||
|
||||
app.use('/cleanit', clean.cleanit);
|
||||
|
||||
|
||||
|
||||
app.use('/events', events.getEvents);
|
||||
app.get('/cinema/:id', events.getCinema);
|
||||
|
||||
app.get('/today', today.getToday);
|
||||
app.get('/today/data', today.getData);
|
||||
|
||||
app.route('/clock')
|
||||
.get(today.getClock);
|
||||
|
||||
|
||||
app.use('/lot', function (req, res) {
|
||||
var pg = require('pg');
|
||||
|
||||
var conString = "postgres://pguser:1V3D4m526i@localhost/silver";
|
||||
console.log(conString);
|
||||
|
||||
|
||||
var client = new pg.Client(conString);
|
||||
var q = 'select * from lot order by d desc';
|
||||
client.connect(function(err) {
|
||||
if(err) {
|
||||
return console.error('could not connect to postgres', err);
|
||||
}
|
||||
client.query(q, function(err, result) {
|
||||
if(err) {
|
||||
return console.error('error running query', err);
|
||||
}
|
||||
console.log(result.rows[0].theTime);
|
||||
//output: Tue Jan 15 2013 19:12:47 GMT-600 (CST)
|
||||
client.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/slack', function (req, res) {
|
||||
res.render('pages/slack');
|
||||
});
|
||||
|
||||
app.get('/temp', function (req, res) {
|
||||
res.render('pages/temp');
|
||||
});
|
||||
|
||||
//});
|
||||
|
||||
/**
|
||||
* create the server
|
||||
*/
|
||||
http.createServer(app).listen(app.get('port'), function () {
|
||||
console.log("Express server listening on port " + app.get('port'));
|
||||
});
|
2
web-server.min.js
vendored
Normal file
2
web-server.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var express=require("express"),path=require("path"),http=require("http"),fx=require("./lib/fx"),btc=require("./lib/btc"),train=require("./lib/train"),app=express();GLOBAL.lastcheck=0;var btcCache={},fxCache={},trainCache={};app.configure(function(){app.set("port",process.env.PORT||9e3),app.use(express.logger("dev")),app.use(express.cookieParser()),app.use(express.session({secret:"1234567890QWERTY"})),app.use(express.methodOverride()),app.use(express.bodyParser()),app.use(function(e,r,s){r.header("Access-Control-Allow-Origin","*"),r.header("Access-Control-Allow-Headers","X-Requested-With"),s()}),app.use(app.router),app.use(express.static(path.join(__dirname,"app"))),app.use(express.errorHandler({dumpExceptions:!0,showStack:!0})),app.use("/btc",btc.doBTC),app.use("/fx",fx.doFx),app.use("/dbeglq",train.dbe_glq),app.use("/glqdbe",train.glq_dbe),app.use("/lot",function(){var e=require("pg"),r="postgres://pguser:1V3D4m526i@localhost/silver";console.log(r);var s=new e.Client(r),p="select * from lot order by d desc";s.connect(function(e){return e?console.error("could not connect to postgres",e):void s.query(p,function(e,r){return e?console.error("error running query",e):(console.log(r.rows[0].theTime),void s.end())})})})}),http.createServer(app).listen(app.get("port"),function(){console.log("Express server listening on port "+app.get("port"))});
|
||||
//# sourceMappingURL=web-server.min.js.map
|
1
web-server.min.js.map
Normal file
1
web-server.min.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["web-server.js"],"names":["express","require","path","http","fx","btc","train","app","GLOBAL","lastcheck","btcCache","fxCache","trainCache","configure","set","process","env","PORT","use","logger","cookieParser","session","secret","methodOverride","bodyParser","req","res","next","header","router","static","join","__dirname","errorHandler","dumpExceptions","showStack","doBTC","doFx","dbe_glq","glq_dbe","pg","conString","console","log","client","Client","q","connect","err","error","query","result","rows","theTime","end","createServer","listen","get"],"mappings":"AAAA,GAAIA,SAAUC,QAAQ,WAAYC,KAAOD,QAAQ,QAASE,KAAOF,QAAQ,QAASG,GAAKH,QAAQ,YAAaI,IAAMJ,QAAQ,aAAcK,MAAQL,QAAQ,eAIpJM,IAAMP,SACVQ,QAAOC,UAAY,CACnB,IAAIC,aAAeC,WAAeC,aAElCL,KAAIM,UAAU,WACVN,IAAIO,IAAI,OAAQC,QAAQC,IAAIC,MAAQ,KACpCV,IAAIW,IAAIlB,QAAQmB,OAAO,QACvBZ,IAAIW,IAAIlB,QAAQoB,gBAChBb,IAAIW,IAAIlB,QAAQqB,SAASC,OAAQ,sBAEjCf,IAAIW,IAAIlB,QAAQuB,kBAEhBhB,IAAIW,IAAIlB,QAAQwB,cAEhBjB,IAAIW,IAAI,SAAUO,EAAKC,EAAKC,GACxBD,EAAIE,OAAO,8BAA+B,KAC1CF,EAAIE,OAAO,+BAAgC,oBAC3CD,MAEJpB,IAAIW,IAAIX,IAAIsB,QACZtB,IAAIW,IAAIlB,QAAQ8B,OAAO5B,KAAK6B,KAAKC,UAAW,SAC5CzB,IAAIW,IAAIlB,QAAQiC,cAAcC,gBAAgB,EAAMC,WAAW,KAE/D5B,IAAIW,IAAI,OAAQb,IAAI+B,OAEpB7B,IAAIW,IAAI,MAAOd,GAAGiC,MAElB9B,IAAIW,IAAI,UAAWZ,MAAMgC,SAEzB/B,IAAIW,IAAI,UAAWZ,MAAMiC,SAEzBhC,IAAIW,IAAI,OAAQ,WACZ,GAAIsB,GAAKvC,QAAQ,MAEbwC,EAAY,+CAChBC,SAAQC,IAAIF,EAGZ,IAAIG,GAAS,GAAIJ,GAAGK,OAAOJ,GACvBK,EAAI,mCACRF,GAAOG,QAAQ,SAASC,GACpB,MAAGA,GACQN,QAAQO,MAAM,gCAAiCD,OAE1DJ,GAAOM,MAAMJ,EAAG,SAASE,EAAKG,GAC1B,MAAGH,GACQN,QAAQO,MAAM,sBAAuBD,IAEhDN,QAAQC,IAAIQ,EAAOC,KAAK,GAAGC,aAE3BT,GAAOU,eASvBnD,KAAKoD,aAAahD,KAAKiD,OAAOjD,IAAIkD,IAAI,QAAS,WAC3Cf,QAAQC,IAAI,oCAAsCpC,IAAIkD,IAAI"}
|
145
web-server.old.js
Normal file
145
web-server.old.js
Normal file
@ -0,0 +1,145 @@
|
||||
var express = require('express'), path = require('path'), http = require('http')
|
||||
/* ,submit = require('./routes/mongo/submit') */
|
||||
;
|
||||
var app = express();
|
||||
var lastcheck = 0;
|
||||
var btcCache = {}, fxCache = {} , trainCache = {};
|
||||
|
||||
app.configure(function () {
|
||||
app.set('port', process.env.PORT || 9000);
|
||||
app.use(express.logger('dev'));
|
||||
app.use(express.cookieParser());
|
||||
app.use(express.session({secret: '1234567890QWERTY'}));
|
||||
/* 'default', 'short', 'tiny', 'dev' */
|
||||
app.use(express.methodOverride());
|
||||
|
||||
app.use(express.bodyParser());
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "X-Requested-With");
|
||||
next();
|
||||
});
|
||||
app.use(app.router);
|
||||
app.use(express.static(path.join(__dirname, 'app')));
|
||||
app.use(express.errorHandler({dumpExceptions: true, showStack: true}));
|
||||
|
||||
app.use('/btc', function (req, res) {
|
||||
console.log('Bitcoin request');
|
||||
function btcQuery(callback, r) {
|
||||
var req = r;
|
||||
var options = {
|
||||
host: 'api.coindesk.com',
|
||||
// port: 80,
|
||||
path: '/v1/bpi/currentprice.json',
|
||||
// method: 'GET',
|
||||
headers: {
|
||||
/* 'Content-Type': 'application/json',
|
||||
'Content-Length': Buffer.byteLength(data)*/
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
http.request(options).on('response', function (response) {
|
||||
var data = '';
|
||||
response.on("data", function (chunk) {
|
||||
data += chunk;
|
||||
});
|
||||
response.on('end', function () {
|
||||
callback(JSON.parse(data), r);
|
||||
});
|
||||
}).end();
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
if (now - lastcheck > (59000 )) {
|
||||
btcQuery(function (a, b) {
|
||||
console.log(a);
|
||||
btcCache = a;
|
||||
lastcheck = now;
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(btcCache));
|
||||
}, res)
|
||||
}
|
||||
else {
|
||||
console.log("Using cache");
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(btcCache));
|
||||
}
|
||||
});
|
||||
|
||||
app.use('/fx', function (req, res) {
|
||||
console.log('FX request');
|
||||
function fxQuery(callback, r) {
|
||||
var req = r;
|
||||
var options = {
|
||||
host: 'openexchangerates.org',
|
||||
// port: 80,
|
||||
path: '/api/latest.json?app_id=0eb932cee3bc40259f824d4b4c96c7d2',
|
||||
// method: 'GET',
|
||||
headers: {
|
||||
/* 'Content-Type': 'application/json',
|
||||
'Content-Length': Buffer.byteLength(data)*/
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
http.request(options).on('response', function (response) {
|
||||
var data = '';
|
||||
response.on("data", function (chunk) {
|
||||
data += chunk;
|
||||
});
|
||||
response.on('end', function () {
|
||||
callback(JSON.parse(data), r);
|
||||
});
|
||||
}).end();
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
if (now - lastcheck > (60000 * 14)) {
|
||||
fxQuery(function (a, b) {
|
||||
console.log(a);
|
||||
fxCache = a;
|
||||
lastcheck = now;
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(fxCache));
|
||||
}, res);
|
||||
}
|
||||
else {
|
||||
console.log("Using cache");
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(fxCache));
|
||||
}
|
||||
});
|
||||
|
||||
app.use('/lot', function (req, res) {
|
||||
var pg = require('pg');
|
||||
|
||||
var conString = "postgres://pguser:1V3D4m526i@localhost/silver";
|
||||
console.log(conString);
|
||||
|
||||
|
||||
var client = new pg.Client(conString);
|
||||
var q = 'select * from lot order by d desc';
|
||||
client.connect(function(err) {
|
||||
if(err) {
|
||||
return console.error('could not connect to postgres', err);
|
||||
}
|
||||
client.query(q, function(err, result) {
|
||||
if(err) {
|
||||
return console.error('error running query', err);
|
||||
}
|
||||
console.log(result.rows[0].theTime);
|
||||
//output: Tue Jan 15 2013 19:12:47 GMT-600 (CST)
|
||||
client.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* create the server
|
||||
*/
|
||||
http.createServer(app).listen(app.get('port'), function () {
|
||||
console.log("Express server listening on port " + app.get('port'));
|
||||
});
|
3053
www/css/mui.css
Normal file
3053
www/css/mui.css
Normal file
File diff suppressed because it is too large
Load Diff
1
www/css/mui.min.css
vendored
Normal file
1
www/css/mui.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
www/index.html
Normal file
7
www/index.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>hello</body>
|
||||
</html>
|
487
www/slack.htm
Normal file
487
www/slack.htm
Normal file
@ -0,0 +1,487 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Slack</title>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<style type="text/css" media="all">
|
||||
body { text-align: center; background: #C9C5C2; margin: auto; }
|
||||
|
||||
.container { text-align: left; position: relative; width: 960px; background: #FFF; border: 2px solid #FFF; -moz-box-shadow: 3px 3px 3px #aaa; -webkit-box-shadow: 3px 3px 3px #aaa; box-shadow: 3px 3px 3px #aaa; margin: 18px auto; padding: 0; }
|
||||
|
||||
body, ul, ol, dl, h1, h2, h3, h4, h5, h6, td, th, caption, pre, p, blockquote, input, textarea { font: .9em 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif; color: #333; }
|
||||
|
||||
a { color: #000; text-decoration: underline; white-space: nowrap; }
|
||||
|
||||
a:visited { color: #666; }
|
||||
|
||||
h1, h2, h3, h4, h5, h6 { font-family: 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif; color: #FFF; margin: 0; padding: 9px 0; }
|
||||
|
||||
h1 a, h1 a:visited { color: #EEE; }
|
||||
|
||||
h1 a:hover { color: #CCC; }
|
||||
|
||||
h1 { font-size: 18px; background: teal; border-bottom: 3px solid #80007e; padding: 9px 0 9px 9px; }
|
||||
|
||||
.small { font-size: .8em; }
|
||||
|
||||
h2 { font-size: 12px; background: #DDD; border-bottom: 1px solid #80007e; color: #333; margin-top: 0; padding: 9px 0 9px 9px; }
|
||||
|
||||
h3 { font-size: 18px; }
|
||||
|
||||
ul { margin: 0; padding: 0; }
|
||||
|
||||
li { display: inline; margin: 0; padding: 0 4px 0 0; }
|
||||
|
||||
table { width: 100%; border-spacing: 10px; }
|
||||
|
||||
th { width: 33%; font-size: 16px; font-weight: 700; line-height: 24px; border-bottom: 1px solid #80007e; color: #333; }
|
||||
|
||||
td { vertical-align: top; background: #FFF; padding: 0 0 6px; }
|
||||
|
||||
td.footer { background: #8abbd7; padding: 10px; }
|
||||
|
||||
.red:hover { color: blue; }
|
||||
|
||||
.floatright { float: right; padding-right: 10px; }
|
||||
|
||||
.floatleft { float: left; padding-left: 10px; }
|
||||
|
||||
a:hover, .red { color: #C00; }
|
||||
|
||||
.dates { padding: 2px; border: solid 1px #80007e; background-color: #ffffff; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="title">Slack - I have plenty of talent and vision I just don't give a damn</h1>
|
||||
|
||||
<div>
|
||||
<h2><span id='one' class='dates'>----</span><span> </span><span
|
||||
id='two' class='dates'>----</span><span> </span> <span
|
||||
id='three' class='dates'>----</span>
|
||||
</h2>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Starting Points/Metasites</th>
|
||||
<th>Tools</th>
|
||||
<th>Bitcoin</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Starting Points/Metasites -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.unmajestic.com/home/bookmarks.php">Slack Bookmarks</a>
|
||||
</li>
|
||||
<li><a href="http://reader.google.com">GReader</a></li>
|
||||
<li><a href="http://www.twitley.com">Twitley</a></li>
|
||||
<li><a href="http://www.bloglines.com/myblogs">Bloglines</a></li>
|
||||
<li><a href="http://www.facebook.com/">Facebook</a></li>
|
||||
<li><a href="http://www.yahoo.com/">Yahoo!</a></li>
|
||||
<li>
|
||||
<a href="http://www.talk3g.co.uk/forumdisplay.php?f=100">Talk3G</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.unmajestic.com/home/bookmarkshome.htm">Bookmarks</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- tools -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://console.appfog.com/#apps">AppFog</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.colorzilla.com/gradient-editor/">CSS Gradient Generator</a>
|
||||
</li>
|
||||
<li><a href="http://utilities-online.info/xmltojson">XML to JSON</a>
|
||||
</li>
|
||||
<li><a href="http://shancarter.com/data_converter">CSV to JSON</a>
|
||||
</li>
|
||||
<li><a href="http://cubic-bezier.com/">Cubic Bezier</a></li>
|
||||
<li><a href="http://gskinner.com/RegExr/">RegEx Tool</a></li>
|
||||
<li>
|
||||
<a href="http://closure-compiler.appspot.com/home">Closure Compiler</a>
|
||||
</li>
|
||||
<li><a href="http://jsonlint.com/">JSON Lint</a></li>
|
||||
<li><a href="http://jsoneditoronline.org/">JSON Editor</a></li>
|
||||
<li><a href="http://www.base64decode.org/">Base64 Decoder</a></li>
|
||||
<li><a href="http://jsbeautifier.org/">JS Beautifier</a></li>
|
||||
<li><a href="http://spritepad.wearekiss.com/">Spritepad</a></li>
|
||||
<li>
|
||||
<a href="http://draeton.github.com/stitches/">Sprite Sheet Generator</a>
|
||||
</li>
|
||||
<li><a href="http://www.cleancss.com/">CSS Optimizer</a></li>
|
||||
<li><a href="http://fontello.com/">Icon Font Generator</a></li>
|
||||
<li><a href="http://html2jade.aaron-powell.com/">HTML to Jade</a></li>
|
||||
<li><a href="http://cdnjs.com//">Cloudflare JS CDN</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Bitcoin -->
|
||||
<ul>
|
||||
<li><a href="https://www.bitstamp.net">Bitstamp</a></li>
|
||||
<li>
|
||||
<a href="http://bitcoinity.org/markets/bitstamp/USD">BitStamp Chart</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://btc-chart.com/market/bitstamp/86400">Bitstamp Chart 2</a>
|
||||
</li>
|
||||
<li><a href="https://mtgox.com/">Mt.Gox</a></li>
|
||||
<li><a href="https://bitbargain.co.uk">BitBargin</a></li>
|
||||
<li><a href="http://blockchain.info/">Blockchain</a></li>
|
||||
<li><a href="http://bitminter.com/">Bitminter</a></li>
|
||||
<li><a href="http://preev.com/">BTC Exchange Rate</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Computer News</th>
|
||||
<th>Weather Reports</th>
|
||||
<th>Free Email WEBpages</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Computer News -->
|
||||
<ul>
|
||||
<li><a href="http://www.pcmag.com/">PCMag</a></li>
|
||||
<li><a href="http://www.newslinx.com/">Newslinx</a></li>
|
||||
<li><a href="http://www.zdnet.com/zdnn"> ZDNet</a></li>
|
||||
<li>
|
||||
<a href="http://service.bfast.com/bfast/click?bfmid=1476905&siteid=22078656&bfpage=news_5">Bfast</a>
|
||||
</li>
|
||||
<li><a href="http://www.news.com/">News.com</a></li>
|
||||
<li><a href="http://www.computerworld.com/">CW</a></li>
|
||||
<li><a href="http://www.cmpnet.com/">TechW</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Weather Reports -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G82%201RG">Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=dumbarton,%20uk&wuSelect=WEATHER">WU Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://weather.yahoo.com/forecast/UKXX0663.html?unit=c">Y! Dumbarton Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.accuweather.com/ukie/index-forecast.asp?postalcode=G9%202SU">Glasgow Weather</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=glasgow,%20uk&wuSelect=WEATHER">WU Glasgow Weather</a>
|
||||
</li>
|
||||
<li><a href="http://www.nowcast.co.uk/lightning/">Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.upminsterweather.co.uk/test/live_lightning.htm">Other Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.meteorologica.info/freedata_lightning.htm">Closer Live Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.malvernwx.co.uk/lightning_data/lightning.htm">Multiple Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.blitzortung.org/Webpages/index.php">European Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.madpaddler.net/wxlightning.php">East Kilbride Lightning</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.bordersweather.co.uk/wxlightning.php">Borders Lightning</a>
|
||||
</li>
|
||||
<li><a href="http://www.madpaddler.net/wxais.php">Ships</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Free Email WEBpages -->
|
||||
<ul>
|
||||
<li><a href="http://gmail.google.com/">Gmail</a></li>
|
||||
<li>
|
||||
<a href="http://www.unmajestic.com/webmail/">Unmajestic Webmail</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.artizanconsulting.co.uk/webmail/">Artizan Webmail</a>
|
||||
</li>
|
||||
<li><a href="http://mail.yahoo.com">Yahoo Mail</a></li>
|
||||
<li>
|
||||
<a href="https://www.guerrillamail.com/">Guerrilla Mail Anti Spam</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Job Searching</th>
|
||||
<th>Entertainment</th>
|
||||
<th>Travel</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Real News Related -->
|
||||
<ul>
|
||||
<li><a href="http://www.monster.co.uk/">monster</a></li>
|
||||
<li><a href="http://www.cwjobs.co.uk/">cwjobs</a></li>
|
||||
<li><a href="http://www.s1jobs.com/myaccount/">s1jobs</a></li>
|
||||
<li><a href="http://www.jobserve.com/">jobserve</a></li>
|
||||
<li><a href="http://www.jobsite.co.uk/jbe/myprofile/">jobsite</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.itjobswatch.co.uk/contracts/scotland/asp.do">IT Jobs Watch Scotland</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Entertainment -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.cineworld.co.uk/cinemas/28?fallback=false&isMobileAgent=false">Cineworld</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.showcasecinemas.co.uk/showtimes/default.asp?selectTheatre=8508">Showcase</a>
|
||||
</li>
|
||||
<li><a href="http://www.imdb.com/">Imdb</a></li>
|
||||
<li><a href="http://www.epguides.com/">EPGuides</a></li>
|
||||
<li><a href="http://eztv.it">Eztv</a></li>
|
||||
<li><a href="http://www.mininova.org">Mininova</a></li>
|
||||
<li><a href="http://www.scrapetorrent.com">Scrapetorrent</a></li>
|
||||
<li>
|
||||
<a href="http://glasgow.myvillage.com/events">Whats on In Glasgow</a>
|
||||
</li>
|
||||
<li><a href="http://www.5pm.co.uk/Search/Event/">Local Events</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Travel -->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.bbc.co.uk/scotland/whereilive/travelscotland/home/regions/index.shtml?name=clyde&place_name=Glasgow&place_number=0006">travel news</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=DBE">Dumbarton East Trains</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=GLQ">Queen Street Trains</a>
|
||||
</li>
|
||||
<li><a href="http://www.kayak.co.uk/">Kayak</a></li>
|
||||
<li><a href="http://www.travelocity.co.uk/">Travelocity</a></li>
|
||||
<li><a href="http://www.travel.com/sitemap.htm">Travel.com</a></li>
|
||||
<li>
|
||||
<a href="http://www.landings.com/_landings/pages/commercial.html">Airlines</a>
|
||||
</li>
|
||||
<li><a href="http://www.flightstats.com">Landings</a></li>
|
||||
<li>
|
||||
<a href="http://www.lib.utexas.edu/Libs/PCL/Map_collection/map_sites/map_sites.html#general">Maps</a>
|
||||
</li>
|
||||
<li><a href="http://www.sitesatlas.com/Maps/">Maps2</a></li>
|
||||
<li><a href="http://www.itn.net/">ITN</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">HAFAS</a></li>
|
||||
<li><a href="http://bahn.hafas.de/bin/query.exe/en">DieBahn</a></li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelreg.html">RailUSA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.trainweb.com/frames_travel.html">TrainWeb</a>
|
||||
</li>
|
||||
<li><a href="http://www.cwrr.com/nmra/travelw2.html">RailWorld</a>
|
||||
</li>
|
||||
<li><a href="http://www.xe.net/currency/">Currency Converter</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.cia.gov/cia/publications/factbook/index.html">CIA</a>
|
||||
</li>
|
||||
<li><a href="http://maps.google.com/">GMaps</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Computer Software, etc.</th>
|
||||
<th>Reference & Special sites</th>
|
||||
<th>Internet Money</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Computer Software, etc. -->
|
||||
<ul>
|
||||
<li><a href="">Portable Apps</a></li>
|
||||
<li><a href="http://www.newfreeware.com/">NewFreeware</a></li>
|
||||
<li>
|
||||
<a href="http://www.makeuseof.com/tag/portable-software-usb/">Portable Software</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.portablefreeware.com/">Portable Freeware Collection</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Reference and Special sites -->
|
||||
<ul>
|
||||
<li><a href="http://www.glossarist.com/default.asp">Glossaries</a>
|
||||
</li>
|
||||
<li><a href="http://www.convert-me.com/en/">Converters</a></li>
|
||||
<li>
|
||||
<a href="http://decoder.americom.com/cgi-bin/decoder.cgi">DECODE</a>
|
||||
</li>
|
||||
<li><a href="http://www.rxlist.com/">Drugs</a></li>
|
||||
<li><a href="http://www.ncbi.nlm.nih.gov/PubMed/">Medline</a></li>
|
||||
<li>
|
||||
<a href="http://www.logos.it/dictionary/owa/sp?lg=EN">Translation</a>
|
||||
</li>
|
||||
<li><a href="http://www.onelook.com/">One Look</a></li>
|
||||
<li><a href="http://www.defenselink.mil/">US Military</a></li>
|
||||
<li><a href="http://www.fedworld.gov/">US Fed</a></li>
|
||||
<li><a href="http://www.ih2000.net/ira/legal.htm">Legal</a></li>
|
||||
<li><a href="http://www.nih.gov/">NIH</a></li>
|
||||
<li><a href="http://www.refdesk.com/">RefDESK</a></li>
|
||||
<li><a href="http://www.britannica.com/">Britannica</a></li>
|
||||
<li><a href="http://www.capitolimpact.com/gw/">States</a></li>
|
||||
<li><a href="http://www.packtrack.com/">PackTrack</a></li>
|
||||
<li><a href="http://www.acronymfinder.com/">Acronym</a></li>
|
||||
<li><a href="http://www.visualthesaurus.com/">V-Thes</a></li>
|
||||
<li>
|
||||
<a href="http://www.timelineindex.com/content/home/forced">Timelines</a>
|
||||
</li>
|
||||
<li><a href="http://en.wikipedia.org/wiki/Main_Page">Wikipedia</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Good Reading Misc. -->
|
||||
<ul>
|
||||
<li><a href="http://www.paypal.com/">Paypal</a></li>
|
||||
<li><a href="http://www.halifax.co.uk/">Halifax</a></li>
|
||||
<li>
|
||||
<a href="http://www.bullbearings.co.uk/stock.portfolio.php">Bullbearings</a>
|
||||
</li>
|
||||
<li><a href="http://www.fidelity.co.uk/">Fidelity</a></li>
|
||||
<li>
|
||||
<a href="http://www.contractorumbrella.com/">Contractor Umbrella</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="footer">
|
||||
<div id='weather'></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="container"></div>
|
||||
</body>
|
||||
<script>
|
||||
function addDays(myDate, days) {
|
||||
return new Date(myDate.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
}
|
||||
function getDays(startdate, enddate) {
|
||||
var r, s, e;
|
||||
s = startdate.getTime();
|
||||
e = enddate.getTime();
|
||||
r = (e - s) / (24 * 60 * 60 * 1000);
|
||||
return r;
|
||||
}
|
||||
function tick() {
|
||||
var today = new Date();
|
||||
var start101 = new Date();
|
||||
var end101 = new Date();
|
||||
var endContract = new Date();
|
||||
var third = new Date();
|
||||
start101.setFullYear(2013, 9, 24);
|
||||
end101 = addDays(start101, 1001);
|
||||
endContract.setFullYear(2014, 3, 6);
|
||||
third.setFullYear(2013, 7, 25);
|
||||
$('#one').text('101B ends: ' + Math.ceil(getDays(today,
|
||||
end101)) + " days / " + Math.ceil(getDays(today,
|
||||
end101) / 7) + " weeks");
|
||||
$('#two').text('Ends: ' + Math.ceil(getDays(today,
|
||||
endContract)) + " days / " + Math.ceil(getDays(today,
|
||||
endContract) / 7) + " weeks");
|
||||
// $('#three').text(innerText =
|
||||
// 'Tough Mudder: ' + Math.ceil(getDays(today,
|
||||
// third)) + " days / " + Math.ceil(getDays(today,
|
||||
// third) / 7) + " weeks");
|
||||
}
|
||||
tick();
|
||||
function get_weather() {
|
||||
navigator.geolocation.getCurrentPosition(show_weather);
|
||||
}
|
||||
function show_weather(position) {
|
||||
var latitude = position.coords.latitude;
|
||||
var longitude = position.coords.longitude;
|
||||
// let's show a map or do something interesting!
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/' + latitude.toString() + ',' + longitude.toString(),
|
||||
data: '',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
context: $('body'),
|
||||
contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
$('#weather').text(data.currently.summary + " " + ((5.0 / 9.0 * (data.currently.temperature - 32))));
|
||||
},
|
||||
error: function(xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bitstamp() {
|
||||
console.log("getting bitstamp");
|
||||
|
||||
var url = 'https://www.bitstamp.net/api/ticker/?=&callback=';
|
||||
|
||||
// let's show a map or do something interesting!
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
data: '',
|
||||
dataType: 'json',
|
||||
jsonp: false,
|
||||
jsonpCallback: "BitStampParser",
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
//$('#weather').text(data.currently.summary + " " + ((5.0 / 9.0 * (data.currently.temperature - 32))));
|
||||
},
|
||||
error: function(xhr, type) {
|
||||
console.log("ajax error");
|
||||
console.log(xhr);
|
||||
console.log(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function BitStampParser(v)
|
||||
{
|
||||
console.log("Bitstamp parser");
|
||||
console.log(v);
|
||||
|
||||
}
|
||||
|
||||
get_weather();
|
||||
bitstamp();
|
||||
</script>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user