All Posts

Sorted from the most recent.


How to have multiple InfoWindows in Google Maps

Allowing each marker to have it's own info window

This is part of a series of posts that I wanted to do around late October last year, I finally got to it.

When I was doing an assignment in Internet Programming last semester, we were given the task of using the Google Maps API. This assignment also required the use of custom markers, and to have Info Windows that are displayed upon clicking the multiple custom markers.

The Google Maps API example for InfoWindows was useful in displaying only one info window (a window with additional information if a marker is clicked), and this led me to thinking I could instantiate a new InfoWindow and add an event listener to it.

Something like this:

	//this is done inside a for-loop that goes through an array of data
	var infowindow = new google.maps.InfoWindow({
    content: contentString
  });
  	//marker is the marker object in the array
  	marker.addListener('click', function() {
    infowindow.open(map, marker);
  });
  	

However, this led to the InfoWindow only displaying information about the last item in the array of objects, no matter which marker I clicked.

After a bit of head scratching and Google-fu, I then realized I had stumbled onto an issue caused by closures.

Read more

How to Fade Out/In in JavaScript Properly

Of Transitions, Wait, and Callbacks in JS

Recently for a project I had to implement fade in and fade out functions in JavaScript, without the use of JQuery. It’s amusing how much of the StackOverflow questions online focus on using JQuery, because it is admittedly easier to just call a library function.

Of course, I have seen implementations of fade in and fade out methods in pure JavaScript, such as this one, however, many of the articles I’ve found do not explain a means of fading out and then followed by fading in the next image. Admitted I’ve hit a very amateur snag in JavaScript programming, thinking that all functions are synchronous and execute after the previous instruction is complete.

Read more

Making Git Commits in the Past

Go back in time to make or edit commits.

Recently on a side project I’ve been working on I decided that I wanted to create a repository… 2 weeks later. This was because initially I felt I didn’t have much code to begin with, no point keeping a version control of code that hasn’t been written yet.. right?

By the time I decided to initialize a git for it, I decided I wanted to keep track of when I started, so I can have a gauge of the duration it took for me to develop the program, at least on whatever free off work hours I could find. Searching online didn’t lead me to the answers right away, so here’s how to create a commit back in time.

Read more

Behavior Change in String.split for Java 8

Java 8 now ignores 1st null element.

Recently on Stackoverflow a user posted a question regarding Java’s String.split() method, one that beginners are regularly exposed to in order to extract data within strings.

The user stumbled upon this when trying to test code in another machine, which happened to be running a different version of Java. Java 8 has changed the implementation of split() from having an empty string being added into the string array on first null element, to not adding an empty string into the array.

Read more

Hello World!

That famous line. Also, about the site logo.

Hello World!

Basically the line that every single programming tutorial the programmer is asked to write.

In itself it is a greeting, an exclamation to the entire world (if anyone is listening) that they are announcing themselves and want everyone to notice.

On a more practical term, it’s simply an easy example to show how a programming language handles the syntax for outputs.

Anyways. This is my Jekyll blog! At this point it’s another place where I voice my thoughts to the world.

Read more

Avocado Milk Recipe

Literally drink an entire avocado.

So my house mates were the ones that introduced me to try avocados (avocadoes?) with milk.

They were also the ones that told me I’ve been spelling them wrong my whole life. avacado - Wrong. avocado - Right.

Avocados are pretty darn healthy, with their healthy fats and all their added nutrition, it’s widely considered as a superfood. They’re also only a dollar each usually at ALDI’s (local supermarket), and if you buy them in bulk you save even more! Though if I were to eat an avocado a day I might get sick of it really fast.

Read more

Portobello Mushroom Burger Recipe

Healthy burgers aren't always tasteless.

I’m a fan of burgers.

Perhaps it’s because it’s an American staple here, or that having lettuce, cheese, tomatoes and onions on top of a patty wedged between 2 toasted buns with a side of fries is a pretty hearty meal, or that the price of a good cheeseburger is usually reasonable, or that there’s so many possible combinations it would take a while to get tired of it.

Though there have been days were I’m too lazy to leave the house and want to eat a little lighter after a week of gluttony. And since that I also am a fan of mushrooms, and I’ve seen the mushroom burgers by various burger joints, I thought I’d try my hand at making the Portobello Mushroom burger, and this is the product of improvising and inspiration from this recipe and MyBurgerLab’s Shroom Shroom Burger (even though it’s vastly different). Watch the video by RealMenEatGreen here as well, they’re the ones that came up with the recipe I adapted.

Read more

Daily work routines.

Is it really that bad?

During my co-op (which is still currently going on), a major lifestyle change I had to live with was to sleep right before 1AM. As a college student, it was almost a daily affair where I would go to bed late and wake up late (who here doesn’t love classes that don’t start at 8AM?). Unfortunately the fact that I had to be in the office by 9 meant that I had to sleep early and wake up early in time to make it to work.

I would wake up at 6AM, or at least attempt to, have my breakfast, prep and leave the house by 7AM, then I would have to catch the train in time, and then later make it to the bus stop downtown at 7.24AM. The sleek gold-on-black Southwest Transit bus would arrive by 7.42AM, heading to my office located in Eden Prairie by 9AM. I would also have to walk about 15 minutes or so from the bus station to my office. If I missed the train, I would have a 50/50 chance of making it to work on time thanks to the different schedules between the train and the bus.

Read more

How to Set up GitHub Pages, Ruby, and Jekyll

A quick guide to making it all work.

There have been a lot of guides and tutorials on setting up GitHub Pages, Ruby, Jekyll and the related gems needed for GitHub Pages. They’re all great. However, I ran into is simple yet frustrating installation issues. For one, installing the GitHub Pages gem did not mention if I need sudo or not, installing the Ruby using apt-get in Ubuntu/Debian yielded an old version, (1.9.3) as or writing. As someone that just wanted to get started with setting things up and exploring Ruby and Jeykll as a static-site generator, I couldn’t care less about versions (If it works, don’t fix it, right?). However, in this case, it doesn’t work. Gems from GitHub Pages need at least v2.0 up. I didn’t want to use a Ruby version Manager like rvm or vbenv, turns out that’s still the simplest way, and the few extra commands give a great return on investment in the future. The official ruby site did mention it’s an old and stable version from apt-get, but they didn’t mention we should grab a newer one. I can’t blame them I guess, since there’s so many web technologies that run happy on older versions of ruby.

This post serves to help first time users of GitHub Pages on how to set up a local environment that follows GitHub pages,

Read more

Epic Ramen Burger Recipe

A DIY of Brooklyn's famous.

New York City and I have an odd relationship. Despite being there twice, I’ve never managed to fully explore the city, because the first time it was a layover before flying home and I crashed at my friend’s aunt’s house, and the second time I had to fly down to replace a stolen passport in during the blizzard that happened early this year.

Regardless I’ve previously heard of this intriguing fusion of 2 food cultures of the West 1 and East. The Ramen burger which combines America’s (well, Germany’s.) well known hamburgers and Japan’s ramen noodles, enjoyed all around the world and filling the stomachs of poor college students who have no time to cook but all the time to procrastinate.

  1. 1 -Did you know the hamburger was invented in Hamburg, Germany? That’s why it’s called a hamburger despite not having any ham.

Read more

Fried Tofu Recipe

Now who doesn't love fried tofu.

(Yay first cooking post!)

Now with that out of the way, I’d like to share a simple recipe I used to satisfy my fried tofu cravings.

As a college student, tofu isn’t overpriced (costs less than beef), and generally considered a healthy food. Plus it definitely gives you your daily protein intake, (especially for you gym brahs). Last but definitely not the least, it’s gluten-free and vegan too!

Read more

“Fate, it seems, is not without a sense of irony.” - Morpheus, the Matrix