Skip to content

Instantly share code, notes, and snippets.

Rich Werden r-i-c-h

View GitHub Profile
@r-i-c-h
r-i-c-h / .bash_profile-Colorful-Git-Status-Prompt
Created Jun 22, 2020
My Colorful git-Status-aware prompt setup in my .bash_profile
View .bash_profile-Colorful-Git-Status-Prompt
# CRAZY COLORED NEW PROMPT w/repo Branch and Status:
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
@r-i-c-h
r-i-c-h / .bash_profile-stuff-1
Created Jun 22, 2020
Some of the aliases from my .bash_profile
View .bash_profile-stuff-1
# My Aliases
alias ..="cd .."
alias rmrf="rm -rf"
# ls on steroids:
alias see="ls -laShF | more"
# Some Apple MacOS specifics for showing/hiding hidden files in the Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app"
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
@r-i-c-h
r-i-c-h / tsconfig.json
Created Jan 30, 2020
Rich's tsconfig.json
View tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true,
"target": "es5",
"sourceMap": true,
"declaration": true,
"module": "es2015",
"moduleResolution": "node"
},
"exclude": [
@r-i-c-h
r-i-c-h / webpack.config.js
Last active Jan 24, 2020
Webpack Code Splitting
View webpack.config.js
/* orig https://gist.github.com/gaearon/ca6e803f5c604d37468b0091d9959269 */
module.exports = {
entry: {
main: './src/app.js',
},
output: {
// `filename` provides a template for naming your bundles (remember to use `[name]`)
filename: '[name].bundle.js',
// `chunkFilename` provides a template for naming code-split bundles (optional)
@r-i-c-h
r-i-c-h / .prettierrc
Created Jan 24, 2020
Rich's .prettierrc
View .prettierrc
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
@r-i-c-h
r-i-c-h / .prettierignore
Created Jan 24, 2020
Rich's .prettierignore file
View .prettierignore
build/
node_modules/
package-lock.json
yarn.lock
package.json
*.html
@r-i-c-h
r-i-c-h / UpdateNote.md
Last active Jan 17, 2020
How to Update Node.js
View UpdateNote.md

To Update Node

Latest "Long Term Support" Ver

nvm install lts/*

Latest "Stable" Version

nvm install stable

Update + Reinstall your GLOBAL packages:

@r-i-c-h
r-i-c-h / my.gitignore
Last active Jul 14, 2020
Rich's .gitignore File
View my.gitignore
# Rich's .gitignore file:
# See https://help.github.com/ignore-files/...
# leading-slash stops recursion, trailing slash = directory/
# 1) Notes files... <<<<
notes.txt
notes.md
localnotes.md
# 2) Dependency directories
node_modules/
View JS-SubsetSum.js
// Will actually work without the 'String()` whatnot, but I'm being particular
const subsetSum = (arr, target) => {
let dictObj = {};
for (let i = 0; i < arr.length; i++) {
const val = arr[i];
const compliment = String(target - val);
if (dictObj.hasOwnProperty(compliment)) { // must use hasOwnProp in case of index=0 which would return as false!!
return [dictObj[compliment],i];
You can’t perform that action at this time.