Skip to content

Instantly share code, notes, and snippets.

View chekit's full-sized avatar
👋

Anton Cherepov chekit

👋
View GitHub Profile
@chekit
chekit / stash_dropped.md
Created October 4, 2019 13:02 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?

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 September 16, 2019 10:10 — 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()
@chekit
chekit / Index.html
Created July 2, 2019 10:25 — forked from meziantou/Index.html
Javascript - Record audio
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>Audio</h1>
@chekit
chekit / gist:3d5b6ec6e8f6839baadf738b279bafa0
Created December 26, 2018 08:15 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
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
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 / package.json
Created June 23, 2016 09:13 — forked from addyosmani/package.json
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js'",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
@chekit
chekit / modernizr.positionfixed.js
Created October 29, 2015 08:54 — forked from bobslaede/modernizr.positionfixed.js
Modernizr position fixed check
;(function(Modernizr, window) {
Modernizr.addTest('positionfixed', function () {
var test = document.createElement('div'),
control = test.cloneNode(false),
fake = false,
root = document.body || (function () {
fake = true;
return document.documentElement.appendChild(document.createElement('body'));
}());
@chekit
chekit / HideMobileAddressBar.js
Last active October 27, 2015 22:21 — forked from mhammonds/HideMobileAddressBar.js
Hide Browser Address Bar - Android + iPhone
//На одном из проектов оказалось, что достаточно добавить body position:fixed
//Ситуация была: на мобильных меню при открытии становилось fixed, но при прокрутке снизу из-за адресной строки появлялся "провал"
//Так же для манипуляции меню к body добавлялся класс .show-nav
//В моей ситуации оказалось достаточно просто добавить в show-nav position: fixed (пофиксить body)
function hideAddressBar()
{
if(!window.location.hash)
{
if(document.height < window.outerHeight)
@chekit
chekit / README.md
Last active August 29, 2015 14:22 — forked from jonathantneal/README.md

EventListener Polyfill

Is IE8 your new IE6? Level the playing field with polyfills.

This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.

addEventListener

addEventListener registers a single event listener on a single target.

@chekit
chekit / server.js
Last active August 29, 2015 14:17 — forked from alexesDev/server.js
var express = require('express');
var app = express();
function productCount(){
return Math.round(Math.random() * 10 + 1);
}
function times(n, callback){
var list = [];