I didn’t always have trouble sleeping.
Five or six years ago, I fell asleep on an airport runway in New York, woke up in Florida, and was confused as to why the plane hadn’t taken off yet. In college, I could pass out at 10 pm while my roommates threw a party downstairs.
I couldn’t comprehend the concept of insomnia. If someone was tired, why wouldn’t they just… sleep?
I’m not sure what changed, but starting a couple of years ago, my sleep began to worsen. I was the proverbial boiling frog, not noticing how bad my sleep was suffering until it was too late. …
A crisp fall afternoon, a small group of friends, a Saturday free of any real plans or responsibilities, and a Ziploc bag packed full of psilocybin cubensis. This marks the beginning of my relationship with snails.
We choose PB&J sandwiches as the sacred vessel to deliver 3 grams of the magic into each of our systems. With our last bites we exchange nods of solidarity over the kitchen island. The nods imply “I’m with you”, “We are in this together”, and perhaps “Good luck”.
An hour later I find myself in the backyard having narrowly escaped a stuffy living room whose walls had begun closing in on me. The fresh air calms my nerves as I notice a group of giant, football-size snails sliding their way up the wooden fence across the yard. …
I was recently given this interview question to solve during a mock technical interview:
Imagine you’re building a back-of-the-headrest entertainment system for an airline. You’re tasked with implementing a feature that will allow users to see pairs of movie whose total runtimes will equal the exact length of their flight.
Write a function that takes an integer flightLength (in minutes) and an array of integers movieLengths (in minutes) and returns a boolean indicating whether there are two numbers in movieLengths whose sum equals flightLength.
A user cannot watch the same movie twice, and the function should only return true if exactly two full movies can be watched during the duration of the flight. …
Hash tables are an instrumental data structure for storing relationships between large amounts of data. When designed correctly, they can offer the access efficiency of an array, and the search, insertion, and deletion efficiency of a hash (all constant time). Hash tables achieve this by storing values in an array with indices that correlate to the stored value’s hash code which is generated by a hash function. We’ll walk through how this works a bit later.
Before we get started, it is important to understand that we need to be mindful of the tradeoff between space and time when implementing a hash table. The more space a hash table takes up in memory (i.e. the larger our hash table is), the more likely it is that we can search our hash table in constant time as there will be less chance of our data experiencing collisions. A collision is when more than one value produces the same hash code, and is thus stored in the same index or “bucket” of our hash table as another value. This creates an array which needs to be iterated through in order to retrieve any values stored at that index. In the worst case, we could create a hash function that assigns the same hash code to all of our values. …
While tech-centric meetups and events certainly have their place, I don’t think they are the best way to expand your professional network, especially as an aspiring developer. Why not? Well, if you’ve ever attended a tech event determined to network like a rockstar, but instead found yourself sipping a beer in the corner and wondering how the hell you were going to attract attention in a sea of wannabe employed developers just like you, then you already know the answer. As an inexperienced dev, it’s hard to stand out.
Like many industries, becoming a software developer isn’t just about what you know, but also who you know. It’s likely that you’ve heard this opinion a thousand times if you’re new to the tech world and are navigating the path to landing your first job. And following that old cliché, I’d be willing to bet that again and again you have been advised to attend tech events as a great way to network. …
bind behave similarly, there are slight differences between them that are important to understand before you can start using these powerful tools to write less repetitive, easier to maintain, and simpler to debug code.
this keyword points to and returns that execution context.
We can take advantage of
this by using it in functions that we can then
apply, or, you guessed it,
bind to different objects; thus allowing us to explicitly define the execution context of our functions. …
Let’s face it, if you’re new to programming, there are few things that feel as cool as learning to use the command line.
Perhaps even cooler though, is the feeling you get when you actually start to make things. So why not put two cool things together and make your very first Ruby app using the good ol’ terminal as a lightweight, easy to manage, user interface!
Apart from impressing your friends and confusing your mom, learning to build a complete CRUD app on the command line is a great way to practice OOP design fundamentals, solidify your understanding of many-to-many data relationships, and if you’re a wannabe Rubyist, learn about what is going on ‘under the hood’ before moving on to building more complex applications for the browser with Rails. …