Skip to content

Instantly share code, notes, and snippets.

View jacklorusso's full-sized avatar

Jack Lo Russo jacklorusso

View GitHub Profile
@nickpunt
nickpunt / lightswitch.js
Last active September 12, 2019 13:39
Lightswitch: A dark mode switcher with user override
/*******************************************************************************
LIGHTSWITCH: A DARK MODE SWITCHER WITH USER OVERRIDE
By Nick Punt 10/26/2018
How to use:
* Create two color schemes in CSS under the classes 'light' and 'dark'
* Add the class 'light' or 'dark' to your body as your default color scheme
* Add button to page with id 'lightswitch', which lets users change/override
import React from 'react'
import styled from 'styled-components'
function flex(name, defaultValue) {
return (props) => {
let value = props[name]
if (!value && typeof defaultValue === 'undefined') return ''
if (!value) value = defaultValue
return `flex-${name}: ${value};`
}
@james-nash
james-nash / contrast-grid-url.js
Last active December 23, 2022 07:55
Generates EightShapes Contrast Grid or Christopher Geary's "Contrast" tool URLs from InVision DSM or Brand.ai design tokens.
/*
Generates EightShapes Contrast Grid or Christopher Geary's "Contrast" tool
URLs from InVision DSM or Brand.ai.
Usage for Contrast Grid URL:
node contrast-grid-url.js [URL]
Usage for Contrast URL:
@staltz
staltz / introrx.md
Last active May 13, 2024 09:59
The introduction to Reactive Programming you've been missing
@keithamus
keithamus / Nano Git Commit Syntax highlighting
Created December 10, 2010 13:58
Add this to your ~/.nanorc and when running "git commit" (if your editor is nano) you'll have syntax highlighting in your commit message. Includes support for "git commit -v" too!
syntax "gitcommit" "COMMIT_EDITMSG$"
color white "#.*"
color green "#.(modified|deleted).*"
color yellow start="# Changes.*" end="# Changed.*"
color cyan start="# Untracked.*" end="diff"
color cyan start="# Untracked.*" end="$$"
color brightred "^deleted file mode .*"
color brightgreen "^\+.*"
color brightred "^-.*"
color brightyellow "^(diff|index|---|\+\+\+).*"