Skip to content

Instantly share code, notes, and snippets.

Avatar

maxichrome maxichrome

View GitHub Profile
@maxichrome
maxichrome / nice-input.tsx
Created Aug 6, 2021
I made a nice input component 😸
View nice-input.tsx
import React, { ComponentPropsWithRef } from "react";
import { RiAlertLine } from "react-icons/ri";
import styled, { css } from "styled-components";
export interface TextInputProps
extends ComponentPropsWithRef<typeof InnerInput> {
label: string;
id: string;
error?: string;
}
@maxichrome
maxichrome / twitter-goodifier.easylist
Created Mar 28, 2021
Twitter Goodifier — remove distracting features from Twitter
View twitter-goodifier.easylist
!!! TWITTER GOODIFIER
!! any rule (starting with "twitter.com##") you want to enable, remove the "!" at the start of the line
!! Remove "Explore" link from left navbar
twitter.com##header a[href="/explore"]
!! Remove unread Notifications indicator from sidebar
! twitter.com##header a[href="/notifications"] div > svg + [aria-label*="unread" i]
!! Remove unread DM indicator from sidebar
! twitter.com##header a[href="/messages"] div > svg + [aria-label*="unread" i]
@maxichrome
maxichrome / readdirSyncRecurse.js
Last active Nov 16, 2020
Recursively, synchronously read a directory in Node.js
View readdirSyncRecurse.js
/*
Output will be formatted like
[ 'file', 'directory/file.ts', 'directory/subdir/otherfile.ts', 'directory/subdir/file.txt' ]
*/
function readdirSyncRecurse (directory) {
const output = []
const items = fs.readdirSync(directory)
for (const item of items) {
@maxichrome
maxichrome / allTrue.js
Last active Nov 16, 2020
Utility function — checks if all or at least one of provided values is true
View allTrue.js
/**
* Checks truthiness of any set of inputs
*
* @param {Array<boolean | Function>} operands Values to check
* @param {'all' | 'one'} mode
*
* @returns {boolean}
*/
function allTrue(operands, mode = 'all') {
/**
View v-nuxt.config.js
export default {
mode: 'universal',
head: {
titleTemplate: titleChunk => `${titleChunk ? `${titleChunk} | ` : ''}` + 'Site',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' },
{ property: 'og:title', content: 'Site (embed test!)' },
{ property: 'og:site_name', content: 'Site' }