Skip to content

Instantly share code, notes, and snippets.

View chadlavi's full-sized avatar
👨‍💻
Working

Chad Lavimoniere chadlavi

👨‍💻
Working
View GitHub Profile
@nihlton
nihlton / useKonami.js
Last active June 7, 2022 22:08
useKonamiCode
const code = [
'ArrowUp', 'ArrowUp', 'ArrowDown',
'ArrowDown', 'ArrowLeft', 'ArrowRight',
'ArrowLeft', 'ArrowRight', 'KeyB', 'KeyA'
];
const useKonami = () => {
const [isActive, setActive] = useState(false);
@alexjlockwood
alexjlockwood / print-unlinked-colors.ts
Created February 3, 2020 21:41
Prints nodes that have fill/stroke colors that aren't linked to a style.
figma.root.children
.flatMap(pageNode => pageNode.findAll(n => true))
.forEach(node => {
if ('fills' in node && 'fillStyleId' in node) {
if (node.fills !== figma.mixed && node.fills.length > 0 && node.fillStyleId !== '') {
print(`${node.name}'s fill color is not linked to a style`);
}
}
if ('strokes' in node && 'strokeStyleId' in node) {
if (node.strokes.length > 0 && node.strokeStyleId !== '') {
@alexjlockwood
alexjlockwood / generate-style-descriptions.ts
Last active September 12, 2023 12:54
Generates style descriptions for each color style in the current Figma file.
// Get the list of color styles in the current Figma file.
const colorStyles = figma.getLocalPaintStyles();
const updatedColorStyles = colorStyles.filter(style => {
const { paints } = style;
if (paints.length !== 1) {
// Skip styles containing multiple colors.
return false;
}
const [paint] = paints;
@chadlavi
chadlavi / fp6.user.js
Last active June 6, 2020 02:36
fp6 accessibility
// ==UserScript==
// @name 6dot accessibility patch
// @version 4.0.6
// @namespace https://gist.github.com/chadlavi/1c57c8568a0ff295668b80a366f10a0d
// @author Chad Lavimoniere
// @grant none
// @include http*://6.*.org/*
// @downloadURL https://gist.github.com/chadlavi/1c57c8568a0ff295668b80a366f10a0d/raw/fp6.user.js
// @updateURL https://gist.github.com/chadlavi/1c57c8568a0ff295668b80a366f10a0d/raw/fp6.user.js
// ==/UserScript==
@chadlavi
chadlavi / youtube-embedder.user.js
Last active October 16, 2020 23:19
a js script to embed youtube videos when a youtube url is present
// ==UserScript==
// @name youtube embedder
// @version 2.0.3
// @namespace https://gist.github.com/chadlavi/27c08ea6648d375c3f5de3ec7f43a015
// @downloadURL https://gist.github.com/chadlavi/27c08ea6648d375c3f5de3ec7f43a015/raw/youtube-embedder.user.js
// @updateURL https://gist.github.com/chadlavi/27c08ea6648d375c3f5de3ec7f43a015/raw/youtube-embedder.user.js
// @description embed youtube videos when a url is present
// @author Chad Lavimoniere
// @exclude http*://*youtube.com*
// @exclude http*://*facebook.com*

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
#!/usr/bin/env python3
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import http.server
@boogah
boogah / ale.bash
Last active July 11, 2022 00:32
Never think about maintaining your homebrew install again with this shitty (but useful) shell script & cron job!
#!/bin/bash
echo ""
echo "`date`: RUNNING: brew update"
/usr/local/bin/brew update
echo "`date`: FINISHED: brew update"
echo ""
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 25, 2024 06:23
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@pfig
pfig / mkfavicon.sh
Created February 12, 2012 12:01
Make a multi-resolution favicon.ico from a source image, using ImageMagick
#!/bin/bash
# from
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png
convert favicon-256.png -resize 16x16 favicon-16.png
convert favicon-256.png -resize 32x32 favicon-32.png
convert favicon-256.png -resize 64x64 favicon-64.png
convert favicon-256.png -resize 128x128 favicon-128.png