Wedding Weight Loss

I got engaged sometime in September and since then, I’ve been a regular visitor at the gym. It’s a rather nice gym – it’s the Club Sport in Pleasanton. It really makes a big difference to go to a nice gym because it’s nice to not get grossed out by something disgusting that I would normally encounter at a cheaper gym.

For a couple weeks after engagement, I’ve been doing 30 minutes on the elliptical and I really wasn’t seeing results. I didn’t gain nor lose weight. I just sort of exerted energy without any results to show for it. The main problem is that I wasn’t watching what I was eating so my best guess was that all the calories I burned exercising was being added back on in my diet.

One day, while eating a greasy cheesesteak, I decided that I would start dieting. It was either Weight Watchers or Jenny Craig. I came home and read about both. Jenny Craig seemed like they’d send you frozen food every so often and that would be a bulk of your meals. I also know the experience of Jenny Craig from a friend that was personally on it. Weight Watchers is much more like keeping track of calories in form of points. So certain foods have a certain number of points based on nutrition value.

I went with Weight Watchers because not only was it a lot cheaper than Jenny Craig, it let me live my life normally. I did not want to carry around frozen foods and never be able to eat out with my friends. Or be the group among coworkers that doesn’t go through the delicious lunch line. I also wanted to be able to go out with my fiance and eat out. I didn’t feel I could do all these social eating things with Jenny Craig.

So I paid the subscription and downloaded the app on my phone. I kept my routine at the gym the same – 30 minutes elliptical. Starting out, I was allotted 29 points daily with like 42 weekly points (it’s changed since then so my beginning allotment may not be accurate). Weekly points are points you can use as extra thorough the week in case you wanted to splurge a little. I’ve used a few as I was adjusting to this new diet but rarely now. I try to stay within the 29 (now 27) daily allotment.

So for the first few days we went out to eat, I became aware of just how much and how unhealthy the stuff I consumed before were. We were at Buffalo Wild Wings and man, was it hard. Some were twice the amount of points I was allotted. Some were all of my points. And very few were under. I don’t think we actually stayed there to eat due to the wait time but I was able to look up point values because the Weight Watchers app has a menu for each of the popular restaurants.

Ever since I’ve gone on Weight Watchers, I’ve learned to love chicken ceasar salads. I actually crave salads now. It’s amazing. I eat so little sweets. I still love sweets but after a bit of not having them, I don’t crave them anymore. I stopped my daily pistachio binge at work. I try to keep 3 consistent meals a day and minimize the snacking. When I do snack, I try to do fruit or something that I wouldn’t binge on because the point is to ease the hunger but not overstuff.

I’ve had about 4 weigh-ins now. 2 weeks in a row, I lost 5 pounds each. The 3rd week, I was stuck in this plateau where I was gaining and not losing. And then the 4th week, I lost all the weight I gain and another 3 pounds. So I’ve lost around 13 pounds in total. Weight always fluctuates which is why they tell you not to weigh yourself everyday and I’ve been bad about not weighing myself everyday. When I had a plateau, I was a little discouraged but I just kept at it. I figure, as long as I’m creating a calorie deficit, I’m doing it right.

So far, Weight Watchers, while it might not be worth the amount of money I’m paying, it’s certainly working for me. It’s teaching me to eat healthier and I’m loving it. When I think about how I ate before, I feel like it was a bit excessive. Like why would I ever eat so much. Overall though, it’s working for me so I’m going with it. :)

Losing Gracefully

I’ve never been good at losing ever since I was a child. I’ve learned to contain my disappointment rather well but that more comes from becoming more introverted throughout the years. Well guys, I have lost again.

I went to LinkedIn’s DevelopHer hackathon which was suppose to serve as motivation to write an app I’ve been wanting to write for months. I didn’t care so much on the winning part until I actually submitted a project. Then my heart was set.

After it was clear I wasn’t even a finalist, my face went expressionless for the remainder of the event. You can’t help but feel disappointed when you lose. At least I can’t.

However, after I was headed outside, the winners were walking by me. I don’t normally say much after losing but as a way of licking my wounds, I congratulated them on their success.

Losing is painful yet it builds a lot of character.

A Therapist Anyone?

The last couple days, I started using IDoneThis. I don’t usually account for my daily accomplishments but this service kept emailing me enough that I just started emailing back. I figure that if I ever go crazy from staring at lines of code, the service will be like my therapist. A much cheaper therapist.

Today while creating an api call in node, I started reading about Mongoose which lead me on a journey to several other Javascript related things. It’s really a big time suck and why I try to refrain from any Google search result that isn’t StackOverflow. And even sometimes, that can be rough.

At work, I’ve been doing a lot with Backbone and Dust. I had a lot of jQuery floating around my Backbone views. And then I got feedback from a review board and I didn’t even read what the person wrote. I just saw the word “view models” and everything clicked. So I’m in the process of removing the spaghetti. The more and more I use Backbone, the less and less I want to use jQuery. I do understand sometimes, it’s good and even necessary. However, I feel like it makes my javascript ugly as if I were cheating somehow.

The todo app I was working on in my last blog post is currently sitting in the same graveyard as all my other unfinished projects. I don’t think it interested me enough to actually finish. I do have another idea which I’ve been going on and on about since I got my current job so if that ever comes to fruition, I’ll write about it.

A New Paradigm

I hate the word paradigm but I felt it fitting. For a few months in my life, paradigm was a highly overused word and I just got really tired of hearing about it.

I haven’t been very active anywhere online lately aside from work related things. I didn’t mean to fall off this blog but my life took a few turns in my career that were rather unexpected. While they were all changes for the better and that forced me to grow and advance in more ways than I ever thought possible, it was a lot to take in at the time.

Not only has my life changed drastically the last few months, but so has the stack I’ve been working on. The last year and a half, I’ve been heavily in WordPress development which I thought was so much fun at the time. I still appreciate WordPress for what it is but now, I’ve gotten into Backbone.js, Node.js, and MongoDB and guys, guys, it’s been an eye opening revelation.

Like MVC isn’t something I haven’t had a whole lot of experience in and now that I’m diving in for the long run, I’m fascinated. SQL-less databases are… pretty amazing. I enjoy them more than MySQL. Partly because it’s new and shiny and the other part is that I feel I can do more with it.

I’m really enjoying Backbone. I spent the last few weeks buried in tutorials, videos, courses, books, everything I could possible get my hands on. I love it. Granted, I don’t think it’s perfect and I still think it has it’s pits. But I feel like I’ve been exposed to a great platform (and I got to pioneer it too). Every time I learn a new technology, I always feel like “Man this is so awesome. Why was I not working with this sooner?”

And I’ll be honest, I look back at my WordPress days and kind of scoff at the thought of doing that again. I still think WordPress is good for a lot of things but if I could redo a few projects I’ve done in the past, I totally wouldn’t go the WordPress route. It’s so fast and easy to build a prototype platform in Node.js. I didn’t do a lot of Node at first because I was intimidated. However, after peeking at the code someone a lot smarter than me wrote, I went home and started dabbling myself. I actually have a pretty good REST api going now (granted, the code structure needs a lot of help but I’m learning! Slowly but surely!)

It is a Todo app but instead of the simple checklist, I’m following Stephen Covey’s method of grouping them by due date and importance. I have such a great interface planned for it too. Super excited and I hope to start blogging about how my development is going on that project soon.

Filter Data Attributes With jQuery

A simple snippet that builds a filter using checkboxes and data attributes. Here is what my filters look like. As you can see, I have a list of checkboxes that has a checkbox. Within the checkbox, I have added a value that will match the data attributes I give later.

And then on the elements I want to filter, I just have a data attribute in the HTML tag.

And then in my jQuery, I grab all the checkboxes and see if any of them are checked. If there are checked boxes, I will filter them accordingly. If there are no checked boxes, I will display all.

Display Most Used WordPress Tags

To display the most used tags in WordPress, you have to create two separate queries (or just one if you only want half the functionality):
- The first get_results is to display most used tags site-wide.
- The second get_results drills it down the the specific category being viewed.

Here’s what you need to know to understand what’s going on here. First, you should take a look at the database schema of WordPress. It is really helpful in figuring out which tables you should query. The main difference between the two queries above is one is looking at all the tags site-wide whereas the second query where you see “AND wp_terms.term_id=$cur_cat_id” which is limiting the tags to just that category.

Second, we are getting information from multiple tables and we are using INNER JOIN to join those tables together. Joining tables was a bit confusing to me at first but then I realized, all I’m doing is matching up the columns on each of the tables I’m joining. The table wp_terms has the most basic information about a term such as is it a category or a tag, what is the name of the term, what is the ID of the term. The table wp_term_relationship is the table that creates relationships between the post table and the terms table so what we’re doing is matching the ID column in wp_posts to the object_id in wp_term_relationships. The wp_term_taxonomy table contains a bit more information about the term such as descriptions, is it a parent category or a child category, etc. The whole database schema may take a little bit of time to figure out depending on your experience with databases but essentially, everything is related to each other.

So after we have all the information we need, our query will return an array and all we have to do is loop through it:

Lazy Load Google Web Fonts With jQuery


Simple jQuery Tabs

At a whiteboard test for a new job, I was required to build a interface using jQuery tabs. Creating tabs in jQuery isn’t difficult in itself. When you think about the concept, it’s actually quite simple. Each tab triggers the display of a div. That’s really all there is to it. Here’s a really good example that I wrote that is completely functional and all you need to add is styling.

Take this html structure. We are create the jQuery tab with list items and holding our content in the divs. Technically, you can use any container element for your content as only the class attached to the element matters. However, we’re using divs for this example.

Then you take the jQuery which I made into a function so that it makes it reusable. The only dependencies is that you need to add the class “tab” to the li’s and class content to the div. Below, we are making it into a jQuery plugins which allows you to easily attach it to a selector which in this case would be the container. Once we have selected the container, we search for elements that has a class of “tab” and attach a click function to it. To correlate the divs to the tab, we are getting the index of each div. This basically says “when we click on the first tab, we want to trigger the first div.”

Then some minimal styling to show it works:

Not too shabby! Check out my jsFiddle for this.

Using jQuery Load and Isotope.js in WordPress

While building another site, I experimented further with methods of implementing ajax in WordPress. ProBlogDesign had an awesome tutorial/wordpress plugin on how to build a load more post button. With a few modifications I was able to use this to my advantage.

My goal was to create a site design that I’ve never implemented before. The website was in it’s early stages, I wanted to be able to at least have an impressive design. So, the goal (which I achieved and is what I will explain in this post) is to utilize jQuery load to load the posts. I then want the posts to be inserted with animations that is used in Isotope.

The problem with jQuery load is that it doesn’t re-execute any scripts associated with the loaded elements. My solution to this was to load it into a hidden div (or section in my case) and then using jQuery, move those sections into my main content area. Here’s what my jQuery looks like:

If you would like to see the entire modified jQuery file (originally downloaded from ProBlogDesign), I have included that below: