This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-disable implicit-arrow-linebreak */ | |
| import { defineConfig } from 'vite'; | |
| import pluginHtml from '@web/rollup-plugin-html'; | |
| import copy from 'rollup-plugin-copy'; | |
| import summary from 'rollup-plugin-summary'; | |
| import minifyHTML from 'rollup-plugin-minify-html-literals'; | |
| const minifyHTMLLiteralsConfig = { | |
| options: { | |
| minifyOptions: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Based on bira theme | |
| setopt prompt_subst | |
| () { | |
| local PR_USER PR_USER_OP PR_PROMPT PR_HOST | |
| # Check the UID | |
| if [[ $UID -ne 0 ]]; then # normal user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Checks if the given CSS pseudo-selector is supported by the browser. | |
| * | |
| * @param {string} selector - The CSS pseudo-selector to check. | |
| * @returns {boolean} - True if the selector is supported, false otherwise. | |
| */ | |
| export const isPseudoSelectorSupported = (selector) => { | |
| const style = document.createElement('style'); | |
| let isSupported; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://jonlabelle.com/snippets/view/yaml/browser-user-agent-regular-expressions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Document</title> | |
| <!-- https://codepen.io/5t3ph/pen/MWyyYNz --> | |
| <!-- https://medium.com/@vfowler/design-form-input-width-to-guide-sighted-users-a6022dd54e73 --> | |
| <!-- https://javascript.plainenglish.io/how-to-adjust-the-width-of-an-input-field-to-the-width-of-its-input-value-728ef59bc3e9 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>:focus-visible</title> | |
| <style> | |
| pre { | |
| height: 100px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const escapeHTML = (str) => | |
| str.replace( | |
| /[&<>'"]/g, | |
| (character) => | |
| ({ | |
| '&': '&', | |
| '<': '<', | |
| '>': '>', | |
| "'": ''', | |
| '"': '"', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs'; | |
| import path from 'path'; | |
| const traverseTree = (dir, attribute, cacheTravese = '') => { | |
| const files = fs.readdirSync(dir); | |
| for (const file of files) { | |
| if ( | |
| file === 'node_modules' || | |
| file.startsWith('.') || | |
| file === cacheTravese |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getObjectType = obj => Object.prototype.toString.call(obj).slice(8, -1); | |
| console.log(getObjectType(new Date())); // Date | |
| console.log(getObjectType([])); // Array | |
| console.log(getObjectType(true)); // Boolean | |
| console.log(getObjectType(function() {})); // Function | |
| console.log(getObjectType(x => x)); // Function | |
| console.log(getObjectType(null)); // Null | |
| console.log(getObjectType(37)); // Number | |
| console.log(getObjectType(NaN)); // Number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Returns the scroll parent of an element along a specified axis and the scroll size and client size. | |
| * | |
| * @param {HTMLElement} el - The element to find the scroll parent of. | |
| * @param {String} [axis='y'] - The axis to find the scroll parent for. | |
| * @returns {Object} An object with the following properties: | |
| * @property {HTMLElement} scrollParent - The scroll parent element. | |
| * @property {Number} scrollParentSize - The size of the scroll parent along the specified axis. | |
| * @property {Number} clientParentSize - The size of the scroll parent's client area along the specified axis. | |
| */ |