REMEMBER: To view the source code for each example below, be sure to right-click on the example page and then select "View page source" from your web browser's popup menu.
Also, be sure to check out how the photo gallery works on the music page as there's some cool stuff going on there. All of the logic can be found in a script called music.js. NOTE: Care was taken to ensure the gallery could handle viewports with varying widths, so it's responsive. I've also integrated the photo gallery with Lightbox2 which enables each image to be displayed in a modal window when it's clicked on.
Finally, I've built many of features with feature toggles such that they can easily be turned on and off. There's also a debugging flag to turn console logging on and off. I also make use of feature configuration page objects to control how things work. Good stuff!
Coding Examples- ↑ Back to Top
- Dependent Drop-down Selectors - This page illustrates how to code dependent drop-down selectors. That is, this example shows how the value of a "parent" selector element determines how the values of its child (or dependent) drop-down selector element gets populated.
- Matrix Swap - This was an interview question I was asked once ==> Write code to swap a 2-dimensional square array across the diagonal: [0,0], [1,1], etc. I have since modified the example slightly to include code to populate and display the matrix as well as to accept input to determine how big the square matrix should be. I think it's a pretty good interview question and I have had the opportunity to ask it to about a half of dozen developers while I worked for SketchUp.
- Array and String Problems #1 - Here is a little example that finds the first non-repeating character of a string.
- Array and String Problems #2 - This example removes characters from a string.
- Mortgage Calculations - This example computes a fixed monthly mortgage payment.
- Callbacks vs. Promises - An example illustrating the difference between Callbacks and Promises. Promises can be a little hard to understand and hopefully this example will shed some light on how to use them and how they differ from "old-school" Callbacks.
- MakeMusic Coding Exercise - A coding test I did in early 2018 for a job interview. I almost got the job too, but MM's budget abruptly changed in the middle of the interview process and they closed the position I was interviewing for. Of course I was disappointed, but it was good practice coding a solution for their "Power Intervals" problem.