<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Carlos Vega on Medium]]></title>
        <description><![CDATA[Stories by Carlos Vega on Medium]]></description>
        <link>https://medium.com/@carlosvegar?source=rss-d2f94f9e834f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*g64EAligNEGOG69twKyI5w.jpeg</url>
            <title>Stories by Carlos Vega on Medium</title>
            <link>https://medium.com/@carlosvegar?source=rss-d2f94f9e834f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 12:58:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@carlosvegar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The darkness]]></title>
            <link>https://carlosvegar.medium.com/-a9fc3ee0ee69?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9fc3ee0ee69</guid>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Fri, 22 Oct 2021 17:56:05 GMT</pubDate>
            <atom:updated>2021-10-22T17:56:05.868Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*LfXgGacQrfeRAcBo.jpeg" /></figure><p>It was close. Too damn close.</p><p>He felt the creature’s lungs expanding and contracting as it crawled into the room looking straight to the spot where he was hiding.</p><p>— Won’t you leave me alone!? — he said to himself, while the sweat slid across his face filling the whole room with the stink of his fear.</p><p>The creature started to sniff around. It could smell him. His fear, his flesh. His <strong><em>soul</em></strong>.</p><p>He knew it was over. The darkness in the room took over his mind and the shadows projected by the beast slowly found their way into his head.</p><p>—Surrender yourself to me —he heard, but he knew the creature couldn&#39;t speak aloud. He was overwhelmed by the fear and his mind was blocked as he realized there was no way out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9fc3ee0ee69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[El camino a la 22.]]></title>
            <link>https://medium.com/historias-de-un-enamorado-suicida/el-camino-a-la-22-3c127e808090?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c127e808090</guid>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Tue, 19 May 2020 18:34:08 GMT</pubDate>
            <atom:updated>2021-05-12T01:31:11.104Z</atom:updated>
            <content:encoded><![CDATA[<p>Ese sábado me desperté ansioso, era muy temprano. Demasiado temprano.</p><p>Los fantasmas de la ciudad blanca aún me perseguían: los tres goles lapidarios que nos arrancaron la Copa aún entraban en mis sueños convirtiéndolos en pesadillas. El recuerdo de la vuelta silenciosa a casa, caminando desde el Rosabal Cordero, no me dejaba dormir en paz.</p><blockquote>¡HOY NO! — me digo a mí mismo mientras decido levantarme de la cama — hoy será diferente.</blockquote><blockquote>Conforme el día avanza la respiración se acelera y poco tiene que ver con el bochorno de mediodía y los nubarrones que se van acercando al Rosabal.</blockquote><p>Había mucho que perder, demasiado. Teníamos el mejor equipo, como en muchas otras ocasiones. Pero éramos <em>_eredia</em>. Éramos el profesor que da cátedra todo el año y entrega el título al final. Poco más de un año antes “sacamos la cédula”.</p><p>Recuerdo que ese día no pude almorzar; es bien jodido comer cuando uno tiene un nudo de 19 años atravesado entre la garganta y el corazón.</p><blockquote>Estoy buscando ansiosamente el bus, se supone que nos espera a un costado del Estadio. Vamos tarde. Escucho los gritos de Julio, un amigo, y encuentro el bus. Para ese momento los nubarrones están encima de nosotros y, ni bien entrando, los goterones empiezan a azotar el techo del vehículo sin piedad. El cielo, oscurecido, no parece un buen augurio.</blockquote><p>El Herediano siempre fue un equipo de garra y entrega. Nací en 1990 y aún así puedo recordar la época en donde estábamos codo a codo con Saprissa y La Liga. Pero todo cambió a una velocidad estrepitosa. La nefasta primera administración de Aquil Alí (¿quién lo diría?) era incapaz de retener a nuestros mejores jugadores (o ganar un título). Año tras año nos veíamos obligados a presenciar como el equipo perdía a sus mejores figuras a manos de los otros dos.</p><p>Perder jugadores es una cosa pero de la mano llegaron los campeonatos entregados. Los partidos clave que no se sostenían. Y nos empezamos a convertir en el equipo del “casi”.</p><blockquote>Llegando a San Isidro, poco antes de entrar a la ruta 32, hacemos una parada para ir al baño y estirar las piernas. Tengo miedo, ¿y si esta lluvia nos impide llegar a Guápiles?… Debimos haber buscado un bus que se fuera más temprano.</blockquote><p>Y luego, Sotela.</p><p>Todas las familias en este país parecen tener una historia en la cual Sotela padre estafa a algún familiar, y siempre tuve mis reservas con la llegada de su hijo, pero era un cambio. Y si hay algo que necesitábamos, era ese cambio. Los resultados empezaron a llegar, los jugadores se empezaron a quedar. Había esperanza.</p><blockquote>Ya estamos sobre la 32, y el cielo se empieza a despejar. Es la primera vez, en toda mi vida, que veo sol durante todo el trayecto que cruza el Braulio Carrillo. No hay derrumbes, no hay embotellamientos. Llegamos con tiempo de sobra.</blockquote><blockquote>Julio había vivido un tiempo en Guápiles, por lo que ya teníamos entradas aseguradas. Dentro del estadio nos ubicaron en sombra, junto con todos los guapileños. Del otro lado puedo ver al resto de los heredianos. No cabe ni un alfiler en las graderías temporales que ha dispuesto el equipo. Somos casa en estadio ajeno. Desearía estar con ellos, pero agradezco tener entradas y me siento, hecho un mar de nervios, mientras espero ansioso el pitazo inicial.</blockquote><p>El título, sin embargo, seguía evadiéndonos. Se sentía como buscar el oro al final del arcoíris. Cada vez que creíamos estar cerca y tenerlo casi al alcance de la mano se movía un centímetro más allá.</p><p>La final contra Liberia no fue la excepción. El doloroso recordatorio de que aún éramos aquel equipo del “casi”.</p><blockquote>Gol de Santos.</blockquote><p>Creo que hablo por todos los heredianos cuando digo que esa final nos marcó. No tengo, entre lo muchos recuerdos dolorosos que este equipo me ha dado, uno tan latente como ese. Una cicatriz de nuestro pasado reciente que hasta hace menos de una década era un herida abierta y punzante.</p><blockquote>La celebración es ensordecedora, cientos de aficionados gritan, cantan y bailan a mi alrededor y el mundo se me cae: no de nuevo, NO PUEDE SER.</blockquote><blockquote>Nunca he estado tan solo teniendo tanta gente a mi alrededor. Ajeno al festejo. Sumido en la tristeza gracias a esos fantasmas cobardes que nunca se fueron, solo acechaban, esperando el momento indicado para salir y recordarme que ese 22 era imposible.</blockquote><p>El dinero empezó a escasear y la máscara de Sotela se cayó en menos de lo que canta un gallo. Ya no solo éramos el equipo del “casi”. también éramos el equipo de los bailes. Y las burlas aumentaron. Pero esta vez fue diferente. <br>Los jugadores se unieron: Mambo, Pablito, Óscar Esteban, Jose Carlos… Todos jalando, hombro a hombro con la afición, la pesada carga que suponía el Club Sport Herediano.</p><blockquote>Gol de Cancela</blockquote><p>Siempre he estado orgulloso de la afición del Herediano. Y no hablo de esos que van a estadio y llenan la final, no. Hablo de los de siempre. Los que estuvimos en las malas, y en las peores. Pero los más grandes en esa época fueron los jugadores. No abandonaron el barco. Si no estaban en banca, estaban en las boleterías vendiendo entradas. Organizando rifas. Muchos estaban en un momento futbolístico ideal para irse a otros equipos donde no tuviesen que mendigar un pago que ni siquiera era lo que estipulaban sus contratos. Se quedaron. Y eso los ha hecho eternos.</p><blockquote>Estoy gritando, corriendo de lado al lado ante una multitud muda que me observa estática. Me van a matar — pienso mientras grito algunas cosas que no voy a repetir. Pero no me importa, celebro este gol por lo que parece una eternidad.</blockquote><p>Ese camerino que fue forjado bajo el fuego más intenso es la base sobre la que descansa el éxito del Club Sport Herediano en la última década. Esos jugadores convirtieron al equipo del “casi” en un equipo que remonta finales. Y también las pierde, pero mantiene su esencia. Aún recuerdo a Jose Carlos Cancela aplaudido por un estadio que sabía muy bien todo lo que le debíamos, aunque ahora jugase con otra camiseta.</p><p>Pablo Salazar ahora es parte de nuestro cuerpo técnico y Victor es el encargado de nuestras ligas menores.</p><blockquote>Gol del Mambo</blockquote><p>A excepción de Roberth Arias y Leo González no recuerdo un jugador de la historia reciente del Herediano con más sangre rojiamarilla que Victor Amaury Núñez. Un herediano que no nació, pero se hizo. Y vaya manera de hacerse.</p><blockquote>Todo es éxtasis. Esta es la estocada final. No hay más allá. La 22 ha llegado. El árbitro pita y corro hacia la cancha. Nada me va a impedir celebrarlo. Abrazarlos. Salto la malla con una habilidad que solo puedo atribuir a la adrenalina que inunda mi cuerpo. La seguridad intenta detenernos pero somos demasiados. Las graderías ya eran nuestras, es el momento de tomar la cancha. Corro, por lo que parecen horas, gritando a todo pulmón: VEINTIDÓS, VEINTIDÓS, VEINTIDÓS…</blockquote><blockquote>Estoy buscando a mis amigos pero mi cuerpo se rinde al cansancio físico, mental y emocional. Son 19 años de espera que acaban de finalizar y no puedo procesarlo.</blockquote><blockquote>Me desplomo en media cancha y rompo en llanto.</blockquote><blockquote>Allí me encuentra Chisko, y me levanta, recordándome que no es momento para llorar: la Copa está llegando y debo abrazarla. Tengo que tocarla. Solo así puedo convencerme de que es real. Solo así sabré que no es aún 18 de mayo y estoy soñando.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*G7Yo5PD11a-BZSGfKLlO1g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6O96iWYSDosYNoUfRf3c4A.jpeg" /></figure><p>Viernes 18 de mayo, 2012</p><blockquote>Mañana es un día muy importante, jugamos la final contra Santos y no creo que me pueda dormir…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c127e808090" width="1" height="1" alt=""><hr><p><a href="https://medium.com/historias-de-un-enamorado-suicida/el-camino-a-la-22-3c127e808090">El camino a la 22.</a> was originally published in <a href="https://medium.com/historias-de-un-enamorado-suicida">Historias de un enamorado suicida</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compounding our concerns]]></title>
            <link>https://medium.com/unhandled-exception/compounding-our-concerns-f38a8de057a7?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f38a8de057a7</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Thu, 16 Aug 2018 18:38:58 GMT</pubDate>
            <atom:updated>2018-08-16T18:56:27.932Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXzxqvczWWYtAyTc40pbkQ.jpeg" /><figcaption><a href="https://pxhere.com/en/photo/921518">https://pxhere.com/en/photo/921518</a></figcaption></figure><p>Recently, I read a tweet from someone trying to wrap their head around React (yup, there’s still a whole bunch of people using other stuff, and that’s perfectly fine). His first argument was about how weird it felt to go back to putting HTML and JS inside the same file. I’ve been there, and I think most of us were so, naturally, I approached him with our preferred counter argument: we need to change our mindset to think about components as the basic unit of any app. And, by doing so, we should be able justify why it makes complete sense to have everything that’s related to this component as close as possible.</p><blockquote>I also threw the classic: JSX is not actually HTML, it’s Just JavaScript™</blockquote><p>While the “component as a basic unit” is a perfectly valid argument, I remember I wasn’t convinced at first, it took me some time to embrace it. And he wasn’t convinced either so I found myself trying to come up with other arguments that didn’t require him to use the thing for months in order to acknowledge that there could be some benefit there. What I wanted to demonstrate was that, while CSS/HTML/JS-based separation of concerns was something useful for web pages, we’ve gone way past that and we need something that enables a higher level of abstraction.</p><h4>It all boils down to the way we build stuff</h4><p>We still build web pages, that’s a fact. But every day we build more and more applications. These “web apps” do a bunch of cool and complex stuff and, as a consequence of this, good ol’ pages couldn’t keep up. Users wanted snappier and desktop-like experiences. And we (sorta) delivered (we’re <strong>trying</strong>, OK!?).</p><p>A lot of us don’t write plain old JS anymore. We write TypeScript, SASS, LESS, “modern” JavaScript (the one we cannot ship cause not all the browsers support it) and so on. Heck, it is even possible to write a web application in a completely different language now (Elm, ReasonML and ReasonReact, Dart and AngularDart). JS/CSS/HTML have effectively become compile targets.</p><blockquote>I mean, you can still write plain JS, throw a script tag inside your index.html and fire that server up. It works. There’s nothing wrong with it. It’s just not a comfortable development experience for big projects. Think about it like this: you can still write asm, it works and it’s amazing. With that being said, would you build a multi-platform desktop music player with it instead of, let’s say, Java?<br>While we’re not quite there yet, I’m confident that, eventually, JS will become a compile target -alongside with WebAssembly- and we’ll write apps using other languages.</blockquote><p>The classic JS/CSS/HTML-based separation of concerns does not apply for these new tools, and I’m not even talking about React vs Vue vs Angular, I’m talking about something deeper: front-end development is converging into a series of common concepts and practices that are implemented in different ways but, conceptually, share a lot.</p><blockquote>Some months ago I had the chance to create the initial version of Storybook for Angular (if you haven’t heard about <a href="https://storybook.js.org/">Storybook</a>, it is basically a tool that lets you render your UI components as individual pieces and work on them <strong>without</strong> having to open your app, or even without an app and server, it’s truly amazing) and found out that, while implemented using a completely different set of tools and principles, the basic concepts held true and I was able to pull it off. There are now versions of Storybook for React, Angular, Vue and more are in the works or in early alpha releases. Before this, I was convinced that the concepts were similar but now I’m completely confident that we’re converging to common ground. This is amazing!</blockquote><p>So, if the JS/CSS/HTML-based separation of concerns doesn’t work for all of our use cases, what does?</p><h4>A (ridiculously) brief (inaccurate and subjective) history of components</h4><blockquote>Back in the day, I used to do some Visual Basic 6 development (that’s badass, I know, I know), then jumped into C++, C#, Java and so on. All of them had some sort of UI component kit/toolbox that you could use to build applications. All of them allowed you to compose interfaces using these small blocks. Call them widgets, components or something else, I don’t really care. The whole point is that we’ve had this nice way of abstracting stuff for decades.</blockquote><p>We’ve always had components in our own platform: inputs, buttons, even the infamous &lt;marquee&gt;. These are all examples of UI pieces that abstract away the complexity of their behavior and expose a declarative interface that we can use to manipulate them. And they worked for web pages. But as soon as we started building web apps, they fell short.</p><p>The web platform wasn’t mature enough to support fully fledged applications so we hacked, molded and bended JS to make it work. We made mistakes. We made a mess. We needed to clean our mess up so we started talking about “separating” our concerns. This period is what I like to call the <strong><em>dark ages</em></strong>.</p><p>Along the way we figured out we were doing it wrong. We tried to fix it. Frameworks and Libraries came and we embraced them as our saviors. We fought for them (some still do). After <strong><em>the Crusades</em></strong> a lot of wounded developers were returning home to build apps with their preferred frameworks. But in the process of fighting other developers, they learnt from them. They found out not everything about their enemies was bad. There were things that could be used to improve their framework/library of preference.</p><h4>The Renaissance</h4><p>That clash of cultures and frameworks brought something good. We started sharing. We started to trade ideas from one framework to another. We even tried to standardize a way to create our own components inside our beloved platform (hang in there, standards are hard!). While imperfect, our frameworks and libraries thrived and our communities succeeded. We started building bridges instead of tearing them down.</p><p>We’re getting close to the <strong><em>industrial age</em></strong>, the revolution, but we’re not quite there yet. For the time being I believe that separating our concerns taking a component-based approach is the way to go. It is a form of abstraction that still holds up even with the new tools we have (Reason and Dart, just to mention a couple). Not to mention that most frameworks and libraries out there use some sort of component-based abstraction mechanism and there are ongoing efforts to standardize web components as part of the platform.</p><p>So, the next time you look at that hideous single-file component, maybe give it a chance, it might not be as bad as it seems.</p><p><em>Disclaimer: I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f38a8de057a7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/unhandled-exception/compounding-our-concerns-f38a8de057a7">Compounding our concerns</a> was originally published in <a href="https://medium.com/unhandled-exception">Unhandled Exception</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Biometric authentication destroyed my life]]></title>
            <link>https://medium.com/unhandled-exception/biometric-authentication-destroyed-my-life-24a20f265c9?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/24a20f265c9</guid>
            <category><![CDATA[short-story]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[iphone]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Thu, 14 Sep 2017 19:58:38 GMT</pubDate>
            <atom:updated>2020-03-10T21:44:40.017Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2fSodkIw41Wz0U5OWWB6sQ.jpeg" /><figcaption>[<a href="https://upload.wikimedia.org/wikipedia/commons/8/89/Macro_Fingerprints.jpg">https://upload.wikimedia.org/wikipedia/commons/8/89/Macro_Fingerprints.jpg</a>]</figcaption></figure><p>I can’t believe this is happening — I think to myself while I stare at my phone in disbelief, not knowing what to do as my whole life collapses in front of my eyes. There’s no way out. I can’t do anything.</p><p><strong>I’ve been hacked.</strong></p><blockquote>Before we continue with this story, let me tell you how everything started. It was on Wednesday, September 13th, 2017 that Apple released the iPhone X with FaceID. Samsung had released a similar feature before but you know what they say: it’s not real until Apple does it.</blockquote><blockquote>There were, of course, security concerns but I’m not what you’d call a techie so I didn’t pay much attention. I mean, if Apple releases something to the public it <strong>has</strong> to be secure, right?</blockquote><blockquote>All I could think of as they presented the feature was it was awesome. The days of spending an extra second unlocking my phone every five minutes were gone. Instant satisfaction!</blockquote><blockquote>I wish I could go back and tell my old self that we can afford that extra second.</blockquote><p>It’s 9:30 am and my head is killing me. I wake up with the worst hangover I’ve had in years and instinctively try to reach my phone.</p><p>Where’s my phone? I start looking around. Is it inside my car? Nope. It’s not on the table. I spend half an hour looking for it around the house. Oh, great. I lost it. I look for my replacement phone and drive to my telecom provider so I can get a replacement SIM.</p><p>I have most of my apps installed on that phone and I try to log in to some of them just to check that everything is OK.</p><p><strong><em>“Wrong password, please try again”</em></strong></p><p>I’m greeted with the same message several times as I open every single app on my phone. I can’t believe this is happening, I followed every security recommendation out there: strong, randomly generated passwords, numbers, symbols… You name it. I even activated two-factor authentication for every service. No one could possibly log in to any of my apps unless they got a hold of my phone.</p><p>Then, it strikes me like lightning.</p><blockquote>Have you ever walked up the stairs after turning the lights off and thought there was an extra step at the end? Have you ever felt that void in your guts after taking that last leap and finding there’s no step?</blockquote><blockquote>Now imagine that sensation, intensified a million times.</blockquote><p>¡Fucking FaceID!</p><p>My thoughts are traveling really fast through my head. I need to act, right now! Where’s my computer?</p><p>I browse into my bank’s virtual agency. I try to log in. Nothing. I call them but it takes ages for them to answer and when they finally pick up they tell me I need to go to a physical agency. I run to my car. Right now nothing else really matters, I need to be sure that my money is safe.</p><p>I drive there and they tell me I used an app on my phone to send money to 4 different ATMs. They say they’ve blocked the account after a while since the activities were suspicious but still, some of the money is gone. Forever. They’re going to look at the security footage but aren’t confident that the attacker can be identified.</p><p>I’m angry. How did they allow that?! I’m going to sue them, they will never know what h…</p><p>My phone vibrates, it’s an SMS from my girlfriend. She’s mad at me. She’s telling me I’m a pig. She calls me and frantically rambles something about her privacy and me breaching it.</p><p><strong>“It’s all over the Internet, Ryan, how could you?”</strong></p><p>I try to call her back but she’s not answering. I don’t understand what’s happening. I try to get it together and think: it’s got to be those nudes she sent me, they were on my phone. Shit. I need a computer.</p><p>As I drive back home I start to realize how big this is: my Facebook account, my Instagram account, my email. Shit. My email, that grants access to every other service. Did they change the password? Of course, they did. Fuck…</p><p>It’s been eight hours since I figured out what happened: Yesterday I was drunk and someone stole my phone and unlocked it using FaceID. Since I had enabled two-factor security for almost every service, they used that same phone to change all the passwords. It was a chain reaction: my phone granted the attacker access to my email, after that both my cellphone and email granted him access to Facebook, and so on…</p><p>I can’t believe this is happening — I think to myself while I stare at my phone in disbelief, not knowing what to do as my whole life collapses in front of my eyes. There’s no way out. I can’t do anything.</p><p><strong>I’ve been hacked.</strong></p><p>Each day we rely more and more on our devices to manage every aspect of our life. Money and social interactions are increasingly happening inside this virtual space that poses security threats most people are yet to fully comprehend.</p><p>Security is a matter that we shouldn’t take lightly. I’m not saying any of these methods are inherently prone to attacks (some of them are, though). I’m just saying that you should stop and think if that extra second you’re going to save is worth your whole life. Yes, your fingerprints, iris, and face are pretty much unique but think about this: what happens if, for some reason, someone gets a hold of that information? You can always change a password but, how do you manage to change your face, fingerprints or iris?</p><p>Once any of those details are public and you rely on them to secure your most valuable information you are a second away from becoming <strong>Ryan</strong>.</p><p><em>Disclaimer: This is a work of fiction. Names, characters, places, and incidents either are products of the author’s imagination or are used fictitiously.</em></p><p><em>I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24a20f265c9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/unhandled-exception/biometric-authentication-destroyed-my-life-24a20f265c9">Biometric authentication destroyed my life</a> was originally published in <a href="https://medium.com/unhandled-exception">Unhandled Exception</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom Elements (v1) and Angular]]></title>
            <link>https://medium.com/ng2-space/custom-elements-v1-and-angular-eb6b3fdb5c51?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb6b3fdb5c51</guid>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Wed, 15 Mar 2017 22:10:41 GMT</pubDate>
            <atom:updated>2018-06-27T00:04:03.790Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlRAoMAt_t_-if01k99WGw.jpeg" /></figure><blockquote><strong><em>TL;DR</em></strong><em>: Here you’ll find a simple example that showcases Angular + Custom Elements interoperability: </em><a href="https://stackblitz.com/edit/angular-custom-elements">https://stackblitz.com/edit/angular-custom-elements</a></blockquote><blockquote><em>This article refers to Angular version 2+</em></blockquote><p>Component-based architecture has been around for a while and quickly became the <em>de facto</em> standard for building web applications; it just feels natural to compose interfaces using small building blocks.</p><p>This architecture has been so widely accepted that frameworks and libraries such as Angular, React, Vue, Ember, Polymer <em>et al</em> all<em> </em>provide some sort of <strong>component encapsulation mechanism</strong>.</p><blockquote>Ideally, components should be isolated units that usually represent a small piece of UI/functionality and can be composed together in order to create complex applications. They have well defined boundaries and will process their inputs to produce an output.</blockquote><p>The main issue is that all these frameworks and libraries tackle the problem from a different perspective and the implementations differ greatly between each other. Web Components should fill this gap and provide a standard way of achieving this but, sadly,<strong> standards are hard</strong>. Hopefully well get there, <a href="http://jonrimmer.github.io/are-we-componentized-yet/">eventually</a>.</p><p>For now, let’s just use one of those alternatives our great community created: Angular.</p><blockquote>I’m going to assume that you have some Angular knowledge and are able to setup a new project. If that’s not the case the following three sections can still give you a clearer view of custom elements and, even if you don’t integrate them with Angular, you can follow along.</blockquote><p>In this short article we are going to learn how to combine this powerful framework with the native Custom Elements API (v1) to create <strong>future proof</strong> components that also work well <strong>today</strong>.</p><h3><strong>Extending the HTMLElement</strong></h3><blockquote>One thing we need to take in account is that the new Custom Element API (v1) intentionally uses the ES2015 class syntax and it won’t work with ES5 (see <a href="https://github.com/w3c/webcomponents/issues/587#issuecomment-253993830">this</a> comment from Domenic). There are workarounds but they involve using Reflect.construct (which is available only in ES2015 and also <strong>non-polyfillable</strong>) or loading a native shim [both strategies are discussed <a href="https://github.com/webcomponents/custom-elements#es5-vs-es2015">here</a>].<br>This shouldn’t really affect our target users since <a href="https://github.com/w3c/webcomponents/issues/423#issuecomment-195395659">“every browser that implements custom elements also implements the new class syntax”</a>. So, for the sake of simplicity and given that the spec itself requires us to use ES2015 classes we’ll do that in this article.</blockquote><p>In order to define a custom element we need to create a class that extends HTMLElement and can have the following methods:</p><pre><strong>export class</strong> CustomElement <strong>extends</strong> HTMLElement {<br>    constructor() {<br>        super();<br>        // Element created<br>    }</pre><pre>    connectedCallback() {<br>        // Element inserted into the document<br>    }<br>    <br>    disconnectedCallback() {<br>        // Element removed from the document<br>    }</pre><pre>    attributeChangedCallback(attributeName, oldValue, newValue) {<br>        // Called when an attribute is changed, appended, removed, <br>        // or replaced on the element.<br>        // Only called for <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements#Attributes">observed attributes</a>.<br>    }</pre><pre>    adoptedCallback(oldDocument, newDocument) {<br>        // Called when the element is adopted into a new document<br>    }<br>}</pre><p>[<a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements">https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements</a>]</p><p>As you can see, custom elements have <strong>lifecycle hooks</strong> (just like any other component created with the aforementioned frameworks/libraries) and are self contained. Another thing to notice is that you don’t really need to implement all the methods, just take what you need depending on the nature of your element.</p><h3>Sending data to your element</h3><p>The recommended way to send data into a custom element is attributes since they’re accesible from the inside and provide a declarative way of describing how a component should look and behave.</p><p>There are three different ways of accessing the attributes once we’ve created the element:</p><h4>attributeChangedCallback</h4><p>This method is called every time an attribute changes (this includes an attribute being removed, appended and/or replaced) and applies only for the pre defined <strong>observedAttributes:</strong></p><pre><strong>export class</strong> HelloElement <strong>extends</strong> HTMLElement {<br>   // Monitor the &#39;name&#39; attribute for changes.<br>  <strong>static get</strong> observedAttributes() {<br>    // add the names of the attributes you want to observe<br>    <strong>return</strong> [&#39;name&#39;];<br>  }</pre><pre>  // Respond to attribute changes.<br>  attributeChangedCallback(attr, oldValue, newValue) {<br>    <strong>if</strong> (attr === &#39;name&#39;) {<br>      <strong>this</strong>._name = newValue;<br>      <strong>this</strong>.render();<br>    }<br>  }<br>  <br>  render() {<br>    <strong>this</strong>.innerHTML = `<br>    &lt;div style=&quot;border: 1px solid #000&quot;&gt;<br>      &lt;h1&gt; Another Custom Element &lt;/h1&gt;<br>      &lt;p&gt;${<strong>this</strong>._name}&lt;/p&gt;<br>    &lt;/div&gt;`;<br>  }<br>}</pre><h4>Class setters/getters</h4><p>You can use class setters/getters to access the attributes by their name:</p><pre><strong>export class</strong> HelloWorld <strong>extends</strong> HTMLElement {<br>  <strong>get</strong> name () {<br>    <strong>return</strong> <strong>this</strong>._name;<br>  }<br>  <br>  <strong>set</strong> name (value) {<br>    <strong>if</strong>(<strong>this</strong>._name !== value) {<br>      <strong>this</strong>._name = value;<br>      <br>      <strong>this</strong>.render();<br>    }<br>  }</pre><pre>render() {<br>    <strong>this</strong>.innerHTML = `<br>    &lt;div style=&quot;border: 1px solid #000&quot;&gt;<br>      &lt;h1&gt; Setter/Getter Element &lt;/h1&gt;<br>      &lt;p&gt;${<strong>this</strong>.name}&lt;/p&gt;<br>    &lt;/div&gt;`;<br>  }<br>}</pre><h4>this.getAttribute</h4><p>Since we’re working inside a custom element this corresponds to the actual instance. This means you can use any function that’s available for a node, including our good ol’ friend getAttribute :</p><pre><strong>export class</strong> HelloGetAttribute <strong>extends</strong> HTMLElement {<br>  connectedCallback() {<br>    <strong>const</strong> attr = <strong>this</strong>.getAttribute(&#39;static&#39;);<br>    <strong>this</strong>.render(attr);<br>  }<br>  <br>  render(name) {<br>    <strong>this</strong>.innerHTML = `<br>    &lt;div style=&quot;border: 1px solid #000&quot;&gt;<br>      &lt;h1&gt; Static Attribute Component &lt;/h1&gt;<br>      &lt;p&gt;${name}&lt;/p&gt;<br>    &lt;/div&gt;`;<br>  }<br>}</pre><h3>Communicating with the outside world</h3><p>Similar to any pre existing HTML element (think of video , input , button ) we can leverage the ability to emit events that can be created with the <a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent">CustomEvent</a> constructor. Just make sure that the browsers you want to support <a href="http://caniuse.com/#feat=customevent">can make use of it </a>.</p><pre><strong>export class</strong> HelloWorldEmitter <strong>extends</strong> HTMLElement {<br>  constructor() {<br>    <strong>super</strong>();<br>    <strong>this</strong>.clickHandler = <strong>this</strong>.clickHandler.bind(<strong>this</strong>);<br>  }</pre><pre>  connectedCallback() {<br>    <strong>this</strong>.innerHTML = `<br>    &lt;div style=&quot;border: 1px solid #000&quot;&gt;<br>      &lt;h1&gt; Emitter Custom Element &lt;/h1&gt;<br>      &lt;button class=&quot;button&quot;&gt;Click me!&lt;/button&gt;<br>    &lt;/div&gt;`;<br>    <br>    <strong>const</strong> button = this.querySelectorAll(&#39;.button&#39;)[0];<br>    button.addEventListener(&#39;click&#39;, <strong>this</strong>.clickHandler);<br>  }<br>  <br>  disconnectedCallback() {<br>    <strong>const</strong> button = <strong>this</strong>.querySelectorAll(&#39;.button&#39;)[0];<br>    button.removeEventListener(<strong>this</strong>.clickHandler);<br>  }<br>  <br>  clickHandler(e) {<br>    e.preventDefault();<br>    <strong>const</strong> event = <strong>new</strong> CustomEvent(&#39;test&#39;, { &#39;detail&#39;: `Hello from emitter at ${<strong>new</strong> Date().toISOString()}.` });<br>    <strong>this</strong>.dispatchEvent(event);<br>  }<br>}</pre><blockquote>“But Carlos, you said we’d be integrating custom elements with Angular and you haven’t event mentioned it after the introduction” — You, right now.</blockquote><p><strong>Patience is a virtue</strong>, my friend.</p><p>If you’ve read all the way through this post you should now be able to create custom elements that are framework/library agnostic. After this, integrating these elements with Angular is a breeze.</p><p>Just open your main.ts file (the file in which you bootstrap your Angular application), import the custom elements and define them as follows:</p><pre>// main.ts<br><strong>import</strong> { platformBrowserDynamic } <strong>from</strong> &#39;<a href="http://twitter.com/angular/platform-browser-dynamic">@angular/platform-browser-dynamic</a>&#39;;<br><strong>import</strong> { AppModule } <strong>from</strong> &#39;./app&#39;;<br><strong>import</strong> { HelloGetterSetter } <strong>from</strong> &#39;./getter-setter-component&#39;;<br><strong>import</strong> { HelloElement } <strong>from</strong> &#39;./attribute-changed-callback-component&#39;;<br><strong>import</strong> { HelloWorldEmitter } <strong>from</strong> &#39;./event-emitter-component&#39;;<br><strong>import</strong> { HelloGetAttribute } <strong>from</strong> &#39;./get-attribute-component&#39;;</pre><pre>customElements.define(&#39;my-hello-getter-setter&#39;, HelloGetterSetter);<br>customElements.define(&#39;my-hello-element&#39;, HelloElement);<br>customElements.define(&#39;my-hello-emitter&#39;, HelloWorldEmitter);<br>customElements.define(&#39;my-hello-attribute&#39;, HelloGetAttribute);</pre><pre>platformBrowserDynamic().bootstrapModule(AppModule)</pre><p>Then, in your application module, import the <strong>CUSTOM_ELEMENTS_SCHEMA </strong>from the <strong>@angular/core</strong> package and provide it as follows:</p><pre>// app.module.ts<br><strong>import</strong> { Component, NgModule, CUSTOM_ELEMENTS_SCHEMA } <strong>from</strong> &#39;<a href="http://twitter.com/angular/core">@angular/core</a>&#39;;<br><strong>import</strong> { BrowserModule } <strong>from</strong> &#39;<a href="http://twitter.com/angular/platform-browser">@angular/platform-browser</a>&#39;;</pre><pre><a href="http://twitter.com/NgModule">@NgModule</a>({<br>  imports: [ BrowserModule ],<br>  declarations: [ App ],<br>  schemas: [ CUSTOM_ELEMENTS_SCHEMA ],<br>  bootstrap: [ App ]<br>})<br>export class AppModule {}</pre><blockquote>The <a href="https://angular.io/docs/ts/latest/api/core/index/CUSTOM_ELEMENTS_SCHEMA-let.html"><strong>custom element schema</strong></a> defines a schema that will allow: any non-Angular elements with a <em>-</em> in their name and any properties on elements with a <em>-</em> in their name which is the common rule for custom elements.</blockquote><p><strong><em>TA-DAH!</em></strong><br>You’re now able to use any custom element inside any template (standalone or inline). Something like this should work as expected:</p><pre><strong>import</strong> { Component } <strong>from</strong> &#39;<a href="http://twitter.com/angular/core">@angular/core</a>&#39;;</pre><pre><a href="http://twitter.com/Component">@Component</a>({<br>  selector: &#39;my-app&#39;,<br>  template: `<br>    &lt;div&gt;<br>      &lt;h2&gt;Hello {{ name }}!&lt;/h2&gt;<br>      &lt;my-hello-getter-setter [name]=&quot;name&quot;&gt;&lt;/my-hello-getter-setter&gt;<br>      &lt;my-hello-attribute static=&quot;Hello&quot; name=&quot;Carlos&quot;&gt;&lt;/my-hello-attribute&gt;<br>      &lt;my-hello-element [attr.name]=&quot;name&quot;&gt;&lt;/my-hello-element&gt;<br>      &lt;my-hello-emitter (test)=&quot;customClick($event);&quot;&gt;&lt;/my-hello-emitter&gt;<br>      {{ emitterText }}<br>    &lt;/div&gt;<br>  `,<br>})<br><strong>export class</strong> App {<br>  name: <strong>string</strong>;<br>  emitterText: <strong>string</strong>;<br>  <br>  constructor() {<br>    <strong>this</strong>.name = &#39;Angular2&#39;<br>  }<br>  <br>  customClick(e) {<br>    <strong>this</strong>.emitterText = e.detail;<br>  }<br>}</pre><h3><strong>Caveats</strong></h3><p>In this line:</p><pre>&lt;my-hello-attribute static=&quot;Carlos&quot;&gt;&lt;/my-hello-attribute&gt;</pre><p>getting an attribute with getAttribute on connectedCallback() seems to be broken because of the Angular lifecycle, so doing this:</p><pre>connectedCallback() {<br>  <strong>const</strong> attr = <strong>this</strong>.getAttribute(&#39;static&#39;);<br>  <strong>this</strong>.render(attr);<br>}</pre><p>doesn’t really work when the component is mounted on an Angular template but works as expected if we drop the custom element directly in the index.html file. In order to make it work and get the correct values from the angular template we need to add the observed attributes and the attributeChangedCallback:</p><pre>static get observedAttributes() {<br>  return [&#39;name&#39;, &#39;static&#39;];<br>}</pre><pre>attributeChangedCallback(attr, oldValue, newValue) {<br>  this[attr] = newValue;<br>  this.render();<br>}</pre><p>Oh, and don’t forget to tell TypeScript to produce es2015 instead of es5 :</p><pre>// tsconfig.json<br>{<br>  <em>&quot;compilerOptions&quot;</em>: {<br>    ...<br>    <em>&quot;target&quot;</em>: &quot;es2015&quot;,<br>    ...<br>  }<br>}</pre><h3>Takeaway</h3><p>I firmly believe that components are here to stay (as a proof, every major framework and library out there supports them to some extent). Custom Elements (alongside with Shadow DOM, HTML Imports and Templates) are the key to a future in which we can build, distribute and use framework/library agnostic components that will allow us to stop re inventing the wheel every time we require something that’s been created a thousand times before.</p><p>With Angular, there are caveats but it’s remarkably easy to integrate custom elements. For now, I’d recommend sticking with the class setter/getter approach since it works transparently.</p><p><strong>Working example</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fangular-custom-elements%3Fembed%3D1&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fangular-custom-elements&amp;image=https%3A%2F%2Fc.staticblitz.com%2Fassets%2Ficon-664493542621427cc8adae5e8f50d632f87aaa6ea1ce5b01e9a3d05b57940a9f.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/410ff4c2af20b6f08bb8de86c69a1adb/href">https://medium.com/media/410ff4c2af20b6f08bb8de86c69a1adb/href</a></iframe><p><strong>Github repo:</strong> <a href="https://github.com/ngdev-space/angular-custom-elements">https://github.com/ngdev-space/angular-custom-elements</a></p><p><em>Disclaimer: I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb6b3fdb5c51" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ng2-space/custom-elements-v1-and-angular-eb6b3fdb5c51">Custom Elements (v1) and Angular</a> was originally published in <a href="https://medium.com/ng2-space">Angular Dev Space</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node 7.6 + Koa 2: asynchronous flow control made right]]></title>
            <link>https://medium.com/ninjadevs/node-7-6-koa-2-asynchronous-flow-control-made-right-b0d41c6ba570?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0d41c6ba570</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[koajs]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Thu, 23 Feb 2017 20:58:08 GMT</pubDate>
            <atom:updated>2017-07-06T15:44:53.210Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*Co0gr64Uo5kSg89ukFD2dw.jpeg" /></figure><blockquote><strong>TL;DR</strong>: Node 7.6 was released yesterday with native support for async/await which was a blocker to declare Koa 2 <a href="https://github.com/koajs/koa/issues/533">stable</a>; that means we can start using it (no need to provide the harmony flag) to build awesome nodejs applications.</blockquote><p>If you’ve never heard about <a href="http://koajs.com/">Koa</a>, it’s a “next generation framework for nodejs” developed by the team behind Express. Its first version (currently stable) relies heavily on <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator">ES2015 generators</a>.</p><p>While V1 is awesome we can always do better and upcoming (more like, <a href="https://tc39.github.io/ecmascript-asyncawait/">almost here</a>) ECMAScript support for asynchronous functions with the <strong>async/await syntax</strong> opens up a new world of possibilities.</p><h4>The problem with async operations</h4><blockquote>If you’re already familiar with callback hell you can totally skip this section</blockquote><p>Async in JavaScript has always been a mess as it usually involved leveraging the language’s ability to treat functions as first-class citizens. This means we are able to pass functions (that carry their context with them) around and execute them (call them back, hence the name “callback”) once the asynchronous operation is done.</p><p><strong>Sounds neat, right?</strong><br>Now go ahead and add a couple of async operations that depend on other async operations to be executed first and you get this:</p><pre>fs.readdir(source, <strong>function</strong> (err, files) {<br>  <strong>if</strong> (err) {<br>    console.log(&#39;Error finding files: &#39; <strong>+</strong> err)<br>  } <strong>else</strong> {<br>    files.<strong>forEach</strong>(<strong>function</strong> (filename, fileIndex) {<br>      console.log(filename)<br>      gm(source <strong>+</strong> filename).size(<strong>function</strong> (err, values) {<br>        <strong>if</strong> (err) {<br>          console.log(&#39;Error identifying file size: &#39; <strong>+</strong> err)<br>        } <strong>else</strong> {<br>          console.log(filename <strong>+</strong> &#39; : &#39; <strong>+</strong> values)<br>          aspect <strong>=</strong> (values.width / values.height)<br>          widths.<strong>forEach</strong>(<strong>function</strong> (width, widthIndex) {<br>            height <strong>=</strong> Math.round(width / aspect)<br>            console.log(&#39;resizing &#39; <strong>+</strong> filename <strong>+</strong> &#39;to &#39; <strong>+</strong> height <strong>+</strong> &#39;x&#39; <strong>+</strong> height)<br>            <strong>this</strong>.resize(width, height).write(dest <strong>+</strong> &#39;w&#39; <strong>+</strong> width <strong>+</strong> &#39;_&#39; <strong>+</strong> filename, <strong>function</strong>(err) {<br>              <strong>if</strong> (err) console.log(&#39;Error writing file: &#39; <strong>+</strong> err)<br>            })<br>          }.bind(<strong>this</strong>))<br>        }<br>      })<br>    })<br>  }<br>})</pre><blockquote><strong>EDIT</strong>: This piece of code serves only as an example of how bad it can get and doesn’t directly relate with Koa.</blockquote><p>“This is madness”, I hear you scream.</p><p>No, this is hell. It’s <a href="http://callbackhell.com/">Callback Hell</a>.</p><blockquote>Since this is not the main topic of this post I’ll just say that newer versions of JavaScript (ES2015, ES2016 and ESNext) have all contributed to address this issue using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promises</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator">Generators</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async</a>/<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await">await</a> (follow the links if you’ve never heard of those before reading on).</blockquote><h3>Enter Koa 2</h3><p>Frameworks such as Express heavily relied on callbacks to perform asynchronous actions and while it’s possible to write fairly clean and readable code using callbacks not every developer out there will know how or even care about doing so. At first, Koa got rid of the aforementioned callback hell using a combination of Promises and Generators but now that we have the async/await syntax available in Node <a href="https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V7.md#7.6.0">Current</a> we can make use of it.</p><p>Your typical Koa hello-world app looks like this:</p><pre><strong>const</strong> koa = require(&#39;koa&#39;);<br><strong>const</strong> app = <strong>new</strong> koa();</pre><pre>app.use(function *(next){<br>  <strong>var</strong> start = new Date;<br>  <strong>yield</strong> next;<br>  <strong>var</strong> ms = new Date - start;<br>  console.log(&#39;%s %s - %s&#39;, this.method, this.url, ms);<br>});</pre><pre>app.use(function *(){<br>  this.body = &#39;Hello World&#39;;<br>});<br><br>app.listen(3000);</pre><p>In contraposition, the Koa 2 version would look something like this:</p><pre><strong>const</strong> koa = require(&#39;koa&#39;);<br><strong>const</strong> app = <strong>new</strong> koa();</pre><pre>app.use(async (ctx, next) =&gt; {<br>  <strong>const</strong> start = <strong>new</strong> Date;<br>  console.log(`Started at: ${start}`);<br>  <strong>await</strong> next();<br>  <strong>const</strong> ms = new Date - start;<br>  console.log(`Elapsed: ${ms}ms`);<br>});</pre><pre>app.use(async (ctx) =&gt; {<br>  ctx.body = &#39;Hello world&#39;;<br>});</pre><pre>app.listen(3000);</pre><blockquote>Yeah, async/await and Generators are deeply related and might look very similar but Generators are way more generic. Actually, <a href="https://medium.com/javascript-scene/the-hidden-power-of-es6-generators-observable-async-flow-control-cfa4c7f31435#.4db3yax9v">you can implement your own version of async/await with Generators and Promises</a></blockquote><h4>Koa Middleware</h4><blockquote>“Koa middleware are simple functions which return a MiddlewareFunction with signature (ctx, next). When the middleware is run by an &quot;upstream&quot; middleware, it must manually invoke next() to run the &quot;downstream&quot; middleware.” — Koa 2.x <a href="https://github.com/koajs/koa/blob/v2.x/docs/guide.md">Guide</a></blockquote><p>Koa middleware can be implemented using a stack flow which allows us to easily manage request/response flows. Our small middleware here logs the elapsed milliseconds since the request was issued:</p><pre>app.use(async (ctx, next) =&gt; {<br>  const start = new Date;<br>  console.log(`Started at: ${start}`);<br><strong>  await next();</strong><br>  const ms = new Date - start;<br>  console.log(`Elapsed: ${ms}ms`);<br>});</pre><p>If you’ve never used Koa you’re probably wondering what the heck is that <strong>await</strong> next() doing there, in the middle of our code. Well, if that’s the case just think about the two ways of event propagation: <strong>capture</strong> and <strong>bubble</strong>. The code before the next() call is analogous to event capturing (capture down) and the code after that corresponds to event bubbling (bubble up). To further illustrate, let’s take a look at the following example:</p><pre>...</pre><pre>app.use(async(ctx, next) =&gt; {<br>  <strong>// Step 1</strong><br>  const start = new Date;<br>  console.log(`Started at: ${start}`);<br>  await next(); <strong>// Step 2</strong><br>  <strong>// Step 7</strong><br>  const ms = new Date - start;<br>  console.log(`Elapsed: ${ms}ms`);<br>});</pre><pre>app.use(async(ctx, next) =&gt; {<br>  <strong>// Step 3</strong><br>  console.log(`Hey, I&#39;m just another middleware`);<br>  await next(); <strong>// Step 4</strong><br>  <strong>// Step 6</strong><br>  console.log(&#39;More stuff after body has been set&#39;);<br>});</pre><pre>app.use(async(ctx) =&gt; {<br>  const name = await dbCall();<br>  <strong>// Step 5</strong><br>  ctx.body = `Hello ${name}`;<br>  console.log(&#39;Body has been set&#39;);<br>});</pre><pre>...</pre><p>The flow goes down like this:</p><p>1- Log start date in middleware 1<br>2- Go to the next middleware, the execution of the next two lines is paused<br>3- Do stuff in middleware 2<br>4- Go to the next middleware, the execution of the next line is paused</p><p>Once we’ve hit the last middleware the flow continues as follows:</p><p>5- Body is set, “bubble” up, since there are no more next() calls<br>6- Do stuff in middleware 2 after body is set <br>7- Do stuff in middleware 1 after body is set and Step 6 is done</p><p>As you can see the execution goes all the way down and then it goes back all the way up providing a really nice way to create middleware and compose request/response flows with ease.</p><h3>Takeaway</h3><p>Koa is an awesome, lightweight framework to develop nodejs applications that just stays out of your way. If you come from an Express background you’ll find it fundamentally different but familiar enough and refreshingly easy to understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*iYTztuDUlvK5qdVhZiSw4g.png" /><figcaption>Koa vs Express (<a href="https://github.com/koajs/koa/blob/master/docs/koa-vs-express.md">https://github.com/koajs/koa/blob/master/docs/koa-vs-express.md</a>)</figcaption></figure><p>As you can see, Koa is basically a middleware kernel. Thankfully there’s a huge <a href="https://github.com/koajs/koa/wiki">catalog</a> of middleware available that you can use to provide routing, templating, caching, authentication, sessions, security, etc.</p><p>If you’d like to run the code presented in this post in your machine just head to our <a href="https://github.com/NinjaDevsIO/koa2-hello-world">Github</a>.</p><p><em>Disclaimer: I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0d41c6ba570" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ninjadevs/node-7-6-koa-2-asynchronous-flow-control-made-right-b0d41c6ba570">Node 7.6 + Koa 2: asynchronous flow control made right</a> was originally published in <a href="https://medium.com/ninjadevs">ninjadevs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular @Input() property changes detection]]></title>
            <link>https://medium.com/ng2-space/angular-2-input-property-changes-detection-3ccbf7e366d2?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ccbf7e366d2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Tue, 22 Nov 2016 15:10:17 GMT</pubDate>
            <atom:updated>2018-06-19T17:26:40.987Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wZc53qZye1hU6IGar8GjQ.jpeg" /></figure><p><strong>TL;DR: </strong>Here’s an example of how to intercept and act upon changes in @Input() properties: <a href="https://stackblitz.com/edit/input-properties-change-detection?embed=1&amp;file=src/main.ts">https://stackblitz.com/edit/input-properties-change-detection?embed=1&amp;file=src/main.ts</a></p><blockquote>This article refers to Angular version 2+</blockquote><p>If you’re reading this chances are you’ve already heard all about Angular’s <a href="https://angular.io/docs/ts/latest/guide/template-syntax.html#!#inputs-outputs">@Input() decorator</a>. It allows you to pass data from parent to child components. These “dumb” components rely solely on the data they receive from their parents and know nothing about the world outside them.</p><blockquote>Smarter people has written a lot about Smart-Dumb/Container-Presentational components, for example, feel free to check out <a href="https://medium.com/u/a3a8af6addc1">Dan Abramov</a>’s write-up on these <a href="https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0#.t7dvm4b4e">here</a>.</blockquote><p>In Angular, if you want to make use of these features, you need to define a component with, at least, one property annotated with the @Input() decorator:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb2bd393d15be0cadc24fcde1bbb7eaa/href">https://medium.com/media/fb2bd393d15be0cadc24fcde1bbb7eaa/href</a></iframe><p>In this case, we added a ChildComponent with a public property called prop1 and annotated it with the @Input()decorator that was imported from @angular/core . This basically tells Angular this property will be injected by a parent component when our ChildComponent is used. Then, in the component’s template we print prop1’s value.</p><p>After we’ve defined our component we need to use it in our app. Here, we define an App component with one public property, name :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/038872843de14ca1512d908856bb13b5/href">https://medium.com/media/038872843de14ca1512d908856bb13b5/href</a></iframe><p>For the sake of simplicity I’ve removed most of the unrelated code that’s needed for this example to run, but let’s focus on the square brackets around prop1 :</p><pre>&lt;my-child-component <strong>[prop1]</strong>=&quot;name&quot;&gt;&lt;/my-child-component&gt;</pre><p>By using the square brackets around prop1 Angular will look for a property that’s called name inside our current component (App) and inject <strong>its value </strong>so our ChildComponent can use it.</p><p>This pattern is really nice since it allows you to abstract common use cases into small, reusable components that can then be used in multiple places within your application.</p><p>Most of the times, you can just add some render logic inside the component depending on the content but sometimes you need to intercept the value sent into the component and act upon it before actually showing something.</p><p>For this particular situation there are two paths we can follow:</p><h3><strong>TypeScript accessors</strong></h3><p>“TypeScript supports getters/setters as a way of intercepting accesses to a member of an object. This gives you a way of having fine-grained control over how a member is accessed on each object.” [<a href="http://www.typescriptlang.org/docs/handbook/classes.html">http://www.typescriptlang.org/docs/handbook/classes.html</a>]</p><p>Since our Angular components are ES6 classes with a @Component() decorator we’re able to leverage TS accessors to intercept the injected value as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2345a42f70f0f9660f6f7728367d6aa0/href">https://medium.com/media/2345a42f70f0f9660f6f7728367d6aa0/href</a></iframe><p>The main difference with our first example is that instead of decorating the property we decorate the setter (line 18):</p><pre><a href="http://twitter.com/Input">@Input</a>()<br>set name(name: string) {</pre><p>Notice that the setter’s name is name so we need to use that in our parent component to pass the data in:</p><pre>&lt;my-name <strong>[name]</strong>=&quot;name&quot;&gt;&lt;/my-name&gt;</pre><p>Additionally, we define a private property _name inside our component to keep track of the value.</p><p>Last, but now least, we added a getter that allow us to transform the value before displaying it. A common example of where to use this is a date component in which we want to show the date in different formats without changing the original data. Also, if we wanted to act upon the received data right after the component gets it we can add that code to the setter. In this case, we just print to the console.</p><h3>ngOnChanges</h3><p>This <a href="https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html">lifecycle hook</a>, responds “when Angular (re)sets data-bound input properties. The method receives a SimpleChanges object of current and previous property values.”</p><blockquote>It’s called before ngOnInit and whenever one or more data-bound input properties change.</blockquote><p>The main difference is that this method is directly related to Angular’s component lifecycle and you’ll receive <strong>all the changes instead of just the changes related to a single property.</strong> For that reason, this method is more suitable if you have a lot of properties that change a lot.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/126bb99324bb9226fa0272d68897b24b/href">https://medium.com/media/126bb99324bb9226fa0272d68897b24b/href</a></iframe><p>As you can see, in this example we need to import the OnChanges interface and implement the ngOnChanges() method. It receives a SimpleChanges object containing the changes (if any) each property had.</p><p>In this case (line 19), we only have one property so we can simply use:</p><pre>const name: SimpleChange = changes.name;</pre><p>to access a child object that contains the currentValue, previousValue and the <a href="https://angular.io/docs/ts/latest/api/core/index/SimpleChange-class.html#isFirstChange-anchor">isFirstChange</a>() function which returns true if this is the first time the property receives a value.</p><p>If we want to transform the original value before showing it (as we did in the TS accessor example), we can just create a private property inside our class and use that (line 22):</p><pre>this._name = name.currentValue.toUpperCase();</pre><p>That way, name will always contain the latest value sent from the parent and _name will contain our modified value.</p><p>Both approaches work pretty well and one could say they’re interchangeable. The only thing you need to keep in mind when making the choice is that the TS Accessors method will end up adding as many setters/getters to your component as properties you can send into it so, for situations in which you have multiple properties you may want to use the ngOnChanges alternative. Check out the full example in <a href="https://embed.plnkr.co/XaAWHluIJPD3KSc8ZLtc/">plunkr</a>.</p><p><em>Disclaimer: I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ccbf7e366d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ng2-space/angular-2-input-property-changes-detection-3ccbf7e366d2">Angular @Input() property changes detection</a> was originally published in <a href="https://medium.com/ng2-space">Angular Dev Space</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You may not want to use [hip_js_framework]]]></title>
            <link>https://medium.com/unhandled-exception/you-may-not-want-to-use-hip-js-framework-708f6358da95?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/708f6358da95</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular2]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Tue, 05 Jul 2016 19:24:14 GMT</pubDate>
            <atom:updated>2017-07-06T15:29:26.844Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*rMow1E1znb-81ouwF_YB7Q.png" /></figure><p>Angular 2 is around the corner (I can’t tell how many times I’ve said this before but this time is for real, I promise) and I’m already reading a lot of Angular-2-vs-React type articles popping all over the place. And it’s gonna get worse.</p><p>The problem with this is that most comparisons are not going to be fair, mainly because these tools were initially created to solve very specific problems that were bounded to a certain context. Then, over time, they evolved into fully fledged frameworks/libraries but a part of that initial motivation remained. Eventually, when a lot of people started using them, they became hip and hot, and everyone started trying to solve every problem out there with these tools just because everyone else was doing the same thing.</p><blockquote>Please, stop.</blockquote><p>For me, there are two things that people tend to forget and make most (if not all) framework-a-vs-framework-b comparisons biased and not as relevant as you might think: <strong>programming paradigms</strong> and <strong>developer mindsets</strong>.</p><h4>Programming paradigms</h4><p>These are merely a way to classify programming languages based on the programming style and some key features that defines each style. Each paradigm will allow developers to solve specific problems in a more efficient way than others so we could say that they not only classify programming languages but also problem domains.</p><blockquote>Programming languages are just tools that allow programmers to solve problems in a very systematic way while following a set of principles and adhering to a predefined style.</blockquote><p>Developers have different backgrounds and, as a consequence of that, we will choose a programming language, framework or library that matches it, and this won’t necessarily be the best choice in a lot of cases. But because this is what we know and trust, we end up using it for every situation, just to discover that it may not work as well as expected.</p><p>And then we start blaming that piece of software for our own mistakes and misunderstandings, or even worse, we attack the people who built it.</p><h4>Developer mindset</h4><p>Every developer has his/her own set of “beliefs”, and these are usually driven by their background but also by a lot of external factors such as the issues they’ve faced using certain technology or tool, the way they think or even the things other developers they admire believe.</p><p>Look at <a href="https://medium.com/u/db72389e89d8">Kent C. Dodds</a>, for example:</p><h3>Kent C. Dodds on Twitter</h3><p>Maybe React or Ember fits the way I think better.</p><h3>Kent C. Dodds on Twitter</h3><p>It&#39;s not a perfect analogy, but I think this is how we are with technology. Maybe Angular fits the way you think better than the way I do.</p><blockquote>Sometimes, it just doesn’t click</blockquote><p>I’ve been there, we’ve all been there. And, when you compare two different frameworks or libraries your mindset plays a big role in your final decision. For some people it might be easier to use react while others may find angular more appealing. There are other individuals that will not settle with neither and start building their own solution from scratch.</p><p>This is good, that’s a big part of what makes this career exciting: you have a lot of options, and even if you don’t like any of those you can always create your own way to solve a problem.</p><p>I don’t wanna read a post featuring a showdown between Angular and React features, that’s what documentation is for; instead, let’s write more articles about how Angular, Cycle, React, Ember, Knockout, Vue, Mithrill, Choo et al are solving specific problems, and how good are they proving to be for that problem domain.</p><p>Just remember: the fact that certain tool doesn’t fit your specific needs or your mindset <strong>doesn’t necessarily</strong> mean that it’s a bad software piece. Of course, there are terrible pieces of software out there and some libraries/frameworks will perform better than others under certain circumstances, but you should take enough time to analyze the implications of implementing a project with them. Don’t blame software for your (or others’) poorly informed decisions.</p><p><em>Disclaimer: I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=708f6358da95" width="1" height="1" alt=""><hr><p><a href="https://medium.com/unhandled-exception/you-may-not-want-to-use-hip-js-framework-708f6358da95">You may not want to use [hip_js_framework]</a> was originally published in <a href="https://medium.com/unhandled-exception">Unhandled Exception</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using non-transpiled modules and Webpack]]></title>
            <link>https://medium.com/unhandled-exception/using-non-transpiled-modules-and-webpack-657dca27bd4a?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/657dca27bd4a</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Fri, 20 May 2016 16:51:14 GMT</pubDate>
            <atom:updated>2016-05-20T16:55:58.635Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>TL;DR: use&gt; </em><strong>include: function(absPath){ return (/[regex for the module(s) you want to include]/.test(absPath) || /src/.test(absPath)); }, </strong>instead of&gt; <strong>exclude: /node_modules/,</strong></blockquote><p>I’m currently working on a project that required some client side validation for credit cards and found this amazing module with pretty much everything I needed in npm:</p><p><a href="https://www.npmjs.com/package/credit-card">credit-card</a></p><p>My project setup includes React, Redux and, of course, Webpack. So I npm-installed that bad boy and everything went as expected; it also worked like a charm with redux-form validators. But, as you know, there’s no such a thing as “smooth sailing” in web development: if something can go wrong it will. And it went.</p><h4>The problem with non-transpiled modules</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmG3ncsr6-pv8y2dXMsgdA.jpeg" /><figcaption>Webpack was showing one of those cryptic error messages we all know and love.</figcaption></figure><p>It turns out that the credit-card module is not distributed as a transpiled module so, when you install it you get the code in ES6. This wasn’t a problem for development but when the moment came for me to test the deployment/build scripts tragedy struck: the process simply failed and Webpack was showing one of those cryptic error messages we all know and love. I couldn’t believe it.</p><p>Damn it! I started checking for the usual stuff: node versions, outdated packages, cache… Nothing helped.</p><p>And then, it struck me like a lightning and I navigated to the credit-card directory just to confirm it: the code wasn’t distributed in ES5. That was the issue.</p><p>According to <a href="https://github.com/continuationlabs/credit-card/pull/24#issuecomment-220470770">this</a> GH issue, the module maintainer didn’t want to transpile the code because:</p><blockquote>1. It’s just a pain to manage.<br>2. It’s weird to test because you’re testing es2015 code that works fine on Node, but people are using transpiled babel code on the client that isn’t tested at all.<br>3. You become dependent on the babel ecosystem which has had some serious bumps during the 5.x.x to 6.x.x transition.<br>4. By not using the actual source, you lose a lot of optimization flexibility from within webpack/browserify</blockquote><p>To be fair those are valid reasons and even if you consider that they’re not you’ll have to deal with it, you either figure out how to fix it yourself or you use another package. I wanted to fix it but I’m not what you’d call a Webpack expert.</p><h4>The more you know</h4><blockquote>Just to make it clear I didn’t stumble across the aforementioned issue until some time later so I spent some time stumbling across StackOverflow and Webpack’s docs</blockquote><p>I knew I had to somehow transpile the module by myself, but I also knew I was excluding the <strong>node_modules </strong>folder so I started playing around with different combinations of <strong>exclude </strong>and <strong>include</strong>.</p><p>Then, I discovered that <strong>exclude </strong>takes precedence over <strong>include </strong>so, if you have both only the <strong>exclude </strong>will work. When I discovered this I was frustrated and, happily, stumbled across the issue so I decided to post a question and grab lunch.</p><p><a href="https://github.com/arb">Adam</a> was kind enough to answer my question and I discovered something new: <strong>include </strong>can take a function that receives the absolute path of each file Webpack is processing and returns <strong>true </strong>or <strong>false </strong>depending on whether you want to include it or not. Then Webpack will run every file path though this function and operate over the file only if the result of executing it is <strong>true</strong>.</p><p>After that, configuring my build took like 2 minutes, I just added a couple of regular expressions to match the specific module (credit-card) and the src folder in my project:</p><pre>include: function(absPath){ return (/credit-card/.test(absPath) || /src/.test(absPath)); },</pre><p>instead of the original:</p><pre>exclude: /node_modules/,</pre><blockquote>Also, Webpack’s documentation <a href="https://webpack.github.io/docs/configuration.html#module-loaders">encourages</a> the use of <strong>include </strong>over <strong>exclude </strong>so it was a double-kill.</blockquote><p>Webpack is an amazing tool but it has a rather high entry barrier: the docs. I’d like to see a lot more articles about specific stuff like this that don’t always happens but can really make you lose your shit.</p><p>Have you ever stumbled across something like this?</p><p><em>Disclaimer: I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=657dca27bd4a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/unhandled-exception/using-non-transpiled-modules-and-webpack-657dca27bd4a">Using non-transpiled modules and Webpack</a> was originally published in <a href="https://medium.com/unhandled-exception">Unhandled Exception</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My SublimeText-killer Atom setup for developing React apps]]></title>
            <link>https://medium.com/unhandled-exception/my-sublimetext-killer-atom-setup-for-developing-react-apps-fa3c06505dd?source=rss-d2f94f9e834f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa3c06505dd</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[atom-text-editor]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Carlos Vega]]></dc:creator>
            <pubDate>Fri, 18 Mar 2016 21:20:48 GMT</pubDate>
            <atom:updated>2016-03-19T20:11:32.215Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ig_y04pS5eWg2pD4jeNaPg.png" /><figcaption>Just look at this beauty!</figcaption></figure><blockquote>TL;DR: VS Code is good for ng2 apps but isn’t good enough for react. Just install Atom (if you haven’t already, open a terminal and run: apm install atom-beautify autoclose-html highlight-selected language-babel react linter linter-eslint minimap minimap-highlight-selected pigments seti-ui monokai-seti</blockquote><p>I’ve been a SublimeText fan for a while. There was something about WebStorm that didn’t quite fit my idea of what I was looking for in a text editor and both Atom and, more recently, Visual Studio Code had their own issues.</p><p>Time passed and both projects (Atom and VS Code) became mature text editors with active communities eagerly building hundreds of plugins to achieve almost any task you could imagine.</p><p>During the past year and a bit I’ve been jumping between ST, Atom and VS Code unable to decide between them. On one hand, ST is a mature project (so mature it seemed to be dead, until <a href="https://www.sublimetext.com/3">recently</a>), on the other hand, both Atom and VS Code embrace, and are built on top of, modern web technologies and are serious OSS initiatives backed by big players in the industry (Github and MS).</p><p>I used to, and still, do a lot of Angular and VS Code provides a remarkably good developer experience for Angular 2 developers. IntelliSense, code completion and TypeScript integration, just to mention some features, makes creating ng2 app in VS Code a delight. Sadly, I can’t say it provides the same experience for developing react apps.</p><p>Some months ago I looked back at Atom and its packages hoping that it could address my needs and it did, so I decided to publish the list of packages that have been making my life easier when developing react apps.</p><p>So, without any further introduction, here it is:</p><ul><li>atom-beautify</li><li>autoclose-html</li><li>highlight-selected</li><li>language-babel</li><li>linter</li><li>linter-eslint</li><li>minimap</li><li>minimap-highlight-selected</li><li>monokai-seti</li><li>pigments</li><li>react</li><li>seti-ui</li></ul><p>With these packages you’ll get linting, a slick UI and the familiar monokai theme, ES6/ES7 syntax highlighting support, auto close for tags, code beautification, react support(snippets, auto-completion and syntax highlighting), and the useful minimap most of us are used to.</p><p>What’s you editor of choice and why? Which packages do you use? Am I missing something?</p><p>Let your responses flow and happy coding!</p><p><em>Disclaimer: I’m not a native English speaker, so feel free to point out grammatical and/or syntactical errors. Every respectful comment is deeply appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa3c06505dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/unhandled-exception/my-sublimetext-killer-atom-setup-for-developing-react-apps-fa3c06505dd">My SublimeText-killer Atom setup for developing React apps</a> was originally published in <a href="https://medium.com/unhandled-exception">Unhandled Exception</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>