Skip to content

Instantly share code, notes, and snippets.

@mpalpha
mpalpha / readme.md
Created August 18, 2021 22:31
git clone and cd into

Installation

You can add the gcd script to your local bin path or you can add the followin snippet to your bash .profile or zsh .zshrc file.

function gcd {
  REPO=$1
  CLONEPATH=$2

 if [ -z $CLONEPATH ]; then
@mpalpha
mpalpha / tailwind.config.js
Created July 13, 2021 15:40
tailwindcss: include google font family plugin
// tailwind.config.js
const plugin = require('tailwindcss/plugin');
module.exports = {
theme: {
fontFamily: {
sans: ['Roboto Condensed'],
},
},
plugins: [
plugin(({ addBase }) => {
@mpalpha
mpalpha / tailwind.plugin.peer.js
Last active July 1, 2021 15:12
tailwind peer pseudo variants extracted for use in tailwindcss v2.2 outside of jit mode. (warning: use a parser, this can inflate your css)
// from https://blog.tailwindcss.com/tailwindcss-2-2#sibling-selector-variants
// add your desired variant 'peer-checked'
//
// Just like group can be combined with any other variant, peer can as well,
// so you have variants like peer-hover, peer-focus, peer-disabled, and loads more at your fingertips.
const plugin = require('tailwindcss/plugin');
const peer = plugin.withOptions(function (options) {
return function ({ addVariant, config }) {
const prefixSelector = function (prefix, selector) {
@mpalpha
mpalpha / tailwind.plugin.border.padding.js
Last active June 23, 2021 17:02
tailwind plugin to add border padding utilities.
// Inherits padding and border settings from your tailwind config to provide alternate padding utilities,
// which account for border sizes using the css calc() function.
//
// Usage: <div class="abds-pt-2-border-2" = "padding-top: calc(0.5rem - 2px);"
const _ = require('lodash');
const { borderWidth } = require('tailwindcss/defaultTheme');
module.exports = function () {
return function ({ addUtilities, e, config }) {
const paddings = config('theme.paddingBorder.padding', config('theme.padding', {}));
@mpalpha
mpalpha / main.js
Last active November 28, 2023 12:46
Storybook render stories source code to prettier formatted html. supports js, jsx, ts, tsx, and mdx formats. tested with "@storybook/html": "^6.2.5"
// .storybook/main.js
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials'
],
};
@mpalpha
mpalpha / ideamaker-end.gcode
Last active January 2, 2025 22:07
klipper 3d printer firmware printer.cfg for creativity elf corexy, mks robin nano v1.2, tmc2209 x5 uart over 2 wifi pins, orbiter extruder, phaetus dragonfly BMS hotend, bltouch, dual z align, no z endstops.
M221 T0 S100 ;reset flow
M104 S0 ;turn off hotend
M140 S0 ;turn off bed
M107 ;turn off fan
G91 ;set relative positioning
G1 E-1 F300 ;retract extruder slightly
G1 Z+150 E-5 X-20 Y-20 F9000.00 ;move z down, retract warm, move nozzle away
G28 X Y ;home x, y
M84 ;disable steppers
G90 ;reset absolute
@mpalpha
mpalpha / css_custom_data.json
Last active March 24, 2021 14:21
Add tailwindcss @tailwind, @Responsive, @screen, and @Variants directives to css lint in .vscode/settings.json
{
"version": 1.1,
"atDirectives": [
{
"name": "@tailwind",
"description": "Use the `@tailwind` directive to insert Tailwind's `base`, `components`, `utilities` and `screens` styles into your CSS.",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#tailwind"
@mpalpha
mpalpha / tailwind-readable-text.js
Last active March 31, 2021 21:23
Dynamically generate the first readable complementary color and the most readable color utilities from the current theme color palette.
// example tailwind.config.js
// ...
// theme: {
// readableText: {
// level: 'AAA',
// size: 'small'
// },
// }
// ...
//
@mpalpha
mpalpha / printer.cfg
Last active May 15, 2020 07:08
klipper printer.cfg for the Tronxy X5S with MKS SKR v1.3, 4x TMC2209 UART, dual z wired in series, BMG extruder, and EZABL probe (this config is sort of working and not finished!)
# This file contains common pin mappings for the BIGTREETECH SKR V1.3
# board. To use this config, the firmware should be compiled for the
# LPC1768.
# See the example.cfg file for a description of available parameters.
[stepper_x]
step_pin: P2.2
dir_pin: !P2.6
enable_pin: !P2.1
@mpalpha
mpalpha / _tailwind-utility.scss
Created April 6, 2020 15:58
SCSS: tailwind utility class generator for sass.
$variables: (
"screens": (
"sm": "640px",
"md": "768px",
"lg": "1024px",
"xl": "1280px"
),
"colors": (
"transparent": "transparent",
"black": "#000",