Skip to content

Instantly share code, notes, and snippets.

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

mundi morgado mundizzle

🏠
Working from home
  • Gierd
  • Oakland, CA
  • 10:39 (UTC -07:00)
View GitHub Profile
// // LUI Next Colors
// // LUI Now colors live in @lendi-ui/color package
import hexToRgba from 'hex-to-rgba';
export const isHex = (str: string) => str.match(/^#(?:[0-9a-fA-F]{3}){1,2}$/);
type Shade = Partial<950 | 900 | 800 | 700 | 600 | 500 | 400 | 300 | 200 | 100 | 50 | 25 | 0>;
type Format = 'hexadecimal' | 'rgba';
type Category = 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info' | 'shade' | 'focus';
type ColorObject = Partial<{ [key in Shade]: { value: string; format: Format } }>;
@nathansmith
nathansmith / postinstall.config.js
Last active August 9, 2020 10:51
Script to move NPM files from "dist" to package root
const { existsSync } = require('fs');
const { execSync } = require('child_process');
// ================
// Check existence.
// ================
const distFolderExists = existsSync('dist');
const srcFolderExists = existsSync('src');
@nathansmith
nathansmith / getDomFallback.js
Last active June 9, 2020 21:38
Helper to mock DOM methods, for when an element might not exist.
/*
Helper to mock DOM methods, for
when an element might not exist.
*/
const getDomFallback = () => {
return {
// Props.
children: [],
className: '',
classList: {
@nathansmith
nathansmith / _has-css-animation.scss
Created April 14, 2020 16:43
How to enable (or disable) CSS animation via JS.
html:not([data-has-css-animation='true']) {
@include remove-css-animation;
}
@media (prefers-reduced-motion: reduce) {
@include remove-css-animation;
}
@tomhicks
tomhicks / plink-plonk.js
Last active November 12, 2024 19:08
Listen to your web pages
Seven different types of CSS attribute selectors
// This attribute exists on the element
[value]
// This attribute has a specific value of cool
[value='cool']
// This attribute value contains the word cool somewhere in it
[value*='cool']
@tomsoderlund
tomsoderlund / ExampleComponent.js
Last active May 13, 2021 01:50
Shared state using React Hooks and Context, to allow sharing of state between multiple components or hooks
import React, { useContext } from 'react'
import { UserContext, UserContextProvider } from './UserContext'
export default (props) => {
const [user, setUser] = useContext(UserContext)
return (
<UserContextProvider user={null}>
<div>User name: {user && user.name}</div>
</UserContextProvider>
@mundizzle
mundizzle / subscriptions.xml
Created June 9, 2019 16:08
front-end feed
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>RSS subscriptions for [email protected]</title>
<dateCreated>Sun, 09 Jun 2019 11:05:23 -0500</dateCreated>
<ownerEmail>[email protected]</ownerEmail>
</head>
<body>
<outline text="A List Apart: The Full Feed" title="A List Apart: The Full Feed" type="rss" xmlUrl="http://feeds.feedburner.com/alistapart/main" htmlUrl="&#10; https://alistapart.com "/>
<outline text="Cognition by Happy Cog" title="Cognition by Happy Cog" type="rss" xmlUrl="http://feeds.feedburner.com/cognitionfeed" htmlUrl="http://cognition.happycog.com/feed"/>
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active April 8, 2025 14:18
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@whoisryosuke
whoisryosuke / prettier.sh
Created April 13, 2019 19:08
Prettier - Format or unminify code (single file or any folder of certain files)
# Quickly fix one file
npx prettier --write your-file.html
# Quickly fix all files of one type
npx prettier --write src/**/*.{js,jsx}