Skip to content

Instantly share code, notes, and snippets.

View jamcgrath's full-sized avatar
💬
Crushing it!

James jamcgrath

💬
Crushing it!
View GitHub Profile
@jamcgrath
jamcgrath / gist:0b2cff98d52eca8bcc0f891337e83801
Created February 26, 2024 10:00
RecipientsDisplay.svelte
<script lang="ts">
import { throttle } from 'lodash-es'
import { tick } from 'svelte'
export let recipients: string[]
let recipientsString: string = ''
let recipientsDisplay: HTMLElement
let recipientsDisplayRecipients: HTMLElement
let recipientsDisplayBadge: HTMLElement
@jamcgrath
jamcgrath / gist:8746ac817632b8d741aece4ca1624e5c
Last active April 26, 2022 23:16
Custom property fallback through media queries
<style>
.m-custom {
margin: var(--m-custom, 0); /* 0 is default value for margin */
}
.p-custom {
padding: var(--p-custom, 0);
}
@media (min-width: 40em) {
@jamcgrath
jamcgrath / infinite_carousel_logic.js
Created April 10, 2021 02:38
Infinite Carousel logic (vue)
@jamcgrath
jamcgrath / gist:a05e22ea89e6501c6576e6dd13c609c5
Created September 29, 2020 02:34
Aria pressed function
toggleAriaPressed(className, e) {
console.log(e.target, className);
if (e.target.getAttribute("aria-pressed") === "true") {
return e.target.setAttribute("aria-pressed", "false");
}
const pressedButton = document.querySelector(
`.${className}[aria-pressed='true']`
);
if (pressedButton) {
pressedButton.setAttribute("aria-pressed", "false");
@jamcgrath
jamcgrath / gist:5df22cf174c7a00ab5ec53eba08085da
Created August 10, 2020 03:10 — forked from jakubpawlowicz/gist:6fa7465b323486e8b89d
Regex matching single- and multiline CSS comments in Sublime Text
/\*((?!\*/).|\n)+\*/
https://catswhocode.com/ffmpeg-commands/
https://gist.github.com/protrolium/e0dbd4bb0f1a396fcb55
mp4 (safari support)
ffmpeg -i input.gif -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p output.mp4
webm
ffmpeg -i input.gif -c vp9 -b:v 0 -crf 41 output.webm
box-shadow: 0 1px 0 0 red; /* Border bottom */
box-shadow: 0 -1px 0 0 red; /* Border top */
box-shadow: -1px 0 0 0 red; /* Border left */
box-shadow: 1px 0 0 0 red; /* Border right */
box-shadow: 0 0 0 1px red; /* All the borders by using the spread properties */
https://www.codementor.io/@michelre/using-box-shadow-to-construct-a-border-ex0rpxvng
file upload
https://accessabilly.com/a-styled-accessible-file-upload/
Minpatters UI
https://ebay.gitbook.io/mindpatterns/
WAI-ARIA Authoring Practices
https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal?utm_campaign=chrome_series_ariaauthoringpractices_061617&utm_source=chromedev&utm_medium=yt-desc
@jamcgrath
jamcgrath / gist:25ef5a811611ad7a64378a895cc08fdc
Created January 31, 2020 03:06
Check css custom proprty support
const isSupported = window.CSS &&
window.CSS.supports && window.CSS.supports('--a', 0);
if (isSupported) {
/* supported */
} else {
/* not supported */
}