This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var winston = require('winston'); | |
module.exports = function(module) { | |
return makeLogger(); | |
}; | |
function makeLogger() { | |
var transports = [ |
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 isMobile() { | |
var a = (navigator.userAgent||navigator.vendor||window.opera); | |
if(/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhttp; | |
if (window.XMLHttpRequest) { | |
xhttp = new XMLHttpRequest(); | |
} else { | |
// code for IE6, IE5 | |
xhttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
} |
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 formatDate(date) { | |
var day = date.getDate(); | |
var monthIndex = date.getMonth() + 1; | |
var year = date.getFullYear(); | |
monthIndex = monthIndex.toString(); | |
if (monthIndex.length < 2) { | |
monthIndex = '0' + monthIndex; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slider = $('.slider'); | |
var num = $('.num'); | |
var sliderPosition; | |
var sliderEndPosition; | |
var sliderValue = 0; | |
var xStart = 30; | |
var xEnd = 420; | |
var yy = 350; | |
var sliderPathLength = xEnd - xStart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var choosedArr = []; | |
var dataArrs = []; | |
var st = $(".st"); | |
var arr = ["friso", "similac", "hipp", "humana", "nutrilon", "bellakt"]; | |
if(localStorage.getItem("Q1_nan_vis2_choosed_brands") != null) | |
arr = localStorage.getItem("Q1_nan_vis2_choosed_brands").split(","); | |
var len = arr.length; | |
var elm; |
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
.userTip { | |
-webkit-animation-name: userTip; | |
-o-animation-name: userTip; | |
animation-name: userTip; | |
-webkit-animation-duration: 1s; | |
-o-animation-duration: 1s; | |
animation-duration: 1s; | |
} | |
@-webkit-keyframes userTip { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var URL = 'http://www.ferra.ru/ru/techlife/news/'; | |
var results = []; | |
var q = tress(function(url, callback) { | |
//обработка страницы с адресом url | |
needle.get(url, function(err, res) { | |
if(err) throw err; | |
//тут парсинг из res.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const send404 = (res) => { | |
res.writeHead(404, {'Content-type': 'text/plain'}); | |
res.write("Error 404: resource not found"); | |
res.end(); | |
}; | |
//send file content and mime type | |
const sendFile = (res, filePath, fileContent) => { | |
res.writeHead(200, {'Content-type': mime.lookup(path.basename(filePath))}); | |
res.end(fileContent); |
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
try { | |
// произошло что-то неприятное, возбудить ошибку | |
throw { | |
name: “MyErrorType”, // нестандартный тип ошибки | |
message: “oops”, | |
extra: “This was rather embarrassing”, | |
remedy: genericErrorHandler // какой обработчик | |
}; | |
} catch (e) { | |
// известить пользователя |