Skip to content

Instantly share code, notes, and snippets.

View jaandrle's full-sized avatar
🚀
Exploring

Jan Andrle jaandrle

🚀
Exploring
View GitHub Profile
@jaandrle
jaandrle / seafile.css
Last active April 10, 2024 18:15
SeaFile — dark mode support theme
/*
Tested on v11.0.3
@see https://github.com/udlch/seafile_ce-edition_custom_theme
*/
@media (prefers-color-scheme: dark) {
:root {
--main-bg: #2b2b2b;
--dark-bg: #202020;
--light-bg: #303030;
@jaandrle
jaandrle / Module_compile.js
Created June 14, 2023 06:59 — forked from ghaiklor/Module_compile.js
Module.prototype._compile() sources
// Run the file contents in the correct scope or sandbox. Expose
// the correct helper variables (require, module, exports) to
// the file.
// Returns exception, if any.
Module.prototype._compile = function(content, filename) {
// Remove shebang
var contLen = content.length;
if (contLen >= 2) {
if (content.charCodeAt(0) === 35/*#*/ &&
content.charCodeAt(1) === 33/*!*/) {
@jaandrle
jaandrle / git_submodule.md
Last active May 6, 2022 18:31
`git submodule`

git submodules

See documentation Git - Submodules, basic usage below.

Clone parent repo

The default git clone … is not enough, so:

git clone --recurse-submodules TARGET_REPO

…or

git clone TARGET_REPO
@jaandrle
jaandrle / createEmojiFlag.js
Last active February 9, 2022 18:13
Create emoji flag (not only in JS, the logic is the same for others)
/* jshint esversion: 6,-W097, -W040, browser: true, expr: true, undef: true */
/**
* Flags emojis are just concation of two emoji letters (see [1]).
* Inspired by [2].
*
* - [1] https://apps.timwhitlock.info/emoji/tables/iso3166
* - [2] https://twitter.com/rauschma/status/1491189507261333505
*
* @param {string|string[]} country Two letters (e.g. 'cs', 'us', …)
* @returns {string}
@jaandrle
jaandrle / .vimrc
Last active May 18, 2023 08:31
Just “Explorer” part
# For inspiration
augroup netrw_mapping
autocmd!
autocmd filetype netrw call <sid>OnNetrwEnter()
augroup END
function s:OnNetrwEnter()
nmap <buffer> <leader>e :bd\|Vifm<cr>
endfunction
" ========================================================================///
" File: cwordhi.vim
" Description: highlight other occurrences of current word
" Version: 0.0.1
" Author: Gianmaria Bajo <mg1979@git.gmail.com>
" License: MIT
" Created: mer 20 novembre 2019 07:20:10
" Modified: ven 31 gennaio 2020 14:40:16
" ========================================================================///
@jaandrle
jaandrle / utils.d.ts
Last active August 30, 2021 11:11
TypeScript
// Brand<number, "USD">
type __BrandWitnes<B= unknown>= Partial<Record<'__witness__',B>>;
type Brand<Base= any, Branding= any, ReservedName extends PropertyKey= '__type__'>
= Base & Partial<Record<ReservedName,Branding>> & __BrandWitnes<Base>;
// BrandBase<Brand<number, "USD">>
type BrandBase<T extends __BrandWitnes>
= T['__witness__'];
// tuRecord<"a"|"b","A"|"B","a"> => { a?: "A"|"B", b: "A"|"B" }
type tuRecord<Keys extends PropertyKey, Values, KeysOptional extends PropertyKey= never>
= Required<Omit<Record<Keys,Values>,KeysOptional>>
/// Adds a pseudo-element to help vertically align text labels in buttons/block-like links with only one magic number
/// idea originaly from: `https://ishadeed.com/article/button-label-alignment/`
@mixin vertically-align-label($height: 1em) {
&:before {
content: '';
display: inline-block;
height: $height;
vertical-align: middle;
}
}
function debugPromise_(callback, ...args){
return callback(...args).catch(({ stack })=> {
const error= new Error(callback.name||String(callback));
error.stack+= '\n'+stack;
throw error;
});
};
//? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError