Skip to content

Instantly share code, notes, and snippets.

@johnelliott
johnelliott / stop-logitech.sh
Last active August 9, 2018 22:04
Stop Logitech options daemon
#!/bin/sh
# https://www.reddit.com/r/mac/comments/6jkutr/how_to_uninstall_logitech_options/
#disable
launchctl unload /Library/LaunchAgents/com.logitech.manager.daemon.plist
# re-enable
#launchctl load /Library/LaunchAgents/com.logitech.manager.daemon.plist
@johnelliott
johnelliott / profile.sh
Created August 8, 2018 16:30
macos terminal.app profile change
alias light='echo "tell app \"Terminal\" to set current settings of windows to settings set \"Google Light\""|osascript;'
alias dark='echo "tell app \"Terminal\" to set current settings of windows to settings set \"Eighties\""|osascript;'
@johnelliott
johnelliott / lame-lighthouse-data.sh
Last active March 16, 2019 14:44
google lighthouse timings
find . -type f -name '*.json' | xargs -n1 -I % cat % |jq '[.finalUrl, .timing.total] '
@johnelliott
johnelliott / time-colorscheme.vim
Last active July 16, 2018 14:39
vim colorscheme time of day day of week
let day = strftime("%w")
let hour = strftime("%H")
if day < 6 && day > 0 && hour > 8 && hour < 17
silent! colo base16-one-light
else
silent! colo peachpuff
endif
silent! colo pablo
@johnelliott
johnelliott / figlet.sh
Last active June 23, 2018 15:51
figlet test
figlist |xargs -n1 -I '%I' figlet -w 120 -f %I %I
@johnelliott
johnelliott / stylelint.config.js
Created June 15, 2018 16:40
global stylelint.config.js with plugins
const path = require('path');
const configBasedir = path.resolve(process.env.NVM_BIN, '..', 'lib/node_modules');
module.exports = {
configBasedir,
plugins: [
path.join(configBasedir, 'stylelint-no-unsupported-browser-features')
],
rules: {
'plugin/no-unsupported-browser-features': [true, {
ignore: ['flexbox'],
@johnelliott
johnelliott / server.js
Created April 28, 2018 02:32
starter express server
require('dotenv').config()
const debug = require('debug')('server')
const express = require('express')
const morgan = require('morgan')
const compression = require('compression')
const app = express()
app.set('env', process.env.NODE_ENV)
app.set('port', process.env.PORT)
#! /bin/bash
# This is how to sign a Cloudinary API request from bash
URL="https://api.cloudinary.com/v1_1/thedailybeast/image/upload"
API_KEY=574791189343157
API_SECRET=abcd
DATE=$(date +%s)
SHA=$(echo -n "overwrite=false&timestamp=${DATE}&unique_filename=false&upload_preset=zcjiokbi&use_filename=true${API_SECRET}" | shasum -a 1 | awk '{print $1}')
FILE="http://cdn.thedailybeast.com/content/dam/dailybeast/2017/02/23/170223-Vox-homeopathic-drug-tease.jpg"
@johnelliott
johnelliott / vertical-slug.js
Created March 20, 2018 21:18
vertical-slug.js
const VERTICAL_SLUG_FORMAT = /^([a-zA-Z0-9]+-)*[a-zA-Z0-9]+$/;
@johnelliott
johnelliott / random-strings-array.js
Created March 3, 2018 17:53
random-strings-array.js
var a = Array(36).fill(true).map(() => Math.random().toString(36).slice(2))