Javascript — Week 2

Life update: I'm taking a Javascript course at General Assembly. It's about time, right? Below is some code I wrote to pick apart a large array of numbers.


// 1. What's the max number?
// UPDATE: @ljharb correctly pointed out that my solution does not work 
// for negative numbers. I changed the algorithm so max is initially set
// to be the first value in the array, and the form loop begins at the
// second value in the array. Thanks, pal.

var max = a[0];
for (var i = 1; i < a.length; i++) {
    if(a[i] > max) {
        max = a[i];
    }   
}
console.log("max number is " + max);

// 2. What's the sum of all the numbers?

var sum = 0;
for (var i = 0; i < a.length; i++) {
    sum = sum + a[i];
}
console.log("sum: " + sum);

// 3. Which numbers are between 50 and 100?

var numbers = [];
for (var i = 0; i < a.length; i++) {
    if (a[i] > 50 && a[i] < 100) {
        numbers.push(a[i]);
    }
}
console.log("numbers between 50 and 100: " + numbers);

// 4. How many numbers greater than 500?

var greaterThan500 = 0;
for (var i = 0; i < a.length; i++) {
    if (a[i] > 500) {
        greaterThan500++;
    }
}
console.log("numbers greater than 500: " + greaterThan500);


// 5. How many even numbers?

var even = [];
for (var i = 0; i < a.length; i++) {
    if ((a[i] % 2) == 0) {
        even.push(a[i]);
    }
}
console.log("even numbers: " + even.length);

// 6. How many odd numbers?

var odd = 0;
for (var i = 0; i < a.length; i++) {
    if ((a[i] % 2) == 1) {
        odd++;
    }
}
console.log("odd numbers: " + odd);

// 7. What's the largest even number?

var maxEven = 0;
for (var i = 0; i < a.length; i++) {
    if ((a[i] % 2) == 0) {
        if(a[i] > maxEven) {
            maxEven = a[i];
        }   
    }   
}
console.log("max even is " + maxEven);

// 8. How many numbers, whose sum of digits is greater than 10?

var breakApart;
var greaterThan10 = 0;
for (var i = 0; i < a.length; i++) {

    breakApart = a[i].toString()
    breakApart = breakApart.split("");
    var sumOfValue = 0;
    for (var j = 0; j < breakApart.length; j++) {
        sumOfValue += parseInt(breakApart[j]);
    }

    if (sumOfValue > 10) {
        greaterThan10++;
    }
}

a.forEach(findSum);

function findSum(item) {
    var digits = item.toString();
    digits = digits.split("");

    var sumOfDigits = 0;
    digits.forEach(addDigits);
    function addDigits(item) {
        sumOfDigits = sumOfDigits + parseInt(item);
    }

    if (sumOfDigits > 10) {
        greaterThan10++;
    }

}

console.log("greater than 50: " + greaterThan10);

Podcasts

Below is a growing (and occasionally shrinking) list of podcasts to which I listen. Yes, to which I listen. If I'm missing any please hit me up on Twitter.


99% Invisible

http://99percentinvisible.org

The king of podcasts. In Overcast I specifically set this podcast to play at 1x because I believe every sound from Roman Mars is deliberate.


A Cast of Kings - A Game of Thrones Podcast

http://www.slashfilm.com/category/features/slashfilmcast/a-cast-of-kings/

There are so many details in the Game of Thrones television show. I think it's important to ensure I didn't miss anything. Also it's fun to hear how the show diverges from the books.


a16z

http://a16z.com/podcasts/

CEOs, VCs, and engineers discuss startups, technology, and the future.



Accidental Tech Podcast

http://atp.fm

Any podcast with John Siracusa complaining is a good podcast. Marco Arment and Casey Liss join him to talk about Apple and other high-tech happenings.


Black Men Can’t Jump in Hollywood

http://headgum.com/podcasts/black-men-cant-jump-in-hollywood/

These guys are hilarious, and they review movies starring black actors and actresses.


By The Way, In Conversation with Jeff Garlin

http://www.earwolf.com/show/by-the-way-in-conversation-with-jeff-garlin/

Jeff Garlin interviews actors and comedians. Note: Quite the unfortunate capitalization in the title.



The Canon

http://thecanon.wolfpop.com/audio/playlists/3968

Movie experts discuss and argue about the best (or worst?) movies.


CreativeMornings Podcast

https://creativemornings.com/podcast

Inspirational talks from inspirational people. I highly recommend y'all try to visit a talk in person if CreativeMornings participates in your city.


Ctrl-Walt-Delete

https://itunes.apple.com/us/podcast/ctrl-+-walt-+-delete/id1043196031?mt=2

Walt Mossberg and Nilay Patel, two curmudgeons from The Verge, discuss the latest in consumer tech.


Dan Carlin’s Hardcore History

http://www.dancarlin.com/hardcore-history-series/

I listened to the World War 1 series and loved it. Dan goes into great detail about global politics, weaponry, mood on the battlefield, etc. I learned so much (including how Franz Ferdinand actually died).


Design Details

http://spec.fm/podcasts/design-details

Bryn Jackson and Brian Lovin chat with San Francisco designers about their backgrounds and experiences.


Design Matters with Debbie Millman: 2009-2016

http://designobserver.com/topic/designmatters/1039

Debbie Millman has honest conversations with designers and their experiences.


Extra Hot Great

http://previously.tv/shows/extra-hot-great/

Television show recaps, news, and quizzes. Can't go wrong.


The /Filmcast

http://www.slashfilm.com/filmcast/

Movie reviews from an entertaining bunch.


The Flop House

http://www.flophousepodcast.com

Comedians discuss and review bad movies, but you really listen for the ridiculous tangents.


How Did This Get Made?

http://www.earwolf.com/show/how-did-this-get-made/

This is my favorite podcast. Comedians review terrible (and awesomely terrible) movies.


I Brew My Own Coffee

http://www.ibrewmyowncoffee.com

Coffee nerds talk about coffee.


I Was There Too

https://soundcloud.com/i-was-there-too

Minor characters from important movies are interviewed.


If I Were You

http://headgum.com/podcasts/ifiwereyou/

I believe I've been following Jake and Amir for over ten years now. This podcast leans towards the immature side. I recommend the live shows and the episodes with guests.


Immutable

http://spec.fm/podcasts/immutable

Sam Soffes is great on podcasts. His "so I just did it" attitude is both entertaining and inspiring.


The Incomparable

https://www.theincomparable.com/theincomparable/

Nerdy topics that are a bit too nerdy for me. However, they occasionally review movies and include John Siracusa. Like I said above, any podcast with Siracusa complaining is a good podcast.


The Journal by Kevin Rose

https://itunes.apple.com/us/podcast/the-journal-by-kevin-rose/id1088864895?mt=2

Kevin Rose discusses whatever is on his mind.


Makers

http://makers.crew.co

I love everything the Crew team is doing these days.


Maltin on Movies

http://www.earwolf.com/show/maltin-on-movies/

Movie reviews from the king of movie reviews.


Melton

https://itunes.apple.com/us/podcast/melton/id928565652?mt=2

I don't know what it is about Don Melton. He's a unique snowflake. I'm sure he would love to hear himself described that way.


The Minimalists Podcast

http://www.theminimalists.com/podcast/

Lately I've been gathering and donating old clothing and miscellaneous items. In my opinion becoming a true minimalist is like living a truly Kosher lifestyle – virtually impossible. However, I can take small steps and try.


Monday Morning Podcast

http://www.billburr.com/category/podcast

I'm a huge Bill Burr fan.


The Needle & The Mouse

http://theneedleandthemouse.com

Fashion meets tech meets Brooklyn meets this delightful couple. Dan Frommer and Lauren Sherman are delightful together.


The Nerdist

http://nerdist.com/podcasts/nerdist-podcast-channel/

On average The Nerdist has entertaining guests who have made a contribution to pop culture. Occasionally there's a real gem who significantly touched your life. 


Nice To Meet You

http://www.vanschneider.com/show/

Tobias van Schneider chats with designers.


Nothing Matters

https://soundcloud.com/nothingmatterscast

Lauren Hockenson, my favorite local journalist, chats with her New York pal, Ben Timmins, about current affairs with a brutally honest perspective.


NSFWLIVE

https://itunes.apple.com/us/podcast/pandolive/id525138925?mt=2

I've been a Paul Carr fan for years. TechCrunch, NSFWCorp, and now Pando. Sarah Lacy used to join him on the show too.


Planet Money

http://www.npr.org/podcasts/510289/planet-money

This podcast is similar to 99% Invisible, but with a focus on money. There's plenty of interesting stories and lessons, and some are quite funny. Did you know that some famous poker plays have stopped playing to focus on investing in other players?


The Q&A with Jeff Goldsmith

http://www.theqandapodcast.com

Jeff Goldsmith interviews movie directors and writers.


Real Time with Bill Maher

https://itunes.apple.com/us/podcast/real-time-with-bill-maher/id98746009?mt=2

If you don't have access to HBO, Bill Maher's show is available as a podcast.


Review

http://www.imore.com/reviewcast

The iMore crew occasionally review movies.


RottenTomatoes

https://itunes.apple.com/us/podcast/rottentomatoes/id860808237?mt=2

Movie and television show reviews from the Rotten Tomatoes crew.


Serial

https://serialpodcast.org

Season 1 was much better than season 2.


Slate’s Political Gabfest

http://www.slate.com/articles/podcasts/gabfest.html

A fun way to keep up with the election, current events, and politics.


The Spoiler Warning

http://www.thespoilerwarning.com

Coworkers review good and bad movies.


The Talk Show With John Gruber

https://daringfireball.net/thetalkshow/

My favorite Apple journalist, John Gruber, discusses the latest with Apple and other tech companies.


TeeVee

https://www.theincomparable.com/teevee/

The Incomporable crew review television shows.


Under the Radar

https://www.relay.fm/radar/

Marco Arment and David Smith discuss iOS development, and everything else involved with releasing an app.


Unjustly Maligned

https://www.theincomparable.com/ump/

Antony Johnston discusses movies and TV shows that weren't as bad as people think. Sometimes I actually agree with him.


The Walking Dead Podcast

http://thewalkingdeadpodcast.com

A weekly review of new episodes of The Walking Dead.


We Have A Microphone

http://www.wehaveamicrophone.com

Michael and Hampton Catlin, former coworkers and current friends, discuss cocktails, travel, and whatever comes to mind.


What's Tech?

http://www.theverge.com/whatstech

The Verge breaks down the latest in tech news into simple concepts.


Cinemathesia

Synesthesia is a neurological phenomenon in which stimulation of one sensory or cognitive pathway leads to automatic, involuntary experiences in a second sensory or cognitive pathway.

I’ve met a couple people who have Synesthesia. They claim that colors appear in their mind when they hear certain sounds (or vice versa). I reflect on this often because for most of my life I believe I suffer from a very similar phenomenon that I aptly named Cinemathesia.

Emotions experienced during a movie earlier in life can be triggered with their original potency by just a few musical notes. A great example is the movie Rudy, which arguably has one of the best original soundtracks in the history of film. A couple specific horn sounds instantly bring me back to the first time I watched the tryouts scene. I can sense the pressure Rudy is under to impress the coaches. The joy from seeing him on the Notre Dame field washes over me. I can close my eyes and feel the bass from all the times Rudy is brutally tackled.

People have always accused me of having an uncanny ability to quote movies with shocking detail. Little did they know I can also quote emotions.

Hobbit

I watched The Hobbit: The Battle of the Five Armies. Spoilers and thoughts below.

  • Peter Jackson: Stop the High Frame Rate nonsense. I thought you learned this lesson from the first Hobbit movie. It is frustrating to watch.
  • Gandalf: How could you make the same mistake twice? If the eagles are so badass at fighting, why don't you use them in Fellowship of the Ring? Yes, I'm aware of the "fly you fools" theory.
  • The fighting is... slow. It feels like watching a computer game in 1999. Oh except for Legolas. He's still so fun to watch.
  • Even after three movies I don't really feel a connection to the Dwarves. I know there's a fat one, an old one, a human-looking one that loves a Lost character,one that looks like Stabler from Law and Order: SVU, and the King who I'm pretty sure is related to Ed Norton Jr.
  • It is very exciting to see an army of Dwarves. Remember that in the Lord of the Rings trilogy we only see a few of them. In The Battle of the Five Armies we get to see hundreds donning iron from head to toe.
  • This movie features a level of military precision that Men do not display in the Lord of the Rings trilogy. Elves gracefully rearrange themselves while their leader rides between their ranks. Dwarves quickly construct a phalanx with their shields similar to Leonidas' first encounter with the Persian army in 300.
  • The stakes in this book/trilogy are dull. If Thorin fails then the mountain continues to belong to Smaug. Once Smaug is killed,however, the mountain is basically up for grabs. Orcs want to gain control because of the mountain's strategic location? Shrug.
  • The violence is tame. Each time an important character is killed, the camera moves to his/her face. There is one scene where I actually thought the Orc didn't kill the character.

Apple Ad

The detail in this advertisement that strikes me is when the young lady flips the switch on her aging record player which is at least forty years old. Will this be a possibility when the young lady becomes a grandmother? How will her grandchildren play her music? There will not be any physical media waiting to be discovered in a box. I suppose we hope that in her old age she still maintains a Spotify account.

Psycho

Thanks to Seth Levi, I finally watched Pyscho

psycho.PNG

Some things I learned:

  • Showing a toilet on screen was extremely rare. Apparently including a toilet was more shocking than the famous shower murder scene.
  • Showing an unmarried man and woman in the same bed was very risqué at the time.
  • Hitchcock uses lingerie to depict Janet Leigh's state of mind. It's white before her decision to embezzle money, and black afterwards. Very clever.

My Pals at Hover

Earlier this month I tweeted some excitement around purchasing a ".coffee" domain name.

Magically, I received this awesome coffee grinder a few days later with a note.

Hey David. Here’s a little something to get the perfect brew while you mull over your new .coffee domain.

-Your pals at Hover

I never thought I could love a domain registrar. Hover is truly amazing.