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
@Chaser324
Chaser324 / GitHub-Forking.md
Last active April 17, 2024 22:46
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@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.

@afternoon
afternoon / rename_js_files.sh
Created February 15, 2014 18:04
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@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="*" />
@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

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:
@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/*