Skip to content

Instantly share code, notes, and snippets.

View maxichrome's full-sized avatar
💜

maxichrome

💜
View GitHub Profile
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' }
@maxichrome
maxichrome / allTrue.js
Last active November 16, 2020 15:58
Utility function — checks if all or at least one of provided values is true
/**
* 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') {
/**
@maxichrome
maxichrome / readdirSyncRecurse.js
Last active November 16, 2020 15:49
Recursively, synchronously read a directory in Node.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 / twitter-goodifier.easylist
Created March 28, 2021 07:10
Twitter Goodifier — remove distracting features from Twitter
!!! 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 / nice-input.tsx
Created August 6, 2021 09:52
I made a nice input component 😸
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;
}
# installs winget on Windows Server
# stolen from https://github.com/actions/runner-images/issues/910#issuecomment-1291001212
Invoke-WebRequest -Uri 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' -OutFile 'VCLibs.appx' # automatically downloads latest version
Invoke-WebRequest -Uri 'https://github.com/microsoft/winget-cli/releases/download/latest/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle' -OutFile 'winget.msixbundle'
$ReleaseInfo = Invoke-RestMethod 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
Invoke-WebRequest -Uri $ReleaseInfo.assets.Where({ $_.name.EndsWith('License1.xml') }).browser_download_url -OutFile 'license.xml' # because the prefix of the file changes with every release
Add-AppxProvisionedPackage -Online -PackagePath winget.msixbundle -LicensePath license.xml -DependencyPackagePath VCLibs.appx