Skip to content

Instantly share code, notes, and snippets.

@TeChn4K
TeChn4K / index.js
Created March 26, 2020 09:33
Pure JavaScript animated ScrollTo
function scrollTo(top, duration) {
const cosParameter = (window.scrollY - top) / 2;
let scrollCount = 0;
let oldTimestamp = performance.now();
function step (newTimestamp) {
scrollCount += Math.PI / (duration / (newTimestamp - oldTimestamp));
if (scrollCount >= Math.PI) {
window.scrollTo(0, top);
}
@TeChn4K
TeChn4K / post-checkout
Created October 28, 2019 10:35
Git Hooks
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by naXa! - naxa.by
# forked by TeChn4K
#
# Git hook to run a command after `git checkout` / `git rebase` if a specified file was changed.
#
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#
# Terminate gracefully on a file checkout (retrieving a file from the index)