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 countHolders(array, placeholder) { | |
var length = array.length, | |
result = 0; | |
while (length--) { | |
if (array[length] === placeholder) { | |
++result; | |
} | |
} | |
return result; |
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
<div class="wrap"> | |
<input type="checkbox" name="slide1" class="none" id="slide1" /> | |
<label for="slide1">показати</label> | |
<p class="show">some text here</p> | |
</div> |
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 ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const path = require('path'); | |
const bundleFolder = './entry/'; | |
const fs = require('fs'); | |
const testFiles = /\.js$/; | |
const arrayFiles = fs.readdirSync(bundleFolder); | |
const AssetsPlugin = require('assets-webpack-plugin'); | |
const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); | |
const objEntry = arrayFiles.reduce(function (result, item) { |
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 isPrime(value) { | |
if (!isPrime.answers) { | |
isPrime.answers = {}; | |
} | |
if (isPrime.answers[value] !== null) { | |
return isPrime.answers[value]; | |
} | |
var prime = value != 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
console.log(a(1)) | |
function a(foo) { | |
if( foo > 20 ) return foo; | |
return b(foo+2); | |
} | |
function b(foo) { | |
return c(foo) + 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
var Line = (function () { | |
function Line(line) { | |
this.x = line.x; | |
this.y = line.y; | |
this.id = line.id; | |
} | |
Line.prototype.setX = function (x) { | |
this.x = x; | |
}; | |
Line.prototype.setY = function (y) { |
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 map$viaReduce (array, fn) | |
{ | |
return array.reduce(function (memo, item, index, array) | |
{ | |
return memo.concat([ fn(item, index, array) ]); | |
}, []); | |
}; |
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
blah.addEventListener('touchend', function(e) { | |
/* prevent delay and simulated mouse events */ | |
e.preventDefault(); | |
/* trigger the actual behavior we bound to the 'click' event */ | |
e.target.click(); | |
}) | |
blah.addEventListener('click', function() { | |
/* actual functionality */ | |
}); |
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 findNodes = function (callback) { | |
var i = 100000, | |
nodes = [], | |
found; | |
// проверить, является ли объект callback функцией | |
if (typeof callback !== “function”) { | |
callback = false; | |
} | |
while (i) { | |
i -= 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
_workWithDOM:{ | |
_empty: function( parent ) { | |
while (parent.firstChild) { | |
parent.removeChild(parent.firstChild); | |
} | |
}, | |
_removeClass: function( el, className ) { | |
if( el.classList ) { | |
el.classList.remove( className ); |