Skip to content

Instantly share code, notes, and snippets.

View devxom's full-sized avatar

Ilia A. Reshetnikov devxom

View GitHub Profile
@devxom
devxom / APIs affecting bfcache.md
Created March 1, 2020 17:16 — forked from victor-homyakov/APIs affecting bfcache.md
API, которые влияют на попадание страницы в bfcache
  • ✔︎ - не мешает попаданию страницы в bfcache
  • ✘ - запрещает попадание страницы в bfcache
  • пустая ячейка - влияние неизвестно
API Firefox Safari Chromium IE
Подписка на beforeunload
Подписка на unload
Незавершённые запросы XHR/fetch ✘ в планах прерывать запрос и вызывать onerror при восстановлении страницы
Незавершённые запросы за ресурсами ✘ кроме favicon
@devxom
devxom / gist:b22bfb1aa933bf4a978b09300340ccdc
Created July 30, 2019 07:42 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@devxom
devxom / entrypoint.sh
Created July 16, 2019 22:38 — forked from SharpEdgeMarshall/entrypoint.sh
Monkeypatch yarn issue #761
#!/bin/bash
# Monkeypatching yarn issue #761 installing with --production flag without devDependencies
if [ -n $NODE_ENV ] && [ "$NODE_ENV" == "production" ] || [ "$NODE_ENV" == "staging" ]
then
# Backup package.json and remove devDep
cp package.json original_package.json
jq 'del(.devDependencies)' package.json > tmp.json && mv tmp.json package.json
#Install
@devxom
devxom / to_https.sh
Created April 9, 2019 14:56 — forked from icyflame/to_https.sh
Convert all GitHub git remotes to SSH or HTTPS.
#/bin/bash
#-- Script to automatically convert all git remotes to HTTPS from SSH
# Script will change all the git remotes.
# If you didn't intend to do that, run the other script in this repo.
# Original 1: https://gist.github.com/m14t/3056747
# Original 2: https://gist.github.com/chuckbjones/9dc6634fe52e56ba45ac
# Thanks to @m14t, @michaelsilver and @chuckbjones.
ssh_to_https(){
REPO_URL=`git remote -v | grep -m1 "^$1" | sed -Ene's#.*(git@github.com:[^[:space:]]*).*#\1#p'`
@devxom
devxom / package.json
Created April 22, 2018 18:16 — forked from surma/package.json
Boilerplate for quick one-off TypeScript projects. Just run `npm start`
{
"name": "tsquickstart",
"version": "1.0.0",
"description": "Boilerplate for quick one-off TypeScript projects. Just run `npm start`",
"scripts": {
"init": "test -f tsconfig.json || (tsc --init -t ESNext -m ESNext && npm install)",
"start": "npm run init && concurrently \"npm run watch\" \"npm run serve\"",
"serve": "http-server",
"watch": "tsc -p . --watch",
"build": "tsc -p ."
@devxom
devxom / license-badges.md
Created September 17, 2017 16:31 — forked from lukas-h/license-badges.md
License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • Badges are made with Shields.io.
  • This badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.  
  • 🇫🇷 Cette liste en français
@devxom
devxom / docker-cleanup
Created August 20, 2017 18:28 — forked from wdullaer/docker-cleanup
Cleanup unused Docker images and containers
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'
<snippet>
<content><![CDATA[
<!-- begin $1 -->
<div class="$1">
$2
</div>
<!-- end $1 -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>di</tabTrigger>
@devxom
devxom / array_find.js
Created October 30, 2016 10:13 — forked from markhowellsmead/array_find.js
Polyfill JavaScript Array.prototype.find for older browsers (e.g. IE 10, IE 11)
if (!Array.prototype.find) {
Array.prototype.find = function(predicate) {
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
@devxom
devxom / rem-px.mixin.scss
Last active September 1, 2016 20:57 — forked from anonymous/gist:ce7c5287e1e20619d8aa
Snippets: rem-px mixin #scss
@function rem($pxs) {
@if type_of($pxs) == list {
$rem: ();
@each $px in $pxs {
$rem: append($rem, $px / 16 * 1rem);
}
} @else {
$rem: $pxs / 16 * 1rem;
}