Skip to content

Instantly share code, notes, and snippets.

View newbornfrontender's full-sized avatar
🐣
Time to code

Infant Frontender newbornfrontender

🐣
Time to code
  • Russia
View GitHub Profile
@newbornfrontender
newbornfrontender / map.js
Last active January 7, 2023 06:35
yandex map custom cluster and placemark
import $ from 'jquery';
// $(document).ready(() => {
// // Создание кластеризатора с произвольным HTML-макетом иконки кластера
// class CustomCluster {
// // Зададаем макет метки кластера
// createCluster() {
// return ymaps.templateLayoutFactory.createClass(
// '<div class="ymap-cluster-icon">{{ properties.geoObjects.length }}</div>',
// );
@newbornfrontender
newbornfrontender / what-forces-layout.md
Created February 22, 2019 05:36 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@newbornfrontender
newbornfrontender / index.css
Created January 22, 2019 18:38
Media Queries, Rem's and CSS Custom Properties
:root {
--fz: 16px;
}
div {
font-size: var(--fz);
}
@media screen and (min-width: 450px) {
p {
@newbornfrontender
newbornfrontender / index.html
Last active January 18, 2019 13:46
Electron Fiddle Gist (CSS Shadow Parts)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Web-components and electron</title>
<style>
my-app::part(title) {
color: cyan;
@newbornfrontender
newbornfrontender / index.js
Created January 18, 2019 07:15
Objects, Prototypes and Classes in JavaScript
// -----------------------------------------------------------------------------
// Objects
// -----------------------------------------------------------------------------
// const Reptile = function(name, canItSwim) {
// this.name = name;
// this.canItSwim = canItSwim;
// };
// Reptile.prototype.doesItDrown = function() {
@newbornfrontender
newbornfrontender / index.js
Created January 18, 2019 06:48
Destructuring. Two more quick tips for arrays
const [,,,, five] = [1, 2, 3, 4, 5, 6, 7];
console.log(`Selected: ${five}`);
@newbornfrontender
newbornfrontender / index.js
Created January 18, 2019 06:46
Destructuring. Multiple return values
const addres = ['37.6068', '55.7386'];
function getCoordinates(addres) {
const coordinates = {
lon: addres[0],
lat: addres[1],
};
return [coordinates.lon, coordinates.lat];
};
@newbornfrontender
newbornfrontender / index.css
Created January 11, 2019 16:05
Construct Stylesheets (пример)
/* Раскоментируйте чтобы увидеть изменения */
/* p {
color: coral;
} */
/* Переопределяет встроенные стили компонента */
/* Раскоментируйте чтобы увидеть изменения */
/* p:last-of-type {
color: cyan;
} */
@newbornfrontender
newbornfrontender / index.css
Created January 11, 2019 16:02
CSS Shadow Parts (пример)
/* Стилизуем части */
/* Из index.js */
my-app::part(text-first) {
color: cyan;
}
/* Из my-greeting.js */
my-app::part(title-color) {
color: purple;
@newbornfrontender
newbornfrontender / index.html
Created January 11, 2019 14:50
Native importmap (not working)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link rel="modulepreload" href="log.js"></link>
<link rel="modulepreload" href="import:lodash">
<script type="importmap">
{