-
Notifications
You must be signed in to change notification settings - Fork 4
Development Notes
Vu Anh edited this page Apr 10, 2023
·
25 revisions
Random notes about Development
VS Code Shortcuts
# Line
Cut Line: Command X
# Format Document
CTRL-SHIFT-I (⌃⇧I) : Format Document
# Hide/Show Panel
⌃` : Switching from terminal and editor
⌘b : Toggle Sidebar Visibility
# Code Runner Extenions
⌃⌥N (Ctrl-Option-N): Run Code
# File
Ctrl-P: Browse Files...
# Editor Group
Split Left: Command `View: Split Editor Left` (VSEL)
Close Editor: Command `View: Close Editor`
Change Group Order: Ctrl + Command + Arrows
Switch File in Group: Ctrl + Tab or Alt + Command + Arrows
## Natigate Objects
Shitf + Command + .: Very powerfull!!!
Command + Shitf + O: Find object (@local, #global)
## Multipleline Editing
Command + D
## Terminal
Ctrl-Shift-[
Ctrl-Shift-]
Mac Keyboard Symbols
-
⌘
is the Command () key. -
⌃
is the Control key. -
⌥
is the Option (alt) key. -
⇧
is the Shift key. -
⇪
is the Caps Lock key. -
fn
is the Function key.
Syntax Highlighting
Extension C/C++ (C/C++ IntelliSense, debugging, and code browsing.)
C++ Setting
"C_Cpp.clang_format_fallbackStyle": "Google"
- Run command
C/C++: Enable Error Squiggles
[1]
[1]: How To enable Error squiggles in VS code // complete solution
Build and Run g++ code
g++ -std=c++17 -Wall -O2 -o "a" "a.cpp" && ./a < in
g++ -std=c++17 -Wall -O2 -o "program" "program.cpp"
export CPLUS_INCLUDE_PATH=/Library/Developer/CommandLineTools/usr/include/c++/v1/
g++ -std=c++17 -Wall -O2 -I/Library/Developer/CommandLineTools/usr/include/c++/v1/ -o "program" "program.cpp"
Rule 1: Check pointer is null
or not, just use boolean operator (don't use null
or nullptr
)
/* Good way */
if(!node) { }
/* Bad ways */
if(node != nullptr) { }
if(node != NULL){ }
Open multiple files
cd problems/leetcode_id
code -r cpp/main/solution.cpp cpp/main/solution.h data/1.in data/1.out data/2.in data/2.out data/3.in data/3.out
Run program
bazel run cpp/main:solution < data/1.in
Convert notebooks to README
jupyter nbconvert notebook.ipynb --to markdown; mv notebook.md README.md