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
"use strict"; | |
// animation utils | |
// =============== | |
const trackTime = id => { | |
const [entry] = performance.getEntriesByName(id); | |
if (!entry) { | |
performance.mark(id); |
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
// MultiExporter.jsx | |
// Version 0.1 | |
// Version 0.2 Adds PNG and EPS exports | |
// Version 0.3 Adds support for exporting at different resolutions | |
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize | |
// Version 0.5 Fixed cropping issues | |
// Version 0.6 Added inner padding mode to prevent circular bounds clipping | |
// | |
// Copyright 2013 Tom Byrne | |
// Comments or suggestions to tom@tbyrne.org |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" | |
integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"> | |
</head> | |
<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
<button id="littleButton">Отправить запросы</button> | |
<div id="content"></div> | |
<script> | |
function sendRequest (url) { | |
return new Promise((resolve, reject) => { | |
const xhr = new XMLHttpRequest(); | |
xhr.open("GET", url, true); | |
xhr.send(); | |
xhr.addEventListener('load', () => { | |
resolve(xhr.response); |
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
/*======================================== | |
= Работа с числами = | |
========================================*/ | |
//Теперь можно сразу писать числа в двоичном виде, | |
//добавив 0b перед числом | |
{ | |
let a = 0b00001111; |
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
/*========================================== | |
= Стрелочные функции и литералы объекта = | |
==========================================*/ | |
// Простой пример стрелочной функции | |
let circleArea = (pi, r) => { | |
let area = pi * r * r; | |
return area; | |
} |
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
/*================================================== | |
= Деструктивное присваивание = | |
==================================================*/ | |
{ | |
let myArr = [1, 2, 3]; | |
let a, b, c; | |
[a, b, c] = myArr; | |
//Или еще более короткий |
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 myFunction(x = 1, y = 2, z = 3) { | |
console.log(x,y,z); //Выведет "6 7 3" | |
} | |
myFunction(6,7); | |
/*=========================================== | |
= Оператор расширения = | |
===========================================*/ |
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 products = [{ name: "Grapefruit", calories: 170, color: "red", sold: 8200 }, | |
{ name: "Orange", calories: 160, color: "orange", sold: 12101 }, | |
{ name: "Cola", calories: 210, color: "caramel", sold: 25412 }, | |
{ name: "Diet Cola", calories: 0, color: "caramel", sold: 43922 }, | |
{ name: "Lemon", calories: 200, color: "clear", sold: 14983 }, | |
{ name: "Raspberry", calories: 180, color: "pink", sold: 9427 }, | |
{ name: "Root Beer", calories: 200, color: "caramel", sold: 9909 }, | |
{ name: "Water", calories: 0, color: "clear", sold: 62123 } | |
]; | |
function compareSold (colaA,colaB) { |
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 (e) { | |
var elementClick = jQuery(this).attr("href"); | |
var destination = jQuery(elementClick).offset().top; | |
jQuery('body').animate({ scrollTop: destination }, 1100); | |
return false; | |
e.preventDefault(); | |
} |
NewerOlder