there is only one found worthy.

Ch4. Reversing an array

READ MORE

Source


//Reverse an array by pushing
function reverseArray(arr)
{
  var revArr = [];
  for(var i=arr.length-1;i>=0;i--) 
  {
     revArr.push(arr[i]);
  }
  return revArr;
}

//Reverse an array by swapping
function reverseArrayInPlace(arr) 
{
  for(var i=0;i<=Math.floor(arr.length/2);i++)
  {
      var t = (arr.length-1)-i;
      var temp = arr[t];
      arr[t] = arr[i];
      arr[i] = temp;
  }
  return arr;
}

console.log(reverseArray(["A", "B", "C"]));
// → ["C", "B", "A"];
var arrayValue = [1, 2, 3, 4, 5];
reverseArrayInPlace(arrayValue);
console.log(arrayValue);
// → [5, 4, 3, 2, 1]

Finish Line

READ MORE
Marathon

It’s a marathon, not a race.

Where is the finish line? You see, in a race it’s easy to give everything you’ve got. You know where the finish line is. It’s right over there. You just gotta run as fast as you can. Ignore all that temporary, piercing pain and forget about your lack of energy. Squeeze every ounce of determination, grit, and motivation out of you. After all, in a race, the only thing that matters is that you give it all up for that 1st place trophy. It’s assumed that you’ll be able to get to the finish line. Maybe not first, but everyone finishes the race around a similar time.

However, this is a marathon and not a race. Everyone finishes at a different time. There are also many personal finish lines in a marathon. Checkpoints and miniature goals, if you will. These are the things that keep you sane. You hope there is an actual finish line somewhere along this path. You can’t actually see it though. You just know that you don’t ever want to stop moving. Even though the pain will always be with you, don’t stop. If you ever stop, it’s going to be harder to get going again. Why can’t we stop again? Oh right, I remember. If you ever stop, it’s going to be harder to get going again. But it’s going to be tough. For myself, sometimes I feel like I’m not even thinking about what I’m doing. It’s like I’ve trained myself to continue to run so I don’t ever stop. Because in a marathon, it isn’t about how fast you finish. It’s whether or not you make it to that finish line. The actual one.

So far, I’ve sped past many things in this marathon. Averted my gaze. I didn’t want to deal with them. They were awkward obstacles I didn’t know how to handle so I tried to bypass them. I thought I could avoid them. I predicted that they were dangerous. They could possibly hurt me. I wanted a shortcut past them. And one of the worst feelings is when I have to run backwards and backtrack. Why is this the case? There weren’t any people handing out water bottles along my shortcut. Also in taking this shortcut, I forgot about everyone else running the marathon. The people that stopped to help me get up when I tripped and fell down. The people who looked back and encouraged me to catch up and follow. The people I could lead the way for. And of course, the people I ran alongside with.

Whatever fork in the road I take. Whatever number I decide to wear on my chest. Don’t forget, one thing is for sure. I won’t take the people and experiences I encounter for granted anymore. I want them all to make it to the only finish line I’ve seen and found.

Ch4. The sum of a range

READ MORE

Source


// Builds an array containing all numbers from start up to (and including) end, with optional step parameter.
function range(start, end, step)
{
  var arr = [];
  
  // Set default step if step not present
  if(arguments.length == 2 && start<end)
  {
    step = 1;
  }
  else if(arguments.length == 2)
  {
    step = -1;
  }

  // Counting up(step is positive)
  if(step>0)
  {
    while(start<=end)
    {
      arr.push(start);
      start+=step;
    }
  }
  // Counting down(step is negative)
  else
  {
    while(start>=end)
    {
      arr.push(start);
      start+=step;
    }
  }
  return arr;
}

// Takes an array of numbers and returns sum
function sum(numArr)
{
  var count=0;
  for(var i=0;i<numArr.length;i++)
  {
    count += numArr[i];
  }
  return count;
}

console.log(sum(range(1, 10)));
// → 55
console.log(range(5, 2, -1));
// → [5, 4, 3, 2]

Nope

READ MORE

The smallest of things can make a huge difference. A single mistake could cost you something big. A tiny change could lead to gigantic growth. I’ve had so much energy lately. My mind has been so full of thoughts, ideas, concepts. My imagination feels like it has expanded its limits. I can try to explain this through my own means. For example, I’ve been working out and exercising a lot and I fixed up my diet. I’ve been adding new routines and I refactored my schedule. Nope, this still doesn’t explain it.

I’ve remembered something very important. I am seeing more clearly now. It’s because somewhere along the line, I lost track of the big picture. I lost my focus. I lost my confidence. I’m not sure how it happened. It was probably a combination of a gradual decline along with a series of big discouragements. But now, I’ve got it back. It’s amazing how powerful encouragement is. And I’m thankful for it. I’m looking forward to passing it along. Even when it’s tough, confusing, and scary.

The smallest of things can make a huge difference. A single letter can completely change a word. A tiny magnification could lead to so much more clarity. I’ve been encouraged, it’s time to do the same.

Sincerely,

I, Hope.

Optimism vs Pessimism(being realistic)

READ MORE

It’s becoming a theme where I feel like I’m.. not naive, but.. what’s the word..
Alright I give up. Let’s use naive.

I don’t understand certain things. It’s like I feel a little left out of the loop. For context, I’m talking about communication. There are so many variables and factors involved with communication. It’s crazy. There’s no way to make sense of it all. There are hidden nuances in communication, things aren’t always as they seem, and it’s hard for me to decipher it all.

For one thing, everyone is different and I’ll be one of the last people you will see make a judgement call without enough information. Sure, I’ll probably have an inkling about what is going on, but I’m skeptical to trust it based on one case study instance. Communication. There has been a recurring theme recently in my life and it’s..(well its hard to say what I completely mean without writing an essay so maybe if I write one word maybe someone will understand, maybe they won’t, but I know for sure there will be pros and cons for writing an essay vs writing one word so let’s just go with the word because it’s shorter and more efficient and I can use programming principles such as DRY and I’m rambling now, no one wants to read this) ironic.

Every time I communicate I feel like no one understands my optimism. I’m not sure if this is a family issue, a culture issue, or a just me issue. I’m probably one of the most optimistic people you’ll ever meet (if you do ever meet me that is, which I would say IS possible). What I mean by that is I believe it takes an “unrealistic” amount of confidence to say something cannot be done, that is, to say with ABSOLUTE certainty that something is not possible. This is because I believe you need that confidence to be 100%. And that’s the reality, that’s not me being pessimistic (Are you God? Do you know everything?). On the other hand, it’s much more plausible to say something is able to be done. Even if the supposed probability is 1%, my statement that something is able to be done still holds true. And I’ll trust in that statement until it’s proven wrong. Even then, it’s probably not going to be to the 100% standard that I want. So I’ll still probably “hope for the best”.

Here’s another example I’ll use to demonstrate optimism vs pessimism (I hope one is enough to convince you because I’ve had like 5 random coincidences happen today that I can use for examples; I have plenty more examples floating around in my head). I’ll ask you a question to think about. Here’s the question, without any context for you to lean upon for guidance: What would you think of me if I told you I like to fight, participate in competitions, and destroy my enemies?

Hmm. Give me your best impression and your worst impression.

Now for the clarification that I myself would need. I will fight to the bitter end for things that matter to me. I will participate in competitions, because even a loss can be seen as a win if you look at the silver lining. And finally, I will destroy my enemies if they get in the way of my goal.

I’m going to go refill my cup of water. It’s half-full.

Expectation vs. Reality

READ MORE

Expectation vs. Reality

“Fake it till you make it”

READ MORE

There’s one scene from the movie Gattaca that popped into my head recently. It gives me chills and inspiration because it’s something that fascinates my imagination.

I’m getting closer. I’m stronger this time. I’m tired of running from conflict. I pray for wisdom to invest my resources wisely. There’s no need to save any for the swim back. I’m still scared though. The question: sink or swim?

Refactor

READ MORE

Note to self: one goal, one dream? If you think you’ve got what it takes then do it. You’ll know when you reach the goal. Until then, refactor. Destroy it. Create it again. Build it back up. Eliminate all distractions and all inefficient factors. This is part of the journey. And while you’re at it show me what you’ve learned. It’s been a while.

Vicarious Failure

READ MORE

First, some context. Now, my thoughts. The article title states: “competition is for losers”. While I agree with some of the points of the article and found most of the content itself interesting, this title bothers me. Loser has a negative connotation in this context and I want it to have a positive one. Mainly because I am a loser. In my mind, that’s not a bad thing. Let me clarify.

Loss, failure, rejection. All of these are fairly common words that bring to mind negative emotions. And they do, for a good reason. They all hurt like hell. They hurt more depending on how much you valued the (blank). I’m pretty sure everyone has experienced these things. What is bothering me most right now are the vicarious people. These are the people who see you, before, during, or after your competition (whatever it may be) and decide to give you some advice or an opinion. These are the people who don’t actually know what it’s like. These are the people that try to convince you because they are qualified to do so. Why? Because they’ve seen other people fail. Okay. They have not just seen other people fail, they’ve seen lots of people fail. Wow, really? These are the people who don’t know what competition is.

Every competition has a loser and a winner. I thought this was an obvious concept. Apparently, the reason some people don’t participate in competition is because it’s not realistic. It’s not realistic to “win”, that is. Anyways, I’m not sure why people have the assumption that if you don’t “win” then its viewed as a failure. Is winning the only goal in a competition? Sure, it’s an important goal but losing has something to offer as well. It feels like you’re losing something you valued. You are and it hurts. There will be pain. Failure is scary. But I’m gonna own it all the way. I can’t learn from a vicarious failure.

Crazy

READ MORE

First, let’s google this word. I’m going to use the 2nd definition: senseless; impractical; totally unsound. I think this context describes pretty well what people think of my goals, my ideas, and me. For a first impression anyways. Now, this is the actual crazy that I don’t understand: what people think of you.

What people think of you. How do you make sense of it? It’s not practical. It’s not sound. What people think of you is indeed, crazy. And I’m referring to the “what” as what’s crazy and not “you” as crazy. People are going to call you many things. People you know are going to say different things. People you don’t know are going to say much of the same things. And all of it, it’s crazy. It is senseless, impractical, and totally unsound. But when I hear those comments about who I am, when I listen to my friends who are all telling me something, and when I look at what the world is shouting at me… it makes sense, for a second. This is because I’ll consider a concept before I give my judgement. And in the end, I come down to the same conclusion. It’s pure distraction. Nothing more. Besides crazy that is. I already set my goals, crafted my ideas, and I know myself. The thing about distraction is that it “distributes” your “action”. Hence, distr-action.

I recently read an article about being in motion versus taking action. Ironically, and obviously, I was distracted. But anyways, I enjoyed it. It was crazy! Well, it wasn’t crazy. But you know. And to kind of play along with its idea, any motion at all is distraction. In other words, action consists of motion. And motion is necessary to make up an action. But it’s still not the action. It might make up an action, but it’s still a motion not an action. Think of someone throwing a ball to you in slow motion. Watch as they grip the ball, then wind their arm back, then finally they whip it forward, releasing the ball. Gripping the ball may be an action itself, but the action of throwing does not equal the action of gripping the ball. Likewise, whipping the arm forward may be an action, but you would not say someone threw the ball if they just whipped their arm forward (Unless you’re the NFL). Each action consists of motions which may be actions that also consist of motions. It’s motionception. Or is it actionception? ANYWAYS, the point is, your goals, your ideas, and yourself may be crazy to the entire world. But as long as you can endure the distraction and follow each individual motion(action?) through the entire action, you’ll be able to put all the distraction together and make it not crazy. Actually, it’s still crazy. Why? It’s still distraction. So, (just) make sense of things in all of that distraction and you’ll have your next action.