Skip to content

Instantly share code, notes, and snippets.

View myfonj's full-sized avatar

Michal Čaplygin myfonj

View GitHub Profile
@myfonj
myfonj / align-to-physical-point-from-150-percent-scale.user.css
Last active August 6, 2019 11:16
Rescale images to physical points
/*
Crisp up-scaled images on display with 150% DPI scale factor
Prevents blurry antialised edges between picture sampling areas.
"DPI Zoom (scale) factor" can be obtained with JavaScript:
window.devicePixelRatio
for 150% DPI scale factor at page with 100% zoom level this should be 1.5
@myfonj
myfonj / ana-tudor-s-morph-svg-grid-smil-variation.markdown
Last active June 9, 2019 16:41
Ana Tudor's "Morph SVG grid" - SMIL variation

Ana Tudor's "Morph SVG grid" - SMIL variation

Based on Ana's pen [1], rewritten into "more pure SVG" to get wider browser support: should work in most non-IE browsers [2].

[1] https://codepen.io/thebabydino/pen/yQewOm [2] https://caniuse.com/#feat=svg-smil Original description:

Codevember #8/ 2018. Chrome only, as it sets the path data d from the CSS. If you like my work in general and this demo in particular and you wish me to be able to continue putting out stuff, please consider one of the following:

/*
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@namespace html url(http://www.w3.org/1999/xhtml);
(still on dev edition)
*/
/*
prevent bright new tab flash
https://www.reddit.com/r/firefox/comments/8h3gy8/trying_to_customize_newtab_in_usercontentcss_and/
*/
@myfonj
myfonj / tasks.jsonc
Last active July 30, 2019 08:37
VS Code HTML Tidy task
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/d", "/c"
]
/*
* Bookmarklet for viewing source in iPad Safari
*/
javascript:(function(d,t){
d.write(t);
d.close();
d.body.appendChild(d.createTextNode(document.documentElement.outerHTML));
})(window.open('about:blank').document,'<!DOCTYPE html><title>Source of ' + location.href + '</title><meta name="viewport" content="width=device-width" /><body style="font-family: monospace, monospace; white-space: pre-wrap;">');
/**
* @returns {"not empty string"|false}
*/
function stringOrFalse() {
return Math.random() > 0.5 ? 'not empty string' : false
}
var stringVar = 'aaa'
var booleanVar = true
@myfonj
myfonj / unround-everything.user.css
Created July 29, 2019 10:13
Unround everything
/* Unround everything */
*:not(#\0):not(#\0):not(#\0),
*:not(#\0):not(#\0):not(#\0)::before,
*:not(#\0):not(#\0):not(#\0)::after,
/* Unround images */
img:not(#\0):not(#\0):not(#\0) {
border-radius: 0 !important;
}
@myfonj
myfonj / console-copy-computed-style-as-json.devtools.js
Last active July 30, 2019 08:59
Copy computed style as formatted JSON in Devtools console
(el=>copy(JSON.stringify((c=>Object.values(c).reduce((o,k)=>{o[k]=c[k];return o},{}))(getComputedStyle(el)),null,'\t')))(document.body)
@myfonj
myfonj / sweep stickies bookmarklet
Last active August 16, 2019 15:52
🧹 Sweep Stickies 🧹
javascript:((u,n,s,t,i,c,k)=>n.querySelectorAll('*').forEach(e=>{true&&(/fixed|sticky/.test((c=getComputedStyle(e))[s])||(/absolute/.test(c[s])&&Number(c.zIndex)>t))&&e!==n.documentElement&&e!==(k=n.body)&&k.contains(e)&&e.parentNode.removeChild(e)||/hidden/.test(c[u])&&e.style.setProperty(u,'auto','important')}))('overflow',document,'position',1111)
(function(){
/*
data extracted from https://unicode.org/Public/emoji/12.0/emoji-test.txt
linked trough https://unicode.org/Public/emoji/12.0/
from https://unicode.org/emoji/charts/full-emoji-list.html
probably licensed under https://www.unicode.org/license.html
*/
const EMOJI_STRING = "😀|grinning face||😃|grinning face with big eyes||😄|grinning face with smiling eyes||😁|beaming face with smiling eyes||😆|grinning squinting face||😅|grinning face with sweat||🤣|rolling on the floor laughing||😂|face with tears of joy||🙂|slightly smiling face||🙃|upside-down face||😉|winking face||😊|smiling face with smiling eyes||😇|smiling face with halo||🥰|smiling face with hearts||😍|smiling face with heart-eyes||🤩|star-struck||😘|face blowing a kiss||😗|kissing face||☺️|smiling face||☺|smiling face||😚|kissing face with closed eyes||😙|kissing face with smiling eyes||😋|face savoring food||😛|face with tongue||😜|winking face with tongue||🤪|zany face||😝|squinting face with tongue||🤑|money-mouth face||🤗|hugging face||🤭|face with hand over