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 update | |
sudo apt-get upgrade | |
// Установка приложений | |
sudo apt-get install vim git tree traceroute | |
// Установка nvm | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash |
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 getRandomer(...chances) { | |
const commonLength = chances.reduce((p, c) => p + c, 0) | |
, chancesLength = chances.length; | |
return function() { | |
const rIndex = Math.floor(Math.random() * commonLength); | |
let startIndex = - 0.5, lastIndex; | |
for (let i = 0; i < chancesLength; i++) { | |
lastIndex = startIndex + chances[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 () { | |
class Lever { | |
constructor(data) { | |
const lever = this; | |
lever.canvas = document.getElementById(data.canvasId); | |
lever.context = lever.canvas.getContext('2d'); | |
lever.canvas.width = data.width; | |
lever.canvas.height = data.height; |
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
const svg = d3.select("body").append('svg') | |
.attr('width', 500) | |
.attr('height', 500); | |
const data = [ | |
{cx: 10, cy: 10}, | |
{cx: 490, cy: 50}, | |
{cx: 50, cy: 490} | |
]; |
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
date | course | |
---|---|---|
2010.01.11 | 30,1851 | |
2010.01.12 | 29,4283 | |
2010.01.13 | 29,3774 | |
2010.01.14 | 29,6409 | |
2010.01.15 | 29,4299 | |
2010.01.16 | 29,5603 | |
2010.01.19 | 29,5963 | |
2010.01.20 | 29,5184 | |
2010.01.21 | 29,6941 |
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
class Point { | |
constructor () { | |
const point = this; | |
point.x = 0; | |
point.y = 0; | |
point.color = 'red'; | |
} | |
moveTo (x, y) { |
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 showPerson1 (name, family, age) { | |
console.log(name, family, age); | |
} | |
function showPerson2 ({name, family, age}) { | |
showPerson1(name, family, age); | |
} | |
const name = 'Aleksey', family = 'Danchin', age = 24; |
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
Array.isEqual = function (...arrays) { | |
if (arrays.length == 0) return false; | |
if (arrays.length == 1) return true; | |
const ctrl = arrays[0] | |
, length = ctrl.length; | |
for (let i = 1; i < arrays.length; i++) { | |
const array = arrays[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
Object.defineProperty(Map.prototype, 'toJSON', { | |
enumerable: false | |
, configurable: true | |
, get: () => function () { | |
const obj = {}; | |
for (const key of this.keys()) | |
obj[key] = this.get(key); | |
return obj; |
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
class User { | |
constructor (isAdmin = false) { | |
const user = this; | |
user.isAdmin = isAdmin; | |
User.all.push(user); | |
} | |
static get admins () { | |
return User.all.filter(user => user.isAdmin); | |
} |