Skip to main content

Posts

The most important thing in life

In life, you need to have a goal. How to achieve your goal? You have to take action with a deep understanding of how reality works. Your brain needs to have a map of reality. To create this mental map, you need to do the damn thing. This will create neural links. Then, you have to calibrate your mental map with reality. How? By constantly reflecting on what is true, what went wrong , what went right, then figure out the root cause and design a plan on how to do it differently in the future. If you mental map is different from reality, your action will not be optimal. ie. You have the wrong belief. You need to have a deep understanding of how reality works. To get there, You can learn from others (including books and in-person) You can learn by yourself (through your own experience or reasoning) Learning by yourself can be slow. However, it will be a source of tremendous value because you reason from first principles. First principles are the basic truth, then you figure
Recent posts

My First 'Not Yet'

I took the 219 assessment about 2 months ago. Kevin administered the test. It was a problem solving question whereby you are required to solve a problem using javascript while talking through the steps. The problem looks relatively simple, so I wrote some test cases and pseudo-code. I then proceeded to code the solution. 30 minutes passed, I was pretty confident my solution was right. It solve 5 of the test cases I wrote. I thought I nailed it. I decided to add in a few test-cases just because I have some time left. One of the test cases doesn't produce the required output. It was alright, this kind of things happens sometimes. I decided to tweak my code here and there, thinking it will produce the required output for that particular test case. To my horror, it didn't. Another 15 minutes passed. I begin to panic a little. I remember asking Kevin 'do I have to time myself for the test'. It was funny now when I think back. Of course I do, it was a 1 hour test. It tu

My Burnout Experience

I want to share with you my experience of burning out. After registering with Launch School, I am extremely excited about my programming journey. I studied for 10 to 12 hours a day, memorizing fact, trying out practice problems, understanding programming concepts. It was fun and exciting and I love seeing myself growing from nothing in programming to something more. After about 3 months, thing starts to change. I started noticing myself paying less attention to details. I find myself skimming through the course material. I skip "Further Exploration" in the practice problem. I am more interested to study just to pass the assessment rather than truly mastering the concept. It was a gradual burning out process but I continue to study for 10 to 12 hours a day through sheer grit. It felt like doing house chore or working a day job that you don't like. One particular morning I woke up, and I remember this deep feeling of dread because I can anticipate that the next 10 to 1

How to make block element sit side by side.

1. Float If two column, one element float right and another float left , or you can float left for all element. If three column, three element float left. Note that all floated element u must specify width, if not, it will take whatever width necessary to fill the content. 2. Inline-block Need to specify width for them also , if not, they will take up whatever space necessary to fill the content. There are default spacing between inline-block, comment them out. Inline-block are vertical align in the bottom by default, you need to set vertical align property to top.

Static vs Relative vs Absolute vs Fixed

Static: the default position. Everything starts from top to bottom nicely according the document flow. Relative: still within normal flow of document. But accept offset position, relative to its original document flow position Absolute: out of normal flow. It doesn't interact with elements around it anymore. The reference point will be parent element that has relative positioning, if not, reference body element. Accepts offset position Fixed: out of normal flow. The element sticks to a corner of the page even if user scrolls. Reference the windows view.

Clear fixes

There are three main ways to clear floats. 1. create and empty div at the bottom of the page. Then set 'clear: both' to that div. 2. create a pseudo element :after, then set 'display: block' 'content: ""' 'clear: both' properties to it. 3. set 'overflow:hidden' to the parent element. Overflow other than visible will create a block formatting context that will force the parent element to expand to fit the height and width of floated child.

Block vs Inline-block vs Inline

Block element block element has width, height, border, padding and margin . The full box model is applied to them. It take up the whole width of the page. It break a newline before and after each element. Floated element are also block element but do not take up full width of page. Inline element Do not break a newline , but stay 'inline' with the rest of the content. Inline element do not have width and height dimension. Margin top and bottom are ignored. Padding top and bottom exist but won't push element above and below it away. Sideways margin and padding will push content away from it. Both inline and inline block element will have some spaces when there is whitespace between them. Inline-block element Behave like a block level element but do not break a new line. It will stay 'inline' with the rest of the content.