Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Anton Cherepov chekit

🎯
Focusing
Block or report user

Report or block chekit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chekit
chekit / stash_dropped.md
Created Oct 4, 2019 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?
View stash_dropped.md

How to recover a dropped stash in Git?

1. Find the stash commits:

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@chekit
chekit / what-forces-layout.md
Created Sep 16, 2019 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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()
@chekit
chekit / Index.html
Created Jul 2, 2019 — forked from meziantou/Index.html
Javascript - Record audio
View Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>Audio</h1>
@chekit
chekit / gist:3d5b6ec6e8f6839baadf738b279bafa0
Created Dec 26, 2018 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
View gist:3d5b6ec6e8f6839baadf738b279bafa0
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@chekit
chekit / detect-click-outside-component.ts
Created Jul 10, 2018
Detect if the click was made outside host component
View detect-click-outside-component.ts
import { Component, ElementRef, HostListener } from '@angular/core';
/**
* If we need to detect where was click made outside the hosting component, we can use the construction below
* Source: https://stackoverflow.com/a/40107009
*/
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
@chekit
chekit / get_unique.js
Last active Mar 14, 2018
reduces digits array from repeated items to unique items only
View get_unique.js
// Reduces digits array from repeated items to unique items only
const arr = [1, 2, 1, 1, 4, 5, 7, 8, 2];
const unique = arr.filter((item, index, arr) => index === arr.indexOf(item));
console.log(unique); // [1, 2, 4, 5, 7, 8]
// Alternative
const unique2 = Array.from(arr.reduce((acc, item) => acc.add(item), new Set()));
console.log(unique2); // [1, 2, 4, 5, 7, 8]
View Creating, pushing a deleting git tags
git tag -am "annotation goes here" tagname_goes_here # cut a tag
git tag -d tagname_goes_here # burn it
git tag -am "annotation goes here" tagname_goes_here # cut another tag
git push --tags # push tags to remote
git push origin :refs/tags/tagname_goes_here # delete tag from remote
@chekit
chekit / ng-replace.md
Last active Sep 26, 2017
replace AngularJS expressions with Angular expressions
View ng-replace.md

*ngFor

Заменяет старый синтаксис ng-repeat="item in obj.items track by $index" или ng-repeat="item in items track by $index" на новый *ngFor="let item of obj.items; trackBy: trackById;" или *ngFor="let item of items; trackBy: trackById;"

Выражение:

ng-repeat="([a-zA-Z]*)\s+(in)\s+([a-zA-Z\.{1}().]*)\s+track by \$index"

Замена:

@chekit
chekit / android-studio-install.md
Created Aug 10, 2017
How to deal with android emulation on Windows
View android-studio-install.md

Решил проблему незапускающегося проекта следующим образом:

В пункте Install the Android Tools ограничился установкой Android Studio

В Android Studio в settings нужно

@chekit
chekit / debounce_throttle.js
Created Aug 5, 2017
Debounce and Throttle methods
View debounce_throttle.js
/*
Debounce
*/
export function debounce(fn, time) {
let timeout = null;
return function () {
let context = this;
let args = arguments;
You can’t perform that action at this time.