Category Archives: Google Apps Script

Array Comparison

Let’s say you want to compare 2 arrays with what I call a 1-1 comparison.  So if you had:

var array1 = [1,2,3,3];

var array2 = [1,2,3,4];

The comparison would tell you about the extra 3 in the first array and the 4 in the second array that doesn’t appear in the first array.  After searching online I found many array comparisons, but none that did that, so I wrote the one below.

The a.slice() with no value in the slice parameter slices at the zero position, so it’s basically just making a copy of the array so the original array will be in tact for other operations (read: the second comparison).  The return will give you an array of the results, and I’ve added 2 comments to help with the readability.  Using the two arrays from the example above, the return would be [4,3].

Google Calendar

Display All Calendars

This is now a published Google Spreadsheet Add-On.  If you have any problems with it please email me.

Google Calendar gives a very neat option called ‘Display only this Calendar.’  What this will do is un-select all calendars except the one that you want to view.  Very cool, especially if you have over 150 calendars built in (like I do).

What isn’t cool is having to re-select all of those 150 calendars, and there is not neat little button to do it built into the calendar.  No worries, Google Apps Script to the rescue!  The code that accomplishes this is below.  I have put it into a spreadsheet I use frequently with a custom menu button that gets the process started.  Enjoy!

 

 

Bodybuilder with Muscles Cartoon Clipart

Occam’s Protocol

**Click Here For The Shortcut to the workout creator**

Like many others I read the 4 Hour Workweek and thought that Tim Ferriss was really onto something.  I liked the 4 Hour Body too, but it wasn’t quite as revolutionary for me.  I did however really like the workout he featured in that book, Occam’s Protocol.  I have followed the exercises only (ignoring diet) and have seen results that I am happy with, with less effort than I would think is required.  So, overall I would have to say that the program delivers.

When you first look at it though, it’s a little confusing when you are supposed to workout, and how to structure your weights, even with the ‘cheat sheets’ that you can find online.  That’s why I put together a little program that will help you out by adding your workouts to your Google calendar.

Before you can do that though, you need to determine your starting weights.  Here is the best resource I have found for understanding this workout and determining those weights: Four Hour Life.

Once you have determined your starting weight and are ready to put your workout events on your Google Calendar, click here.