Skip to content

Instantly share code, notes, and snippets.

View utilmind's full-sized avatar
🏠
Working from home

Oleksii Kuznietsov utilmind

🏠
Working from home
View GitHub Profile
@utilmind
utilmind / set-wallpaper.bat
Last active April 15, 2025 00:59
Windows 10 batch file to set Desktop background wallpaper
:: See also "set-background-color.bat".
:: Sometimes, when you're using the best performance settings, with no shadows under icon labels,
:: it's important to specify the solid background-color too, to display the contrast color for the icon labels.
:: If your primary wallpaper color is dark, set the solid color to black (000000). When it's light -- set solid color to white (ffffff).
@echo off
if [%1]==[] (
echo USAGE: set-wallpaper.bat [full/path/to/filename.jpg]
exit
@utilmind
utilmind / expireStorage
Last active April 20, 2021 22:23
Replacement for regular localStorage or sessionStorage objects, if they blocked by some paranoiac browser, like Brave with default settings
// This is replacement for regular localStorage or sessionStorage objects,
// if they blocked by some paranoiac browser, like Brave with default settings....
var expireStorage = {
length: function() {
return data.length;
},
key: function(key) {
return Object.keys(data)[key];
},
@utilmind
utilmind / cookieless-ga.js
Created January 9, 2021 07:21
Google Analytics without cookies
// https://medium.com/swlh/how-to-use-google-tag-manager-and-google-analytics-without-cookies-7d041c73cc76
// https://developers.google.com/tag-manager/devguide
(function() {
window.dataLayer = window.dataLayer || [];
var GA_MEASUREMENT_ID = "UA-XXXXXXXXX-X",
GA_LOCAL_STORAGE_KEY = "ga:clientId",
clientId = localStorage.getItem(GA_LOCAL_STORAGE_KEY),
gtag = function() {
dataLayer.push(arguments);
@utilmind
utilmind / js-ucwords
Last active August 23, 2019 08:00
ucwords() for JavaScript
// The unicode-safe ucwords() func for JS (to capitalize the first characters of words),
// which additionally respects double-lastnames like Russian Засс-Ранцев and weird French names,
// like Honoré de Balzac and d'Artagnan.
String.prototype.ucwords = function() {
return this.toLowerCase()
.replace(/(^|\s|\-)[^\s$]/g, function(m) {
return m.toUpperCase();
})
// French, Arabic and some noble names...
@utilmind
utilmind / bootstrap4-style-custom-check-radio-boxes
Last active July 15, 2019 01:56
Custom "Bootstrap v4"-style check/radio-boxes. Checkboxes are animated.
<style>
/* Original idea of styling peeped at https://codersblock.com/blog/checkbox-trickery-with-css/ */
input[type="checkbox"],
input[type="radio"] {
position: absolute;
left: -9999px;
}
.check-label,
@utilmind
utilmind / mielophone.txt
Last active April 24, 2019 13:08
Правило милозвучності в строках
/* This code make for Ukrainian language only.
Перетвоює пару В-У в строках відповідно до правила милозвучності української мови.
Перетворює «в» на «у» чи навпаки, залежно від контексту (наявності голосних-приголосних поруч).
Фаворит Експертів в номінації --> Фаворит Експертів у номінації
Фаворит Успіху у номінації --> Фаворит Успіху в номінації
*/
function mielophone($s, $l = false) {
global $lang;
if (!$l) $l = $lang;