Skip to content

Instantly share code, notes, and snippets.

View davestewart's full-sized avatar
⚙️
Workin' on Chrome extensions!

Dave Stewart davestewart

⚙️
Workin' on Chrome extensions!
View GitHub Profile
@mrmanc
mrmanc / disable-macos-man-page-shortcuts.md
Last active May 4, 2023 04:58
Turn off annoying macOS man page shortcuts via the command line

Turn off annoying macOS man page shortcuts via the command line

Context

macOS 10.14.4 introduced a keyboard shortcut that conflicts with one of IntelliJ IDEA’s best shortcuts. cmd-shift-a pops open a Terminal window running an apropos search on the text selection, rather than the command palette.

You can manually disable these keyboard shortcuts via System Preferences, but this script does this programmatically. I was unable to find any existing information about how to do this via the command line, so I rolled my own solution.

It took a long time to work out which defaults domain to find the plist for this. I probably worked out the pbs domain from this post.

@davestewart
davestewart / nuxt.config.js
Last active December 22, 2020 14:34
Nuxt build config to provide sane source maps and reliable HMR
// @see https://twitter.com/dave_stewart/status/1332340558069690371
// Special thanks to https://github.com/nicholasoxford
// YMMV!
module.exports = {
build: {
extend (config, { isDev, isClient }) {
if (isDev) {
// provides proper source and properly-named source map for pages and components
config.devtool = 'source-map'
@davestewart
davestewart / last-demo.js
Last active October 20, 2020 15:54
Modify a function so it only resolves the last call
// decorated search function
const search = last(function (query) {
return new Promise(function (resolve, reject) {
setTimeout(() => {
// randomly fail
Math.random() < .25
? reject(new Error('failed for query ' + query))
: resolve(String(query).toUpperCase())
}, Math.random() * 2000)
})
@davestewart
davestewart / git extract feature with history.md
Last active April 25, 2020 21:24
Git: Extract feature to new repo, retaining history

Git: Extract a feature to a new repo, retaining history

Abstract

I recently needed to extract a feature from a project to its own repo so I could publish as a standalone library:

# from
/some-project/src/some-folder/some-feature/*
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@nickcernis
nickcernis / readme.md
Last active March 7, 2024 01:43
Exclude node_modules and .git from Backblaze backups on Mac

Exclude node_modules and .git from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add these rules inside the bzexclusions tag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@praveenpuglia
praveenpuglia / shadow-dom.md
Last active March 28, 2024 15:06
Everything you need to know about Shadow DOM

I am moving this gist to a github repo so more people can contribute to it. Also, it makes it easier for me to version control.

Please go to - https://github.com/praveenpuglia/shadow-dom-in-depth for latest version of this document. Also, if you find the document useful, please shower your love, go ⭐️ it. :)

Shadow DOM

Heads Up! It's all about the V1 Spec.

In a nutshell, Shadow DOM enables local scoping for HTML & CSS.

let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {
@davestewart
davestewart / gulpfile.js
Last active October 7, 2018 10:03
Laravel Gulp setup - compiles scripts & styles (plus custom paths and live build option) with live-reload
// ---------------------------------------------------------------------------------
// libs
var gulp = require('gulp'),
// tools
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
livereload = require('gulp-livereload'),
@prograhammer
prograhammer / laravel-lumen-5-homestead-win.md
Last active February 13, 2024 16:39
Laravel/Lumen 5.1 Homestead for Windows (includes fixes for shared-folder related slowness, npm install problems, caching, etc)

Laravel / Lumen Homestead for Windows w/fixes

###Initial installation and configuration Install Git for Windows which includes Git Bash.

Install VirtualBox and Vagrant.

Note: These fixes were not originally done for VirtualBox 5.0 and Vagrant 1.7.4. They are for the previous versions instead: VirtualBox 4.3.30 and Vagrant 1.7.3. Some of these fixes may not be needed now. For example, I recently upgraded to VirtualBox 5.0 and Vagrant 1.7.4 and I did not have to alter the Vagrant ruby (.rb) files as shown in part of this Gist below. I'll soon try from a fresh install (not upgrade) and update this Gist accordingly.

In Git Bash (always run as administrator), type cd ~ to