Rahul's Personal Blog

Consistency is a root and perfection is a flower.

My College ended in 2016, and I had 2 months to kill. so I enrolled in a GYM.

There was a Guy doing a bench press, in terrible form. What a fool, I thought.

Last year, I enrolled again. To my surprise, The Guy had bulked up. And, I remained stagnant.

What did I lack? The immediate response is consistency. But it’s not.

Consistency is like momentum, The more you have it. More Consistent you will be in the future. But you don’t have momentum from day 1.

The real reason is Perfection. The thought of doing everything from the onset. It puts unnecessary hurdles and impedes the cultivation of Consistency.

When starting aim for consistency. When ending aim for Perfection.

Want to develop a habit of reading? Open a book and read only a page every day. Once, you have done that for 30 days. Add other complexities like improving comprehension.

What did perfection kill for you?

Networking Right Way

Most of the Networking Events sucks ..

Early, In my career. I was very active in meetups. I would travel to the other side of Banglore to join meetups.

I meet a lot of people. We will exchange numbers, and will never message again. It was a recurring theme for some time.

Till I realized a better way to network. It’s never to network. Instead, spend time doing.

Want to connect with open-source contributors? Start contributing to open-source projects. You will connect with lots of devs over time. Want to connect with builders? Go and take part in hackathons.

The connection made this way will be strong and will last longer.

I share my weekly learnings. Follow for more.

JavaScript Interview Questions

Question1

Make changes to the following function so that the 1 invocation of the setInterval prints the same random number and next iteration different number.

You can only change the random method, You can not change the callback inside the setInterval.

const random = () => {
    return Math.random()
}
setInterval(() => {
  console.log(">>>>>")
  console.log(random())
  console.log(random())
  console.log("<<<<")
}, 3000)

Output should be

>>>>>
0.4343
0.4343
<<<<<
>>>>>
0.3624
0.3624
<<<<<
.....

Solution

let r = Math.random()
function random() {
  setTimeout (() => {
    r =  Math.random()
  }, 0)
  return r
}

setInterval(() => {
  console.log(">>>>>")
  console.log(random())
  console.log(random())
  console.log("<<<<")
}, 3000)

Question 2

Implement the Typewriter effect on a string.

Refer to the codesandbox https://codesandbox.io/s/stoic-moon-n4xdm3

import "./styles.css";
import { useEffect, useState } from "react";

export default function App() {
  return (
    <div className="App">
        <Typewriter text="Hello World" />
    </div>
  );
}

const Typewriter = ({ text }) => {
  const [index, setIndex] = useState(0);
  useEffect(() => {
    const intervalId = setInterval(() => {
      setIndex((prevIndex) => {
        if (prevIndex >= text.length) {
          clearInterval(intervalId);
        }
        return prevIndex + 1;
      });
    }, 500);
    return () => clearInterval(intervalId);
  }, [text]);

  return <div>Loaded: {text.substring(0, index)}</div>;
};

Learnings From Sam Altman

Compound Yourself

  1. Move your carrer towards an upward right trajectory.
  2. Don’t stay in a career where someone with 20 years of experience is equivalent to 2 year of experience.
  3. As your career progress, each unit of work should produce more and more results. Question How is that leverage possible as a developer/PM in software?
  4. Look for really big opportunities that if successful can make everything else small. Question Not clear about Long term thinking with a broad view of how different systems in the world are going to come together.

Have almost too much self-belief

  1. Develop a very high sense of self-belief and develop that early.
  2. As you get datapoints about your judgement is good and can consistently deliver results, trust it more.
  3. Balance your self-belief with self-aware, if people are critical of you, listen and understand why.

Learn to think independently

  1. Think from first principles, generate ideas and discuss with someone.
  2. Grit is that you will fall multiple times and you can stand up every time.

Get Good at Sales

  1. Get good at written communication. Make sure your thinking is clear and use plain language to explain it.
  2. Show for in person meeting whenever it’s important.

Make it easy to take Risk

  1. Take risk and take it more often. You have to try many things and adapt quickly
  2. Look for small bets you can make where you lose 1x if you’re wrong but make 100x if it works. Then make a bigger bet in that direction. Question, What are some of these bets looks like.
  3. Keep you life cheap and flexible.

Focus

  1. It’s more important to work on the right thing instead of just working.
  2. Move Fast and accomplish the most important bits in the direction.

Work Hard

  1. Working hard and smart can take you to 99% percentile.
  2. Momentum begets success.
  3. Working towards maximum big impact should be celebrated and is fulfilling.
  4. Work Stamina is the biggest predictor of sucess. Question What are you doing to increase the work stamina.

Be Bold

  1. It’s easier to do hard startup compared to easy startup.
  2. Working on important and hard problem will get you tailwind of people willing to help you.
  3. Follow your curiousity.

Be Wilful

  1. Iam going to keep going until this works, and no matter what the challenges are I’m going to figure them out”, and mean it, go on to succeed.

Be Hard to Compete With

  1. Like build a strong personal brand, learn things at intersection of one or more fields.
  2. Most people do whatever people they are hanging out with.

Build a Network

  1. Effective way to build network is to help people as much as you can.
  2. Quickly spotting drive, creativity gets much easier with practise.
  3. Ask this question, Is this person force of nature?

Be internally driven

  1. Smartest people are internally driven and they do things to satisfy themselves
  2. They feel compelled to make something happen in the world.