Skip to content

Instantly share code, notes, and snippets.

View dkrnl's full-sized avatar

Dmitri Pyatkov dkrnl

View GitHub Profile
@dkrnl
dkrnl / git-last-commit-files-changed.sh
Created September 15, 2022 07:22
git last commit files changed
git diff --name-only HEAD@{1} HEAD
@dkrnl
dkrnl / find-duplicate.sh
Created July 5, 2022 12:23
find duplicate files
find . -mindepth 1 -printf '%h %f\n' | sort -t ' ' -k 2,2 | uniq -f 1 --all-repeated=separate | tr ' ' '/'
@dkrnl
dkrnl / what-forces-layout.md
Created June 21, 2022 04: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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
U+0000
U+0002
U+000D
U+0020
U+0021
U+0022
U+0023
U+0024
U+0025
U+0026
#!/bin/sh
find -name '*.png' -print0 | xargs -0 optipng -o7
/* eslint global-require: "off" */
const fs = require('fs');
const path = require('path');
const postcss = require('postcss');
const { URLSearchParams } = require('url');
const DEBUG = ('DEBUG' in process.env && parseInt(process.env.DEBUG, 10) > 0);
const PROD = ('NODE_ENV' in process.env && process.env.NODE_ENV === 'production') || process.argv.indexOf('-p') !== -1;
const { browserslist: BROWSERS } = require('./package.json');
@dkrnl
dkrnl / jpegtran-all-files.sh
Last active May 19, 2017 05:08
jpegtran all jpeg files in directroy
#!/bin/sh
find . -name "*.jpg" -type f -exec jpegtran -verbose -copy none -optimize -outfile {} {} \;
@dkrnl
dkrnl / pre-commit.sh
Last active December 29, 2016 06:04
SVN pre-commit: commit message required
#!/bin/sh
REPOS="$1"
TXN="$2"
export LANG="ru_RU.UTF-8"
SVNLOOK=/usr/bin/svnlook
LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | wc -m)
@dkrnl
dkrnl / selectize-clear_button.js
Last active September 7, 2016 07:37
Selectize clear button
/**
* Plugin: "clear_button" (selectize.js)
* Copyright (c) 2015 Dmitri Piatkov & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
@dkrnl
dkrnl / www-backup.sh
Last active August 16, 2016 05:07
Backup sites in www directory
#!/usr/bin/env bash
cd /var/backups/www
# backup www folders
for i in `find /www/* -type d -nowarn -maxdepth 0 -exec basename {} \;`;
do
tar -cvzf $i.$(date +%F).tgz /www/$i
done