Skip to content

Instantly share code, notes, and snippets.

@zenithtekla
Last active March 26, 2023 15:17
Show Gist options
  • Save zenithtekla/ef3c52d2860644528408abf256cfd40f to your computer and use it in GitHub Desktop.
Save zenithtekla/ef3c52d2860644528408abf256cfd40f to your computer and use it in GitHub Desktop.
IntelliJ Mac keystrokes
[user]
email = user@email.com
name = User Name
[alias]
view = log --pretty=format:\"%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s\"
viewtime = log --pretty=format:\"%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s\" --date=relative
pristine = "!git for-each-ref --format='%(color:blue)%(authorname)%(color:reset) %09 %(color:green)%(refname:short)%(color:reset)' | grep 'Pristine Tran'"
# fromme = "!git for-each-ref --sort=committerdate --format='%(color:red)%(committerdate:short) - %(committerdate:relative)%(color:reset) %09 %(color:blue)%(authorname)%(color:reset) %09 %(color:green)%(refname)%(color:reset)' | grep 'Pristine Tran'"
fromme = "!git for-each-ref --sort=committerdate --format='%(committerdate:short) - %(committerdate:relative) %09 %(authorname) %09 %(color:green)%(refname)%(color:reset)' | grep 'Pristine Tran'"
listhead = "!git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:red)%(objectname:short)%(color:reset);%(color:yellow)%(refname:short)%(color:reset);(%(color:green)%(committerdate:relative)%(color:reset));%(authorname);%(contents:subject)' | column -t -s ';'"
logtree = log --graph --oneline --decorate --all
co = checkout
dev = checkout development
st = status
pl = pull -r
cm = commit --no-verify -m
ad = add -A
url = remote -v
link = remote -v
# For all branches: git branch -avv
# For local branches only: git branch -lvv
# For remote branches only: git branch -rvv
#
# Working with branches
#
# mergetest
mergetest = "!f(){ git merge --no-commit --no-ff \"$1\"; git merge --abort; echo \"Merge aborted\"; };f "
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
pub = "!git push -u origin $(git branch-name)"
# Delete the remote version of the current branch
unpub = "!git push origin :$(git branch-name)"
# Delete the remote branch
# delremote = "!git push origin -d :$(git branch-name)"
delremote = "!git push origin -d"
# Delete the local branch
dellocal = "!git branch -D :$(git branch-name)"
# Delete a branch and recreate it from master — useful if you have, say,
# a development branch and a master branch and they could conceivably go
# out of sync
recreate = "!f() { [[ -n $@ ]] && git checkout \"$@\" && git unpublish && git checkout master && git branch -D \"$@\" && git checkout -b \"$@\" && git publish; }; f"
# Fire up your difftool (e.g. Kaleidescope) with all the changes that
# are on the current branch.
code-review = difftool origin/master...
# Given a merge commit, find the span of commits that exist(ed) on that
# branch. Again, not so useful in itself, but used by other aliases.
merge-span = "!f() { echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f2); }; f"
# Find the commits that were introduced by a merge
merge-log = "!git log `git merge-span .. $1`"
# Show the changes that were introduced by a merge
merge-diff = "!git diff `git merge-span ... $1`"
# As above, but in your difftool
merge-difftool = "!git difftool `git merge-span ... $1`"
# Interactively rebase all the commits on the current branch
rebase-branch = "!git rebase -i `git merge-base master HEAD`"
#
# Working with files
#
# Unstage any files that have been added to the staging area
unstage = reset HEAD
# Show changes that have been staged
diffc = diff --cached
# Mark a file as "assume unchanged", which means that Git will treat it
# as though there are no changes to it even if there are. Useful for
# temporary changes to tracked files
assume = update-index --assume-unchanged
# Reverse the above
unassume = update-index --no-assume-unchanged
# Show the files that are currently assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
# Checkout our version of a file and add it
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
# Checkout their version of a file and add it
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
# Delete any branches that have been merged into master
# See also: https://gist.github.com/robmiller/5133264
delete-merged-branches = "!git co master && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
glog = "!git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative ; true"
editconfig = "!sh subl $HOME/.gitconfig"
[core]
excludesfile = ~/.gitignore
[diff]
tool = vimdiff
# Created by https://www.gitignore.io/api/node
.DS_Store
# Node and related ecosystem
# ==========================
.nodemonignore
.sass-cache/
node_modules/
.bower-*/
.idea/
cache/
# MEAN.js app and assets
# ======================
public/dist/
uploads
*.pem
# General
# =======
*.dat
*.out
*.pid
*.gz
*.tmp
*.bak
npm-debug.log
npm-debug.log*
*.swp
pids
local-file-*
local-mock/
client/local-mock/
server/local-mock/
# For IntelliJ, Webstorm aliases to work with .babelrc configuration, create a webpack.junk.js file and add them there
webpack.junk.js
# Sublime editor
# ==============
.sublime-project
*.sublime-project
*.sublime-workspace
# Eclipse project files
# =====================
.project
.settings/
.*.md.html
.metadata
*~.nib
local.properties
# IntelliJ
# ========
.idea
*.iml
# Cloud9 IDE
# =========
.c9/
# Visual Studio
# =========
#Ignore files build by Visual Studio
*.suo
*.ntvs*
*.njsproj
*.sln
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.tlb
*.tlh
*.cache
*.ilk
*.dll
*.lib
*.sbr
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
# Windows
# ===========
#ignore thumbnails created by windows
ehthumbs.db
Icon?
Thumbs.db
Desktop.ini
# OS X
# ===========
.DS_Store*
._*
# Linux
.directory
*~
# .zsh_profile, .zshrc, .bash_profile can apply the same below:
# IF ESC key not working, try Ctrl (^) + C
# eval $(/usr/libexec/path_helper -s)
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export PATH=/usr/local/lib/node_modules:$PATH
export PATH=/${HOME}/.npm-packages/bin:$PATH
# nvm
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
# google-cloud-sdk
export PATH=/${HOME}/google-cloud-sdk/bin:$PATH
kill-port() { lsof -P | grep ':$1' | awk '{print $2}' | xargs kill -9; }
# maven 3.5.0
export PATH=/${HOME}/Practice/Maven/apache-maven-3.5.0/bin:$PATH
# android-studio gradle
# export PATH="$PATH:/Applications/Android Studio.app/Contents/gradle/gradle-3.2/bin"
# export ANDROID_HOME=/Users/admin/Library/Android/sdk/
# export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
# export PATH="$PATH:/Users/admin/Library/Android/sdk/platforms/android-26"
# wildfly
export PATH=/${HOME}/Practice/Maven/wildfly-10.1.0.Final/bin:$PATH
alias WILDFLY="cd /${HOME}/Practice/Maven/wildfly-10.1.0.Final/bin"
# iTerm color
export CLICOLOR=1
# Java
# export JAVA_HOME=$(/usr/libexec/java_home)
# JDK 11
export JAVA_HOME=$(/usr/libexec/java_home)
# JDK 8
# export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
# GRADLE
export GRADLE_HOME=/usr/local/opt/gradle/libexec
export PATH=$GRADLE_HOME/bin:$PATH
# TOMCAT
# NGINX
# sublime text 3
alias subl="open -a /Applications/Sublime\ Text.app"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/${HOME}/Practice/Python-Google-SDK/google-cloud-sdk/path.bash.inc' ]; then source '/${HOME}/Practice/Python-Google-SDK/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/${HOME}/Practice/Python-Google-SDK/google-cloud-sdk/completion.bash.inc' ]; then source '/${HOME}/Practice/Python-Google-SDK/google-cloud-sdk/completion.bash.inc'; fi
# lockmac
alias lockmac="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
# edit alias config of Git with subl.
alias git-alias="subl ~/.gitconfig"
alias changed-files="git log --name-only --oneline"
# keep wifi on
alias keepwifion="sudo pmset -a sleep 0"
# use alias to run Shared of mvn build
alias mvn-start="mvn -PautoInstallPackage clean install"
# use alias to open Brackets
alias bracket="open -n /Applications/Brackets.app/"
# export Wine PATH
# export PATH=/opt/local/bin/wine:$PATH
# export PATH=/Users/admin/Wine\:$PATH
alias wins="open -a /Applications/Wine\ Stable.app"
# use alias to open Irfanview, require Wine
alias irfan="wins /${HOME}/.wine/drive_c/Program\ Files\ \(x86\)/IrfanView/i_view32.exe"
alias batch-img="wins /${HOME}/.wine/drive_c/Program\ Files\ \(x86\)/IrfanView/i_view32.exe"
# use alias to open ExamDiff, require Wine
alias xdiff="wins /${HOME}/.wine/drive_c/Program\ Files/ExamDiff\ Pro/ExamDiff.exe"
# use alias to open pdf24, require Wine
# ls alias for color display
alias ls='ls -G'
alias lsrt='ls -alrt'
# check processor on MBP
alias specs-mac-processor='sysctl -n machdep.cpu.brand_string'
# timestamp
alias timestamp='date +"%Y-%m-%d %T"'
# launch chrome
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome &"
# youtube-dl
alias mp3-dl="cd /${HOME}/Music && youtube-dl -o '%(title)s.%(ext)s' --extract-audio --audio-format mp3"
# pdf24
alias pdf24="wins /${HOME}/.wine/drive_c/Program\ Files\ \(x86\)/PDF24/pdf24-Creator.exe"
# aem4502 for mobile testing
alias aem4502="/${HOME}/Dev/ngRok-server/ngrok http 4502"
alias aem4503="/${HOME}/Dev/ngRok-server/ngrok http 4503"
alias aem4508="/${HOME}/Dev/ngRok-server/ngrok http 4508"
alias aem4509="/${HOME}/Dev/ngRok-server/ngrok http 4509"
alias aem3000="/${HOME}/Dev/ngRok-server/ngrok http 3000"
# sdkmanager
alias sdkmanager="/${HOME}/Library/Android/sdk/tools/bin/sdkmanager"
# docker
alias dkall="docker container list --all"
alias dklist="docker ps -a"
alias dkls="docker ps -a"
alias dkimages="docker image list"
alias dkstop="docker container stop"
alias dkrm="docker container rm"
alias dkrmi="docker rmi"
# brew services for mongoDB
alias mongo-start="brew services start mongodb"
alias mongo-stop="brew services start mongodb"
alias brew-list="brew services list"
alias brew-mongo="sudo lsof -iTCP -sTCP:LISTEN | grep mongo"
alias pg-start="brew services start postgresql"
alias pg-stop="brew services stop postgresql"
alias pg-restart="brew services restart postgresql"
alias mysql-start="brew services start mysql"
alias mysql-stop="brew services stop mysql"
alias mysql-restart="brew services restart mysql"
# TOMCAT
alias tomcat-start="cd /Users/admin/Practice/Tomcat/apache-tomcat-9.0.2/bin && ./catalina.sh start"
alias tomcat-stop="cd /Users/admin/Practice/Tomcat/apache-tomcat-9.0.2/bin && ./shutdown.sh"
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

ITERM2:

VIM

vim: esc + u to undo, esc + / to search (look forward), esc + ? (look backward)

  • Delete All Lines: Press the Esc key to go to normal mode. Type %d and hit Enter to delete all the lines

Cmd + D to open side-(vertical) tab in Iterm2

Cmd + Shift + D will open a horz tab

kill-port() { lsof -P | grep ':$1' | awk '{print $2}' | xargs kill -9; }

brew install youtube-dl

brew install ffmpeg

brew cask install postman

youtube-dl --extract-audio --audio-format mp3 -l

To install p7zip using Homebrew, first update your brew formulae to be sure you are getting the latest p7zip.

$ brew update Use Homebrew to install p7zip:

$ brew install p7zip

#Add all files in the sputnik (source) directory to the compressed target file heed.7z:

to zip sputnik folder

$ 7z a heed.7z sputnik

Unzip heed.7z to sputnik folder

$ 7z x heed.7z

Password protect

$ 7z a -p heed.7z sputnik

Add A keyboard-shortcut-hotkey-to-open-terminal-in-macos

https://stackoverflow.com/questions/35954184/is-there-a-keyboard-shortcut-hotkey-to-open-terminal-in-macos

https://docs.docker.com/docker-for-mac/#explore-the-application-and-run-examples

docker ps

docker ps -a

To stop and remove the running container with a single command, type: docker rm -f webserver

This will remove the container, but not the nginx image.

You can list local images with docker images.

You might want to keep some images around so that you don’t have to pull them again from Docker Hub.

To remove an image you no longer need, use docker rmi followed by an image ID or image name. For example, docker rmi nginx.

https://github.com/robrich/docker-hands-on-workshop/blob/master/docker-ecosystem.pdf https://github.com/robrich/docker-hands-on-workshop

docker build -t frontend:0.1 .

docker run -p 3000:3000 -d frontend:0.1

docker logs b62

docker container list

docker container list --all

docker container prune

docker container stop <CONTAINER ID>

docker container rm <CONTAINER ID>

docker image list

docker image list --all

docker image prune

docker image rm <IMAGE ID>

DOCKER HUB (https://hub.docker.com/r/pristinetran/)

docker push <image>

docker login

docker tag <IMAGE ID> pristinetran/imageName:1.0

docker push pristinetran/dotnetsample:1.0

Azure CONTAINER REGISTRY (https://portal.azure.com/#resource/subscriptions/5e5687ea-8148-4daf-b6ff-f5e6504a8d89/resourcegroups/pristine/providers/Microsoft.ContainerRegistry/registries/sample1/accessKey, https://www.sonatype.com/nexus-repository-oss)

docker login sample1.azurecr.io -u <username> -p <password>

docker login sample1.azurecr.io -u sample1 -p n0j=+=lgA+3ohjegpP5bGXx+dj2CoM3p

docker image tag 6aa sample1.azurecr.io/sample1/dotnetsample:1.0

docker push sample1.azurecr.io/sample1/dotnetsample:1.0

DOCKER COMPOSE

touch docker-compose.yml (required* file docker-composer.yml)

docker-compose up -d (start|restart)

docker-compose down (stop)

** DOCKER SWARM (Kubernetec, Pointainer, Rancher)**

http://training.play-with-docker.com/swarm-mode-intro/

3 managers & 10-100 service workers

scale up and down

To let service workers join a manager, do the following command with <YOUR SESSION TOKEN>

docker swarm join --token SWMTKN-1-0b2cwrjxje065ae8win4y9siw5djyy9u83944y8 ikzhl00eoyg-1juz01c1t9s5tfmuial36wdmv 10.0.89.3:2377

** RESOURCES **

/Applications/Rider EAP.app/Contents/bin where crck.jar is stored

/Applications/IntelliJ IDEA.app/Contents/bin/

/Users/admin/Library/Preferences/IntelliJIdea2017.1 where vmoptions is stored

http://training.play-with-docker.com/

http://labs.play-with-docker.com/

https://katacoda.com/

https://docs.docker.com/learn/

https://docs.docker.com/engine/tutorials/

RW for Fat32 Drive - Ref: https://apple.stackexchange.com/questions/148875/i-cant-write-to-my-flash-drive-and-it-is-already-in-the-ms-dos-fat-format-w
https://apple.stackexchange.com/a/339863
here's what I did after much face-palming and cursing of Apple and their absolute disregard for their users:
From the terminal:
Identify your USB by NAME and IDENTIFIER:
diskutil list
Output is:
/dev/disk3 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *2.0 GB disk3
1: DOS_FAT_32 MIXTAPE 2.0 GB disk3s1
In this case, NAME=MIXTAPE and the IDENTIFIER=/dev/disk3s1
Now unmount the USB:
sudo diskutil unmount /dev/$IDENTIFIER
Example:
sudo diskutil unmount /dev/disk3s1
Output is:
Volume MIXTAPE on disk3s1 unmounted
Now create the Volume directory - this appears to be the key!
sudo mkdir /Volumes/$NAME
Example:
sudo mkdir /Volumes/MIXTAPE
No output.
Now mount the USB to the Volume:
sudo mount -w -t msdos /dev/disk3s1 /Volumes/$NAME
Example:
sudo mount -w -t msdos /dev/disk3s1 /Volumes/MIXTAPE
No output.
Validate that the USB is now writeable:
touch /Volumes/$NAME/tmp.txt
Example:
touch /Volumes/MIXTAPE/tmp.txt
You should now be able to see that you were able to create the tmp.txt file on your USB in the Finder app or by:
ls -al /Volumes/$NAME
Example:
ls -al /Volumes/MIXTAPE

Install unidentified apps on Mac: sudo spctl --master-disable to bypass security and install Anywhere

-javaagent:/Applications/IntelliJ IDEA.app/Contents/bin/JetbrainsLic.jar

Optional for IntelliJ 2018.3.1

Go to hostfile and add the following likes (subl /etc/hosts for MAC, and Windows edit c:\Windows\System32\Drivers\etc\hosts)

127.0.0.1 www.jetbrains.com 127.0.0.1 plugins.jetbrains.com

Conversely, 0.0.0.0 will allow every connection, not only localhost associated with 127.0.0.1

On Windows comps: configure this way for IntelliJ to load Git Bash "C:\Program Files\Git\bin\sh.exe" -login -i

Horizontal Scrolling on Windows works with JDK 8u112

The key is to configure the IntelliJ Platform Plugin SDK after installing it http://filehippo.com/download_java_development_kit/64/tech/71020/

https://www.jetbrains.com/help/idea/configuring-intellij-platform-plugin-sdk.html

IntelliJ plugins ##:

Rainbow Brackets, Emmet everywhere, Database Navigator, Material Theme UI, React snippets by jinsihou, Json sorter, google-java-format, sbt, scala

IntelliJ settings##:

Uncheck unterminated statement, Code Style Javascript - indent by 2 spaces, Surround selection on typing quote or brace, HTML generated quote marks - Single

VS Code plugins ##:

  • Cloudfoundry Manifest YML Support, IntelliJ IDEA Keybindings,

  • Git: minimum GitLens, Git Graph, Git History (exploratory & evaluating)

  • Code for SSH: Remote - SSH

  • AI-driven code: GitHub Copilot, IntelliCode, IntelliCode API Usage Examples,

  • Themes: Dracula Official theme (optional), Dracula IntelliJ theme (optional), Atom Material Theme, Community Material Theme (optional), Bracket Pair Colorizer (deprecated, native in VSCode now)

  • Java: Extension Pack for Java, Debugger for Java, Test Runner for Java, Maven for Java, Project Manager for Java, Lombok Annotations Support for VS Code, Language Support for Java(TM) by Red Hat, Javadoc Tools

  • UI: ES7+ React/Redux/React-Native snippets, Live Server

  • Code quality: SonarLint, Dependency Analytics

  • Doc: XML by RedHat, XML to JSON by Bui Anh Thang

AFTER MacOS key swapping for regular use of Ctrl button than Cmd, the following applies:

Auo-import setup for Java inside IntelliJ https://www.mkyong.com/intellij/eclipse-ctrl-shift-o-in-intellij-idea/

Code | Reformat Code... for the whole file or Code | Auto-Indent Lines for the current line or selection.

You can customise the settings for how code is auto-formatted under preferences -> Editor -> Code Style. Several comments below were asking how to ensure comments also indent to the same level as the code to which they refer. You can achieve this as follows (see screenshot), in this example for JavaScript. src: https://stackoverflow.com/questions/9044472/correct-indentation-in-intellij

CTRL + Alt + L: correct indentation (auto-indent lines)

CTRL + Delete: delete entire line

CTRL + X: cut entire line where caret is, without having to select the line

CTRL + C: copy entire line where caret is, without having to select the line

CTRL + L: select entire line

Alt + arrowUp: expand selection

Alt + Enter(Return in Mac): auto completion

CTRL + hover view Type definition, choose option from context menu to proceed further for more detail view

CTRL + left-click to go to Type definition, choose option from context menu to proceed further for more detail view

Cmd + Space Auto-completion if the project<language,code> has Type support.

Definition: Ctrl + Y | Alt + Space

Declaration: Ctrl + B

Move line up|down: CTRL+SHIFT+arrow

Goto Line: Cmd + L

Select next occurrrence: Cmd + G, to unselect: Cmd + Shift + G

select all occurrences: CTRL + Cmd + G

(For selection with the proposed keystroke setting .jar file, Windows users can use Alt in lieu of Cmd to perform similar actions)

multiple carets/cursors: ALT + SHIFT + left-click

Navigate to the next/previous change in the editor Cmd + Alt + Shift + Arrow

Navigate errors in the current file F2 | Shift + F2

For current viewing file, find Previous change by F9, next change by F10

To switch files, view recently closed files CTRL + E

Find class Ctrl + O, Find a FILE : Ctrl + Shift + O

Navigate file name: Ctrl + Shift + O

Navigate Class: Ctrl + O

Navigate symbol: Ctrl + Alt + O

JAR file for importing settings for some of those major keystokes https://drive.google.com/open?id=1rClHjmKCIoKNkWz2hEDEkdPpOIkZbWOu https://www.jetbrains.com/help/idea/2016.3/keyboard-shortcuts-you-cannot-miss.html


macSierra to disable for installing apps:

sudo spctl --master-disable

To fix errors on installing a new app (e.g. YARN) bash: line 98: /Users/admin/.bashrc: Permission denied consider running this:

sudo chmod 777 /Users/admin/.bashrc

sudo chmod 777 ~/.bash_profile

General Mac keystrokes:

sudo -i : root privilege

Space: to open Image in MAC Ctrl + Alt + Esc (Mac): clt+alt+del in Windows

Ctrl + Space : to open spot light Search and Terminal

Ctrl + Alt + J : to open Chrome console in Mac

Shift + Ctrl + 3|4 for screenshot

Ctrl + Shift + H : home (pristinetran) in Finder

Cmd + L: go to Line (c9io: Cmd+G)

F6|F7: Previous|Next Change

F9|F10: Previous|Next Diff

Ctrl + .: Collapse|Expand (c9io: Alt + F2)

TYPESCRIPT Depending on the context, there are different ways to get type information. (Shortcuts for OS X)

View > Expression Type ⌘⇧P: shows a popup Navigate > Type Declaration ⌘⇧B: navigates in the editor If 2. does not help, I do Navigate > Declaration ⌘B and then 2. View > Quick Definition ⌥Space (or ⌘Y) View > Parameter Info ⌘P: shows a popup with the declaration of a function parameter

Please try "Code | Inspect Code..."

https://www.jetbrains.com/help/webstorm/2016.3/running-inspections.html?search=inspect

For specific linter results only (as results from linters are internally handled as separate Inspections) you may use "Code | Run Inspection by Name..."

https://www.jetbrains.com/help/webstorm/2016.3/running-inspection-by-name.html?search=inspect

For cloud9, multiple cursors

https://docs.c9.io/docs/multiple-cursors

git remote -v


If you want remove files in the last commit, you can use this:

git reset --hard HEAD~1

And if need files in the last commit, you can use this:

git reset --soft HEAD~1

git remote set-url origin http://ptran_i@stash.infra.gotyco.net/scm/awi/angular-webpack.git

Workflow process:

git checkout develop

git pull

git checkout -b AAEC-1366-edit-group-permissions

<make changes>

git add --all

git commit -m "AAEC-1366 test updates"

git merge develop

so you can certainly do that when you create the branch but there is always the possibility that there have been updates to develop after you created your new branch so for this it doesnt matter because you don't intend to pull anything back into develop; you are just testing that your branch makes it to stash but in the future is what you would do is make your commit, check out develop and pull, then check your branch back out and merge develop into it fix any conflicts if they exist

[3:17]
then git push origin HEAD

[3:18]
that way your current branch has everything from develop and when you do a pull request there will be no conflicts

STASH

git add --all

git status

git stash : save local changes to a stash, e.g. stash[0]

git stash : save additional local changes to another stash[1], stash[2]

git checkout develop to switch back to develop branch

git pull to update from develop branch

git checkout -b just-another-new-branch

git stash apply and git stash pop to retrieve local changes

git stash list git stash clear

Easiest way is to rebase your feature branch onto develop, using

git checkout develop

git rebase --onto develop origin/release/XXXXX feature/yourFeatureBranch

Using this form of rebase --onto selects all the changes made in yourFeatureBranch that weren't part of develop. It's wise to double-check the result. Proceed normally (as described above) to commit using a PR for merge to develop.

*** git stash for last commit ***

git reset --soft HEAD~1

git stash

#src: https://stackoverflow.com/questions/26884364/how-to-stash-my-previous-commit


http://stash.infra.gotyco.net/projects/AWI

[11:10]
https://jira.gotyco.io/secure/RapidBoard.jspa?rapidView=106&projectKey=AAEC&view=planning.nodetail

[11:10]
https://confluence.gotyco.io/display/MD/Eco+System

https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md

EACCES: permission denied

sudo chown -R $USER:$GROUP ~/.npm

sudo chown -R $USER:$GROUP ~/.config

*** GIT ALIASES *** git config --global alias.fromme "!f() { git for-each-ref --format='%(authorname) %09 %(refname)' | grep 'Pristine Tran' }; f"


FOR MAC (ori):

CTRL + Cmd + G: select all occurrences Definition: Cmd + Y | Cmd + Space Declaration: Cmd + B Select next occurrrence: Ctrl + G, to unselect: Ctrl + Shift + G


INSTALL BREW on Mac OSX src: http://stackoverflow.com/questions/20381128/how-to-install-homebrew-on-os-x

Check XCode is installed or not.

$ gcc --version

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

$ brew doctor

$brew update. http://techsharehub.blogspot.com/2013/08/brew-command-not-found.html "click here for exact instruction updates"

If you have to install XCode: automatically accept license: xcodebuild -license accept


Ensure JDK is installed. java -version

brew tap caskroom/cask && brew cask install java && brew cask info java

Standalone Selenium webdriver java -jar /Users/pristinetran/Downloads/selenium-server-standalone-3.0.1.jar -port 4500

brew services start chromedriver

brew services restart chromedriver

npm run update-webdriver


Display all files Mac

to show hidden files go into (Terminal) and type:

defaults write com.apple.finder AppleShowAllFiles TRUE

and then:

killall Finder

To revert: Do the same to FALSE


Change screenshot location defaults write com.apple.screencapture location

start mongodb with Brew brew services start mongodb

(mongoDB folder is located within usr/local/Cellar together with chromedriver)

Open terminal at usr/local/Cellar/mongodb/3.4.2 and run the following:

mongod --dbpath bin/data/db

OR add to .bashrc file using nano: nano ~/.bashrc

export PATH=/usr/local/Cellar/mongodb/3.4.2/bin:$PATH

Ensure whoami

sudo chown pristinetran /data/db

to run the database

In another terminal, open mongo cli by

./mongo or mongo

show dbs gives vision of all dbs

use proj1 creates|switches to db proj1

show collections

db.proj1.count() count data in our db

var pristine = {type:'person', name: 'Pristine'}

pristine again should display the obj literal above.

db.proj1.save(pristine) should save the record

system.indexes

db.proj1.find() renders record from the database.

db.proj1.find({type:'person'}) renders record from the database. db.proj1.find().pretty() renders record from the database - one line at a time.


src: http://stackoverflow.com/questions/3018397/how-to-run-a-program-without-specifying-the-full-path

You can create a soft link:

ln -s /var/lib/gems/1.8/bin/rails /usr/local/bin Then you can run rails directly.


git config --global core.excludesfile ~/.gitignore sudo vi ~/.gitignore

cat ~/.gitignore | pbcopy

The above should be it, the other way is to perform git alias for cadd = rm -rf */*.stackdump && rm -rf */*.DS_Store && git add -A

git cadd

Meteor 1.4.3.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
To get started fast:
$ meteor create ~/my_cool_app
$ cd ~/my_cool_app
$ meteor
Or see the docs at:
docs.meteor.com
# SAMPLE pg_hba.conf file per Rajit Kapoor: https://www.quora.com/How-can-I-install-PostgreSQL-on-AWS-EC2-and-how-can-I-access-that
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTIONS]
# host DATABASE USER ADDRESS METHOD [OPTIONS]
# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain
# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
# plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# database name, or a comma-separated list thereof. The "all"
# keyword does not match "replication". Access to replication
# must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# comma-separated list thereof. In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names
# from a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# host name, or it is made up of an IP address and a CIDR mask that is
# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# specifies the number of significant bits in the mask. A host name
# that starts with a dot (.) matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# columns to specify the set of hosts. Instead of a CIDR-address, you
# can write "samehost" to match any of the server's own IP addresses,
# or "samenet" to match any address in any subnet that the server is
# directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
# "krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
# "password" sends passwords in clear text; "md5" is preferred since
# it sends encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE. The available options depend on the different
# authentication methods -- refer to the "Client Authentication"
# section in the documentation for a list of which options are
# available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# special characters must be quoted. Quoting one of the keywords
# "all", "sameuser", "samerole" or "replication" makes the name lose
# its special character, and just match a database or username with
# that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal. If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect. You can
# use "pg_ctl reload" to do that.
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all power_user 0.0.0.0/0 md5
host all admin 0.0.0.0/0 md5
host all other_user 0.0.0.0/0 md5
host all storageLoader 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident
django-admin startproject sampsite
./manage.py runserver
./manage.py startapp polls
VIRTUAL ENV
http://python-guide-pt-br.readthedocs.io/en/latest/dev/virtualenvs/#virtualenvironments-ref
virtualenv --version
sampsite admin $ virtualenv virtualenv_exec
# configure to ACTIVATE VIRTUALENV automatically
echo source virtualenv_exec/bin/activate > virtual_env
chmod a+x virtual_env
# activate VIRTUALENV everytime
. ./virtual_env
# deactivate
deactivate
''' In order to keep your environment consistent,
it’s a good idea to “freeze” the current state of the environment packages.
To do this, run
'''
$ pip freeze > requirements.txt
$ pip3 freeze > requirements3.txt
''' This will create a requirements.txt file, which contains a simple list of all the packages in the current environment, and their respective versions.
You can see the list of installed packages without the requirements format using “pip list”.
Later it will be easier for a different developer
(or you, if you need to re-create the environment) to install the same packages using the same versions:'''
$ pip install -r requirements.txt
'''
This can help ensure consistency across installations, across deployments, and across developers.
Lastly, remember to exclude the virtual environment folder from source control by adding it to the ignore list.
'''
# /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django
I have never used Tape, Phantom is a necessity
I havn't used Jasmine in a while but every time I have evaluated it in the past I liked Mocha better
Mocha has a stronger plugin architecture and support, and supports both TDD and BDD test syntax
Jasmine and Mocha are testing frameworks and they work for any JavaScript, browser or server
PhantomJS is a headless browser.
Karma is a test runner and basically a wrapper around all of the tech you want to use for your testing.
Protractor is a webdriver implementation for writing end user GUI tests
can Protractor be considered as for BDD? >> it's an API to interface with the browser, so you can use it in BDD tests
I would say its more appropriate to use with BDD yeah since in the browser you would be testing actual behavior
Istanbul is a wrapper like Karma ? >> istanbul measures code coverage and I think it integrates with several testing frameworks.
it evaluates how much of the codebase your tests cover
so your tests themselves have to load the code that is being tested, and it looks at what lines are being executed in the codebase
___
I would say it's just technical debt.
they were probably working at some point and then stagnated
I played lightly with Jasmine and Mocha before and usually, I created a singleton so whenever I run the script like `mocha test.js`, it will go and grab all the *.test.js in the proj directory (using `glob` pattern in NodeJS).
but that’s server side, for client-side I’m not quite sure with ES5.
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation: */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
}
}
`npm link webpack` for issue with cannot load webpack module
// Example for webpack.junk.js
const path = require('path')
module.exports = {
resolve: {
alias: {
'@components': path.resolve(__dirname, './app/components'),
'@containers': path.resolve(__dirname, './app/containers'),
'@identity': path.resolve(__dirname, './app/identity'),
'@lib': path.resolve(__dirname, './app/lib'),
'@test': path.resolve(__dirname, './test'),
'@views': path.resolve(__dirname, './app/views'),
'@utils': path.resolve(__dirname, './util'),
'@server': path.resolve(__dirname, './server'),
},
},
};
@hivelogic2018
Copy link

@hivelogic2018
Copy link

@hivelogic2018
Copy link

hivelogic2018 commented Jan 28, 2022

Troubleshooting IJ 2019 installation:
cd /Applications/ && xattr -cr IntelliJ\ IDEA\ 2.app

http://fls.jetbrains-agent.com
src: https://osxdaily.com/2019/02/13/fix-app-damaged-cant-be-opened-trash-error-mac/

@hivelogic2018
Copy link

hivelogic2018 commented Oct 25, 2022

https://stackoverflow.com/questions/34652563/using-myproject-npmrc-with-registry
https://stackoverflow.com/questions/60877361/configure-multiple-registries-in-npmrc

Set Git username and email
https://smarterco.de/set-the-username-and-email-in-git-globally-and-per-project/

.npmrc
registry=https://registry.npmjs.com

to verify: npm config get registry

Add account as a sudoer on Mac: https://zwbetz.com/add-your-account-as-a-sudoer-on-mac/

1-time thing for installing packages with the npm registery (to use another registry, alter the http part) - this way of doing is less favorable to the .npmrc way: npm config set registry http://registry.npmjs.org/

@hivelogic2018
Copy link

hivelogic2018 commented Feb 11, 2023

delete local branches that do not exist on remote any more:
git fetch -p ; git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d

alias lintfix='npm run lint --fix'
alias 1log='git log --oneline'

npm i -g yarn
// in the codebase cli:
lintfix && yarn test -u && npm run build

(npm test -- --update)

git push --set-upstream origin centos-dev

@hivelogic2018
Copy link

// latest 02-11-2023 settings.json vscode
{
    "update.mode": "none",
    "git.enabled": true,
    "editor.detectIndentation": true,
    "editor.tabSize": 2,
    "files.trimTrailingWhitespace": true,
    "editor.trimAutoWhitespace": true,
    "files.autoSave": "onWindowChange",
    "window.restoreWindows": "folders",
    "emmet.syntaxProfiles": {
        "javascript": "html",
        "jsx-sublime-babel-tags": "javascriptreact",
        "xml": {
            "attr_quotes": "single"
        }
    },
    "emmet.triggerExpansionOnTab": true,
    "workbench.sideBar.location": "left",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "workbench.colorTheme": "Dracula Soft",
    "redhat.telemetry.enabled": true,
    "editor.minimap.enabled": false,
    "security.workspace.trust.untrustedFiles": "newWindow",
    "git.autofetch": true,
    "terminal.integrated.profiles.osx": {
        "zsh": {
            "path": "/bin/zsh",
            "icon": "star",
            "env": {
                "TESTING_VAR": "abc"
            }
        }
    },
    "terminal.integrated.defaultProfile.osx": "zsh",
    "sonarlint.rules": {
        "typescript:S6480": {
            "level": "off"
        }
    },
    "git.ignoreRebaseWarning": true,
    "editor.defaultFormatter": "vscode.typescript-language-features",
    "eslint.format.enable": true,
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "[typescript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    },
    "[javascript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    },
    "typescript.updateImportsOnFileMove.enabled": "always"
}

@hivelogic2018
Copy link

hivelogic2018 commented Mar 21, 2023

When you do the initial push add the -u parameter:

git push -u origin my_branch:remote_branch
Subsequent pushes will go where you want.

EDIT:

As per the comment, that only sets up pull.

git branch --set-upstream
should do it.

To remove all untracked files, whether they are ignored or not, use the command git clean -f -x instead. The -x option removes all untracked files, including ignored files.

@hivelogic2018
Copy link

https://stackoverflow.com/questions/7244321/how-do-i-update-or-sync-a-forked-repository-on-github

# Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

# Fetch all the branches of that remote into remote-tracking branches

git fetch upstream

# Make sure that you're on your master branch:

git checkout master

# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:

git rebase upstream/master

Primarily using:

git pull upstream main
git merge upstream/main

@hivelogic2018
Copy link

quick, simple python script to server a folder of files including json files with cors opened for UI fetch

from http.server import SimpleHTTPRequestHandler
import os
import json
import urllib.parse
import http.server

class CORSRequestHandler(SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_header('Access-Control-Allow-Origin', '*')
        self.send_header('Access-Control-Allow-Methods', 'GET')
        self.send_header('Access-Control-Allow-Headers', 'Content-Type')
        SimpleHTTPRequestHandler.end_headers(self)

    def do_GET(self):
        parsed_path = urllib.parse.urlparse(self.path)
        request_file_path = parsed_path.path.strip("/")
        if os.path.isfile(request_file_path):
            if request_file_path.endswith('.json'):
                self.send_response(200)
                self.send_header('Content-type', 'application/json')
                self.end_headers()
                with open(request_file_path, 'rb') as f:
                    self.wfile.write(f.read())
            else:
                super().do_GET()
        else:
            self.send_error(404)

PORT = 8000
DIRECTORY_TO_SERVE = "my_folder"
os.chdir(DIRECTORY_TO_SERVE)

httpd = http.server.HTTPServer(('localhost', PORT), CORSRequestHandler)
print(f"Serving directory {DIRECTORY_TO_SERVE} at http://localhost:{PORT}")
httpd.serve_forever()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment