JUNE 30, 2020

You can measure the time elapsed during the execution of TypeScript commands by keeping a reference to the start time and then subtracting the current time at any point on your program from that start time to obtain the time elapsed between two points in time.

const start = new Date().getTime();

// Run some code..

let elapsed = new Date().getTime() - start;

Let's create two helper functions to get the current time (i.e. now) and the elapsed time at any point from that moment.

// Returns current time
// (and, if provided, prints the event's name)
const now = (eventName = null) => {
    if (eventName) {
      console.log(`Started ${eventName}..`);
    return new Date().getTime();

// Store current time as `start`
let start = now();

// Returns time elapsed since `beginning`
// (and, optionally, prints the duration in seconds)
const elapsed = (beginning = start, log = false) => {
    const duration = new Date().getTime() - beginning;
    if (log) {
    return duration;

With those utility functions defined, we can measure the duration of different events.

// A promise that takes X ms to resolve
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));

// Measure duration (while waiting for 2 seconds)
(async function demo() {
    const waitInSeconds = 2;
    let beginning = now(`${waitInSeconds}-second wait`);
    // Prints Started 2-second wait..
    await sleep(waitInSeconds * 1000);
    elapsed(beginning, true);
    // Prints 2.004s

Before you go

If you found this useful, you might want to join my mailing lists; or take a look at other posts about code, React, and TypeScript.

JUNE 30, 2020


More than a year ago, I was sitting with my Mom sketching an Eastern Island stone statue. We were, though, thousands of kilometers away from the Chilean island, right by the entrance of the Wellcome Gallery at the British Museum.

Back then, I didn't know that that drawing would be both the opener of the first of a series of A4-sized Moleskine sketchbooks and the first illustration to make it into my sketches newsletter in July 2, 2019.

One year later, I find myself with fifty-three published sketches and stories.

I won't lie: it wasn't easy.

Some posts were fast to write, others required an intensive back-and-forth effort of writing and reviewing and writing and reviewing.

Many times, I've talked about my daily routine and habits, and about the process I follow to make this newsletter happen. I've wondered if I was repeating myself too much, but ever since I read John Maeda's advice I don't worry too much about it. "Repetition, repetition, repetition. It works. It works. It works."

In these pieces, I try to share things I learn that might inspire you as much as they inspired me, and tell stories with a personal tone without turning this newsletter into a personal diary. This is not a how-to guide, it's an art experiment and a literary exercise.

Certainly, many of my journaling notes are for me to keep.

Still, I'll continue revisiting my notes and using the dozens of unpublished drafts as a source of inspiration for future stories.

I'd like to THANK YOU for pushing me to keep going in one way or another.

On top of writing a story and drawing, scanning, and editing a drawing—every Tuesday—I was hesitant to translate every single story to Spanish. "If you don't translate [your stories] to Spanish I probably won't read them," a friend said. As a native Spanish speaker who's been reading in English for the past ten years, I've used the translation of these posts as a way to practice my Spanish writing skills.

Some stories even made it into the Getting Simple podcast. (I produced an augmented audio version of Stories Are The Answer including clips from Patrick Winston's lectures.)

My girlfriend and my Mom have supported me heavily, providing feedback on most posts and helping with things that didn't sound quite right in Spanish.

Friends reviewed drafts; brainstormed; shared ideas on the publication format and the web layout; and spotted typos or simply corrected my English.

Many of you replied to my emails with insightful points of view.


Happy newsletterversary.

JUNE 27, 2020

Thanks to everyone who attended, really.

We've had such a great time and were humbled by seeing 230+ people connected at all times.

Take a look at the links and references with many of the things and people we talked about.

JUNE 27, 2020

Well, this is happening today.

Even though our workshop is listed in the North-South Americas Workshops page, I'm tuning in from Málaga, Spain, where I live and work, remotely.

Jose Luis, Nate, and guest speakers will be joining from the US. Those include Elizabeth Christoforetti & Romy El Sayah, Ao Li, Runjia Tian, Xiaoshi Wang & Yueheng Lu, and Andrew Witt.

The format of our workshop has been widely adopted by numerous organizations as an alternative to the cancelation of on-site conferences, workshops, and other gatherings.

Zoom conference rooms miss many of the nuances present in in-person events, yet I feel they enable a new kind of interaction in which people who wouldn't have been able to cross the Atlantic are now a click away from hopping into a live conference with us. (No need to book plane tickets and accommodation, and seats don't necessarily need to be limited.)

As suggested by Jose Luis, ours are a series of non-technical lectures and demos. We've organized a one-day workshop in which we'll share our views on the role of machine intelligence in architecture, art, and design, commenting on state-of-the-art projects, tools, and machine learning models that are here to stay with us.

While preparing this workshop, I recorded two technical, hands-on coding tutorials as I was building the Pix2Pix & RunwayML drawing app we'll showcase today, using Glitch, Paper.js, RunwayML, and Pix2Pix, among other technologies. (I've published Part 1 and Part 2 so far.)

Visit our workshop page to see the most up-to-date schedule.

I hope you'll join us.

Stay in touch for future events.

JUNE 26, 2020

JR — Insisting Simplicity, Frugal Practices to Achieve Financial Independence, and Permaculture Design

Hi Friends—

In these challenging times, I truly hope you and your loved ones can shelter in place and stay healthy.

Today, I bring you a conversation with JR from Insisting Simplicity—a blog about simple living, minimalism, and adventure travel in which he writes to celebrate life, our planet, and the richness of simple living.

Please enjoy this (remote) episode as much as I did. I learned a lot about financial independence, the FIRE movement (Financial Independence, Retire Early), and permaculture design.

Listen to "JR — Insisting Simplicity, Frugal Practices to Achieve Financial Independence, and Permaculture Design"

JUNE 23, 2020

Achievements of 2020

Wash hands more than twenty times per day.

Wear a face mask.

Elbow-greet people.

Deliver a talk from my living room.

Play social distancing (two-meter mode) with strangers.

Stay at home for 45 days in a row.

Astronaut-grade package reception with elevator delivery.

Those are my achievements. What are yours?

JUNE 16, 2020

Should you aim for quantity instead of quality?

Last week, I asked you whether you were writing enough, stating that it is more likely to get good ideas when you're generating lots of them.

This mindset seems to go against Getting Simple's motto—Do Less, Better—but that's far from true. It's all about paying attention to your daily inputs and outputs.

If, as I do, you like to do many different things, you can carefully choose what you want to spend your time on. What activities you want to engage in, what type of tools you want to use, what it is that you want to create, and what type of information you want to consume.

You don't need to stick with a single project or a single activity. But you need to approach anything you do with focus.

In my case (and as you might already know if you've been reading to previous sketches and listening to the podcast) I've chosen to sketch, write, podcast, code, and record learning videos to share my knowledge and, hopefully, inspire others.

There's room for different types of projects in which you can aim for quantity over quality to obtain more original outcomes.

To provide a tangible example, think of a sketchbook.

The more sketches you draw, the more chances there are that you'll produce good drawings.

An easy rule of thumb for beginners is that one out of each ten ideas you generate will be good. (And this applies to sketches, stories, videos, or anything you make as well.)

For instance, my skill as a writer or sketcher influences my ratio of good-to-bad stories or drawings.

Of course, this ratio might be lower or higher depending on the field you are in and your level of expertise.

Experts manage to bring that ratio down when they reach proficiency at whatever it is they do. Still, they know there will always be bad ideas among the ones they generate.

The good thing is that, apart from lowering the good-to-bad ratio, skill and expertise let you judge your own ideas to better identify the good ones and discard the bad ones.

I believe this mindset helps me produce more original ideas.

Give it a try.

Go for quantity.

Learn to judge what's good and what's not so good.

Then refine your best creations.

JUNE 9, 2020

Are you writing enough?

Picasso's artworks include more than 1,800 paintings, 1,200 sculptures, 2,800 ceramics, and 12,000 drawings, without mentioning prints, rugs, and tapestries, but only a tiny fraction of those are recognized today as great works of art. 1

Reading Adam Grant's latest book, Originals, I learned about the fact that many artists—such as Picasso, Beethoven, Mozart, or even Shakespeare—created hundreds (if not thousands) of artworks that have been forgotten.

I write (at least) two hundred words every day.

(That's my practice to get more fluent and to "show up" day after day.)

The key is in not missing a single day—reinforcing my writing habit with an easy word count I can complete in a matter of minutes.

When the night comes and I haven't written, this exercise inevitably turns into an obligation. I quickly pour ideas that might end up being developed at a later date.

On the contrary, it's a joy to overpass your personal goal early in the morning with ample time to work on your drafts.

Let's do the math.

Two hundred words a day for thirty days makes 6,000 words per month.

Six thousand words a month for twelve months makes 72,000 words per year.

It's easy(er)—no matter what you write—to find something worth publishing among thousands and thousands of words (than it is to start from scratch).

So, when daily writing, I go for quantity instead of quality.

Selectively, I'll review and refine old drafts in an effort to publish something worth your time.

And I truly hope I'm doing a good job.

In Grant's words, "Many people fail to achieve originality because they generate a few ideas and then obsess about refining them to perfection."

In short: write, and write a lot.

It's more likely to get good ideas when you're generating lots of them.

  1. Grant, Adam M., and Sheryl Sandberg. Originals: How Non-Conformists Move the World. New York, New York: Viking, 2016. Kindle version. 

JUNE 8, 2020

Just came across this machine learning (and TensorFlow) glossary which "defines general machine learning terms, plus terms specific to TensorFlow."

JUNE 2, 2020

Hello, June

When I came back to Spain from the US almost two years ago, I was surprised to see people wandering around even on Tuesday afternoons in the month of February.

It isn't high season. It isn't the weekend. I thought to myself. I guess it'd be this way for ever.

The streets were full of people, among them (some) locals and (many) foreigners, (most) of the latter ones tourists back them.

Today, walking by the beach, in good company, feeling the water on my feet, I was surprised by the amount of foreigners that live in Málaga or spent the quarantine here, in heaven.

I had never seen the coast as full of people walking, exercising, biking, and talking to their loved ones as these days, and we might not see it again unless we get ourselves into a similar pandemic (or, more likely, in another unexpected series of events we can't even imagine).

Until then, I invite you to enjoy your current city.

Get to know how you and other locals like to navigate the places around you.

In Málaga, days keep getting longer and longer, and the fact that people can only sit outside at restaurants makes the city feel even more alive than when things were "normal."

I feel lucky to be where I am.

Hello, June!

JUNE 2, 2020

In trying to use Artisan::call($command, $arguments) to execute a command exposed by my Laravel package—Folio—I was running into this issue.

The command "folio:clone" does not exist.

My commands were working on the terminal, by calling php artisan folio:clone, for instance, but they were not working programmatically, calling something like this.

Artisan::call('folio:clone 123 "New Title"');

Artisan::command was not a solution as it serves to register commands and not to execute them.

By looking into the FolioServiceProvider.php (the service provider of my own package) I noticed the $this->app->runningInConsole() check. My commands were being registered in the console but were not exposed elsewhere (that is, in the application itself).

I'd guess this is a security and performance measure. Commands that don't need to be available to the Laravel app are not registered for it.


The solution was simply registering the commands I want to be callable from my Laravel sites outside of the if statement that checks for $this->app->runningInConsole().

While eight commands are only available to run on the console, there's one available to both the console and the application's runtime.

if ($this->app->runningInConsole()) {


In my case, I'm the maintainer of the package and could easily work around this limitation by taking the command I want to use in Laravel out of the if statement.

But you can register commands yourself in your app's $commands array in app/Console/Kernel.php. See the following example.

// app/Console/Kernel.php
protected $commands = [

While the CreateUserCommand is only registered to the console by the package, I can explicitly make it available for my entire application calling it with Artisan::call('folio:user {email} {password}') (which is this command's signature).


I hope you found this useful. Feel free to ping me at @nonoesp, join the mailing list, or check out other Laravel posts and code-related publications.

MAY 30, 2020

The Anchor team has a new video-to-audio conversion tool, making it easier than ever to transform virtual hangouts into podcast episodes.


And if you already have a podcast, video uploading means more options and flexibility in your recording process. Whether you’re interviewing guests on Google Meet or livestreaming with your co-host over Instagram, now you can import, edit, and share your conversations — wherever they take place — all from the same platform. Recording on video also makes it easy to maintain the magic of in-person podcasting sessions, so when recording together in the same room isn’t an option, you can still rely on the body language and visual cues that keep your conversations flowing smoothly.

You can use recordings from Google Meet, Zoom, Instagram Live, Skype, FaceTime, or Twitch.

MAY 28, 2020

Kean Walmsley — Fun, Freedom, Flexibility, and Family

Hi Friends—

If you were to ask me who I'd like to be when I grow up, Kean Walmsley would be high on my list.

Kean has crafted a lifestyle that prioritizes fun, freedom, flexibility, and family, leaving room for traveling and working around the world, blogging, teaching, sports, research, and more.

Please enjoy this episode, its transcript, and its show notes.

Listen to "Kean Walmsley — Fun, Freedom, Flexibility, and Family"

MAY 28, 2020

If you are wondering where the audio files of your Apple Voice Memos are, in case you want to browse through them, see their file sizes, and copy or remove them, they are located in the folder inside of ~/Library/Application Support.

That is, the Library folder inside of your macOS username. For instance, if your username was john, this would be the full path.

/Users/john/Library/Application Support/

Hope that helps!

MAY 26, 2020

What am I looking at?

Many Mondays, I find myself empty-handed—exactly as I did yesterday—browsing through my journals in search of a story I could share today.

Back when I started in July 2019, I committed to post a short story every Tuesday, both in English and Spanish, to my sketches newsletter.

I keep getting surprised by the amount of words I've written and the amount of things I've drawn over the past year.

My hope is that I'll find the time to write more "deeply," preparing posts and sketches in advance and having more time to mull over my own thoughts and ideas.

But hey, here it is.

I have no real reason to keep going other than an agreement with myself, and the intention to keep improving my sketching, writing, and storytelling skills.

Yesterday, I shared last week's sketch on Hacker News.

User sktrdie asked, What am I looking at?

Art, I think. maaark replied.

And I also think that's what all of this is about in the end: an art project.

Last week's text was short (maybe lazy). My intention was generate a feeling of incompleteness. To leave room for interpretation.

In John Maeda's words, Perhaps this is the fundamental distinction between pure art and pure design. […] The best art makes your head spin with questions. 1

  1. Maeda, John. The Laws of Simplicity. Cambridge, Mass: MIT Press, 2006. Kindle version. 

MAY 21, 2020

Yesterday, I made a first live stream to test the waters while editing Kean Walmsley's episode of the Getting Simple podcast, what will be May 2020's monthly episode.

I was using OBS on a MacBook Pro to stream, via Ethernet, my webcam video and a 4K display at 2560x1440 at thirty frames per second at 9000 kbps, recording locally at the same resolution and fps at 25000 kbps, and then using Adobe Audition to edit an individual audio file.

While YouTube considered my stream was "healthy," the problem was, I believe, that I was streaming using Apple's Hardware Encoder (which releases a lot of CPU while streaming). This was slowing down every single effect I applied in Audition, making my share-out counterproductive, as all I was trying to do was trying my live streaming setup while editing the podcast.

Long story short, I won't probably be editing the podcast live anymore, at least not with this setup. I might be able to pipe my MacBook Pro's screen through an Elgato HD60S+ video capture device to then stream from a different machine, so the machine that's running Adobe Audition is not the same than the machine that's streaming.

That might complicate the setup but might allow for this sort of streaming. For other coding tutorials, a single machine should work fine.

If that's your thing, tune in on YouTube (@nonomartinezalonso) to know when I go live next (and make sure to turn on all channel notifications to be notified).

MAY 19, 2020

We just wanted free internet

And you gave us ads and all sorts of unsolicited connections.

MAY 15, 2020

iA Writer 5.5 Brings Real-Time Markdown to PDF Previews

This sparked a smile on my face.

I don't even remember when I paid for iA Writer (both desktop and mobile) yet I keep getting awesome updates in a consistent bases for the Information Architects team.

Their latest update — iA Writer 5.5 — showed up yesterday on my machines with PDF previews (!) that update in real time, which lets me skip one step on my process, which is often exporting, opening a PDF in Preview, and then iterate through the changes I want to make. The preview respects the page size you've setup for printing as well as the title page, headers, footers, and page numbering.

iA Writer 5.5 for Mac and iOS has arrived. The update adds a powerful mix of functionality and delicate subtlety that will improve your writing workflow.

Congratulations to the team, really. And thanks so much for making my writing experience such a joy.

Read more on their blog.

MAY 14, 2020

I recently got Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition by Aurélien Géron as a recomendation from Keith.

This second version updates all code samples to work with TensorFlow 2, and the repository that accompanies the book—ageron/handson-ml2—is also updated frequently to catch up with the latest updates.

Just the Python notebooks on that GitHub repository are super helpful to get an overall on state-of-the-art machine learning and deep learning techniques, from the basics of machine learning and classic techniques like classification, support vector machines, or decision trees to the latest techniques to code neural networks, customizing and trained them, loading and pre-processing data, natural language processing, computer vision, autoencoders and gans, or reinforcement learning.

MAY 13, 2020


Nice work from Shenzhen, Carleton, and Simon Fraser Universities, titled Graph2Plan: Learning Floorplan Generation from Layout Graphs, along the lines of #HouseGAN. Via @alfarok.

Our deep neural network Graph2Plan is a learning framework for automated floorplan generation from layout graphs. The trained network can generate floorplans based on an input building boundary only (a-b), like in previous works. In addition, we allow users to add a variety of constraints such as room counts (c), room connectivity (d), and other layout graph edits. Multiple generated floorplans which fulfill the input constraints are shown.

Read the paper on Arxiv.

MAY 12, 2020

Feels like simplicity

I'm in the midst of reading The Laws of Simplicity by John Maeda. 1

I love the tone of the book—sharp, on point, but also personal, funny, and entertaining—and the way he invites the reader, I welcome you to this creative experience.

He made it, exactly, 100 pages.

I wanted to share three out of his ten laws with you today.

Law 3. Time. Savings in time feel like simplicity.
Law 4. Learn. Knowledge makes everything simpler.
Law 7. Emotion. More emotions are better than less.

  1. Maeda, John. The Laws of Simplicity. Cambridge, Mass: MIT Press, 2006. Kindle version. 

MAY 11, 2020

Their demo video made me look. This seems like a super useful tool for creatives that would let us skip things like cropping, editing, sharing via Email or Airdrop, and much more. Seamless. As John Maeda would say, "Savings in time feel like simplicity."

Finally a practical use of AR. —The Verge

They have a form to request early access.

MAY 10, 2020

Sketches — Stories Are the Answer (Podcast version)

Hi Friends,

Here's an episode in memory of Patrick Winston which opens the new Sketches series with a short piece on story understanding with artificial intelligence and my experience attending Winston's 6.034 lectures at MIT. "Don't just tell me it's a school bus. Tell me why you think it's a school bus."

I've sketched for the last 365 days. A year ago I decided not only to sketch daily but to write short stories and publish them online every Tuesday. The first story went out on July 2, 2019. And today is the first time I'm telling you one of those stories in a podcast, with my voice.

Please enjoy this episode, its transcript, and its show notes.

Listen to "Sketches — Stories Are the Answer"

MAY 10, 2020

We propose In-Domain GAN inversion (IDInvert) by first training a novel domain-guided encoder which is able to produce in-domain latent code, and then performing domain-regularized optimization which involves the encoder as a regularizer to land the code inside the latent space when being finetuned. The in-domain codes produced by IDInvert enable high-quality real image editing with fixed GAN models.

MAY 8, 2020

With this open time

You do not have to write the next bestselling novel
You do not have to get in the best shape of your life
You do not have to start that podcast

What you can do instead is observe this pause as an opportunity
The same systems we see crumbling in society
Are being called to crumble in each of us individually
The systems that taught us we are machines
That live to produce & we are disposable if we are not doing so
The systems that taught us monetary gain takes priority over humanity
The systems that create our insecurities then capitalize off of them
What if we became curious with this free time, & had no agenda other than to experience being?
What if you created art for the sake of creating?
What if you allowed yourself to rest & cry & laugh & play & get curious about whatever arises in you?
What if our true purpose is in this space?
As if mother earth is saying: we can no longer carry on this way,
The time is now - I am reminding you who you are.
Will you remember?

(Emphasis mine.)

—Emma Zeck

Via Ana García Puyol.

MAY 5, 2020

Connect directly to RunwayML models with only a few lines of code to build web apps, chatbots, plugins, and more. Hosted Models live on the web and can be used anytime, anywhere, without requiring RunwayML to be open!


We've also released a JavaScript SDK alongside the new Hosted Models feature. Use it to bring a Hosted Model to your next project in just 3 lines of code.

MAY 5, 2020

Keeping memories

To write non-fiction, you want to know as much as you can about a given subject.

Your knowledge might come from different sources—even your own memory—but relying on memory can be dangerous.

Memories are temporarily stored in the hippocampus (the part of your brain that acts as a daily memory cache) and only transferred into a long-term storage device (the neocortex) after a good night's sleep. In fact, the less quality sleep you get the harder it is to retain your memories in old age. 1

Often, my memories of certain events are limited to what's written in the page, and I repeatedly wish I had added just a bit more detail.

That's why I prefer to write daily.

I want to know more.

As I forget more and more details of those future-proofed memories, each of my written words gains value.

Today is a new opportunity to add more depth.

How are you feeling?
What's your plan for the day?
Where are you writing from?
What pen (or keyboard) are you using to write?
What are you wearing?
What worries you?

How did you sleep today?

  1. Walter, Matthew (2017). Why We Sleep: The New Science of Sleep and Dreams, Penguin Random, Kindle version. 

APRIL 30, 2020

We’ve officially launched a new podcast API for developers. In layman's terms, this means third-party developers can now build powerful new experiences for audiences, leveraging all of Spotify’s public, podcast-related data. What does that look like in practice? Maybe it’s an app that recommends episodes to a listener based on what their network is into, or a calendar integration notifying fans when a new episode is available. With data from over a million podcasts and counting, the possibilities are endless.


If you want to dive into the technical nitty gritty, then jump on over to our Spotify for Developers blog to learn more about how you can start exploring. And if you want to learn more about what this means for you and your show, we’re here to walk you through it.

APRIL 28, 2020

Into the wild

The first bite to one of the dried apricots I bought at Market Basket teleported me back to the mountain bike trips my cousins and I would do with my father, early on Sunday morning.

Ito, Nacho, and myself—and Dad leading the way—would go through various routes in Torre de Benagalbón, often using Santillán Stream as our starting point. The beginning was always familiar: we'd leave home and reach the river mouth within minutes, biking through "El Chalet" (what used to be the summer house of my uncle's family), passing through a small bridge below road N-340, and leaving the nuns' school behind.

In our childhood, it wasn't long until the landscape turned into a wild route. We'd only spot little farmer settlements and other informal constructions along our way.

Today, a big chunk of land has been built on. The route has become a small stream, often dry, along a set of housing units built over the past twenty years.

Continuing with our journey, we'd bike along Añoreta's golf course (where my dad plays religiously every week1) and pass below the A-7 highway bridge. When biking through this area, we'll be on the look for golf balls. We knew locals would have done their round in the early morning, but balls were constantly being kicked out of the course and we'd always collect a few.

Mountain bike route into the wild.

Our destination changed every weekend and we'd end up in different places, often making a stop and sitting on the floor to eat a sandwich.2 It was my father who'd lead the way and decide which tracks to follow. I've never known how he'd manage to orient himself to reach all of those places. I guess you don't think about it when it's on someone else's plate to decide.

Wherever it is that we went, those dried apricots (which we call orejones back home) were a constant. Both their taste and smell bring back memories of our bike trips across the streams of Torre de Benagalbón.

Dad loves them.

Dried apricots.

  1. Of course, golf has also been disrupted by COVID-19. 

  2. I still keep digital photos of those trips, and that's probably why I better remember those moments. 

Want to see older publications? Visit the archive.

Listen to Getting Simple .