The Hacker’s Healthy Guide, a simple 3 steps algorithm

I love to eat! In fact I eat a lot! And I have the great fortune to be the partner of one marvelous chef
that cooks amazing meal almost every day!

But I’m a hacker, I like coding even more then I like to eat. So I spent most of my time sitting in front of a computer without any apparent movement, eating stuff and drinking a lot.

So what I eat everyday is important to me, but I’m not a grano-hippie carrying my bag of nuts and dried fruits. And I believe any diet or restriction on the aliments you can eat are the biggest bullshit ever. What I do is a quick check of the nutrition facts label of each product I buy at the grocery.

Fat

fat fat fatI don’t really check the fat quantity. Saturated fat should be low. But the important thing is Trans fat should be 0. Almost no product with trans fat ever enter my house. This type of fat is transformed in a way your body can not recognize it as fat, so it won’t end up in the right place and it’s not the type of fat you can loose by exercising. It’s there forever, like Microsoft hidden libraries when you install Office!

Sodium

salty!This one is important because it’s high on several products that are low fat or low calories. If it’s low in fat but has more then half your daily value in sodium (often the case for dried noodle soup) it’s a no-no, it would be like eating salt!

Protein

juiceEver wondered why drinking a glass full of fruit juice will keep you hungry and only one apple can sustain you for a couple of hours ? That’s because the juice doesn’t hold any proteins. Proteins expand in your stomach and make you feel satisfied. If a meal hold lots of proteins you won’t need to eat as much to get going!

Code samples

If you find this boring just read the code bellow, it’s a simplified version of the algorithm in the language of your choice:

Ruby:


  def eat?(product)
    product.trans_fat == 0 &&
      product.sodium < 1000 &&
        !product.proteins.empty?
  end

Python:


  def eatable(product):
    return product.transFat == 0 and product.sodium < 1000 \
                                 and len(product.proteins) > 0

C#:


  public bool IsEatable(Product product) {
    return product.TransFat == 0 && product.Sodium < 1000
                                 && product.Proteins.Length > 0;
  }

Lisp:


  (defun eat? (product)
    (and (= (trans-fat product) 0)
         (< (sodium product) 1000)
         (/= (array-total-size (protein product)) 0)))

Closing tips

asian pearEven if you have to eat frozen food for lunch there are some good choices out there, just check out those 3 things. Plus, fruits and vegetables are always a winner. But cutting, wrapping the thing can be pretty annoying. To bring back excitement, joy and extaze to your meal think about trying new fruits like: asian pear, dragon fruit, kaki, kiwi, mango… OK that’s enough I’m starting to dribble.

Now what are your tips on being an healthier hacker ? I’d really like to know! Or maybe you’d like to contribute to the translation of the (really complex!) algorithm (or correct my poor lisp coding skills). Please do, I’ll add it with due credit!

Bon appétit!

Warning if you’re gonna submit some code in the comments:
My friend wordpress.com seems to eat some part of the content when we use < or >. This is stupid, but if you’re going to submit some code in a comment, replace the < by &lt; and > by &gt; or just send me your code by email at macournoyer_AT_gmail.com. Sorry for the inconvenient.

12 Comments

Filed under C#, Misc, python, ruby, tutorial

12 responses to “The Hacker’s Healthy Guide, a simple 3 steps algorithm

  1. ok but there are also basics like checking the “best before” date

    product.best_before product.chemicals.length

    or something like that

    funny article

  2. hey the comment box eat my previous comment. apparently it doesnt accept code. i said. check

    product.best_before is inferior to Time.now

    and also don’t eat overprocessed food (=transfat and chemicals)

    product.natural_ingredients.lenght superior to product.chemicals.length

  3. It seems wordpress is eating all the < and remaining characters…

    If you’re gonna submit code, replace you <, > and & with entities… sorry…

    Thanks for the suggestions Heri! Nice tip on having more natural ingredients then chemicals! It should appear first on the list of ingredients.

    As for the best before date, I’m not sure, sometimes it is slightly increased by the seller to make sure you buy some more soon. Even if it’s 2 days past best before but was in the fridge all the time, might still be good, just smell it! But, like everyonw else, I’m sure, when I buy stuff I always reach in the back to take the one with the greatest best before date.

  4. Great post Marc-Andre. I always wanted to write something about “Diet for Geeks”.

    I’ve lost 55 pounds in 2 years all by myself but applying a new food strategy.

    I found that eating in the morning would completely change the way you eat for the rest of the day. I started eating again on morning with one bowl of light corn flakes with milk.

    I tried to eat fish as much as possible, especially when going to the restaurant and I’d rather eat proteins at lunch.

    When I was hungry in the middle of the day, generally at 5pm, I tried to eat a fruit with some black chocolate (a very small portion).

    I tried to eat light in the evening with big vegetable salads.

    I allowed me 2 meals in the week where I can eat anything.

    With some time, I was use to it and it worked fine. I used to lose 2 to 5 pounds per month. That’s not a lot, but at the end of the year, it’s not that bad and you don’t take it back.

    Of course, exercising is part of the plan and starting riding by bike is the best way to start. Running is the sure way to hurt yourself if you’re overweighted.

    I try to follow that strategy here, but I have some trouble to find the food I used to eat.

    That’s really a work of everyday to take care of that. It’s not about having a diet for 1 month and getting back to normal just after, it’s about changing the way your eat for the rest of your life.

    I guess most people don’t want to hear about that.

  5. Hey Fred,

    Thank you so much for the great reply!

    I totally agree with you, when you eat well for breakfast you’re not that hungry throughout the rest of the day.

    This is a pretty good plan, congrats on sticking with it! I should definatly eat more fish. But the problem is the ones they got at the grocery don’t look that appealing and are all glossy…

    You’re right most people don’t want to hear about that kind of thing, I didn’t expect that much response but I’m glad you did!

  6. How do I keep healthy?

    – I get in touch with what the science found (blood type diet, acid/alkaline balance) : that is easy and natural for me

    – I am not fanatic about any diet, but I cycle through my own knowledge of tips that I have gathered in my life

    – I check my body position whenever I am sit or stand up

    – I try to (eat/be active) among what my lifestyle needs are.

    – I do what is necessary to have a good sleep.

    – I enjoy local fruits/vegetables during the summer/fall

    – I never eat sugar without protein and/or fat, so my blood sugar level keeps steady

    – I stretch to release the pressure

    – I run when I feel to.

    I do too much things! 🙂

  7. Wow! those are nice tips Philippe, thanks a lot!

    My favortie one is “I enjoy local fruits/vegetables during the summer/fall”

    But what “I do what is necessary to have a good sleep” means ? What do you do ? Hit yourself on the head with a pan ?

  8. Haha! 🙂

    To give myself a chance for a good sleep :

    – I infuse some herb, I really enjoy mélisse.

    – I try to not be hungry before I sleep (banana and milk are great when it late)

    – I try to laugh before getting to bed. It can only take 5 minutes. I look for some funny videos on youtube. Try this one : http://youtube.com/watch?v=O0dybAaZWuI

    – Try the bergamote essential oil, one drop is enough on your skin.

    I try to manage my stress, that is a never ending job! I am aware of my health, my signals, my body.

    When I go to bed, I stop to think about my day business. Well it works, but I finally dream to it almost every night anyway!

  9. That seems like a lot of things to do, no doubt you’re sleeping after doing all this! I still prefer the pan

    🙂

  10. Pretty nice site, wants to see much more on it! :)a

  11. Pingback: Warning: does your food contain Ascorbic Acid? — Some French Guy

  12. Pingback: Refactor my Code « Marc-André Cournoyer’s blog

Leave a comment