<?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 Jorge Chávez on Medium]]></title>
        <description><![CDATA[Stories by Jorge Chávez on Medium]]></description>
        <link>https://medium.com/@jorgech?source=rss-45f86dd59135------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SNFp6Vu_j5aLfxeT.jpg</url>
            <title>Stories by Jorge Chávez on Medium</title>
            <link>https://medium.com/@jorgech?source=rss-45f86dd59135------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 10:09:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jorgech/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[10 Pasos para configurar React, Webpack 4 y Babel 7]]></title>
            <link>https://medium.com/nearsoft-jobs/10-pasos-para-configurar-react-webpack-4-y-babel-7-5b4096924f23?source=rss-45f86dd59135------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b4096924f23</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[nearsoft]]></category>
            <dc:creator><![CDATA[Jorge Chávez]]></dc:creator>
            <pubDate>Tue, 19 Feb 2019 20:23:12 GMT</pubDate>
            <atom:updated>2019-04-29T08:52:45.870Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOSLISvW8kSfwVxfiAxEew.png" /></figure><p>JavaScript es sin duda una de los lenguajes de programación mas utilizados en todo el mundo (para bien de muchos, para mal de otros).</p><p>Ember, Angular, Backbone, Vue.js, son algunos frameworks y librerías que muchos desarrolladores estamos adoptando como nuevas tecnologías, pero sin duda alguna, <strong>React</strong> es una de las librerías mas populares utilizadas en el front-end gracias a su facilidad para crear interfaces de usuario, pero no solo eso, ya que React puede ser utilizado para crear aplicaciones de escritorio con <a href="https://electronjs.org/"><strong>Electron</strong></a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FnbTjM1nYBz8eRObFHd%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Freact-nbTjM1nYBz8eRObFHd&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FnbTjM1nYBz8eRObFHd%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/ddf8d3fe009d86de16a620e6a788d8d0/href">https://medium.com/media/ddf8d3fe009d86de16a620e6a788d8d0/href</a></iframe><p>Incluso podemos desarrollar aplicaciones móviles nativas con React, utilizando <a href="https://facebook.github.io/react-native/"><strong>React Native</strong></a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7SUdqHeRHEfb8DkP27%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Freact-native-desarrollo-movil-7SUdqHeRHEfb8DkP27&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7SUdqHeRHEfb8DkP27%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b2f4edd068b882828ed82ecea5b19ee/href">https://medium.com/media/5b2f4edd068b882828ed82ecea5b19ee/href</a></iframe><p>O para lo que comúnmente se utiliza, <strong>Aplicaciones Web</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F9Y3Kw7N7D77Ribazfl%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Freact-desarrollo-web-9Y3Kw7N7D77Ribazfl&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F9Y3Kw7N7D77Ribazfl%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/386dd2b5424e422929c18810b21b0eac/href">https://medium.com/media/386dd2b5424e422929c18810b21b0eac/href</a></iframe><p>Ahora, todo puede sonar hermoso cuando sabemos lo que podemos hacer con React, pero configurar un ambiente utilizando esta librería puede darte dolor de cabeza (yo ya pasé por esto). Es por eso que en este post decidí resumir este proceso en tan sólo 10 pasos.</p><p>Para poder seguir esta guía correctamente sólo es necesario tener instalado <a href="https://nodejs.org/en/">node</a> y <a href="https://www.npmjs.com/">npm</a>.</p><h3>Paso #1: Basic scaffold</h3><p>Empezaremos por generar nuestro directorio principal en este caso lo llamaremos <strong>basic-react. </strong>Luego crearemos nuestro archivo package.json con el comando npm init -y</p><ul><li><strong>-y</strong> es un parámetro que le indica a npm que queremos que cree el archivo <em>package.json</em> con la información mas básica sin preguntarnos absolutamente nada.</li></ul><p>Hasta ahorita nuestro proyecto debe de lucir algo así:</p><pre>basic-react/<br>  package.json<br></pre><h3>Paso #2: Instalación de dependencias</h3><p>Instalaremos todas las dependencias necesarias para que React funcione correctamente, en este caso ocuparemos 6 dependencias:</p><ul><li><strong>react:</strong> Librería que nos permite crear interfaces web en base a componentes.</li><li><strong>react-dom: </strong>Nos permitirá insertar los componentes creados con React a nuestro DOM.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*71vgTWmZd5JaP0Rs4H6LUQ.png" /></figure><ul><li><strong>path: </strong>Esta librería nos ayudara a obtener rutas</li><li><strong>@babel/core:</strong> Transformara ECMA6 a JavaScript más viejo (estandarizado para todos los navegadores).</li><li><strong>babel-loader: </strong>Éste es un modulo de webpack que nos ayudará a leer nuestros archivos de JavaScript y procesarlos con @babel/core y @babel/preset-react.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0EpFXNU2Qd8aDMEZalmbw.png" /></figure><ul><li><strong>@babel/preset-react:</strong> Al momento de que babel trate de convertir ECMA6 a JavaScript viejo, no va a entender <a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a>, y este preset nos ayudará con eso.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l5PUKd2tvaxWhltvIIJPVg.png" /><figcaption>JSX a JavaScript</figcaption></figure><p>Todas estas librerías las instalaremos con <strong>npm</strong> utilizando --save como argumento; podemos instalarlos todos en una sola línea:</p><pre>&gt; npm install path <a href="http://twitter.com/babel/core">@babel/core</a> <a href="http://twitter.com/babel/preset-react">@babel/preset-react</a> react babel-loader react-dom --save</pre><ul><li>--save este argumento guardará una referencia de la librería recién instalada en el archivo package.json</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sEA8F-bNz6lcaAjc3VYBZg.png" /><figcaption>Package.json React</figcaption></figure><h3>Paso #3</h3><h4>Instalación de webpack</h4><p>Webpack cuenta con un <a href="https://www.npmjs.com/package/webpack-cli">CLI</a> que nos ayuda con comandos para poder interactuar con todas las herramientas que cuenta webpack. Vamos a instalarlo globalmente con:</p><pre>npm install webpack webpack-cli --global</pre><p>Podemos comprobar que se haya instalado correctamente con el comando:</p><pre>&gt; webpack --version<br>4.21.0</pre><p>Si en este momento nosotros corremos el comando webpack,nos daremos cuenta que nos va a tirar un error como:</p><pre>ERROR in Entry module not found: Error: Can&#39;t resolve &#39;./src&#39;</pre><p>Eso es por que nosotros no tenemos ningún archivo de configuración para webpack, y por default tratará de encontrar este archivo dentro del directorio src el cual nosotros no tenemos.</p><h3><strong>Paso #4</strong></h3><h4>Archivo de configuración</h4><p>Crearemos el archivo webpack.config.js en la raíz, el cual será el archivo de configuración que webpack utilizará para procesar todos los componentes crearemos.</p><pre>touch webpack.config.js</pre><p>Este archivo necesita inicialmente tres cosas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*nVxT-h6RRCjWYxzgm6pd9Q.png" /></figure><p><strong>mode:</strong> Webpack optimizara nuestro bundle segun el modo que utilicemos.</p><p><strong>entry:</strong> Dirección a nuestro archivo de entrada</p><p><strong>output:</strong> Webpack generara un archivo de salida, donde tendremos todo lo que llegue a procesar webpack.</p><p>Ahora podemos usar este archivo como configuración con el comando:</p><pre>&gt; webpack --config webpack.config.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*jOtlcCOOrVqis8VJ1ZrCyQ.png" /></figure><p>Podemos observar que webpack ya esta funcionando correctamente y nos genera un archivo dist/main.js , que en realidad es un bundle que cuenta con todos nuestros archivos procesados y compilados, <strong>todos</strong> pero en un mismo archivo.</p><h3>Paso #5</h3><h4>Configuración de webpack</h4><p>Ésta creo que es la parte mas compleja de todo el proceso, pero creo yo que es por que webpack introduce muchos términos nuevos que son propios de su librería.</p><p>Empecemos con importar path y exportar la configuración.</p><pre>var path = require(&#39;path&#39;);</pre><pre>module.exports = {</pre><pre>}</pre><p>Ahora agregaremos el punto de entrada y el archivo de salida que será generado por webpack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-mGGp6e9ghuvK0u-5_Nx3w.png" /></figure><pre>module.exports = {<br>  entry: &#39;./components/index.js&#39;,<br>  output: {<br>    path: path.resolve(__dirname, &#39;dist&#39;),<br>    filename: &#39;[name].js&#39;<br>  }<br>}</pre><p>Y finalmente agregamos @babel/core y @babel/preset-react, esto con la ayuda de babel-loader:</p><pre>module.exports = {<br>  entry: &#39;./components/index.js&#39;,<br>  output: {<br>    path: path.resolve(__dirname, &#39;dist&#39;),<br>    filename: &#39;[name].js&#39;<br>  },<br>  module: {<br>    rules: [<br>      {<br>        test: /\.js$/,<br>        exclude: /node_modules/,<br>        use: {<br>          loader: &#39;babel-loader&#39;<br>        }<br>      }<br>    ]<br>  }<br>}</pre><h3>Paso #6</h3><h4>Webpack + JSX</h4><p>Para que podamos utilizar JSX en nuestros componentes, debemos hacerle entender a webpack ese tipo de sintaxis. Aquí es donde toma un papel importante la librería @babel/preset-react.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXJzSWBmQv9snRjRycO2CA.png" /></figure><p>En este caso sólo agregaremos un preset a babel-loader.</p><pre>module.exports = {<br>  entry: &#39;./components/index.js&#39;,<br>  output: {<br>    path: path.resolve(__dirname, &#39;dist&#39;),<br>    filename: &#39;[name].js&#39;<br>  },<br>  module: {<br>    rules: [<br>      {<br>        test: /\.js$/,<br>        exclude: /node_modules/,<br>        use: {<br>          loader: &#39;babel-loader&#39;,<br>          options: {<br>            presets: [&#39;<a href="http://twitter.com/babel/preset-react">@babel/preset-react</a>&#39;]<br>          }<br>        }<br>      }<br>    ]<br>  }<br>}</pre><h3>Paso #7</h3><h4>Primer componente</h4><p>Vamos a crear nuestro archivo index.js dentro de una carpeta llamada components donde tendremos nuestro primer componente.</p><pre>//components/index.js</pre><pre>import React, { Component } from &#39;react&#39;; //Importamos react</pre><pre>class Root extends Component {</pre><pre>   render() {</pre><pre>     return(</pre><pre>       &lt;h1&gt;Hola mundo desde React&lt;/h1&gt;</pre><pre>     )</pre><pre>   }</pre><pre>}</pre><p>Como puedes observar, en este archivo hacemos solamente dos cosas:</p><ul><li>Importamos React</li><li>Creamos un componente que lo único que hace es hacer render de “HTML” pero recordemos que en realidad no es HTML, es <a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a>.</li></ul><p>Nota: webpack aun no sabe que este archivo existe, tenemos que indicarlo en webpack.config.js.</p><h3>Paso #8</h3><p>Crearemos un archivo index.html dentro de la raíz del proyecto que contenga el siguiente HTML:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;<br>  &lt;head&gt;<br>    &lt;meta charset=&quot;utf-8&quot;&gt;<br>    &lt;title&gt;Basic React&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;div id=&quot;app&quot;&gt;<br>      <br>    &lt;/div&gt;<br>    &lt;script src=&quot;dist/main.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Podemos ver que tenemos un div con un ID “app”. Aquí dentro es donde se va a hacer render de nuestros componentes de react, y también importamos el archivo que nos genera webpack, dist/main.js</p><h3>Paso #9</h3><h4>Interacción con el DOM</h4><p><a href="https://reactjs.org/docs/react-dom.html"><strong>react-dom</strong></a> es una librería que nos permite interactuar con cualquier elemento dentro del DOM, en nuestro caso la vamos a usar insertar nuestro componente dentro de <strong>DIV </strong>mencionado anteriormente.</p><p>Agregamos esto dentro de <strong>index.js</strong></p><pre>import React, { Component } from &#39;react&#39;;<br>import ReactDOM from &#39;react-dom&#39;;</pre><pre>class Root extends Component {<br>  render() {<br>    return (<br>      &lt;h1&gt;Hola mundo desde React&lt;/h1&gt;<br>    )<br>  }<br>}</pre><pre>let container = document.getElementById(&#39;app&#39;);<br>let component = &lt;Root /&gt;;</pre><pre>ReactDOM.render(component, container);</pre><p>Con esto estamos diciéndole a <strong>react-dom</strong> que ponga el componente declarado anteriormente llamado<em>&lt;Root /&gt;</em> dentro del contenedor que tenga el ID “app”.</p><h3>Paso #10</h3><h3>Verifica scaffold</h3><p>Hasta este punto, este seria nuestro scaffold básico, para poder ver todo en acción:</p><pre>basic-react<br>  components<br>    index.js<br>  index.html<br>  package.json<br>  webpack.config.js</pre><p>Podemos verificar que todo este funcionando correctamente si abrimos nuestro archivo <strong>index.html</strong> con cualquier navegador.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sLJEV0TiKTjpSE4_6JzpTw.png" /></figure><p>Hasta aquí terminan estos sencillos pasos para correr React de la manera más simple posible, ¿que sigue? Mi recomendación es que puedas correr esta aplicación con <strong>webpack-dev-server.</strong></p><p>Si tienen una duda con respecto a algún paso pueden ponerse en contacto conmigo por medio de mi correo jorgechavzns@gmail.com.</p><p>Happy coding!</p><h3>Jorge Chavez, Software Developer @ Nearsoft</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b4096924f23" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nearsoft-jobs/10-pasos-para-configurar-react-webpack-4-y-babel-7-5b4096924f23">10 Pasos para configurar React, Webpack 4 y Babel 7</a> was originally published in <a href="https://medium.com/nearsoft-jobs">Nearsoft Jobs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Como descargar videos de Facebook para mandarlos por Whatsapp?]]></title>
            <link>https://medium.com/@jorgech/como-descargar-videos-de-facebook-para-mandarlos-por-whatsapp-3723e60fb444?source=rss-45f86dd59135------2</link>
            <guid isPermaLink="false">https://medium.com/p/3723e60fb444</guid>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[descargar-videos]]></category>
            <category><![CDATA[videos]]></category>
            <category><![CDATA[facil]]></category>
            <category><![CDATA[sin-programas]]></category>
            <dc:creator><![CDATA[Jorge Chávez]]></dc:creator>
            <pubDate>Sat, 16 Jun 2018 05:38:52 GMT</pubDate>
            <atom:updated>2018-06-16T05:38:52.319Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*xYs-RnyJMpd8xghW.jpg" /><figcaption>Download videos from facebook</figcaption></figure><p>Aquí un tutorial muy sencillo de como descargar videos de tu timeline en facebook para mandarlos por Whatsapp por ejemplo:</p><h3>Paso 1:</h3><p>Obten el link directo del video, esto lo puedes saber desde tu computadora dando click derecho y copiando la URL del video.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKbPVXxFOsI6Pi4tcJ7cDg.png" /></figure><h3>Paso 2:</h3><p>Entra a esta URL directamente y agrega la palabra <strong>mobile </strong>antes de la URL</p><p>Algo como:<br><a href="https://www.facebook.com/9GAGCute/videos/959250604269341/">https://www.facebook.com/9GAGCute/videos/959250604269341/</a></p><p>modificalo con la palabra <strong>mobile:</strong></p><p><a href="http://mobile.facebook.com/9GAGCute/videos/959250604269341/">http://<strong>mobile</strong>.facebook.com/9GAGCute/videos/959250604269341/</a></p><p>Esto deberia de abrir la version movil de facebook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*m_YvIotqDqaCL_VJufLtgg.png" /></figure><h3>Paso 3:</h3><p>Busca la URL del video descargable:</p><p>Aqui tienes dos opciones, buscar dentro del HTML el tag del video y extraer el URL, o en la consola de google chrome puedes pegar el siguiente script:</p><pre>$(&#39;video&#39;).getAttribute(&#39;src&#39;)</pre><p>y eso te dara el link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4B97sr7bDnAGi1yJRzY4Q.png" /></figure><h3>Paso 4:</h3><p>Descarga el video, en este link puedes simplemente dar click derecho y descargar el video.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEFhLNqGD12AcGKj84UlIw.png" /></figure><p>Eso es todo, espero que hayan entendido.</p><p>@jorgechavz</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3723e60fb444" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[¿Como conseguir tortillas gratis siendo youtuber?]]></title>
            <link>https://medium.com/@jorgech/como-conseguir-tortillas-gratis-siendo-youtuber-760fd7ca4386?source=rss-45f86dd59135------2</link>
            <guid isPermaLink="false">https://medium.com/p/760fd7ca4386</guid>
            <category><![CDATA[hermosillo]]></category>
            <category><![CDATA[longo]]></category>
            <category><![CDATA[burro]]></category>
            <dc:creator><![CDATA[Jorge Chávez]]></dc:creator>
            <pubDate>Sun, 26 Nov 2017 00:01:39 GMT</pubDate>
            <atom:updated>2017-11-26T10:08:12.326Z</atom:updated>
            <content:encoded><![CDATA[<p>Spoiler alert: El titulo del video no es click bait, realmente consegui tortillas gratis.</p><p>Hace un tiempo atrás me toco ir a Hermosillo Sonora, cuna de la comida mas rica que he probado, mariscos, percherones, tacos de carne asada que realmente sorprende al paladar, y de un “burro” gigante llamado <strong>Longo</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*8hnTbj2r2cWAtkTURtNqOA.png" /></figure><p>Mis amigos Hermosillenses me llevaron a comer los mentados <strong>Longos, </strong>diciendo que después de comer uno, no volvería a comer en los próximos 3 días, por sus grandes dimensiones. Y si, efectivamente su tamaño es una de sus atrancciones principales.</p><p>Yo como todo buen <em>millenial youtuber wanna be</em>, cargo a todos lados mi cámara y grabo todas las cosas que se me hacen interesantes, pues en esta ocación queria grabar mi experiencia con estos burros.</p><h3>La llegada</h3><p>Todo fue normal, llegamos al lugar y se veía un lugar muy tradicional de comida Mexicana, gente disfrutando sus <strong>Longos, </strong>como si fuera una cosa cotidiana, pero yo… yo estaba emocionado y muy contento por que soy un gordito que disfruta mucho la comida y las nuevas experiencias.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RzgPq_olTogMVh3U2Y2eFg.jpeg" /><figcaption>Entrada de los longos</figcaption></figure><p>Al estar formados en la fila para pedir los <strong>Longos</strong>, otra cosa me hizo muy feliz. Los precios no eran los mas accesibles ($100 MXN aprox) pero al ver el tamaño del <strong>Longo</strong>, creo que si vale mucho la pena.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6nF_LlO5x2cDYOEOjVkZmQ.jpeg" /><figcaption>Precios de los Longos en Hermosillo</figcaption></figure><h3>Escoge tu guiso</h3><p>Obviamente cuando sabes que vas a morir, siempre escoge la muerte mas honorable, no? Pues su servidor se pidio el Burro especial de 5 guisos, <em>big big mistake</em>.</p><p>Cuando estabamos pidiendo los guisos, en ese momento no lo note, pero en el video se ve claramente como el dueño del lugar se me quedaba viendo mucho.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*KsfYSK3hCY-dKrCNEI35xQ.gif" /></figure><p>Les digo, en ese entonces no lo note, pero los 10 minutos que estuvimos ahi, en mi video se nota fácilmente que el dueño me ve de una manera muy peculiar, como sospechando de algo, en fin llego mi turno de elegir los <strong>5 guisos</strong>. No recuerdo todos los que elegí pero si llegan a ir en algún momento de su vida, les recomiendo el chicharron prensado.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*uMlqwUN_t9x2abixZvqRqQ.gif" /><figcaption>Eligiendo guisados</figcaption></figure><h3>Ensaladas</h3><p>Nótese que hasta este punto, el dueño seguía viéndome sospechosamente, pero igual yo seguía concentrado en saber cuales serian me elecciones para esta nueva experiencia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*EHCKn-t_To85tzeEQsx3Jw.gif" /></figure><p>Cuando ya elegí mis cinco deliciosos guisos, llega el momento de preparar el <strong>Longo</strong> en la barra de ensaladas.<br>El longo esta en un estado <em>semi-terminado</em>, donde lo único que le falta es salsa y un poco de verdura, por aquello de tener algo verde y saludable (NOT!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*hcGv_Yf5QfXN2XAjutv57Q.gif" /><figcaption>Ensaladas</figcaption></figure><h3>Cerrando el Longo</h3><p>Cuando ya por fin el <strong>Longo</strong> esta terminado, solo falta un pequeño detalle, cerrarlo. De verdad, es todo un arte, no es como solo hacer un poco de origami con la tortilla, solo los dueños de ahi nacieron con el don de cerrar esta obra de arte. <strong>Mentira, en realidad son solo dos movimientos.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*KEuFC1NhHaFaQ7IicwkQlA.gif" /></figure><p>Llégo a que el tan mencionado dueño cierre mi Longo, y cuando estoy ahi me empieza a decir con un tono de molestia:</p><p><strong>Dueño</strong> — Que estas filmando mijo?<br><strong>Yo</strong> — Eh?<br><strong>Dueño</strong> — Que estas filmando?<br><strong>Yo</strong> — Eh… pues como cierra el burro. (sin albur)<br><strong>Dueño</strong> — Por que ya nos han puesto como 10 pinchis taquerias<br><strong>Yo</strong> — No, no, no, yo estoy presumiendo los burros.<br><strong>Dueño</strong> — Todo bien, todo bien <em>(Frase hermosillense para referirse que literal, todo esta bien)<br></em><strong>Tony<em> </em></strong>— Viene de Chihuahua, y le gusta grabar<br><strong>Dueño</strong> — Es que vienen desde Peñasco, Nogales, y a todos les ponen el mismo nombre.</p><p>Aquí es donde comprendí la mirada sospechosa del señor era por que los <strong>Longos</strong> son un secreto milenario en Hermosillo, y ellos son los originales. Varias personas de otras ciudades han tratado de copiar la receta. Despues hablar 5 minutos con el señor, me platico que le gustaba mucho Chihuahua (de donde soy originario) y que tenia muchas ganas de conocer las <strong>Barrancas del Cobre.</strong></p><h3>Tortillas gratis</h3><p>Cuando ya estábamos comiendo, se acerco el señor con un paquete de tortillas recién hechas y me dijo:</p><blockquote>Tenga mijo, para que siga presumiendo lo bueno que hay en Hermosillo.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*CUhlo6c3xrAQivA__QUIrg.gif" /><figcaption>Tortillas gratis en los Longos de Hermosillo</figcaption></figure><p>Oh si! Un buen paquete de tortillas solo por ser “<strong>youtuber</strong>”. No recuerdo el nombre del señor, pero me dio mucho gusto el haber conocido y comido en su local.</p><p>El video completo de lo que paso lo pueden encontrar en mi canal de youtube:</p><p><a href="https://www.youtube.com/user/chikinflue8?sub_confirmation=1">Click aquí para ir a mi canal</a></p><p>Gracias por leer esta historia llena de comida.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=760fd7ca4386" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Elixir Macros]]></title>
            <link>https://medium.com/hackernoon/understanding-elixir-macros-3464e141434c?source=rss-45f86dd59135------2</link>
            <guid isPermaLink="false">https://medium.com/p/3464e141434c</guid>
            <category><![CDATA[elixir-compiler]]></category>
            <category><![CDATA[macro]]></category>
            <category><![CDATA[elixir-ast]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[metaprogramming]]></category>
            <dc:creator><![CDATA[Jorge Chávez]]></dc:creator>
            <pubDate>Wed, 22 Nov 2017 22:57:41 GMT</pubDate>
            <atom:updated>2019-06-26T07:44:22.275Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHQF76ghMaYCWjshzAbtSA.jpeg" /></figure><p>Some time ago when I was studying <a href="https://hackernoon.com/tagged/elixir">Elixir</a> for the first time, I step out with a chapter in the documentation related with something called <strong>Macros. </strong>When I looked into this, some complicated terms started to show up and then I got scared. Things like:</p><ul><li>Metaprogramming</li><li>Abstract Syntax Three</li><li>Elixir AST</li><li>AST Literals</li><li>quote &amp; unquote</li></ul><p>In order to understand <strong>Macros</strong> we should have an idea of what these new technical terms means, and how they are related with Elixir.</p><h3><strong>Metaprogramming</strong></h3><p>Almost all blogs, books or videos will say something like<strong> <em>Code that writes code</em></strong><em>, </em>but I really liked the explanation that <a href="https://twitter.com/@iamvery">@iamvery</a> gave in one of his talks.</p><blockquote>Metaprogramming it’s just <a href="https://hackernoon.com/tagged/programming">programming</a> …</blockquote><blockquote>Programming is performing some work in some data …</blockquote><blockquote>Data are quantities on which operations are performed.</blockquote><p>So metaprogramming is like programming regularly. However the data where we perform operations can be whatever we want and not just the data structures that the language offers us. For example:</p><pre>2 + 3</pre><p>We know that ‘<strong>2<em>’</em></strong> and ‘<strong>3<em>’</em></strong> are data and ‘<strong><em>+’</em></strong> is the operation. However in metaprogramming ‘<strong>+</strong>’ is considered data too. We can manipulate that, have access to it and do whatever we want with it.</p><h3>Abstract Syntax Three</h3><p>When we make programs, the compiler in charge of transforming our code into <strong>bytecode </strong>needs to know the syntactic structure of our program, so the instructions can be performed as we defined. An abstract syntax three is that representation. Let see some really simple examples:</p><pre>2 + 3</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*OtrgCEM8Ju-puxCCvwKL0w.jpeg" /><figcaption>AST (Abstract Syntax Tree)</figcaption></figure><pre>2 + 3 == 5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*K5cAW7FetVGEMcvqvEANIg.jpeg" /><figcaption>AST (Abstract Syntax Tree)</figcaption></figure><h3>Elixir AST</h3><p>Elixir has it’s own way to represent AST, this is by converting almost everything to a three element tuple, just to recap a little bit on this, the Elixir compiler has some steps before it produces the <strong>.beam</strong> file, this is a really brief schema:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eqr7KBvtwWOfF8Twt8tO8Q.png" /><figcaption>Elixir compiler phases</figcaption></figure><p>When using macros we are scripting and producing Elixir AST, we won’t touch the <strong>Expand Macros</strong> and <strong>Erlang AST</strong>. But, it’s good to know that those steps are there.</p><h3>AST Literals</h3><p>Basic data structures like <strong>atom, integer, float, string, list </strong>and <strong>two element tuples </strong>are considered <em>literals. </em>It means that when the compiler process that, they are the the same in AST form. Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFeDLf1SmPlPwuteoG8MyQ.png" /><figcaption>AST Literal</figcaption></figure><h3><strong>3 element tuples</strong></h3><p>In the other hand, everything else is transformed to a three element tuple which has this basic structure:</p><p><strong>If it is a variable:</strong></p><p>First element is the variable <strong>name</strong>, second item is the <strong>metadata</strong> that it’s needed in order to this variable to exist (<em>normally empty</em>), and the last item is the <strong>context</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fK-XJpgKy-au9XX1IP2BAw.png" /><figcaption>Variable to Elixir AST</figcaption></figure><p><strong>If it is a call</strong></p><p>First element is the function <strong>name</strong>, second is just <strong>metadata</strong> (normally you won’t care about this), and last item are the <strong>arguments</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xJ8lw63DKJvKOqv74NBLpA.png" /><figcaption>Function call to Elixir AST</figcaption></figure><h3>quote</h3><p>Probably at this point you are thinking on quitting this article, AST are complicated nested structures. However, there are some helpful functions (actually they are Macros too) that can help us manage all this structures.</p><p>May be if you see an example of <em>quote, </em>you can understand what it is and how to use it:</p><pre>iex&gt; quote do: 2 + 3<br>{:+, [context: Elixir, import: Kernel], [2, 3]}</pre><p>we can use it inline or multiline as any other function or macro.</p><pre>iex(1)&gt; quote do<br>...(2)&gt;   if 2 + 3 == 5 do<br>...(3)&gt;     &quot;this is true&quot;<br>...(4)&gt;   else<br>...(5)&gt;     &quot;this is false&quot;<br>...(6)&gt;   end<br>...(7)&gt; end</pre><pre>{<strong>:if</strong>, [context: Elixir, import: Kernel],<br> [{<strong>:==</strong>, [context: Elixir, import: Kernel],<br>   [{<strong>:+</strong>, [context: Elixir, import: Kernel], [<strong>2</strong>, <strong>3</strong>]}, <strong>5</strong>]},<br>  [do: <strong>&quot;this is true&quot;</strong>, else: <strong>&quot;this is false&quot;</strong>]]}</pre><h3>unquote</h3><p>With unquote, the first thing that went to my mind was:</p><pre>iex(1)&gt; unquote do: {:+, [context: Elixir, import: Kernel], [2, 3]}<br>&quot;2 + 3&quot;</pre><p>but that is not how <em>unquote</em> works, let’s put it this way.</p><blockquote>quote and unquote are like “interpolated strings”</blockquote><p>Imagine the next code:</p><pre>iex(1)&gt; name = &quot;George&quot;<br><strong>&quot;George&quot;</strong><br>iex(2)&gt; &quot;Hello name&quot;<br><strong>&quot;Hello name&quot;</strong></pre><p>We need to <strong>evaluate</strong> the variable <strong>name, </strong>with strings we use<strong> #{}</strong></p><pre>iex(1)&gt; name = &quot;George&quot;<br><strong>&quot;George&quot;</strong><br>iex(2)&gt; &quot;Hello #{name}&quot;<br><strong>&quot;Hello George&quot;</strong></pre><p>With <strong>quoted expressions </strong>we use unquote.</p><pre>iex(1)&gt; number = 3<br>iex(2)&gt; quote do: 2 + unquote(number)<br>{<strong>:+</strong>, [context: Elixir, import: Kernel], [<strong>2</strong>, <strong>3</strong>]}</pre><h3><strong>Macros</strong></h3><p>Finally, the main idea of this article is to show you what Macros are but as I said in the beginning, there are some other concepts that we needed to understand in order to write Macros.</p><p><strong>Let’s define our first Macro:</strong></p><pre>defmodule MyMacros do</pre><pre><strong>  defmacro</strong> nice_print({:+, _meta, [lhs, rhs]}) do<br>    quote do<br>      IO.puts &quot;&quot;&quot;<br>        #{unquote(lhs)}<br>      + #{unquote(rhs)}<br>        --<br>        #{unquote(lhs+rhs)}<br>      &quot;&quot;&quot;<br>    end<br>  <strong>end</strong></pre><pre>end</pre><p>See how immediately we use quote, that’s because macros always return an Elixir AST, if you don’t you will get an error.</p><p><strong>Let’s use that Macro:</strong></p><pre>iex(1)&gt; require MyMacros<br>[MyMacros]<br>iex(2)&gt; MyMacros.nice_print 2 + 3<br>  2<br>+ 3<br>  --<br>  5</pre><p>Notice that our macro receives a three element tuple, that’s the Elixir AST of <strong>2 + 3 </strong>in this case and not the evaluation of that expression which is 5.<br>quote &amp; unquote are not the only tools that we have in order to manage Macros.</p><p><strong>Macro.to_string</strong></p><pre>iex(1)&gt; expression = quote do: 2 + 3<br>{:+, [context: Elixir, import: Kernel], [2, 3]}<br>iex(2)&gt; Macro.to_string(expression)<br><strong>“2 + 3”</strong></pre><p><strong>Code.eval_quoted</strong></p><pre>iex(1)&gt; expression = quote do: 2 + 3<br>{:+, [context: Elixir, import: Kernel], [2, 3]}<br>iex(2)&gt; Code.eval_quoted(expression)<br>{<strong>5</strong>, []}</pre><h3>Pros &amp; Cons</h3><p>In Chris McCord book “<strong>Metaprogramming Elixir</strong>” he has a section called Macro Rules, and his first rule is:</p><blockquote>Don’t Write Macros</blockquote><p>But why?, they are powerful and amazing, aren’t it?… I guess that’s the first reason, they are so powerful that you can get addicted to overuse them and by overuse them you code can look ugly and hard to read.</p><p>In one of the <strong>Jesse Anderson</strong> talks he show one really interesting quote:</p><blockquote>Code is read many more times than it is written, which means that the ultimate cost of code is in its reading.</blockquote><p>And for me that’s true, we don’t have to lose the idea to writing code beautiful and easy to read.</p><p>The benefits of using Macros are the metaprogramming part, we can do things that with normal functions we can’t, arguments in functions are evaluated before we can even use them in our function body, with Macros this is not the case since we only receive the Elixir AST version of our expressions.</p><p>Macros are also good for hiding boilerplate, imagine that you had to write this</p><pre>case(true) do<br>  x when x in [false, nil] -&gt;<br>    false<br>  _ -&gt;<br>    true<br>end</pre><p>instead of this</p><pre>if true do<br>  true<br>else<br>  false<br>end</pre><p>So, with macros we have this possibility of hiding code by generating it inside the macro.</p><p>Hopefully you get the idea of what Macros are and how to use them, for me this topic is really awesome since this is the first time I do metaprogramming. Elixir make it easy and maintainable to read. If you have any question here is my twitter <a href="https://twitter.com/JorgeChavz">@jorgechavz</a>. Thanks!</p><h3><strong>Resources</strong></h3><p>Macros don’t stop here, there is so many information out there related with this topic, I will leave some links here that really helped me to understand this interesting topic.</p><p><strong>The minimum knowledge you need to start Metaprogramming in Elixir<br></strong><a href="https://dockyard.com/blog/2016/08/16/the-minumum-knowledge-you-need-to-start-metaprogramming-in-elixir">https://dockyard.com/blog/2016/08/16/the-minumum-knowledge-you-need-to-start-metaprogramming-in-elixir</a></p><p><strong>Don’t Write Macros But Do Learn How They Work — Jesse Anderson </strong><a href="https://www.youtube.com/watch?v=Bo48sQDb-hk&amp;t=1802s">https://www.youtube.com/watch?v=Bo48sQDb-hk</a></p><p><strong>Write less, do more (and have fun!) with elixir macros<br>Video:</strong> <a href="https://www.youtube.com/watch?v=mkoYqXdXl5Y">https://www.youtube.com/watch?v=mkoYqXdXl5Y</a><br><strong>Slides:</strong> <a href="http://slides.com/chrismccord/elixir-macros#/">http://slides.com/chrismccord/elixir-macros#/</a></p><p><strong>Understanding Elixir Macros</strong><br><a href="http://theerlangelist.com/article/macros_1">http://theerlangelist.com/article/macros_1</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3464e141434c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/understanding-elixir-macros-3464e141434c">Understanding Elixir Macros</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sobreviviendo a un Internship en Nearsoft (ilustrado con gifs)]]></title>
            <link>https://medium.com/nearsoft-jobs/sobreviviendo-a-un-internship-en-nearsoft-ilustrado-con-gifs-3354057bc104?source=rss-45f86dd59135------2</link>
            <guid isPermaLink="false">https://medium.com/p/3354057bc104</guid>
            <category><![CDATA[nearsoft]]></category>
            <category><![CDATA[first-job]]></category>
            <category><![CDATA[internships]]></category>
            <dc:creator><![CDATA[Jorge Chávez]]></dc:creator>
            <pubDate>Fri, 24 Mar 2017 16:31:22 GMT</pubDate>
            <atom:updated>2017-03-27T22:52:19.568Z</atom:updated>
            <content:encoded><![CDATA[<p>Mucho se rumora que un Internship es feo y aburrido, lo cual hace que muchas personas rechacen oportunidades de crecimiento profesional y social. <em>Yo fui un sobreviviente de unos de los Internships más difíciles que la humanidad haya conocido</em> (dígase con voz exagerada). Hablo de <strong>Nearsoft Academy.</strong></p><p>Se trata de un programa que dura aproximadamente 6 meses, donde se tienen varias etapas para que te prepares y ya no seas un niño recién salido de la universidad con cara de bebé y seas un hombre grande y fuerte, preparado para trabajar con equipos profesionales y clientes reconocidos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*xob_ZDTC69WK7jfyAuMj1Q.gif" /></figure><p>Las etapas son:</p><ol><li>Reset</li><li>Building something from scratch</li><li>Open Source</li><li>Get a job</li></ol><blockquote>Nota: Probablemente para estas fechas el plan de Nearsoft Academy ya haya cambiado un poco</blockquote><p>El primer día creo que es de los más interesantes. Pasas por los pasillos de la oficina y te das cuenta que algo anda mal: ¡Un montón de gente <strong>feliz</strong> te saluda como si te conociera desde hace muchos años! Algo anda mal ¿Verdad? La gente no puede ser feliz mientras trabaja.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*SNnnAN5EYWZuIynw0pRP8g.gif" /></figure><p>Además, Nearsoft te da hospedaje por un tiempo en la ciudad de Hermosillo, Sonora. Yo vivía con 3 personas más que también eran Interns.</p><p>El primer mes fue como un <strong>reset</strong> a mi cerebro. Vi muchos videos sobre innovación, y entre otras cosas, leí el libro que probablemente toda persona que tiene en mente ser un desarrollador debería ya de haber leído:<strong> ‘Pragmatic programmer’. </strong>Este libro va rompiendo cada uno de los puntos más importantes a considerar en el desarrollo de software; mi capítulo preferido fue ‘<strong>Broken window’.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*j_FIfUPTmHHwpviG2xJY8A.gif" /></figure><p>La intención de Nearsoft al mandarte a Hermosillo es para que conozcas a todos los de la oficina de Hermosillo. Tú no te tienes que preocupar por nada en la vida, tendrás casa, comida, y mucho que hacer dentro de ese mes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*Mjpt0QLY7Vwa8V2ygpUTGA.gif" /></figure><p>Vivir junto con otras 3 personas fue un poco difícil al principio, ya que no conoces bien cuáles son sus costumbres, pero con el tiempo te irás adaptando (creo).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*nKF3RPDhDGK_-n3oUZHkeQ.gif" /></figure><p><strong>Open Source</strong> fue un término que no tenía claro hasta que me tocó colaborar en un proyecto grande. En resumen llegan y te dicen:</p><blockquote>Bienvenido a las grandes ligas, donde colaborarás en proyectos Open Source reconocidos. Tu misión este mes será tener por lo menos un commit en algún repositorio grande.</blockquote><p>Al inicio las posibilidades son nulas, pero una vez que te metes de lleno te das cuenta que todo es posible. A mí me tocó trabajar con <a href="https://github.com/bower/bower/pull/2225"><strong>Bower</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3aTFld1WZ2rlEJRbDg6fQg.png" /><figcaption>Bower.io</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VhWmcRhSZ-Wi4PK_r1hxag.png" /><figcaption>Bower.io</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*pM_bDtM7q3VRVwWQRjhrEA.gif" /><figcaption>Esta fue mi expresión cuando me aceptaron mi Pull Request</figcaption></figure><p>Pero de todo el Internship, creo que la etapa que más me gustó y a la cual sobreviví fue la de <strong>Building something from scratch.</strong></p><blockquote>Jóvenes, hoy van a reinventar la manera en que las oficinas de Nearsoft estarán en comunicación, van a crear un <strong>PORTAL</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*bGg2_JcOyWsY-QNutsnFyA.gif" /><figcaption>wait what?</figcaption></figure><p>Cuando entre en la oficina de Chihuahua, había un letrero enorme que decía <strong>Welcome to the magic, </strong>pero jamás lo vi como algo serio hasta que me dijeron eso.</p><p>Aquí una serie de fotos de los inicios del <strong>PORTAL</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QjHRKfFkmEruRq3c73lEog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h8Ookhj8EPqD0IeYCYE1kA.png" /><figcaption>Nuestro bebe</figcaption></figure><p>Tres cosas que podría recomendar para sobrevivir a un Internship:</p><ul><li><em>Enjoy .-</em> Disfruta cada una de las oportunidades, <strong>sin pensar si te van a contratar o no.</strong></li><li><em>Learn .-</em> Aprende de todos. Cada persona con la que te encuentres puede enseñarte un poco de su experiencia. <strong>Pregunta sin pensar si te van a contratar o no.</strong></li><li><em>Speak up .-</em> ¿Te ha pasado que tienes algo que decir, y existe un ser interior que te impide sacar tus ideas, ya sea por vergüenza o por miedo a que te critiquen, y tiempo después te das cuenta que perdiste una oportunidad? Pues olvídate de eso y sé tan expresivo como puedas, si te gusta di que te gusta, si no te gusta, pues di que no te gusta. <strong>Habla sin pensar si te van a contratar o no.</strong></li><li><em>Listen .-</em> Cuando alguien más dé su opinión, escúchala pensando que esta persona puede tener la solución a tus problemas. <strong>Escucha sin pensar si te van a contratar o no.</strong></li></ul><p>Al final del programa sólo una cosa pudo haber pasado:</p><blockquote>Haber ganado más experiencia que la que pudiste haber tenido en todos tus años de carrera.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*lbN0dBW_8njB5BRHqZjRoQ.gif" /></figure><h4>Jorge Chávez, Software Engineer @Nearsoft</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3354057bc104" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nearsoft-jobs/sobreviviendo-a-un-internship-en-nearsoft-ilustrado-con-gifs-3354057bc104">Sobreviviendo a un Internship en Nearsoft (ilustrado con gifs)</a> was originally published in <a href="https://medium.com/nearsoft-jobs">Nearsoft Jobs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to access to the Back and Front camera from Swift]]></title>
            <link>https://medium.com/@jorgech/how-to-access-to-the-back-and-front-camera-from-swift-accf5adfc37f?source=rss-45f86dd59135------2</link>
            <guid isPermaLink="false">https://medium.com/p/accf5adfc37f</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[tutotial]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Jorge Chávez]]></dc:creator>
            <pubDate>Fri, 05 Feb 2016 23:07:05 GMT</pubDate>
            <atom:updated>2018-09-21T08:26:51.918Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to access to the Back and Front camera in Swift</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nf3jdMskDagPcuwJhbDRnQ.jpeg" /></figure><p>Hi there, this is one of these tutorials that at the end of it you said ‘Thank god I found this’. I’m a noob in iOS development, so when I was trying to learn how to manage the camera on swift I realice that it’s hard to find something good without die trying to do it.</p><p>So, as a superhero of the noobs I will try to explain this in an easy way, let’s get started.</p><p>Things you will need to understand before you touch the keyboard and start coding like crazy:</p><ul><li><em>device</em>: Every iPhone or iPad has 3 types of devices, here it’s an image of the two <strong>devices, </strong>third one is the mic<strong>.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5sB4THXIMKmkz9iJuPlt0g.png" /></figure><ul><li><em>session</em>: It’s something that is in charge to control everything related between the <strong>device </strong>and the <strong>preview layer, </strong>we have to provide two things to this session, an input and an output.</li><li><em>input</em>: it’s a wrapper of the device. I mean, we have to insert the device into the input, hopefully with the code you can catch what I’m trying to say.</li><li><em>output:</em> The output is the variable in charge of configure some things like, what kind of <em>codec</em> are we using, the quality of the video we want and other stuff.</li><li><em>preview layer</em>: Basically this is the layer where we are going to preview all the frames that the device capture (back and front camera).</li></ul><p>What I’m trying to say is this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9vnANUwCaC_tsTEZkDuyQ.png" /></figure><p>Well, If you didn’t understand my weird explanation let’s start with the fun and understandable part, <strong>code code code!</strong></p><h4>Create new project.</h4><p>At this point I guess you should know how to set the view and things like that, but if you are poor guy who all your life have lived in a cave then I will explain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*vmZ0hBAIUcd6CyXVtYhtUA.png" /><figcaption>Select Single View Application</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*CyJ958wFgVgaBuppHgbcCQ.png" /><figcaption>Name your app.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01jCf-bP-bvrb5-B18WIPg.png" /><figcaption>Search the View from the Object library and drag it to the default View Controller you already have.</figcaption></figure><h4>Give some constraints to the UIView</h4><p>Depending on how would you like to show the camera, you will need to give a size and position to this new UIView, so in my case I will do the UIView fullscreen, here is how I did it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*tVBvIntLtp3-HEpKJ1EhKw.png" /></figure><p>Add more constraints</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*ChfqHYKhAmZ4gLZ8lwlNIA.png" /></figure><p>Finally update the frames</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*YeOz1kftylSzNyjIN2L26w.png" /></figure><p>We are done with our basic interface.</p><h4>Code code code code!</h4><p>Create an outlet for the UIView we just add to the <em>ViewController.swift</em></p><pre>@IBOutlet weak var cameraView: UIView!</pre><p>In order to use all the type of variable and methods we need, we will need a default library call <strong>AVFoundation, </strong>so import it.</p><pre>import AVFoundation</pre><p>Then we have to declare the variables we will use.</p><pre>var session: AVCaptureSession?</pre><pre>var input: AVCaptureDeviceInput?</pre><pre>var output: AVCaptureStillImageOutput?</pre><pre>var previewLayer: AVCaptureVideoPreviewLayer?</pre><p>Remember that we need a <strong>device?, </strong>let’s build a function that return a device we want.</p><pre>//Get the device (Front or Back)</pre><pre>func getDevice(position: AVCaptureDevicePosition) -&gt; AVCaptureDevice? {</pre><pre>    let devices: NSArray = AVCaptureDevice.devices();</pre><pre>    for de in devices {</pre><pre>        let deviceConverted = de as! AVCaptureDevice</pre><pre>        if(deviceConverted.position == position){</pre><pre>           return deviceConverted</pre><pre>        }</pre><pre>    }</pre><pre>   return nil</pre><pre>}</pre><p>As you can see, this function accept an argument of type AVCaptureDevicePosition and returns a AVCaptureDevice, there are just two positions we are going to use in this tutorial:</p><ul><li>AVCaptureDeviePosition<strong>.Front</strong></li><li>AVCaptureDeviePosition<strong>.Back</strong></li></ul><p>So if we want to use this function we just do it like:</p><pre>let camera = getDevice(.Back)</pre><pre>//or</pre><pre>let camera = getDevice(.Front)</pre><p>Now we need to add this <strong>device</strong> to the <strong>input</strong></p><pre>do {</pre><pre>   input = try AVCaptureDeviceInput(device: camera)</pre><pre>} catch let error as NSError {</pre><pre>   print(error)</pre><pre>   input = nil</pre><pre>}</pre><p>Before we add the <strong>input</strong> to the <strong>session</strong> we can use the <em>canAddInput() </em>method to verify if this input can be used into the session.</p><pre>if(session?.canAddInput(device) == true){<br>   <br>   //Add the input to the session</pre><pre><br>session?.addInput(input)</pre><pre>}</pre><p>Before we add the output to the session we can configure some settings like the <em>codec</em> we want to use or the <em>quality</em>, I’m just going to add a codec for testing purposes but this is not necessary.</p><pre>output?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]</pre><p>Then add the <strong>output </strong>to the <strong>session </strong>in the same way we added the input</p><pre>if(session?.canAddOutput(output) == true){</pre><pre>   session?.addOutput(output)</pre><pre>}</pre><p>We are done with the <strong>input</strong> and <strong>output, </strong>now we have to take care of the <strong>previewLayer.</strong></p><p>First we need to add the session to this <strong>previewLayer</strong></p><pre>previewLayer = AVCaptureVideoPreviewLayer(session: session)</pre><h4>Optional</h4><p>We can configure things in the previewLayer like, aspect fill, video orientation, etc.</p><pre>previewLayer?.videoGravity = AVLayerVideoGravityResizeAspectFill</pre><pre>previewLayer?.connection.videoOrientation = AVCaptureVideoOrientation.Portrait</pre><p>Now we have to add a frame to the <strong>previewLayer </strong>and add the layer to the UIView we created at the beginning (cameraView).</p><pre>//previewLayer will have the same size and position of the cameraView</pre><pre>previewLayer?.frame = cameraView.bounds</pre><pre>cameraView.layer.addSublayer(previewLayer!)</pre><p>Finally we just have to start running the <strong>session</strong></p><pre>session?.startRunning()</pre><h4>Done</h4><blockquote>Note: You will be able to see the result if you run the app in an actual device.</blockquote><h4>Final code</h4><p>This is the final code</p><pre>import UIKit<br>import AVFoundation</pre><pre>class ViewController: UIViewController {</pre><pre>   @IBOutlet weak var cameraPreview: UIView!</pre><pre>   var session: AVCaptureSession?</pre><pre>   var input: AVCaptureDeviceInput?</pre><pre>   var output: AVCaptureStillImageOutput?</pre><pre>   var previewLayer: AVCaptureVideoPreviewLayer?</pre><pre>override func viewDidLoad() {</pre><pre>   super.viewDidLoad()</pre><pre>   //Initialize session an output variables this is necessary<br>   session = AVCaptureSession()</pre><pre>   output = AVCaptureStillImageOutput()</pre><pre>   let camera = getDevice(.Back)</pre><pre>   do {</pre><pre>      input = try AVCaptureDeviceInput(device: camera)</pre><pre>   } catch let error as NSError {</pre><pre>      print(error)</pre><pre>      input = nil</pre><pre>   }</pre><pre>   if(session?.canAddInput(input) == true){</pre><pre>      session?.addInput(input)</pre><pre>      output?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]</pre><pre>      if(session?.canAddOutput(output) == true){</pre><pre>         session?.addOutput(output)</pre><pre>         previewLayer = AVCaptureVideoPreviewLayer(session: session)</pre><pre>         previewLayer?.videoGravity = AVLayerVideoGravityResizeAspectFill</pre><pre>         previewLayer?.connection.videoOrientation = AVCaptureVideoOrientation.Portrait</pre><pre>         previewLayer?.frame = cameraPreview.bounds</pre><pre>         cameraPreview.layer.addSublayer(previewLayer!)</pre><pre>         session?.startRunning()</pre><pre>      }</pre><pre>   }</pre><pre>}</pre><pre>//Get the device (Front or Back)</pre><pre>func getDevice(position: AVCaptureDevicePosition) -&gt; AVCaptureDevice? {</pre><pre>   let devices: NSArray = AVCaptureDevice.devices();</pre><pre>   for de in devices {</pre><pre>      let deviceConverted = de as! AVCaptureDevice</pre><pre>      if(deviceConverted.position == position){</pre><pre>         return deviceConverted</pre><pre>      }</pre><pre>   }</pre><pre>   return nil</pre><pre>}</pre><pre>}</pre><p>Build and run the app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=accf5adfc37f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>