Skip to content

Instantly share code, notes, and snippets.

View lukesmurray's full-sized avatar
😎
Hard at work

Luke Murray lukesmurray

😎
Hard at work
View GitHub Profile
@JulianG
JulianG / createStrictContext.js
Created August 9, 2020 14:07
Create React Strict Context
import React from 'react';
export function createStrictContext(options = {}) {
const Context = React.createContext(undefined);
Context.displayName = options.name;
function useContext() {
const context = React.useContext(Context);
if (!context) {
throw new Error(options.errorMessage || `${name || ''} Context Provider is missing`);
}
@Merott
Merott / tailwind-colors-as-css-variables.md
Last active April 26, 2024 11:06
Expose Tailwind colors as CSS custom properties (variables)

This is a simple Tailwind plugin to expose all of Tailwind's colors, including any custom ones, as custom css properties on the :root element.

There are a couple of main reasons this is helpful:

  • You can reference all of Tailwind's colors—including any custom ones you define—from handwritten CSS code.
  • You can define all of your colors within the Tailwind configuration, and access the final values programmatically, which isn't possible if you did it the other way around: referencing custom CSS variables (defined in CSS code) from your Tailwind config.

See the Tailwind Plugins for more info on plugins.

@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.