Skip to content

Instantly share code, notes, and snippets.

View josefaidt's full-sized avatar
🦉

josef josefaidt

🦉
View GitHub Profile
@josefaidt
josefaidt / nvm.fish
Created January 11, 2019 21:49
fish shell wrapper for nvm; add to `config.fish` or to functions directory
# need to install Fisher via `curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish`
# need to install bass via `fisher add edc/bass`
set LATEST_NVM (ls -t /usr/local/Cellar/nvm | head -1)
function nvm
bass source /usr/local/Cellar/nvm/{$LATEST_NVM}/nvm.sh --no-use ';' nvm $argv
end
@josefaidt
josefaidt / eslint.fish
Created January 11, 2019 21:53
fish shell eslint wrapper to use universal config; place in `config.fish` or functions directory
function eslint
command eslint --config ~/.config/.eslintrc.js $argv
end
@josefaidt
josefaidt / eslint.fish
Created January 29, 2019 14:39
ESLint Fish Functions
# Wrap ESLint command to use global config
function eslint
command eslint --config ~/.config/.eslintrc.js $argv
end
# Personal utility to install ESLint in the current working directory
function yawn
@josefaidt
josefaidt / commands.py
Created February 26, 2019 20:21
Ranger command: Open in VSCode
from ranger.api.commands import Command
class code(Command):
"""
:code
Opens current directory in VSCode
"""
def execute(self):
@josefaidt
josefaidt / Github-Dark-Fixed.css
Created March 5, 2019 16:50
Stylish - Github Dark - theme (2019)
@-moz-document domain("githubusercontent.com"), domain("graphql-explorer.githubapp.com"), domain("github.ibm.com"), regexp("^https?://((blog|gist|guides|help|raw|resources|status|developer)\\.)?github\\.com/((?!generated_pages/preview).)*$") {
/*! Github Dark v1.20.84 (2018-11-19) */
/*! Repository: https://github.com/StylishThemes/GitHub-Dark */
/*! Userstyle: http://userstyles.org/styles/37035 */
/*! License: https://creativecommons.org/licenses/by-sa/4.0/ */
/* Override default browser styles */
button {
color: #b5b5b5 !important;
}
/* begin auto-generated rules - use tools/generate.js to generate them */
@josefaidt
josefaidt / lavandula.yml
Last active June 17, 2019 20:28
Lavandula terminal theme for Alacritty, ported to support the MacBook Pro sRGB corrections
# Lavandula
colors:
# Default colors
primary:
background: '0x040112'
foreground: '0x726f7c'
# Normal colors
normal:
black: '0x1e0543'
@josefaidt
josefaidt / github-graphql-file-contents.graphql
Created January 10, 2020 00:26
Gets file contents from a repository folder
{
repository(name: "josefaidt.github.io", owner: "josefaidt") {
folder: object(expression: "master:app/content/pages") {
... on Tree {
entries {
oid
object {
... on Blob {
text
}
@josefaidt
josefaidt / now-swap-teams.js
Created March 28, 2020 15:09
Utility file to hot-swap ZEIT Now config files between multiple teams (personal and team)
//
// utility to swap ZEIT Now configs
// unable to scope deploys to dev (team) with git enabled
//
// /.now
// |- now.swap.json
// |- project.json
// |- project.personal.json
// |- project.team.json
//
@josefaidt
josefaidt / fs-router.js
Last active April 6, 2020 19:04
basic express filesystem router
import fs from 'fs';
import path from 'path';
import express from 'express';
const getFileRoutes = async ({ directory, ignore = /_/, include = /\.js$/ }) => {
const result = new Map();
const nestedGetFiles = async nestedDirectory => {
const files = fs.readdirSync(nestedDirectory, { withFileTypes: true });
for (let i = 0; i < files.length; i++) {
const f = files[i];
#!/usr/bin/env node
const { existsSync: exists, promises: fs } = require('fs');
const { spawn } = require('child_process');
const path = require('path');
const c = require('chalk');
const dotenv = require('dotenv');
const nodemon = require('nodemon');
// set default node_env
process.env.NODE_ENV = process.env.NODE_ENV || 'development';