Skip to content

Instantly share code, notes, and snippets.

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

ReSampled pointofpresence

🏠
Working from home
View GitHub Profile
@pointofpresence
pointofpresence / get length of biggest nested array.js
Last active March 31, 2024 14:08
JS: Получить размер самого большого вложенного массива
// get length of biggest nested array
const maxLength = Math.max(...sheetsArray.map(subArr => subArr.length));
@pointofpresence
pointofpresence / helpers.js
Created April 26, 2023 17:50
Array to number array
const prev = oldVersion.split('.').map(Number);
const next = newVersion.split('.').map(Number);
@pointofpresence
pointofpresence / what_is_1e3.js
Last active May 5, 2023 22:05
From pointofpresence.ru
> parseInt(1000)
1000
> parseInt(1000.0)
1000
> parseInt("1000.0")
1000
> parseInt(1e3)
@pointofpresence
pointofpresence / midi.py
Created August 16, 2023 13:16
Python midi to system
"""
pip install rtmidi
http://zabaykin.ru/?p=200
"""
import time
import rtmidi
import win32api
#import win32clipboard
@pointofpresence
pointofpresence / find-unused-css.js
Last active December 21, 2023 20:00 — forked from michaelnordmeyer/find-unused-css.js
Find unused CSS rules on a page
(function() {
for (var ssi = 0; ssi < document.styleSheets.length; ssi++) {
let rules;
try {
rules = document.styleSheets[ssi].cssRules || [];
} catch (e) {
rules = []
}
var sheetHref = document.styleSheets[ssi].href || 'inline';
@pointofpresence
pointofpresence / set data attribute.js
Last active March 31, 2024 14:13
JS: Установить значение data-атрибута DOM-элемента
script.dataset.ednaWidget = null;
// установит значение data-edna-widget="null" у элемента script
javascript:void function(){function truncateString(e,t){return e.length>t?e.slice(0,t):e}const title=document.title,href=location.href,host=new URL(href).host,cleanHost=host.replace(/[^a-zA-Z0-9]/g,"-");let finalHost=cleanHost.replace(/--/g,"-");finalHost.length||(finalHost="local");let sel=window.getSelection().toString();0===sel.length&&(sel=prompt("Description"));let text=`## ${title}\n\n${href}${sel&&sel.length>0?`\n\n${sel}`:""}`;const textarea=document.createElement("textarea");textarea.value=text,document.body.appendChild(textarea),textarea.select(),document.execCommand("copy");let command=`obsidian://advanced-uri?filepath=__INBOX/${finalHost}&mode=new`;if(document.queryCommandSupported("copy")){const e=document.execCommand("copy");document.body.removeChild(textarea),e?(console.log("Текст успешно скопирован в буфер обмена"),command=`obsidian://advanced-uri?filepath=__INBOX/${finalHost}&clipboard=true&mode=new`):(console.error("Перенос через URL"),command=truncateString(`${command}&data=${text=encodeURI