The Best Algorithm for Learning to Cook

Cook to eat and cook to learn

There are two reasons for cooking: cooking to eat and cooking to learn. The main point of cooking is to eat healthy food, affordably without spending too much time or effort. Once that’s achieved, cooking allows you to learn about what foods work with your tastes and your body. You can also use cooking to learn about your own culture or other cultures.

The method I’m going to describe is inspired by building software which emphasizes reusable pieces.


A meal has three interchangeable parts

I tend to eat high fiber diets. That means my meals (lunch and dinner) are about 1/4 carbs, 1/4 protein, and 1/2 vegetables by volume with plenty of oils. My snacks tend to be fruit and nuts. Breakfast is plain whole yogurt and bananas.

Your meals depend on what works for your body, but using these guideliens this is a reasonable starting point for a healthy diet. Americans tend to eat too much sugar, meat, and bread and not enough vegetables, so that’s why I err on the side of too much vegetables.

We want to think of these three parts (carbs, protein, vegetables) in a meal as parts that can be swapped out, like a three-person play that can have different actors. 

When I start cooking, I think “what’s my carb, my protein, and my vegetables?”. 

As we learn more recipes, we can then identify what ingredients play these three roles and introduce these parts in our meals.


Flavor agents dress up our three parts

We’re trying to get a tasty meal at the end and we’re starting with raw ingredients. Most raw ingredients have a taste, but I think of them as a canvas for a range of flavors.

Boiling a raw potato would be rather bland so we add salt or sour cream to make it taste better. The salt and sour cream give the food additional flavors, so I’m going to call them flavor agents.


Cooking methods turn these parts of the meal into different forms

Cooking is the collection of methods (algorithms) for turning those raw ingredients (inputs) into good food (outputs). Here are some example outputs.

Examples of carbs

  • Steamed carbs
  • Mashed potatoes
  • Pizza dough, pita, flatbread
  • Burger bun
  • Corn tacos, arepas

Examples of proteins

  • Burgers
  • Meatballs
  • Breaded and fried fish
  • Roasted meats
  • Braised meats
  • Curries

Examples of vegetables

  • Salad
  • Sauteed vegetables
  • Roasted vegetables
  • Grilled vegetables

Examples of flavor agents

  • Vinegar
  • Ginger
  • Garlic
  • Black bean sauce
  • Spices
  • Herbs
  • Capers
  • Mayo
  • Mustard
  • Honey

The key to learning to cook (or really learning anything) is learning the next most useful skill enough to get you to the next level. You could call it agile. At that new level, you may find that you need a whole different set of skills. What’s missing is a leveling system to help guide cooking students. In the same way that when you play Pokemon Go, you feel great when you level up, you should be able to see your cooking skills level up too.

We like leveling up because we like the feeling of progress within a structure of that tells you what to do next towards a given a goal. Finding your own goal is really difficult and you may spend a lot of time wandering before you find it.


A great cooking course organizes cooking methods into levels and guides you through them

The cooking course that I’m imagining comes down to starting everyone at level 1 of the four different parts (carbs, proteins, vegetables, and flavors). I would split up the different methods into levels by difficult, effort, ingredients and amount of equipment needed.

The first goal would be to complete level 1 for all four parts. Then it’s really up to the individual to choose what they want to get better at.

Within the levels, the course would describe the method, give examples of what kinds of ingredients can be put into the method and have the student cook a couple recipes with this method.

When the student is bored with a recipe, then they can either cook another ingredient with the same method or move on to the next level. Since the three parts are interchangable, they can be taught independently and students can progress at their own pace based on their interest.

Now I just have to build it.


Designing Cooking for millenials

Before, I talked about how cooking is not designed for millenials.

  1. Cooking for one every night is inefficient.
  2. Recipes assume you have ingredients and equipment. They also aren’t visual.
  3. Cooking education relies on recipes and not techniques.

What’s the answer?


Cooking for one

Cooking every night takes up a lot of time and effort. If you cook every night, it’ll take about 1 hour each night. The answer is cooking many meals at once. I like to cook six on Sunday nights.


  1. Containers. I’d tried cooking larger portions before, but that didn’t work well because I didn’t have any way to store it. The key is buying containers and preassembling the meals into containers on the day you cook so that you all you need to do is heat it up when you want to eat.
  2. Variety. People get sick of eating the same thing all week. That’s why I cook three different meals for the week and I only eat them for dinner. That way you can still buy lunch and get a wide variety of food.


Recipes are broken for millenials

Recipes are not designed with the needs of a millenial in mind. They don’t realized that millenials don’t have a full pantry, a lot of kitchen equipment or a lot of time. They are heavily text based.


  1. A simple solution would be to include more data on the recipe about the number of ingredients, dishes, cooking techniques used and type of equipment it needs.
  2. We can also communicate recipes in pictures or videos instead.
  3. Recipes should be organized to maximize the amount of reusable pieces. For example, recipes that share a common set of ingredient or techniques should be grouped together.
  4. Recipes should be designed in a modular way to show what parts can be substituted.


Cooking education relies on recipes and not techniques

Cooking is something passed down from parents to children, but more and more, parents are not cooking, so where will children learn to cook?

People cook now by looking on Google for recipes. This leads to learning to cook by trying many different recipes. This is a very ineffective way to learn.

What are recipes?

They’re a written way to communicate instructions for making something.

The problem is that each recipe only tries to recreate a special case not communicate how the ingredients were chosen and their purpose in the dish.

Following a recipe for roast pork is like learning for the first time that 3 x 5 = 15. Sure, next time you’re asked what 3 x 5 is, you’ll know it’s 15, but you didn’t learn how to multiply. If I asked you what 4 x 6 is, you won’t have a clue. In the same way, you haven’t learned how to cook meat by learning a recipe, just the answer to a specific problem.


The answer is teaching methods and using recipes as examples of methods.

The whole point of cooking education should be to teach the 20% of techniques that make up 80% of recipes so that people can reap the benefits of cooking and start experimenting with ingredients on their own.

How does that work? Next, I’ll show the cooking curriculum I’d use to teach cooking.



Cooking was not designed for millenials


To me, cooking means so many things.

Food is the basis for health and cooking is educating yourself about what foods are good for you and what foods taste good.


People cook differently than companies do and way healthier.

  • People cook with real food and companies cook with ingredients you can’t pronounce.
  • People don’t use as much salt, sugar or fat as companies do.
  • People prioritize taste and health and companies optimize on cost.


A lot of my family’s celebrations are centered around food. Cooking is passed down from one generation to another and I feel that I’m losing cultural heritage if I don’t learn how to cook. Cooking means community.


Economically, if I cook 6 meals a week, I can save 200 dollars a month.

I think people like the idea of cooking. I think cooking just has a bad user interface. For people who don’t have much experience cooking, it’s a large hurdle to cross.


Cooking has a bad user interface

  • Millenials are usually single which means cooking for one. Cooking every night for one is time and effort intensive.


  • Recipes are broken. They are meant for families who have a large kitchen, plenty of equipment, and a stocked pantry with lots of ingredients. Millenials (especially city dwellers) don’t have these things.
    1. Ingredients. Recipes often require 10-15 ingredients, so it’s hard to make things just from what you have. If you try to make chicken tikka masala one night and thai curry the next, you will have a lot of these ingredients that are not used very often, so there lots of leftover ingredients, which end up spoiling. The ingredient list that need 1 oz of sherry vinegar  means you need to buy a specialize item
    2. Equipment. Recipes need equipment like food processors and large mixing bowls that there’s not room to store. Using a lot of equipment means cleaning a lot of dirty dishes, so it’s a lot of work unless you have a dishwasher (not standard in New York).
    3. Presentation. Recipes are not visual and rely heavily on text to convey instructions. If Snapchat and Instagram are any indication, millenials love visual media.


  • Cooking education is lacking. Usually, cooking is taught by parents, who themselves may not be very good. Most education is focused on following recipes and not enough emphasis is placed on learning techniques so students learn to create their own recipes. When a beginner goes online to find a recipe, so many recipes that it’s hard to know what to pick.


What’s the answer? That’s next.


The Best Credit Card Rewards Calculator

There are so many articles about what the best rewards credit card is. They talk about all the features, pros and cons. Revolving categories. Redemption minimums. Cash back pretending to be miles. It’s really complicated.

You know what would actually answer this question once and for all? If we just calculated your expected rewards from each card and compared them. So, that’s what we’re going to do.


Credit Card Rewards Basics

Rewards are only rewards if you’re not paying interest. If you still have balances, pay them off before continuing. You should be paying off your balances every month for the rest of this to be relevant.

There are cashback rewards, there are miles at airlines or hotels, and then there are cashback points pretending to be miles. Here, we’re going to look at the first and the third types.

Length of credit history makes up 15% of the FICO credit score so you should have some cards which are open for a long time. Let’s see what are the best credit cards in the long run.


What’s the best cashback credit card to have forever?

You want the redemption rate to be the highest after the sign up bonus has already been obtained. This is the card that you will be spending most of your money on.

What you want to avoid is keeping a card with an expensive annual membership fee open for a long time. It’s not doing you much good.

Screen Shot 2016-07-07 at 4.47.10 AM.png

Citi DoubleCash is the best in this case and that’s great because it also doesn’t have an annual membership fee, so you can keep it open forever without paying for it each year. Also, unlike cards that can only be used to redeem for travel, DoubleCash can be redeemed for anything.

I calculated these numbers using the average New York household spending from before. This example household spends $25,143 a year on their credit cards.


What’s the deal with Sign Up Bonuses?

Notice how I said that permanent cards don’t take into account consider the sign up bonus. Here’s why:

The best credit cards in the long term are not the best in the short term, because sign up bonuses make up a large part of the value of rewards cards.

Screen Shot 2016-07-07 at 4.53.24 AM.png

Compare the first year reward values to second year reward values. The red arrow shows Citi DoubleCash. It’s no longer the at the top of the list because all the cards above it have some sort of signup bonus.

If you average the signup bonus over the years that you have the card open, here’s what you get.

Screen Shot 2016-07-07 at 4.56.28 AM.png

As time goes on, the cards separate into two groups, one around $500 a year and another around $375 a year.

Now, looking at just the top cards in the first year compared to Citi DoubleCash.

Screen Shot 2016-07-07 at 4.58.25 AM.png

Notice how these cards start very high due to the signup bonus and then fall below DoubleCash over time. You could stop using the card once you have the sign up bonus, but that generally means having to cancel the card because these signup up bonus cards tend to have annual fees. Cancelling cards affects the length of cards open and so has a small negative effect on your credit score.


I don’t spend 25k on my credit cards in a year. Does the math change?

Remember that these numbers were calculated off an annual household spending of 25k.

What happens if you spend less?

12k a year

Screen Shot 2016-07-07 at 5.16.32 AM.png

Citi DoubleCash is still the best card in the long run.

Screen Shot 2016-07-07 at 5.18.22 AM.png

But, in the first year, we see some other cards with signup bonuses overtake DoubleCash.

If you spend less than 12k a year, you may not spend enough to get the signup bonus (ex. Barclays Arrival and Capital One Venture requires 3K spent in three months).

What happens if you spend more?

50k a year

Screen Shot 2016-07-07 at 5.30.25 AM.png

In the long run, DoubleCash still comes out on top. Interestingly, at 95K annually, Barclays Arrival actually equals DoubleCash.

Screen Shot 2016-07-07 at 5.27.22 AM.png

In the short run, DoubleCash is actually doing better now as the weight of the signup bonus is reduced by the increase in spending.


What about airline cards, American Express membership points and hotel cards?

They’re very complicated because they can be redeemed for different values depending on how they are redeemed. Another subject for another time.


What’s the best cashback rewards card?

For most people spending more than 8k a year, Citi DoubleCash is the best. It gives you the most money without considering signup bonuses.

There are many good cards above with signup bonuses and you could chase them, but it may not be worth your time. You might as well find a card that will last you a lifetime.

Sounds like dating.

We could be doing more with Human Intelligence

Computer scientists are working very hard to create an artificial intelligence that solve problems in many domains (general intelligence). Turns out there’s already something with general intelligence, humans.

I am reminded of how grateful we should be about the human intelligence we take for granted and the gap between what we are doing with this intelligence and what we are capable of achieving.

Studying AI, we can take its example for improving its intelligence by trying to improve our own. One way I’m doing that is by learning how machine learning works, so I can do more with the tools at my disposal. Another way we can do this is by looking at what may be holding ourselves back from achieving our goals and making plans to change that part about ourselves, the same way that any halfway decent general AI would, given the chance.

The warnings about general AI sounds kind of familiar. A group of intelligent organisms shape their world to make it suit their every need despite all other organisms. Yes, it sounds like humans. Need wood? Get it from rainforests. Need power? Burn some fossil fuels. Need feelings of love? Make a website just for cat videos. The only difference may be that our human conscience feels bad about the damage that we’ve done to the planet and strive to repair it. Computers don’t have this conscience yet, but they’re going to need that if we’re going to survive with them.

We can take the analogy of a stamp collecting machine and imagine how we would do that. Then, being human, apply our conscience when thinking about what our “stamp” would be and collect that, be it money, power or good in the world. Time’s ticking. Better get on it.



Coursera Machine Learning

How do New Yorkers spend their money?

I was curious how New Yorkers spent their money. Turns out Bureau of Labor Statistics has that data.


How do New Yorkers spend their money?

Screen Shot 2016-06-29 at 5.27.07 PM.png
Source: US Department of Labor, Bureau of Labor Statistics. Consumer Expenditures Survey. New York 2013-2014

Mostly housing (not surprising),  transportation, food, and retirement savings.


How do Americans spend their time?

Screen Shot 2016-06-29 at 5.37.10 PM.png
Source: Bureau of Labor Statistics. American Time Use Survey, Ages 15+, Employed and Unemployed 2015

Sleeping (personal care) is most of it. Then, we spent time on leisure and sports, work, and household activities (cooking and cleaning). This data includes retired people too, so that’s why the work hours are lower than expected. Amazingly, about 3 hours a day is still spent on TV.


What does this say about society and technology?

Top Areas of Money Spent

  1. Housing
  2. Transportation
  3. Food
  4. Retirment Savings

Top Areas of Time Used

  1. Sleeping
  2. Leisure and sports
  3. Work
  4. Household activities


First, it’s interesting that the things we spend all our time on are not the things that we spend our money on. It seems like we actually spend fairly little money on things that we choose and mostly spend money on things that we have to.

Second, it feels like the biggest changes have come in the areas where we spend our time (communications, entertainment) and not so much the areas where we spend our money. Althought it seems like there are some developing technologies which will change this, most notably self driving cars.

I wonder if I feel that certain industries are not seeing progress because there hasn’t been or because I don’t know enough about all of these industries to judge. May warrant some further investigation.

Life is distractions

As I blowing our the candles on my birthday cake, one of my friends surprised me with a question: what was the most important thing I had learned this year?

The idea of distractions had been rolling around in my head.


Why am I thinking about distractions?

I felt that I was spending too much time checking, reading, and watching the news that it filled up the time when I wasn’t working or with my friends. My particular poisons were podcasts, Youtube, and online news.

Two podcasts really nailed this feeling. I was not alone. This feeling was manufactured.

  • Note to Self did a week-long bootcamp called Infomagical, where the goal was to be more deliberate about the information that we consume. Each day of the week had a challenge to try out techniques for combating this distraction.
  • On the Ezra Klein Show, Andrew Sullivan talked about his 10 day meditation after quitting blogging ( 10:00, 14:50). Most poignant was when he said that there’s “an entire economy built on [this distraction]” and asks: what are we distracting ourselves from?

Infomagical recognizes the feeling of being overwhelmed. More content is generated than ever and we drown in the tsunami unless we’re able to actively choose what we read and watch. This series really hit on some of the feelings that I experienced: being overwhelmed with news, clicking on link after another, reading everything on the front page, reading but not talking about the news, and allowing the avalanche of news to consume my time and attention.

Andrew Sullivan knows that this content is generated on purpose. Media outlets fight for our attention so that they can sell this attention to advertisers to either support their journalism or to just make money. It’s not just news, it’s Youtube, HBO, podcasts, Instagram. My favorite example of this comes from The Next Web. When you finish reading an article, you’re greeted with the message “Shh. Here’s some distraction” implying that they produce distractions but also feed it to you over your objections.


Screen Shot 2016-06-29 at 11.57.39 AM

I’m not saying that all distractions are bad or that all distraction is sinister. Quartz and Vox tell me about things that I care about. CrashCourse reminds me that reading literature has something to offer about the human experience. Giving up my Sunday night to HBO connects me to other people. Listening to the Ezra Klein Show made me think about the ethics of our food. Most of these things entertain me. It’s when we’re not able to control the flow of information into our brains (addicted) that this becomes worrisome.


Why is it a problem if we’re distracted and entertained?

Because when you fill up all your time with distractions, they’re probably masking other problems. It becomes easier to find distraction than to face the problems that you’re trying to avoid.

  • How should I make a living?
  • What does it mean to love someone?
  • Why should I have children?
  • Should I relearn my native language?
  • How do I maintain my family’s culture?
  • Which friendships do I value and which of those am I neglecting?
  • What should I be doing about the homeless people in our cities?
  • How do I make society more fair?
  • Should I be eating animals?
  • Why don’t we treat our veterans the way that they deserve?
  • Are we building Cylons who will destroy us?
  • How do I make my life matter?


This piece is what I wished I had said at my birthday party. What I ended up saying was something like this: “I’ve been thinking a lot about distractions a lot recently. A lot of life is distractions, but when you remove all those distractions you get to the real questions that you’ve been avoiding. That’s the stuff that really moves you forward in your life. So I’m trying to be more mindful about how much time I spend on the internet”.


What can we do about it?

Infomagical offers some suggestions. Their challenges are meant to help you take control of your information intake.

I came across Bullet Journal recently too. I often find myself in the situation when there is nothing on my mind, like when I’ve just woken up, and my first instinct is to check my phone. The phone’s ability to grab you before you have found your focus is the biggest challenge of focus. When my task management system is on the internet, it’s easy to avoid doing that task by popping open another tab and wander off into the internet. Having an offline task manager means that you’re thinking about what you have to do before you have a chance to take you off on a journey.

Now, get off the internet and talk to someone about this.





(Space left intentionally blank for you to think before clicking on to the next thing.)










More about this idea

While writing this, I thought about some further reading and watching related to this idea. I left them until the end so that it would be less distracting.

Note to Self: Infomagical

Ezra Klein interview with Andrew Sullivan

Crash Course Philosophy Existentialism

Bullet Journal

Infomagical Challenge 4 – Talk to A Friend About What You Read for 7 Minutes

A Curriculum of Guides about Blocks in Objective-C

Recently, there was a question about blocks that I couldn’t answer so I took a note to review it.

I came upon some great articles. Seeing the same elephant described by different people invariably leads to a comprehensive understanding of the elephant (much in the same way that taking beginner swing dance classes from 4-5 people leads to better fundamentals).

With no desire to write an inferior blog post, I’m going to review the ones I found, much the same way that I review restaurants.

The Guides

Mike Nachbaur: Using GCD and Blocks Effectively

Tutsplus: Objective-C Succinctly: Blocks

AppCoda: Introduction to Objective-C Blocks

Apple Working with Blocks

Matt Nunogawa Objective C Blocks: Summary, Syntax & Best Practices

Conrad Stoll Blocks, Operations, and Retain Cycles

I’ll be looking at:

  • explanation of why it’s important
  • completeness vs depth
  • the example code
  • ease of transferring examples to projects
  • how beginner friendly it is

Which should I read first?

Starting from Square One

Go with Tutsplus: Objective-C Succinctly: Blocks. It’s short, has useful examples and memory is well explained with diagrams. It stops short of retain loops though, which is a vital topic. Also lacking is why blocks are used (when would I want to use a block? what would I have used otherwise?).

AppCoda (Introduction to Objective-C Blocks) is really known for their app tutorials. They explain very well why you would use blocks and lead you through an example of how it would be used in a practical situation with an actual app.

Mike Nachbaur: Using GCD and Blocks Effectively extends deeper into asynchronous callbacks, introduces Grand Central Dispatch, and the idea that retain cycles can happen.

For Programmers from Other Languages

Matt Nunogawa (Objective C Blocks: Summary, Syntax & Best Practices) writes his blog directed at programmers from other languages and overviews blocks with greater examples for retain cycles and how to avoid them.

Bonus: Conrad Stoll (Blocks, Operations, and Retain Cycles) writes about a real example of a bug that his team faced with retain cycles and blocks.

For Quick Reference After Learning It Once

Apple Working with Blocks documentation can be a bit dry and doesn’t give much guidance for when to use it, but if that doesn’t bother you, then by all means go ahead. It’s very comprehensive.

How I deleted all my local Evernote notes and recovered them

I am not the first nor the last idiot to delete all my local Evernote notes. Given that they were in a local notebook, you can imagine how important they were to me. Commence panic.

Events leading up to the catastrophe

1. I updated Yosemite.

2. Evernote starts acting up and won’t let open.

3. I go to the app store to download Evernote only to find that I can only “Install” it. Hit install.

4. Find all local files missing. Have a heart attack.

How to Recover your Local Evernote notes

1. Turn on hidden files.

Hit Command + Spacebar to bring up spotlight and search for Terminal

After opening terminal, it should look like this:

Screen Shot 2015-02-01 at 9.54.02 PM

Close all of your finder windows

Enter this line in Terminal and hit enter

defaults write AppleShowAllFiles TRUE

Nothing will happen. Open Finder again and you will see grayed out files. Those are the hidden ones.

2. Restore notes from Time Machine

Go to Macintosh HD/Users/yourUsername/Library/CoreData

It should have be empty.

Open up Time Machine and go back to an hour ago when you still had the com.evernote.Evernote folder. If you don’t have Time Machine enabled, then you’re out of luck. Sorry. Should look something like this.

Screen Shot 2015-02-01 at 9.58.47 PM

The green files there are your Evernotes.

Hit restore and you will find them in Finder.

3. Delete Evernote from Applications

4. Download Evernote from the website if you had installed Evernote from the App Store

5. Install Evernote again and find your files

Why did it happen?

Installing Evernote from the App Store replaced my old version of Evernote with a clean one which synced with the server. Unfortunately, my local notebooks were not synced with the server, so they were lost.

Why does this solution work?

Evernote Installed from the App Store and Evernote downloaded from the web and installed store their notes in two different places.

Evernote from the App Store puts their notes in the folder:


Evernote downloaded from their website puts their notes in the folder:


This makes sense because Apple wants all the files for the apps in the App Store to be neatly organized in one container. Normally, when you install a program, it will add file in lots of different places.

Installing Evernote from the App Store deleted the data from the folder where Evernote from the website would typically store it’s files.

You just have to put it back by restoring from Time Machine and getting the right Evernote (the one from the website) to read the files from the right place.

What attempts did not work?

Replace the CoreData folder in the container with the restored one

You would think that simply moving the files from the CoreData folder into the container that App Store Evernote uses would be sufficient, but in fact that Evernote will create a new folder to store it’s notes because the longAlphanumericString is not the same as the one it was expecting.

The notes simply will not open in Evernote or worse tell you that it has an unspecified owner and for you to log out.

Copying the .enspot files directly over also did not work

I will be keeping my notes synced from now on

What use is privacy when you lose your data?