- "Think first, then try." - Daniel P. Friedman
- "The key to understanding complicated things is knowing what not to look at." - Gerald Jay Sussman
- "Programs must be written for people to read, and only incidentally for machines to execute." — Harold Abelson and Gerald Jay Sussman
blog's Introduction
blog's People
blog's Issues
学 Java
IntelliJ
写 Java 用 IntelliJ 可以让工程师 enjoy coding 而不是 typing.
我研究一番,发现学习 IntelliJ 直接 follow 内建的Learn IDE Features
效果最佳。不仅有 roadmaps(下图),IDE 还直接 set 好了每个场景。
enjoy~
New to me: Debugger
一直没认真学过如何 debug
,当时我的 programming 101 是用 JavaScript,授课老师大概说:"程序是否正确应该仅由你的思考所决定,而不是靠 console.log
打印出的东西。浪费时间在 debugger 工具上,不如花时间想清楚。"
差不多四年过去了,回想他的话,其实需要一个 context,也是那个课程的理念:「重要的是编程**,而不是工具。」有多少初学者是看到那复杂的 IDE 界面而放弃?
而对于 pro 来说,debugger just make life easier. 我写 Python 时,就很喜欢用 IPython.embed
当 breakpoint
查看手上 object 的 data structure,以及它的 method 用起来是怎样的;在写自动化程序(RPA)时就更好玩了,可以做到像在 REPL
控制 browser。
最后,Let's show off(对应教程的 Debug workflow):
- breakpoint 让程序停在你觉得出错的地方
- evaluate 那个 expression 看是否真的出错了
- 啊?真有出错,那就给这个 expression 加上 Watches,它会展示每一个变量
- 接着自信地
Step Into
,再 evaluate 每段觉得出错的 expression,并修改代码 - 改好了吧,别急着 rerun!你甚至不需要重启 runtime,而是
a. 按Build
,IDE 会自动 Patch 最新的 code
b. 再按Drop Frame
让 call stack 退回到 breakpoint,换言之就是 undo step 4. - resume program,相信一切顺利了
第五步对我来说很新鲜:)而整个 workflow 也是很好的实践。
coding practice
Leetcode Top 100 Liked Questions
- 1. Two Sum
- 2. Add Two Numbers
- 3. Longest Substring Without Repeating Characters
- 4. Median of Two Sorted Arrays
- 5. Longest Palindromic Substring
- 10. Regular Expression Matching
- 11. Container With Most Water
- 15. 3Sum
- 17. Letter Combinations of a Phone Number
- 19. Remove Nth Node From End of List
- 20. Valid Parentheses
- 21. Merge Two Sorted Lists
- 22. Generate Parentheses
- 23. Merge k Sorted Lists
- 24. Swap Nodes in Pairs
- 25. Reverse Nodes in k-Group
- 31. Next Permutation
- 32. Longest Valid Parentheses
- 33. Search in Rotated Sorted Array
- 34. Find First and Last Position of Element in Sorted Array
- 35. Search Insert Position
- 39. Combination Sum
- 41. First Missing Positive
- 42. Trapping Rain Water
- 45. Jump Game II
- 46. Permutations
- 48. Rotate Image
- 49. Group Anagrams
- 53. Maximum Subarray
- 55. Jump Game
- 56. Merge Intervals
- 62. Unique Paths
- 64. Minimum Path Sum
- 70. Climbing Stairs
- 72. Edit Distance
- 74. Search a 2D Matrix
- 75. Sort Colors
- 76. Minimum Window Substring
- 78. Subsets
- 79. Word Search
- 84. Largest Rectangle in Histogram
- 85. Maximal Rectangle
- 94. Binary Tree Inorder Traversal
- 96. Unique Binary Search Trees
- 98. Validate Binary Search Tree
- 101. Symmetric Tree
- 102. Binary Tree Level Order Traversal
- 104. Maximum Depth of Binary Tree
- 105. Construct Binary Tree from Preorder and Inorder Traversal
- 114. Flatten Binary Tree to Linked List
- 121. Best Time to Buy and Sell Stock
- 124. Binary Tree Maximum Path Sum
- 127. Word Ladder
- 128. Longest Consecutive Sequence
- 131. Palindrome Partitioning
- 136. Single Number
- 138. Copy List with Random Pointer
- 139. Word Break
- 141. Linked List Cycle
- 142. Linked List Cycle II
- 146. LRU Cache
- 148. Sort List
- 152. Maximum Product Subarray
- 155. Min Stack
- 160. Intersection of Two Linked Lists
- 169. Majority Element
- 189. Rotate Array
- 198. House Robber
- 200. Number of Islands
- 206. Reverse Linked List
- 207. Course Schedule
- 208. Implement Trie (Prefix Tree)
- 210. Course Schedule II
- 215. Kth Largest Element in an Array
- 221. Maximal Square
- 226. Invert Binary Tree
- 234. Palindrome Linked List
- 236. Lowest Common Ancestor of a Binary Tree
- 238. Product of Array Except Self
- 239. Sliding Window Maximum
- 240. Search a 2D Matrix II
- 279. Perfect Squares
- 283. Move Zeroes
- 287. Find the Duplicate Number
- 295. Find Median from Data Stream
- 297. Serialize and Deserialize Binary Tree
- 300. Longest Increasing Subsequence
- 322. Coin Change
- 338. Counting Bits
- 347. Top K Frequent Elements
- 394. Decode String
- 416. Partition Equal Subset Sum
- 437. Path Sum III
- 438. Find All Anagrams in a String
- 494. Target Sum
- 543. Diameter of Binary Tree
- 560. Subarray Sum Equals K
- 617. Merge Two Binary Trees
- 739. Daily Temperatures
- 763. Partition Labels
学 Redux
Redux 用到了一个叫 Thunk 的词让我感兴趣,第一次看到这个词是在 SICP,于是想看看在这儿,它是干嘛的。四五个小时过去,我有如下收获...
学习资料
学会使用 Redux:
- If immutable objects are good, why do people keep creating mutable objects?
- Redux core concepts: https://redux.js.org/introduction/core-concepts
- Redux terms: https://redux.js.org/tutorials/essentials/part-1-overview-concepts#redux-terms-and-concepts
- Redux-middleware: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware
- Redux-thunk: https://www.reddit.com/r/reactjs/comments/6e0vgt/is_my_understanding_of_reduxthunk_correct/
学会 Redux 的实现:
- Redux: https://blog.jakoblind.no/learn-redux-by-coding-a-mini-redux/
- Redux-thunk: https://blog.jakoblind.no/async-actions-with-redux-thunk-demystified/
- Redux-middleware: https://gist.github.com/shanehh/e0f89b38bc8ec0253900823c719eb881
上面的 blog 没有 Redux Middleware 的实现。我以前看过几篇 blog 实现 Express.js/Go Gin 的 middleware,回看觉得弄得复杂了点,recursion 写得像 iteration. 于是写了一个自认为 useless while elegant & powerful 的例子😁
看文档不开心的地方
对,我要抱怨一句,Redux 的示例代码风格对我来说还是太 smart 了一点。文档里的 Basic Example ,如果是我的话,就会把
function counter(state = 0, action) {
switch (action.type) {
case "INCREMENT":
return state + 1
case "DECREMENT":
return state - 1
default:
return state
}
}
let store = createStore(counter)
改成
function counter(state, action) {
switch (action.type) {
case "INCREMENT":
return state + 1
case "DECREMENT":
return state - 1
default:
return state
}
}
let store = createStore(counter, 0)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.