This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('index', ['data']) | |
.controller('IndexController', ['routeList', function (routeList) { | |
//* | |
routeList.getAjaxData(function (data) { | |
this.routeList = routeList.sort(data); | |
}); | |
/*/ | |
this.get = function () { | |
//routeList.getAjaxData(); | |
this.routeList = routeList.getAjaxData(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
if(window.console) { return; } | |
var newConsole = {}; | |
function noop() {}; | |
//First class logging attributes | |
(['assert', 'count', 'dir', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'table', 'time', 'timeEnd', 'trace', 'warn']) | |
.forEach(function (key) { | |
newConsole[key] = noop; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Inspired by http://stackoverflow.com/a/11526569/46810 | |
(function () { | |
//Max possible value for Date() +/- of 0 | |
var max = 8640000000000000; | |
Object.defineProperties(Date.prototype, { | |
isMaxDate: { | |
get: function () { return this.valueOf() === max; } | |
}, | |
isMinDate: { | |
get: function () { return this.valueOf() === -max; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const request = require('sync-request'); | |
var cfg = JSON.parse(fs.readFileSync('./config.json', 'utf8')); | |
var query = Object.keys(cfg.apiData) | |
.map(key => [key, cfg.apiData[key]].join('=')) | |
.join('&'); | |
var res = request('GET', `${cfg.apiUrl}?${query}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const http = require('http'); | |
fs.readFile('./config.json', 'utf8', (err, data) => { | |
if (err) { throw err; } | |
var cfg = JSON.parse(data); | |
var query = Object.keys(cfg.apiData) | |
.map(key => [key, cfg.apiData[key]].join('=')) | |
.join('&'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const http = require('http'); | |
getConfig() | |
.then(getWeather) | |
.then(workWithResult) | |
function getConfig () { | |
return new Promise((resolve, reject) => { | |
fs.readFile('./config.json', 'utf8', (err, data) => { |