Skip to content

Instantly share code, notes, and snippets.

View dziku86's full-sized avatar

Kamcio dziku86

View GitHub Profile
const handleClick = e => {
if (!modalEl.contains(e.target)) modalEl.hidden = !0
}
@dziku86
dziku86 / darkthemeswitcher-inline.js
Last active December 8, 2020 14:57 — forked from frontdevops/darkthemeswitcher-inline.js
Simple Dark Theme Bookmarklet for web pages
javascript:(d=>{var css=`html{background:#fefefe;filter:invert(100%)}*{background:inherit}img:not([src*=".svg"]),video{filter:invert(100%)}`,style,id='dark-theme-snippet',ee=d.getElementById(id);if(null !=ee)ee.parentNode.removeChild(ee);else{style=d.createElement('style');style.id=id;style.styleSheet?style.styleSheet.cssText=css:style.appendChild(d.createTextNode(css));d.head.appendChild(style)}})(document)
@dziku86
dziku86 / scriptloader.js
Last active February 20, 2021 21:57 — forked from itsjavi/scriptloader.js
JS ScriptLoader using ES6 Promises
function ScriptLoader () {
const loader = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = !0
script.addEventListener('load', resolve(script), !1)
script.addEventListener('error', reject(script), !1)
body.appendChild(script)
})
this.load = url => loader(url)
@dziku86
dziku86 / functional-utils.js
Created February 20, 2021 21:37 — forked from bendc/functional-utils.js
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@dziku86
dziku86 / formProgress.js
Created February 21, 2021 22:15 — forked from adactio/formProgress.js
Show a progress bar with every form that has a method of POST. Particularly nice if there's a file upload involved.
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function (win, doc) {
'use strict';
if (!win.XMLHttpRequest || !win.FormData || !win.addEventListener || !doc.querySelectorAll) {
// doesn't cut the mustard.
return;
}
function hijaxForm (formElement) {
var progressBar;
const getAllFocusableElements = (parent) => Array.from(parent.querySelectorAll('*')).filter(elm => elm.tabIndex > -1).sort((a,b) => a.tabIndex > b.tabIndex ? 1 : a.tabIndex < b.tabIndex ? -1 : 0);
@dziku86
dziku86 / app.js
Created January 19, 2023 18:09 — forked from prof3ssorSt3v3/app.js
Code from video about using Promise.finally and Spinners
function delay(time = 500) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time);
});
}
let spinner = document.querySelector('.spinner');
spinner.classList.add('active');
fetch('./books.json')
@dziku86
dziku86 / ntfs-file-system-increase-speed-performance.com
Created March 6, 2024 17:38 — forked from p3x-robot/ntfs-file-system-increase-speed-performance.com
🚄 This is a simple utility to increase the NTFS performance by turning off some NTFS features that are not so used by now (or not so important).
rem execute as an Administrator
rem based on http://www.windowsdevcenter.com/pub/a/windows/2005/02/08/NTFS_Hacks.html
ram based on https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc938961(v=technet.10)
rem http://archive.oreilly.com/cs/user/view/cs_msg/95219 (some installers need 8dot3 filenames)
rem disable 8dot3 filenames
ram Warning: Some applications such as incremental backup utilities rely on this update information and do not function correctly without it.
fsutil behavior set disable8dot3 1

There are lots of command lines which can be used with the Google Chrome browser. Some change behavior of features, others are for debugging or experimenting. This page lists the available switches including their conditions and descriptions. Last automated update occurred on 2018-10-20.

Condition Explanation
-- Report pseudo allocation traces. Pseudo traces are derived from currently active trace events.
--/prefetch:1 /prefetch:# arguments to use when launching various process types. It has been observed that when file reads are consistent for 3 process launches with the same /prefetch:# argument, the Windows prefetcher starts issuing reads in batch at process launch. Because reads depend on the process type, the prefetcher wouldn't be able to observe consistent reads if no /prefetch:# arguments were used. Note that the browser process has no /prefetch:# argument; as such a