Fluent, immutable interface for creating CSS Media Queries in PHP.
use function Loilo\MediaQuery\mq;
$query = mq('a: true')
->or(mq('b: true')->and('c: true'))
->and('d: true');| /** | |
| * Convert between Uint8Array and Base64 strings | |
| * Allows for any encoded JS string to be converted (as opposed to atob()/btoa() which only supports latin1) | |
| * | |
| * Original implementation by madmurphy on MDN | |
| * @see https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_1_–_JavaScript%27s_UTF-16_%3E_base64 | |
| */ | |
| function b64ToUint6(nChr) { | |
| return nChr > 64 && nChr < 91 |
| import revHash from 'rev-hash' | |
| import { readFileSync, statSync } from 'fs' | |
| import { resolve } from 'path' | |
| /** | |
| * Calculate the rev hash for a file | |
| * | |
| * @param {string} file The path to the file to hash | |
| * @returns {string} | |
| */ |
| // This userscript redirects you to the English version of a website if it's denoted in the source code. | |
| // Insert any URLs of websites below (after @match), for example https://developer.mozilla.org/* or https://www.php.net/* | |
| // Use multiple @match clauses to enable the script on several domains. | |
| // ==UserScript== | |
| // @name Redirect to English | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.0 | |
| // @description Redirect websites to their English version | |
| // @author Florian Reuschel <florian@loilo.de> |
This is a Sass mixin to handle a 3-way dark mode. It relies on a data-theme attribute on your <html> element with a value of light or dark. If data-theme is absent (i.e. it's neither light nor dark), the system's preferred mode is used.
body {
// matches data-theme="light" or data-theme="auto" with system instructing light mode
@include light {
background: white;
color: black;This is about how to split a GitHub pull request, following a real in-the-wild example.
So it happened that I once wanted to fix a bug (#832) on the shelljs repository.
I forked the repository, cloned it and created a new branch called ln-directory-dest. I fixed the bug, created a pull request, and implemented initial review feedback.
At this point, I had added the commits A, B, C, D, E and [F](https://github.com/Loilo/shelljs/commit/946ab48bf5cf9c8aac03407
| /** | |
| * Export all data from an IndexedDB database | |
| * | |
| * @param {IDBDatabase} idbDatabase The database to export from | |
| * @return {Promise<string>} | |
| */ | |
| export function exportToJson(idbDatabase) { | |
| return new Promise((resolve, reject) => { | |
| const exportObject = {} | |
| if (idbDatabase.objectStoreNames.length === 0) { |
Tip
These are some Sass mixins and functions for handling responsiveness which I'm using in virtually every project.
At the start of the responsive.scss you can find configuration variables for you to adjust.
| export function magicMethods (clazz) { | |
| // A toggle switch for the __isset method | |
| // Needed to control "prop in instance" inside of getters | |
| let issetEnabled = true | |
| const classHandler = Object.create(null) | |
| // Trap for class instantiation | |
| classHandler.construct = (target, args, receiver) => { | |
| // Wrapped class instance |