Skip to main content

Posts

Showing posts from August, 2015

Finding Happiness

I listen to a lot of podcasts. They are great for entertainment as well as education. I finished listening to a recent podcast by Tim Ferris in which he interviews Naval Ravikant. The entire podcast was great, but one part really jumped out at me. You can find the podcast here, and I have detailed below what I found so enlightening.

“Desire is a contract you make with yourself to be unhappy until you get what you want.” – Naval Ravikant

This is the pull quote for the podcast, so it must have struck Tim in a similar way that it struck me.

I have experienced this, but haven't been able to see this wisdom before. When I want something really badly, it consumes my every thought. Then of course, once I actually obtain whatever it was, it doesn't actually make me happy. At least not to the extent that I was unhappy before I got it. Thinking about a desire with this mindset really changes the desire's affect on you.

Naval then continues with, "In any situation in life you hav…

Using tsUnit to Unit Test TypeScript

I have been working on a project using TypeScript and needed to use TDD to build up some of that project. I wanted to find a way to write my Unit Tests in TypeScript so that I could continue to practice TDD and ensure that my code’s logic was sound. I found tsUnit, a TypeScript Unit Testing Framework. The documentation explains pretty well how to get started with simple unit tests.
After getting a simple test running, I found the need to have a setup function happen before each of my tests run. I couldn’t find any documentation on how to accomplish this from the github documentation or through some quick Google searching. If I want to have something run once before my tests start up I can use the constructor of the TestClass, but I needed this to happen before each test so that they are in a known good state. I found the answer by digging into the tsUnit.ts file itself. To get a function to happen before each test, use the setUp function, this name is the same as the attribute that NU…