Skip to content

Instantly share code, notes, and snippets.

View tomhodgins's full-sized avatar
😍
Writing CSS

Tommy Hodgins tomhodgins

😍
Writing CSS
View GitHub Profile
@mirisuzanne
mirisuzanne / cq.css
Last active October 6, 2021 10:41
Thoughts on Container Queries
/*
This is not meant to be a final CSSWG proposal,
but reflects my immediate thoughts after reading
[David Baron's](https://github.com/dbaron/container-queries-implementability) promising draft.
This gist was created to demonstrate my idea for removing selectors from his query syntax.
More of my thoughts & notes are online at css.oddbird.net/rwd/
*/
main,
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@stevenvachon
stevenvachon / README.md
Last active September 17, 2022 14:54
Apple Music/iTunes library audit

music-library-audit

Find file location errors within an Apple Music/iTunes library file.

This provides some insight into the "some of the songs were not imported because they could not be found" error.

Note: Only files referenced with file:// are supported. Any others will be reported as not found.

Installation

Node.js >= 12 is required. Type this at the command line:

@jonathantneal
jonathantneal / css-parser-super-core.js
Created January 9, 2020 18:30
CSS Parser Super Core (the barest bits)
function parse(cssText) {
// this regex matches all non-contextual nodes; which are comments, whitespaces, strings, numbers, named identifiers, and delimiters.
var cssRegExp = /\/\*((?:[^*]|\*[^\/])*)\*\/|([ \t\n\f\r]+)|"((?:[^"\\\n\f\r]|\\\r\n|\\[\W\w])*)"|'((?:[^'\\\n\f\r]|\\\r\n|\\[\W\w])*)'|#((?:[-\w]|[^\x00-\x7F]|\\[^\n\f\r])+)|([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee]-?\d+)?)|(-?(?:[-A-Z_a-z]|[^\x00-\x7F]|\\[^\n\f\r])(?:[-\w]|[^\x00-\x7F]|\\[^\n\f\r])*)|([\uD800-\uDBFF][\uDC00-\uDFFF]|[\W\w])/g;
// the contextual nodes generated from these matches are:
// - numbers with a unit (number + named identifier),
// - at identifiers (`@` + named identifier),
// - blocks (everything between equally nested `(` and `)` or `[` and `]` or `{` and `}`), and
// - functions (named identifier + block).
// you will likely create a root/parent scope for organizing your blocks and functions
/* use sleep from below, or bring your own */
// export const sleep = millis => new Promise(_ => setTimeout(_, millis));
async function impl(sentinel, func, interval, args) {
for (; !sentinel.aborted; await sleep(interval)) {
await func(...args);
}
}
export default function runAtIntervals(func, interval, ...args) {
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@jonathantneal
jonathantneal / README.md
Created December 28, 2019 07:02
CSS Parser (2019-12-28)

At 1.7kB, parse.js can parse CSS as component values and mutate the tree with visitors:

var source = ':nth-child(5) {\n\tcolor: var(--foo, var(--bar, var(--cat, blue)));\n}';
var cssast = parse(source);
cssast.visit({
  CSSFunction: {
    exit: function(node) {
      if (node.name === 'var') {
 node.replaceSelf(node.last);
@jonathantneal
jonathantneal / README.md
Last active December 2, 2019 21:31
CSS Loose Object Model

Loose CSS Object Model

The "Loose" CSS Object Model is a primative object model compatible with the CSS Syntax that preserves every single code point in CSS Objects without sacrificing the usability of those objects to a developer.

The core concept of the "loose" CSS object model is to separate all information into 2 kinds of objects; the CSSDetail and the CSSValue.

CSSDetail

The CSSDetail represents all whitespace and comments in CSS.

implement Liner;
include "sys.m";
include "draw.m";
include "bufio.m";
sys : Sys;
bufio : Bufio;
Iobuf : import bufio;
@mrpatg
mrpatg / discord.js
Created October 22, 2019 11:21
Discord - Hide Blocked Message Bar
/*
Open Discord desktop app and press CTRL+SHIFT+I.
Paste this whole thing into the console and press enter.
This will need to be repeated each time Discord is started/restarted.
*/
(function hideBlocked() {
// This script already existed, but the class names in Discord have changed. I modified it to work again.
document.querySelectorAll('[class^=messageGroupBlocked]').forEach(div => div.setAttribute("style", "display: none;"));