- https://github.com/reviewpad/code-review-tips - List of code review tips
- https://conventionalcomments.org/ - Comments that are easy to grok and grep
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Place your key bindings in this file to override the defaultsauto[] | |
| [ | |
| { | |
| "key": "ctrl+cmd+g", | |
| "command": "editor.action.selectHighlights", | |
| "when": "editorFocus" | |
| }, | |
| { | |
| "key": "shift+cmd+l", | |
| "command": "-editor.action.selectHighlights", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fbr () { | |
| local branches branch | |
| branches=$(git branch --all --sort=-committerdate | grep -v HEAD) && branch=$(echo "$branches" | | |
| fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) && git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on run {input, parameters} | |
| set theTime to (time string of (current date)) as string | |
| tell application "System Events" | |
| keystroke theTime | |
| end tell | |
| return input | |
| end run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const animals = ['cat', 'dog', 'fish']; | |
| const lengths = animals.map(animal => animal.length); | |
| console.log(lengths); | |
| const reducer = (acc, word) => acc + word.length; | |
| const letterCount = animals.reduce(reducer, 0); | |
| console.log(letterCount); | |
| const hasThree = word => word.length === 3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="description" content="Higher Order Function - Simple Demo"> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // e.g. "write a simple function that logs out the factor of a given number" | |
| // input '4' should return '24' since 4 * 3 * 2 * 1 = 24 | |
| // input '6' should return '720' etc... | |
| // First, discuss and consider the basic utility of a `while` loop | |
| function factor(number) { | |
| let result = 1; | |
| let count = number; | |
| while (count > 1) { | |
| result *= count; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UPDATE wp_posts | |
| SET post_content = replace(post_content, 'Existing string', 'Desired replacement string') | |
| WHERE post_type = 'post' | |
| -- can do a 'dry run' search, if the tool doesn't offer UI (phpMyAdmin does) | |
| SELECT * | |
| FROM wp_posts | |
| AND post_content LIKE '%Existing string%' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Change wp_ to your database prefix | |
| -- Change example.com to your domain | |
| -- Change string to the text you want to search for | |
| SELECT | |
| ID as 'Post ID', | |
| post_title as 'Title', | |
| CONCAT('http://example.com/',post_name) as 'URL' | |
| FROM `wp_posts` | |
| WHERE post_type = 'post' |
NewerOlder