- Create a gist if you haven't already.
- Clone your gist:
# make sure to replace `<hash>` with your gist's hash git clone https://gist.github.com/<hash>.git # with https git clone git@gist.github.com:<hash>.git # or with ssh
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
Images |
Многие увидев #Задачка_28 — "о, так здесь же можно просто взять lodash.get". И были бы правы. Но сначала рассмотрим более креативные варианты решений
Решение на позицию тех. лида 🙂
Написать конвертор путей в формат json-pointer. А потом использовать библиотеку, которая умеет доставать значения с объекта в новом формате.
Сылка на формат json-pointer— https://datatracker.ietf.org/doc/html/rfc6901
Спасибо Юре Ткаченко, мы сами про это не подумали.
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
git branch beforeReset | |
git reset --soft <root> | |
git commit --amend | |
# Verify that the new amended root is no different | |
# from the previous branch state | |
git diff beforeReset |
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
1. Set to default registry: | |
npm set registry https://registry.npmjs.org/ | |
2. Unpublish package (force) | |
npm unpublish[<@scope>/]<pkg>[@<version>] | |
2.1. Force | |
npm unpublish <pkg> --force | |
3. Recompile C++ addons (if install new version of nodejs)+ |
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 всегда надо указывать type="button" иначе кнопка будет вести себя как type="submit" |
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
/** | |
* relates an element's border box to the document origin | |
* | |
* @param {DOMObject} current element | |
* @return {Object} top and left cooridanets of element relative to origin document | |
*/ | |
function offset(element) { | |
const rect = element.getBoundingClientRect(); | |
const win = element.ownerDocument.defaultView; |
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 Animal(name) { | |
this.name = name; | |
this.speed = 0; | |
} | |
// Методы хранятся в прототипе | |
Animal.prototype.run = function() { | |
alert(this.name + " бежит!") |
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
class EventEmitter { | |
constructor() { | |
this.events = {}; | |
} | |
emit(eventName, data) { | |
const event = this.events[eventName]; | |
if( event ) { | |
event.forEach(fn => { | |
fn.call(null, data); |
NewerOlder