This file contains hidden or 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 det (argStr) { | |
var numbers = argStr.split(' ').map(Number), | |
length = Math.sqrt(numbers.length); | |
if ((length % 1) !== 0) return false; | |
if (length === 1) return numbers[0]; | |
if (length === 2) return numbers[0] * numbers[3] - numbers[1] * numbers[2]; | |
var matrica = []; | |
for (var i = 0; i < length; i++) { |
This file contains hidden or 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 isIntersection (x1, y1, x2, y2, x3, y3, x4, y4) { | |
var point1 = {x: x1, y: y1}, | |
point2 = {x: x2, y: y2}, | |
point3 = {x: x3, y: y3}, | |
point4 = {x: x4, y: y4}; | |
var line1 = {}, | |
line2 = {}; | |
init(); |
This file contains hidden or 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 getSimpleArray (N) { | |
var preparation = new Int8Array(N + 1), retArray = [], i, j; | |
if (N >= 2) retArray.push(2); | |
for (i = 3; i <= N; i += 2) { | |
if (preparation[i] !== 0) continue; | |
retArray.push(i); | |
j = i * 2; | |
while (j <= N) { | |
preparation[j] = 1; | |
j += i; |
This file contains hidden or 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 setIntervalControlling (callback, time) { | |
var startMoment = (new Date).getTime(), | |
number = 0, timeOfLoop = 0, difference = 0, | |
realTime = time, minStep = Math.pow(2, -4); | |
var loop; | |
__restart(); | |
return { stop: function () { clearInterval(loop); } }; |
This file contains hidden or 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 insertSort (array) { | |
for (var i = 1; i < array.length; i++) { | |
var key = array[i], j = i - 1; | |
while (j > -1 && array[j] > key) | |
array[j + 1] = array[j--]; | |
array[j + 1] = key; | |
} | |
This file contains hidden or 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 sum (a, b) { | |
var c = [], buff = false; | |
for (var i = a.length - 1; i >= 0; i--) | |
if ((a[i] && b[i]) || (!a[i] && !b[i])) { | |
c.unshift(buff); | |
buff = a[i]; | |
} else c.unshift(!buff); | |
if (buff) c.unshift(true); |
This file contains hidden or 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
sudo apt-get install thunderbird apache2 mysql-server php5-mysql php5 libapache2-mod-php5 php5-mcrypt git gitk npm vim htop ssh traceroute vlc |
This file contains hidden or 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.header').remove(); | |
// Удаление номеров каждого задания. | |
var elements = $('.nobreak.pbody').find('span'); | |
for (var i = 0; i < elements.length; i++) { | |
var element = $(elements[i]), | |
text = element.text(), | |
index = text.indexOf('.'), | |
text = '№ ' + text.substr(0, index) + ')'; |
This file contains hidden or 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 isIntersection (x1, y1, x2, y2, x3, y3, x4, y4) { | |
var angles = [ | |
getAngleOf(x2, y2, x1, y1, x3, y3) + getAngleOf(x2, y2, x1, y1, x4, y4), | |
getAngleOf(x4, y4, x3, y3, x1, y1) + getAngleOf(x4, y4, x3, y3, x2, y2), | |
getAngleOf(x1, y1, x2, y2, x3, y3) + getAngleOf(x1, y1, x2, y2, x4, y4), | |
getAngleOf(x3, y3, x4, y4, x2, y2) + getAngleOf(x3, y3, x4, y4, x1, y1) | |
]; | |
var sum = angles[0] + angles[1] + angles[2] + angles[3]; |
This file contains hidden or 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
"use strict"; | |
let res = ` | |
1111110 | |
1111100 | |
1111111 | |
1111111 | |
1111111 | |
0111111 | |
0111111 |