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 walkCollection(elements, callback){ | |
Array.prototype.forEach.call(elements, element => callback(element)); | |
} | |
class SearchData { | |
constructor() { | |
const searchBarId = '#search-bar'; | |
const form = document.querySelector(`${searchBarId} > form`); | |
const button = form.querySelector('button'); | |
const storedSearchesBlock = document.querySelector('.stored-searches'); |
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
// traverses through object's own properties on all its levels | |
function walk (obj){ | |
// | |
Object.keys(obj).forEach(function(ob){ | |
var currentOb = obj[ob]; | |
(Object.prototype.toString.call(currentOb)==='[object Object]') | |
? walk(currentOb) | |
: console.log('value', currentOb); | |
}); | |
} |
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 isMobile = (typeof window.orientation !== "undefined" || navigator.userAgent.indexOf('IEMobile') !== -1); |
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 setObjectStructure(obj, index = 0, arr = ['one', 'two', 'three']){ | |
obj[arr[index]] = {}; | |
let nextIndex = index + 1; | |
if (arr.length > nextIndex){ | |
setObjectStructure(obj[arr[index]], nextIndex, arr); | |
} | |
console.log('obj=>', obj); | |
}({}); |
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
console.log('build here'); | |
var fs = require('fs'); | |
// var path = require('path'); | |
var done = function(err) { | |
console.log(err); | |
} | |
// var file = path.resolve(dir, file); | |
console.log('__dirname=>', __dirname); |
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 http = require('http'), | |
fs = require('fs'), | |
port = 8080, | |
index_path = '/index.html'; | |
http.createServer(function (request, response) { | |
var exts, | |
ext, | |
type = 'text'; |
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 elements, | |
nextInObject = (function(){ | |
var i= 0, keys; | |
return function(obj){ | |
if(!i) keys = Object.keys(obj); | |
if(obj[keys[i+1]]){ | |
i++; | |
return [ [keys[i-1], obj[keys[i-1]]], [keys[i], obj[keys[i]]] ]; | |
}else{ | |
i=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elements, | |
nextInArray = (function(){ | |
var i= 0; | |
return function(arr){ | |
if(arr[i+1]){ | |
i++; | |
return [arr[i-1], arr[i]]; | |
}else{ | |
i=0; | |
return false; |
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
// Karma configuration | |
// Generated on Sun Jul 20 2014 11:36:55 GMT+0400 (Московское время (зима)) | |
module.exports = function(config) { | |
config.set({ | |
// base path that will be used to resolve all patterns (eg. files, exclude) | |
//basePath: '', | |
// frameworks to use | |
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | |
frameworks: ['jasmine'], | |
// list of files / patterns to load in the browser |