<br />
<b>Deprecated</b>:  The each() function is deprecated. This message will be suppressed on further calls in <b>/home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php</b> on line <b>456</b><br />
{"version":"https://jsonfeed.org/version/1","title":"Roberto Vázquez González","description":"Roberto Vázquez González Personal Web Site","home_page_url":"https://robertovg.com","feed_url":"https:/robertovg.com/feed.json","user_comment":"This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL — https:/robertovg.com/feed.json — and add it your reader.","favicon":"https:/robertovg.com/icon.png","author":{"name":"Roberto Vázquez González"},"items":[{"id":"https:/robertovg.com/blog/here-my-uses-page","url":"https:/robertovg.com/blog/here-my-uses-page","title":"Here my \"Uses Page\"","date_published":"2020-01-22T00:00:00.000Z","date_modified":"2020-01-22T00:00:00.000Z","content_html":"<h2>The initiative</h2>\n<p>This Monday (2020-01-20), listening to <a href=\"https://syntax.fm/show/215/hasty-treat-picking-the-stack-for-uses-tech-gatsby-react-context-styled-components\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Syntax.fm</a> I hear about the <a href=\"https://wesbos.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Wes Bos</a>' <a href=\"https://uses.tech/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">uses.tech</a> initiative, something I see more and more in developers profiles and I found very useful to get good ideas of tools people found in their daily work.</p>\n<h2>Why I joined to the idea</h2>\n<p>I play the guitar since I was 10 years old, and in bands from the '00s, and I remember copying our favourites bands gears and configurations in a page called <a href=\"https://web.archive.org/web/20170420231024/https://www.guitar.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Guitargeek</a> (no longer online) when I was finding my sound.</p>\n<p>So when I saw the initiative created, I got in love with the idea to apply it to our tools as developers, and I found both <code class=\"language-text\">uses.tech</code> and each <code class=\"language-text\">/uses</code> pages super interesting to see what people are using and get improvement ideas.</p>\n<h2>Here you have mine</h2>\n<p>So I created my <a href=\"/uses/\">/uses</a>, adding not only \"Hardware\" but the pieces of software and technology I use daily and after years of usage, I found it worth to keep in my workflow.</p>\n<p>Feel free to visit <a href=\"/uses/\">it and hopefully get some ideas</a></p>"},{"id":"https:/robertovg.com/blog/what-you-need-to-successfully-work-remotely","url":"https:/robertovg.com/blog/what-you-need-to-successfully-work-remotely","title":"What you need to successfully work remotely","date_published":"2019-07-25T00:00:00.000Z","date_modified":"2019-07-25T00:00:00.000Z","content_html":"<h2>Freelancers Day</h2>\n<p>Last July 4th, our friends from <a href=\"http://workincompany.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Coworking Company</a> got the idea to celebrate <a href=\"http://workincompany.com/freelancersday2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Freelancers Day</a> in Spain with the coordination of the coworking Spaces who wanted to join us.</p>\n<h2>Space Context</h2>\n<p>As you may know, I'm the co-founder of the coworking space where I work every day, which is called <a href=\"https://corkerspace.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Corker Space</a>, space I run with my partner <a href=\"https://nuriaperezdesign.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Nuria Pérez</a>.</p>\n<p>She already got the idea to arrange talks in the space, and we found a good idea to start those talks with the opportunity which <a href=\"http://www.jaimearanda.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jaime Aranda</a> offered us by joining this initiative.</p>\n<p>Our space is a small coworking, and Cádiz is a not a startup area, but we wanted to shake the community and find out as good talent as possible to make the event. And we really found it, super close from us.</p>\n<h2>The Conference</h2>\n<p>We luckily knew some of the speakers but also we found in the way awesome freelancers who also joined us, creating an amazing and interesting day, where we learnt a lot from each.</p>\n<p>The list of speakers who joined as to Freelancers day (by schedule order) where:</p>\n<ul>\n<li><a href=\"https://bluedreams.blue/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Nuno Branco</a>(Communications Coach) with his The Art of Conscious Negotiation, essential advice in modern times to arrive at conscious business goals.</li>\n<li><a href=\"https://www.borjagiron.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Borja Girón</a>(SEO Consultant) who explained how his making his living from his blog page and how to achieve it in 7 steps.</li>\n<li><a href=\"https://petereynolds.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Pete Reynolds</a> (Content Specialist) teaches all of us a super smart and simple strategy to get 10,000 visitors to your new website and kickstart your SEO!</li>\n<li><a href=\"https://thebranx.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ines, Jesús Dani y Damián from The Branx</a> explained us a new concept (at least for me), the Brand Experience and how the successfully apply to their clients.</li>\n<li><a href=\"http://www.cadifornia.cc\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Miguel Navarro Cuevas</a>, lastly but not with less importance, walked through how much important is to set up a correct Technology RoadMap during project implementations.</li>\n</ul>\n<p>Such a big level 🤩!</p>\n<h2>My talk</h2>\n<p>My talk was just about what I learned and I think anyone needs to successfully work remotely, a set of tips I apply after having polish my workflow during +5 years I already spend working remotely.</p>\n<p>So here the <a href=\"https://docs.google.com/presentation/d/16ky7MyQKEFJ651CoA9mOJQCo1fngvw9ri1XNaWwVk_8/edit?usp=sharing\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google Drive Slides</a> if anyone finds them interesting.</p>\n<h2>Conclusion</h2>\n<p>Even with the excitement which produces to talk in front of people, it was super nice to do it, get the feedback and hopefully teach something to someone.</p>\n<p>Additionally, was great to connect and start creating a community with other freelancers who work in your local area.\nSuch events, awake your brain and boost your energies to start or push your projects, share ideas with other professionals to validate or iterate over them.</p>\n<p>I think we all <strong>grow by sharing!</strong></p>"},{"id":"https:/robertovg.com/blog/writing-scripts-as-frontend-with-es6-and-jest","url":"https:/robertovg.com/blog/writing-scripts-as-frontend-with-es6-and-jest","title":"Writing Scripts As Frontend With Es6 And Jest","date_published":"2019-07-01T00:00:00.000Z","date_modified":"2019-07-01T00:00:00.000Z","content_html":"<h2>Context</h2>\n<p>As frontend developer when I want to extract information from a website to then inject into a document (usually markdown one), I do a bit of <code class=\"language-text\">web scraping</code> to understand how to get the data with the <a href=\"https://www.w3schools.com/cssref/css_selectors.asp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CSS selectors</a> (e.g. <code class=\"language-text\">classNames</code>) of the elements I need from the webpage, and then I execute a simple script in the console like the following one:</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token function\">copy</span><span class=\"token punctuation\">(</span>\n  Array<span class=\"token punctuation\">.</span><span class=\"token function\">from</span><span class=\"token punctuation\">(</span>document<span class=\"token punctuation\">.</span><span class=\"token function\">querySelectorAll</span><span class=\"token punctuation\">(</span><span class=\"token string\">'.row-title'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">e</span> <span class=\"token operator\">=></span> e<span class=\"token punctuation\">.</span>textContent<span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">.</span><span class=\"token function\">join</span><span class=\"token punctuation\">(</span><span class=\"token string\">';;'</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>Then in <a href=\"https://www.sublimetext.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sublime</a> or <a href=\"https://code.visualstudio.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">VS Code</a>, I paste them using those junctions chars ';;' and multi cursor capabilities of those editors to edit them as I want to give it the markdown format I need.</p>\n<p>This time I wanted to extract the technologies of webpages with links to them to be saved in a document. But wappalyzer offers <a href=\"https://www.wappalyzer.com/download\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">browser extensions</a> and we can't access to the popover content of the browser extension from the console, so no possibility to extract the information from console script as I use to do.</p>\n<h2>Mission</h2>\n<p>I found this <a href=\"https://www.npmjs.com/package/wappalyzer\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">npm node module</a>, and it opened my mind on how was the best way to use it as end-user to get the technologies used on websites and paste it into the clipboard.</p>\n<p>I've created a lot of <code class=\"language-text\">.sh</code> in my career to automate dev processes, deployments, repeatable tasks using sometimes even <a href=\"https://en.wikipedia.org/wiki/AppleScript\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">AppleScript</a> , but surprisingly for me, I never thought to use my web developer toolset (javascript and npm in this case) to write \"desktop scripts\". So <code class=\"language-text\">npm scripts</code> and this <code class=\"language-text\">wappalyzer node module</code> was a good start to build something to be executed with <a href=\"https://www.npmjs.com/package/npx\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">npx</a>.</p>\n<blockquote>\n<p><strong>I wanted to write a script to extract the technologies of any page with npm to be executed through npx and get the output from wappalyzer to the clipboard in markdown.</strong></p>\n</blockquote>\n<p>So also the point of this \"exercise\" was not only to resolve it but with some restrictions to learn something in the way.</p>\n<ul>\n<li>I wanted unit tests.</li>\n<li>I wanted to use modules and last es6 syntax not just (it was executed inside node, so I knew it was going to be a pain point).</li>\n<li>Register it to npm register so anyone can use it in the future or by anyone else.</li>\n<li>And of course publish it in Github, so maybe someone can use it or make modifications to it in the future.</li>\n</ul>\n<h2>Toolset and Planning</h2>\n<p>I found this article<a href=\"https://blog.npmjs.org/post/118810260230/building-a-simple-command-line-tool-with-npm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\"Building a simple command line tool with npm\"</a>, but was not giving me es6 modules, babel, eslint and jest. I learned how to expose npm scripts through <code class=\"language-text\">bin</code> property in <code class=\"language-text\">package.json</code>. Those scripts we link will need to have a <a href=\"https://en.wikipedia.org/wiki/Shebang_(Unix)\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">Shebang</code></a> to be executed as node scripts.</p>\n<p>Then I knew to use <code class=\"language-text\">last es6 syntax</code>, <code class=\"language-text\">node modules imports</code>, <code class=\"language-text\">prettier</code>, ... I needed a tool to compile the <code class=\"language-text\">js</code> and my first choose was <a href=\"https://webpack.js.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">webpack</code></a>, as I use to do in my web projects. But <code class=\"language-text\">webpack</code> it's created to build web outputs and I had to hack it to don't expect HTML, CSS and accept scripts with <code class=\"language-text\">Shebang</code> in the <code class=\"language-text\">.js</code> so I finally decided to use simple <code class=\"language-text\">babel-cli</code>.</p>\n<p><code class=\"language-text\">Jest</code>, was a pretty clear decision for the unit tests, without any additional configuration, as it's super valid to test functions and we don't need anything specific here like <a href=\"https://airbnb.io/enzyme/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">enzyme</a> or <a href=\"https://testing-library.com/react\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React Testing Library</a>.</p>\n<p>The last piece of the puzzle was how to copy things on the clipboard of the machine, as I know in the browser console there is this <a href=\"https://css-tricks.com/can-copy-console/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">copy</code></a> but was not available within <code class=\"language-text\">node</code>. But again a ready to use node module was there to do the job (<a href=\"https://github.com/sindresorhus/clipboardy\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">clipboardy</code></a>)</p>\n<h2>Implementation</h2>\n<p>So once I was clear how to build the project, I just needed to start.</p>\n<h3>Project Init</h3>\n<p>Just created a simple and empty new folder <code class=\"language-text\">wappalyzer-to-md</code> and npm <code class=\"language-text\">npm init</code> did the rest.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">mkdir</span> wappalyzer-to-md<span class=\"token punctuation\">;</span> <span class=\"token builtin class-name\">cd</span> wappalyzer-to-md<span class=\"token punctuation\">;</span> <span class=\"token function\">npm</span> init</code></pre>\n      </div>\n<h3>Configuration <code class=\"language-text\">.babelrc</code> and <code class=\"language-text\">eslint</code></h3>\n<p>So now let's add the <code class=\"language-text\">.babelrc</code> and <code class=\"language-text\">eslint</code> configuration:</p>\n<p>First we install what we need for our configuration:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">npm</span> <span class=\"token function\">install</span> --save-dev @babel/core @babel/cli @babel/preset-env @babel/node</code></pre>\n      </div>\n<p>And the <code class=\"language-text\">.babelrc</code> file looks like that:</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token punctuation\">{</span>\n  <span class=\"token string\">\"presets\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"@babel/preset-env\"</span><span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span></code></pre>\n      </div>\n<p>Then the eslint ones, as I'm unable to work nowadays without eslint + prettier. So again with dev dependencies:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">npm</span> <span class=\"token function\">install</span> --save-dev babel-eslint eslint eslint-config-node eslint-config-prettier eslint-plugin-prettier babel-loader babel-polyfill</code></pre>\n      </div>\n<p>And again the configuration file (<code class=\"language-text\">.eslintrc</code>) was something like that, after some specific changes for this project:</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token punctuation\">{</span>\n  <span class=\"token string\">\"extends\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"node\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"prettier\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n  <span class=\"token string\">\"parser\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"babel-eslint\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token string\">\"parserOptions\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token string\">\"ecmaVersion\"</span><span class=\"token operator\">:</span> <span class=\"token number\">8</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"ecmaFeatures\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token string\">\"experimentalObjectRestSpread\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span>\n      <span class=\"token string\">\"impliedStrict\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span>\n      <span class=\"token string\">\"classes\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span>\n    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token string\">\"env\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token string\">\"es6\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"browser\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"jasmine\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"node\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"commonjs\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"jest\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token string\">\"rules\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token string\">\"no-unused-vars\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n      <span class=\"token number\">1</span><span class=\"token punctuation\">,</span>\n      <span class=\"token punctuation\">{</span>\n        <span class=\"token string\">\"ignoreRestSiblings\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span>\n        <span class=\"token string\">\"argsIgnorePattern\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"^ignore\"</span><span class=\"token punctuation\">,</span>\n        <span class=\"token string\">\"varsIgnorePattern\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"^ignore\"</span><span class=\"token punctuation\">,</span>\n        <span class=\"token string\">\"caughtErrorsIgnorePattern\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"^ignore\"</span>\n      <span class=\"token punctuation\">}</span>\n    <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"arrow-body-style\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token number\">2</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"as-needed\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"no-param-reassign\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n      <span class=\"token number\">2</span><span class=\"token punctuation\">,</span>\n      <span class=\"token punctuation\">{</span>\n        <span class=\"token string\">\"props\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span>\n      <span class=\"token punctuation\">}</span>\n    <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"no-console\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"import\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"func-names\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"space-before-function-paren\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"max-len\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"no_underscore-dangle\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"consistent-return\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"comma-dangle\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"import/prefer-default-export\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"array-bracket-spacing\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"space-in-parens\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"prefer-arrow-callback\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"no-plusplus\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"no-use-before-define\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"global-require\"</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"import/no-commonjs\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"import/no-extraneous-dependencies\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n      <span class=\"token string\">\"error\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token punctuation\">{</span>\n        <span class=\"token string\">\"devDependencies\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span>\n      <span class=\"token punctuation\">}</span>\n    <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"no-process-exit\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token string\">\"plugins\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"prettier\"</span><span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span></code></pre>\n      </div>\n<h3>Libraries to use and package setup <code class=\"language-text\">npm build</code></h3>\n<p>Then we needed to be able to use <code class=\"language-text\">babel</code> transformation process to build the ./src, and connect it in the <code class=\"language-text\">bin</code> script.</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token punctuation\">{</span>\n  <span class=\"token comment\">// ...</span>\n  <span class=\"token string\">\"scripts\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token string\">\"build\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"babel src --out-dir dist\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"test\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"jest --watchAll\"</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token comment\">// ...</span>\n  <span class=\"token string\">\"bin\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token string\">\"wappalyzer-to-md\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"./dist/cli.js\"</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token comment\">// ...</span>\n<span class=\"token punctuation\">}</span></code></pre>\n      </div>\n<p>With the previous configuration, we are able to execute the <code class=\"language-text\">babel</code> compiled sources. And we can update them each time we build the project.</p>\n<p>So let's create also our first file which will be our start point of the script <code class=\"language-text\">/src/cli.js</code>:</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\">console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'-- Starting Execution --'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">const</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">,</span> url<span class=\"token punctuation\">]</span> <span class=\"token operator\">=</span> process<span class=\"token punctuation\">.</span>argv<span class=\"token punctuation\">;</span>\n\n<span class=\"token punctuation\">(</span><span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">try</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// 1.- We need to validate params</span>\n    <span class=\"token comment\">// 2.- Make the call to the sever side to check</span>\n    <span class=\"token comment\">// 3.- Transform it to markdown</span>\n    <span class=\"token comment\">// 4.- Copy it to the clipboard</span>\n\n    console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">' -- 📋 Markdown Copied 📋 -- '</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span> <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span>e<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    console<span class=\"token punctuation\">.</span><span class=\"token function\">error</span><span class=\"token punctuation\">(</span><span class=\"token string\">' --💥 Something when wrong 💥-- '</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    console<span class=\"token punctuation\">.</span><span class=\"token function\">error</span><span class=\"token punctuation\">(</span>e<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span> <span class=\"token keyword\">finally</span> <span class=\"token punctuation\">{</span>\n    process<span class=\"token punctuation\">.</span><span class=\"token function\">exit</span><span class=\"token punctuation\">(</span><span class=\"token number\">0</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>We are not only creating the file but defining the \"script workflow\" with it splitting it to be able to work with tests in the correct way 💁‍.</p>\n<h3>Executing the project with <code class=\"language-text\">npm link</code></h3>\n<p><a href=\"https://docs.npmjs.com/cli/link\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">npm link</code></a> it's a great way to test and use <code class=\"language-text\">npm modules</code> before registering them.</p>\n<p>To execute the previous example we just need to execute in the console in our project folder.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">npm</span> <span class=\"token function\">link</span></code></pre>\n      </div>\n<p>Then we are able to execute it with:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\">npx wappalyzer-to-md</code></pre>\n      </div>\n<p>And get the console output in the console.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\">\n      <pre class=\"language-text\"><code class=\"language-text\">-- Starting Execution --\n-- 📋 Markdown Copied 📋 --</code></pre>\n      </div>\n<h3>Jest setup <code class=\"language-text\">npm test</code></h3>\n<p>Let's just add the uni test configuration to be able to implement each part of the workflow described previously with unit test. For it let's install jest configuration</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">npm</span> <span class=\"token function\">install</span> --save-dev jest babel-jest</code></pre>\n      </div>\n<p>And having the <code class=\"language-text\">jest --watchAll</code> in the <code class=\"language-text\">test</code> script made me able to execute <code class=\"language-text\">npm test</code></p>\n<p>I got these issues: <code class=\"language-text\">ReferenceError: regeneratorRuntime is not defined</code> described <a href=\"https://github.com/babel/babel/issues/5085\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">here</a> and I got it resolved by specifying the target for babel in the <code class=\"language-text\">.babelrc</code>.</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token punctuation\">{</span>\n  <span class=\"token string\">\"presets\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n    <span class=\"token punctuation\">[</span>\n      <span class=\"token string\">\"@babel/preset-env\"</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span>\n        <span class=\"token string\">\"targets\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n          <span class=\"token string\">\"node\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"current\"</span>\n        <span class=\"token punctuation\">}</span>\n      <span class=\"token punctuation\">}</span>\n    <span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span></code></pre>\n      </div>\n<p>Then I was able to start coding with <code class=\"language-text\">npm test</code> running as usual with any <code class=\"language-text\">js</code> project.</p>\n<h3>Implementing the plan</h3>\n<p>For the implementation, we need only 3 libraries the two already described <code class=\"language-text\">wappalyzer</code> and <code class=\"language-text\">clipboardy</code> and the indispensable <code class=\"language-text\">lodash</code> one.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">npm</span> <span class=\"token function\">install</span> lodash clipboardy wappalyzer</code></pre>\n      </div>\n<p>You have the full project available in my <a href=\"https://github.com/robertovg/wappalyzer-to-md\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Github</a> account to check it, use it, adapt or improve it.</p>\n<p>Basically, I created the following folder structure for each of the steps described in the <code class=\"language-text\">cli.js</code> backbone:</p>\n<ul>\n<li><strong>validation</strong>: To have params validations, as in the cli the inputs are coming from the call args.</li>\n<li><strong>data</strong>: To wrap the logic of using the <code class=\"language-text\">Wappalyzer</code> npm module and test it.</li>\n<li><strong>logic</strong>: for me, the logic in this program was to transfer the Json output from <code class=\"language-text\">Wappalyzer</code> to the \"standard\" markdown I was trying to create. Pretty straight and quite exciting to create in an elegant way 🤓</li>\n<li><strong>output</strong>: in the script, we haven't viewed, but we do have output logic, so again I decided to isolate the <code class=\"language-text\">clipboardy</code> logic and wrap in the logic folder.</li>\n</ul>\n<p>These are the main parts of the small script project, I think the best way to know how each part works, as I think we should always do, it's just to read the <code class=\"language-text\">specs</code> test on each folder to then understand then easy <code class=\"language-text\">cli.js</code> file which orchestrates the script pieces.</p>\n<p>Additionally, to execute before register the script project, we should <code class=\"language-text\">npm link</code> the project an execute it again now with valid params like:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\">npx wappalyzer-to-md https://robertovg.com</code></pre>\n      </div>\n<p>And we will have in the clipboard a markdown document with what we wanted to extract 🥳.</p>\n<h3>Register in npmjs.com to be widely used 🤔.</h3>\n<p>So last step was to register to npm, so we can use it without the sources, that's pretty sexy approach and honestly the first time I think to register on npm something which is not created to be used as <code class=\"language-text\">node module</code> but as <code class=\"language-text\">npm script</code>.</p>\n<p>Pretty simple, this is done by <code class=\"language-text\">npm publish</code> as always and first, you need to set up an account in <a href=\"https://www.npmjs.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">npmjs.com</a> and log to npm through <code class=\"language-text\">npm login</code> call.</p>\n<p>Then the package it's available for anyone calling</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\">\n      <pre class=\"language-bash\"><code class=\"language-bash\">npx wappalyzer-to-md <span class=\"token operator\">&lt;</span>url<span class=\"token operator\">></span></code></pre>\n      </div>\n<p>And listed publicly in npm <a href=\"https://www.npmjs.com/package/wappalyzer-to-md\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">register</a>.</p>\n<h2>Conclusion</h2>\n<p>Nothing crazy here, but funny for me to use my web toolset to make a script. I will try to use this approach when I see the opportunity in the future if I need to resolve scripting challenges again.</p>\n<p>Have you ever use <code class=\"language-text\">npm script</code> in this way? Do you see improvements in the way I use it? Or maybe do you have any doubt? I'm always happy to learn from any feedback and hopefully, this can be useful not just for me but for anyone facing problems which could be resolved by <code class=\"language-text\">npm scripts</code>.</p>\n<p>I hope you enjoy reading 🤗.</p>"},{"id":"https:/robertovg.com/blog/o-auth-2-with-react-native-keeping-expo","url":"https:/robertovg.com/blog/o-auth-2-with-react-native-keeping-expo","title":"OAuth 2 with React Native keeping Expo","date_published":"2018-10-13T00:00:00.000Z","date_modified":"2018-10-13T00:00:00.000Z","content_html":"<h2>Intro</h2>\n<p>I'm a frictionless guy, developer mainly because <strong>I enjoy the process of creation of new applications</strong> and I like to use them and enjoy with the process, trying to <strong>avoid as much as I can the time I spend on manual deployments configuration process</strong>. Basically <strong>I Prefer to spend this time doing than resolving config problems</strong>.</p>\n<p><a href=\"https://facebook.github.io/react-native/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React Native</a> (RN) is a game-changing technology in the mobile development world, a lot of magic is happening in the background in order to transform the React code to native code transparently.</p>\n<p>But using RN without Expo, makes you have to deal with Xcode, Android Studio to generate the packages and deploy your application to the Play and App Store, and this means to have to deal with more configuration dependent to 2 completely different platforms <a href=\"https://cocoapods.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">cocoapods</a> and <a href=\"https://developer.apple.com/swift/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">swift</a> for iOS and <a href=\"https://gradle.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">gradle</a> and <a href=\"https://java.com/en/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Java</a> for Android.</p>\n<p>That's why the existence of <a href=\"https://expo.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Expo</a> makes sense.</p>\n<h2>Why Expo is so needed when working with RN</h2>\n<p>I have to say the default output from <a href=\"https://github.com/react-community/create-react-native-app\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">create-react-native-app</code></a> produces a React Native + Expo project, so we don't have to do anything special to have Expo up and running.</p>\n<p>The reasons why for me setting the project up with expo makes sense are described in the following points:</p>\n<ul>\n<li>Resolve the testing scaffolding.</li>\n<li>Allow you to execute and play with the application on real devices without having to set up your devices as development devices</li>\n<li>Generate <a href=\"https://en.wikipedia.org/wiki/.ipa\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">.ipa</code></a> (iOS App Store Package) and <a href=\"https://en.wikipedia.org/wiki/Android_application_package\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">.apk</code></a> (Android PacKage) to deploying to App Stores through their server without having to deal with XCode (which makes mandatory to have a Mac computer) and JDK.</li>\n<li>Sugar additions like tunnel deployment (allowing devices out of your Network to try your application during development ).</li>\n<li>A tool to open the emulators through the CLI or the browser with just one click.</li>\n<li>And offering their own <a href=\"https://docs.expo.io/versions/latest/sdk\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SDK</a> to deal with specific device possibilities in a transparent way.</li>\n</ul>\n<p>And the best thing as I said before, <strong>the configuration comes resolved out of the box with <code class=\"language-text\">create-react-native-app</code></strong></p>\n<h2>Our First Authentication Solution</h2>\n<p>At <a href=\"https://www.precursive.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Precursive</a>, when we started to use <a href=\"https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_intro.htm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Apex Rest API</a> within our React Native application we also needed to resolve the authentication from a different way than any other application we made inside the Salesforce development.</p>\n<p>I try to give a try to follow the official documentation, and in the case of Salesforce was using the <a href=\"https://developer.salesforce.com/developer-centers/mobile\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Salesforce Mobile SDK</a> with <code class=\"language-text\">forcereact create</code> as is described in their <a href=\"https://trailhead.salesforce.com/en/modules/mobile_sdk_react_native/units/mobilesdk_reactnative_create_app\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">trailhead</code></a></p>\n<p>This <code class=\"language-text\">react-native-force</code> module provides 4 packages with useful Salesforce utilities <code class=\"language-text\">&#39;import {oauth, network, smartstore, smartsync} from &#39;react-native-force&#39;;</code> and we can use <code class=\"language-text\">oauth.authenticate</code> to Login to Salesforce, but this project is not using expo.</p>\n<blockquote>\n<p>In summary; <strong>Good and frictionless</strong> solution but because it generates the project with <code class=\"language-text\">react-native-force</code> and <strong>it doesn't use expo</strong>. It generates dependent iOS and Android code with the <code class=\"language-text\">forceios</code> and <code class=\"language-text\">forceandroid</code> native modules.</p>\n</blockquote>\n<h2>Other O Auth2 with RN</h2>\n<p>Salesforce provides <a href=\"https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Authenticate Apps with OAuth\n</a> so OAuth looks like the standard to use for authentication.</p>\n<p>So I checked the different RN libraries out there to resolve this O Auth.</p>\n<ul>\n<li><a href=\"https://github.com/adamjmcgrath/react-native-simple-auth\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">OAuth login for React Native</a>. This one provides easy setup for this social networks (Google, Facebook, Twitter and Tumblr).</li>\n<li><a href=\"https://github.com/fullstackreact/react-native-oauth\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react-native-oauth</a> provides an interface to OAuth 1.0 and OAuth 2.0 providers with support for the following providers for React Native apps (Twitter, Facebook, Google, Github, and Slack)</li>\n<li><a href=\"https://github.com/FormidableLabs/react-native-app-auth\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React Native App Auth</a> React native bridge for AppAuth - an SDK for communicating with OAuth2 providers, <strong>this is the one which looks more standard, in my opinion,</strong>.</li>\n</ul>\n<p><strong>But all of them uses native modules and Expo doesn't currently support them</strong>, meaning we need to <a href=\"https://docs.expo.io/versions/latest/expokit/eject\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">eject</a> the application to install those libraries, and this means no expo in the project 😢.</p>\n<h2>Our solution to don't leave Expo</h2>\n<p>So before accepting the fact that OAuth libraries are not compatible with Expo, I checked the Expo SDK and I found something which we could use to resolve our problems <a href=\"https://docs.expo.io/versions/v30.0.0/sdk/auth-session\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">AuthSession</a>.</p>\n<p>This package is already included in Expo, so basically we just need to use it to make the login.</p>\n<p>So here a quick simple <code class=\"language-text\">SignInScreen</code> component showing how to log in to Salesforce using Expo Auth-session (of course we also need to have connected application set up correctly following <a href=\"https://developer.salesforce.com/page/Connected_Apps\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SF instructions</a>).</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> React<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span> Component <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'react'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> <span class=\"token constant\">SF_OAUTH_URL</span><span class=\"token punctuation\">,</span> <span class=\"token constant\">REMOTE_ACCESS_CONSUMER_KEY</span> <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'react-native-dotenv'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> AsyncStorage<span class=\"token punctuation\">,</span> Button<span class=\"token punctuation\">,</span> View<span class=\"token punctuation\">,</span> Text <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'react-native'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> AuthSession <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'expo'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> globalStyles <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'../constants/Styles'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> ScreenKeys <span class=\"token keyword\">from</span> <span class=\"token string\">'../constants/ScreenKeys'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">SignInScreen</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">Component</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">static</span> navigationOptions <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n    title<span class=\"token operator\">:</span> <span class=\"token string\">'Please sign in'</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n\n  state <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n    errorCode<span class=\"token operator\">:</span> <span class=\"token keyword\">null</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n\n  <span class=\"token function-variable function\">_signInAsync</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> navigation <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">const</span> redirectUrl <span class=\"token operator\">=</span> AuthSession<span class=\"token punctuation\">.</span><span class=\"token function\">getRedirectUrl</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">const</span> result <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> AuthSession<span class=\"token punctuation\">.</span><span class=\"token function\">startAsync</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      authUrl<span class=\"token operator\">:</span>\n        <span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${</span><span class=\"token constant\">SF_OAUTH_URL</span><span class=\"token interpolation-punctuation punctuation\">}</span></span><span class=\"token template-punctuation string\">`</span></span> <span class=\"token operator\">+</span>\n        <span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">?response_type=token</span><span class=\"token template-punctuation string\">`</span></span> <span class=\"token operator\">+</span>\n        <span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">&amp;client_id=</span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${</span><span class=\"token constant\">REMOTE_ACCESS_CONSUMER_KEY</span><span class=\"token interpolation-punctuation punctuation\">}</span></span><span class=\"token template-punctuation string\">`</span></span> <span class=\"token operator\">+</span>\n        <span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">&amp;prompt=login</span><span class=\"token template-punctuation string\">`</span></span> <span class=\"token operator\">+</span>\n        <span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">&amp;redirect_uri=</span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${</span><span class=\"token function\">encodeURIComponent</span><span class=\"token punctuation\">(</span>redirectUrl<span class=\"token punctuation\">)</span><span class=\"token interpolation-punctuation punctuation\">}</span></span><span class=\"token template-punctuation string\">`</span></span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span>result<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> type<span class=\"token punctuation\">,</span> errorCode <span class=\"token operator\">=</span> <span class=\"token string\">'You cancel or dismissed the login'</span> <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> result<span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>type <span class=\"token operator\">===</span> <span class=\"token string\">'success'</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token comment\">// Just simple way to store the token in this examples</span>\n      <span class=\"token keyword\">await</span> AsyncStorage<span class=\"token punctuation\">.</span><span class=\"token function\">setItem</span><span class=\"token punctuation\">(</span><span class=\"token string\">'userToken'</span><span class=\"token punctuation\">,</span> <span class=\"token constant\">JSON</span><span class=\"token punctuation\">.</span><span class=\"token function\">stringify</span><span class=\"token punctuation\">(</span>result<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      navigation<span class=\"token punctuation\">.</span><span class=\"token function\">navigate</span><span class=\"token punctuation\">(</span>ScreenKeys<span class=\"token punctuation\">.</span>main<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token comment\">/**\n       * Result types can be: cancel, dismissed or error (with errorCode)\n       */</span>\n      <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span><span class=\"token function\">setState</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span> errorCode <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n\n  <span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> errorCode <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>state<span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n      <span class=\"token operator\">&lt;</span>View style<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>globalStyles<span class=\"token punctuation\">.</span>container<span class=\"token punctuation\">}</span><span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span>Button title<span class=\"token operator\">=</span><span class=\"token string\">\"Sign in!\"</span> onPress<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span><span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>_signInAsync<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n        <span class=\"token punctuation\">{</span>errorCode <span class=\"token operator\">?</span> <span class=\"token operator\">&lt;</span>Text<span class=\"token operator\">></span><span class=\"token punctuation\">{</span>errorCode<span class=\"token punctuation\">}</span><span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>Text<span class=\"token operator\">></span> <span class=\"token operator\">:</span> <span class=\"token keyword\">null</span><span class=\"token punctuation\">}</span>\n      <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>View<span class=\"token operator\">></span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre>\n      </div>\n<blockquote>\n<p>With this steps, <strong>we can login to Salesforce orgs through RN application and then use <code class=\"language-text\">Apex Rest API</code></strong> and work with Salesforce servers as any other standard Rest server, making our development work as <strong>standard and frictionless</strong> as possibles keeping Expo 🚀.</p>\n</blockquote>"},{"id":"https:/robertovg.com/blog/don-t-fear-the-hoc-when-writing-react","url":"https:/robertovg.com/blog/don-t-fear-the-hoc-when-writing-react","title":"Don't fear the HOC, when writing React","date_published":"2018-08-20T00:00:00.000Z","date_modified":"2018-08-20T00:00:00.000Z","content_html":"<h2>Intro</h2>\n<p>When I started to use <strong>Functional Programming (FP)</strong> in my code, I also started thinking in a different way. When something is finished and working, I constantly ask my self, <strong>\"Could I get the same results, with a more elegant code?\"</strong>. Of course, I've been always refactoring my code, but since I'm in the FP influence, <strong>this feeling of chasing purity, simplicity, and proudness</strong> when coding is far more relevant.</p>\n<p>As it said in the <a href=\"https://reactjs.org/docs/higher-order-components.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">official documentation</a>: \"<em>A HOC is a function that takes a component and returns a new component</em>\", obviously they do something in this process, usually they add some properties to the target component by the execution of some extra logic, allow them to reuse the code which the HOC contains.</p>\n<p>This article pretends to be a rough introduction and reference to anyone interested, not only on understanding what they are but also to share my experience with <em>High Order Components (HOC)</em> in real-world examples.</p>\n<h2>When we use HOCs</h2>\n<p>I've been using <strong>HOCs</strong> with React from the very beginning without notice, simple examples could be found when you start integrating common in third-party to your code, like <em>Redux</em> or <em>graphql</em>.</p>\n<p>I will paste a piece of code where I use <em>graphql</em> with <em>Apollo</em> to query and fetch user data from the session and a basic logic of a simple authentication code.</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> React <span class=\"token keyword\">from</span> <span class=\"token string\">'react'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> PropTypes <span class=\"token keyword\">from</span> <span class=\"token string\">'prop-types'</span><span class=\"token punctuation\">;</span>\n<span class=\"token comment\">// eslint-disable-next-line</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> Meteor <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'meteor/meteor'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> gql <span class=\"token keyword\">from</span> <span class=\"token string\">'graphql-tag'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> graphql<span class=\"token punctuation\">,</span> withApollo <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'react-apollo'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">import</span> LoggedApp <span class=\"token keyword\">from</span> <span class=\"token string\">'./LoggedApp'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> Logging <span class=\"token keyword\">from</span> <span class=\"token string\">'./Logging'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">const</span> <span class=\"token function-variable function\">App</span> <span class=\"token operator\">=</span> <span class=\"token parameter\">props</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> data<span class=\"token punctuation\">,</span> client <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> props<span class=\"token punctuation\">;</span>\n  <span class=\"token comment\">// Skipping the execution if data is not loaded</span>\n  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>loading<span class=\"token punctuation\">)</span> <span class=\"token keyword\">return</span> <span class=\"token keyword\">null</span><span class=\"token punctuation\">;</span>\n  <span class=\"token comment\">// We show the LoggedApp  or Logging one depending if the user is logged</span>\n  <span class=\"token keyword\">return</span> data<span class=\"token punctuation\">.</span>user<span class=\"token punctuation\">.</span>_id <span class=\"token operator\">?</span> <span class=\"token operator\">&lt;</span>LoggedApp <span class=\"token punctuation\">{</span><span class=\"token operator\">...</span>props<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span> <span class=\"token operator\">:</span> <span class=\"token operator\">&lt;</span>Logging client<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>client<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">const</span> userQuery <span class=\"token operator\">=</span> gql<span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">\n  query User {\n    user {\n      _id\n      alias\n    }\n    users {\n      _id\n      alias\n    }\n  }\n</span><span class=\"token template-punctuation string\">`</span></span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token function\">graphql</span><span class=\"token punctuation\">(</span>userQuery<span class=\"token punctuation\">)</span><span class=\"token punctuation\">(</span><span class=\"token function\">withApollo</span><span class=\"token punctuation\">(</span>App<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>Here instead of exporting the <code class=\"language-text\">App</code> component directly to be used in other parts of our app, we use 2 HOCs, one to inject a <code class=\"language-text\">graphql</code> query and another to inject <code class=\"language-text\">Apollo</code> to manage the queries. So no one but 2 HOCs used in this simple example.</p>\n<p>More details of how to use Apollo in your apps in their <a href=\"https://www.apollographql.com/docs/react/essentials/get-started.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">official docs</a>.</p>\n<p>As a really high-level summary, we could say that <strong>HOCs return our components adding them some special properties, abstracting you from the logic contained in the HOC</strong>.</p>\n<h2>Example Project Context</h2>\n<p>So after understanding the benefits HOCs can bring to your code, I'm using them in my code when I see a good opportunity. And here I'll try to explain a clear situation where we used.</p>\n<p>In <a href=\"https://precursive.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Precursive</a> we use <strong>React</strong> + <a href=\"https://react.lightningdesignsystem.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Design System React\n</a> (a library we are using to render our <a href=\"https://www.lightningdesignsystem.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Lightning</a> Scheduling Page). This library is <strong>React</strong> implementation of Lightning and because it can be used in different environments, we need to specify were we to find the icons assets (SVGs).</p>\n<p>We do this configuration with the <a href=\"https://react.lightningdesignsystem.com/components/icon-settings/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Icons Settings</a>, a component, this component is used as a wrapper on your root component and all nested components will use to know where to find the icons assets.</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token comment\">// imports...</span>\n\n<span class=\"token keyword\">const</span> sagaMiddleware <span class=\"token operator\">=</span> <span class=\"token function\">createSagaMiddleware</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">// Creating enhancers to connect our middleware (saga and asyncDispatchMiddleware)</span>\n<span class=\"token comment\">// and adding devtools in elegant way</span>\n<span class=\"token keyword\">const</span> enhancer <span class=\"token operator\">=</span> <span class=\"token function\">composeWithDevTools</span><span class=\"token punctuation\">(</span><span class=\"token function\">applyMiddleware</span><span class=\"token punctuation\">(</span>sagaMiddleware<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">const</span> store <span class=\"token operator\">=</span> <span class=\"token function\">createStore</span><span class=\"token punctuation\">(</span>reducers<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span> enhancer<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">// We load the configuration of the icons differently depending if we have</span>\n<span class=\"token comment\">// or not the local environment icons available from _slds</span>\n<span class=\"token keyword\">const</span> IconConfiguration <span class=\"token operator\">=</span>\n  process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">NODE_ENV</span> <span class=\"token operator\">===</span> <span class=\"token string\">'development'</span> <span class=\"token operator\">?</span> <span class=\"token punctuation\">(</span>\n    <span class=\"token comment\">// eslint-disable-next-line</span>\n    <span class=\"token keyword\">const</span> actionSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/action-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token comment\">// eslint-disable-next-line</span>\n    <span class=\"token keyword\">const</span> customSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/custom-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token comment\">// eslint-disable-next-line</span>\n    <span class=\"token keyword\">const</span> doctypeSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/doctype-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token comment\">// eslint-disable-next-line</span>\n    <span class=\"token keyword\">const</span> standardSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/standard-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token comment\">// eslint-disable-next-line</span>\n    <span class=\"token keyword\">const</span> utilitySprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/utility-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token operator\">&lt;</span>IconSettings\n      actionSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>actionSprite<span class=\"token punctuation\">}</span>\n      customSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>customSprite<span class=\"token punctuation\">}</span>\n      doctypeSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>doctypeSprite<span class=\"token punctuation\">}</span>\n      standardSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>standardSprite<span class=\"token punctuation\">}</span>\n      utilitySprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>utilitySprite<span class=\"token punctuation\">}</span>\n    <span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span>App <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n    <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>IconSettings<span class=\"token operator\">></span>\n  <span class=\"token punctuation\">)</span> <span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span>\n    <span class=\"token operator\">&lt;</span>IconSettings iconPath<span class=\"token operator\">=</span><span class=\"token string\">\"/_slds/icons\"</span><span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span>App <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n    <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>IconSettings<span class=\"token operator\">></span>\n  <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\nsagaMiddleware<span class=\"token punctuation\">.</span><span class=\"token function\">run</span><span class=\"token punctuation\">(</span>rootSaga<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&lt;</span>Provider store<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>store<span class=\"token punctuation\">}</span><span class=\"token operator\">></span><span class=\"token punctuation\">{</span>IconConfiguration<span class=\"token punctuation\">}</span><span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>Provider<span class=\"token operator\">></span><span class=\"token punctuation\">,</span> document<span class=\"token punctuation\">.</span><span class=\"token function\">getElementById</span><span class=\"token punctuation\">(</span><span class=\"token string\">'app'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>So basically as you can see, depending on the environment we load the SVG through <em>requires</em> or relay to Salesforce assets when the application is deployed in Salesforce (<strong>Why to load the icons into our static resources if they are already loaded in Lightning Experience</strong>).</p>\n<blockquote>\n<p>Notice I'm using require inside the if statement, in this way I only fetch those SVGs when I'm on the development environment and avoid to include them in the package to be deployed.</p>\n</blockquote>\n<h2>Problem to resolve</h2>\n<p>This previous code works, but we have 2 issues with it.</p>\n<ul>\n<li>First, we have code which could be isolated about this Icon configuration which is completely independent of the initialization of our application.</li>\n<li>Secondly, if we want to use this piece of code in different parts of our applications (having other root components to mount)...well then we have to copy and paste the code, and <strong>this is never an option</strong>.</li>\n</ul>\n<h2>Solution with HOC</h2>\n<p>So why not use a HOC to isolate the logic around the creation of this <code class=\"language-text\">IconSettings</code> component, sound like a good use case, don't you think?</p>\n<p>Actually, the solution with HOCs is the only tool we have to return a new component wrapped into the <code class=\"language-text\">IconSettings</code> one (which need to be set up as a wrapper)</p>\n<p>So I created a new component called <code class=\"language-text\">iconifyComponent</code> with this code.</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> React <span class=\"token keyword\">from</span> <span class=\"token string\">'react'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> IconSettings <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'@salesforce/design-system-react'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">/**\n * HOC to wrap the IconSettings logic and reuse when need to be reused (on salesforce environment)\n * We load the configuration of the icons differently depending if we have\n * or not the local environment icons available from _slds\n */</span>\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">function</span> <span class=\"token function\">iconifyComponent</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">WrappedComponent</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">return</span> <span class=\"token keyword\">function</span> <span class=\"token function\">WrappingComponent</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">props</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">NODE_ENV</span> <span class=\"token operator\">===</span> <span class=\"token string\">'development'</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token comment\">// eslint-disable-next-line</span>\n      <span class=\"token keyword\">const</span> actionSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/action-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token comment\">// eslint-disable-next-line</span>\n      <span class=\"token keyword\">const</span> customSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/custom-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token comment\">// eslint-disable-next-line</span>\n      <span class=\"token keyword\">const</span> doctypeSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/doctype-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token comment\">// eslint-disable-next-line</span>\n      <span class=\"token keyword\">const</span> standardSprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/standard-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token comment\">// eslint-disable-next-line</span>\n      <span class=\"token keyword\">const</span> utilitySprite <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons/utility-sprite/svg/symbols.svg'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n        <span class=\"token operator\">&lt;</span>IconSettings\n          actionSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>actionSprite<span class=\"token punctuation\">}</span>\n          customSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>customSprite<span class=\"token punctuation\">}</span>\n          doctypeSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>doctypeSprite<span class=\"token punctuation\">}</span>\n          standardSprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>standardSprite<span class=\"token punctuation\">}</span>\n          utilitySprite<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>utilitySprite<span class=\"token punctuation\">}</span>\n        <span class=\"token operator\">></span>\n          <span class=\"token operator\">&lt;</span>WrappedComponent <span class=\"token punctuation\">{</span><span class=\"token operator\">...</span>props<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>IconSettings<span class=\"token operator\">></span>\n      <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span>\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n      <span class=\"token operator\">&lt;</span>IconSettings iconPath<span class=\"token operator\">=</span><span class=\"token string\">\"/_slds/icons\"</span><span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span>WrappedComponent <span class=\"token punctuation\">{</span><span class=\"token operator\">...</span>props<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>IconSettings<span class=\"token operator\">></span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre>\n      </div>\n<p>Now in our entry point, we can just use the HOC to abstract of the icon configuration and make it super nice, elegant and clear.</p>\n<p>Using the created <code class=\"language-text\">iconifyComponent</code> in our entry point (<code class=\"language-text\">index.js</code>) we got something like that:</p>\n<div class=\"gatsby-highlight\" data-language=\"js\">\n      <pre class=\"language-js\"><code class=\"language-js\"><span class=\"token comment\">// more imports...</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> iconifyComponent <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'./data/iconifyComponent'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">const</span> sagaMiddleware <span class=\"token operator\">=</span> <span class=\"token function\">createSagaMiddleware</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">// Creating enhancers to connect our middleware (saga and asyncDispatchMiddleware)</span>\n<span class=\"token comment\">// and adding devtools in elegant way</span>\n<span class=\"token keyword\">const</span> enhancer <span class=\"token operator\">=</span> <span class=\"token function\">composeWithDevTools</span><span class=\"token punctuation\">(</span><span class=\"token function\">applyMiddleware</span><span class=\"token punctuation\">(</span>sagaMiddleware<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">const</span> store <span class=\"token operator\">=</span> <span class=\"token function\">createStore</span><span class=\"token punctuation\">(</span>reducers<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span> enhancer<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">const</span> AppIconized <span class=\"token operator\">=</span> <span class=\"token function\">iconifyComponent</span><span class=\"token punctuation\">(</span>App<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\nsagaMiddleware<span class=\"token punctuation\">.</span><span class=\"token function\">run</span><span class=\"token punctuation\">(</span>rootSaga<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">const</span> AppIconized <span class=\"token operator\">=</span> <span class=\"token function\">iconifyComponent</span><span class=\"token punctuation\">(</span>App<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token function\">render</span><span class=\"token punctuation\">(</span>\n  <span class=\"token operator\">&lt;</span>Provider store<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>store<span class=\"token punctuation\">}</span><span class=\"token operator\">></span>\n    <span class=\"token operator\">&lt;</span>AppIconized <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n  <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>Provider<span class=\"token operator\">></span><span class=\"token punctuation\">,</span>\n  document<span class=\"token punctuation\">.</span><span class=\"token function\">getElementById</span><span class=\"token punctuation\">(</span><span class=\"token string\">'app'</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>🤩 Pretty sexy, don't you think? If now, we need to use the same icon configuration in any other part of our application (if there is another root application), we can just use the HOC again and forget about the details.</p>\n<h2>Conclusion</h2>\n<p>Well as everything in life, we should not abuse of the usage of HOCs in our code, and try to write them when it makes sense, but in the other hand is a pretty elegant solution we have available in our tools within React environments.</p>\n<p>Well, tell me what you think about this use case and about the use of HOCs in your code.</p>\n<p>See you soon!</p>"},{"id":"https:/robertovg.com/blog/next-steps-after-level-2-react-native-with-graphql-part1","url":"https:/robertovg.com/blog/next-steps-after-level-2-react-native-with-graphql-part1","title":"Next steps after Level 2 React Native With Graphql - Part 1","date_published":"2018-06-16T00:00:00.000Z","date_modified":"2018-06-16T00:00:00.000Z","content_html":"<h2>The importance of side skills</h2>\n<p>This 2018, I'm spending my <strong>learning time</strong> on <a href=\"https://facebook.github.io/react-native/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React Native</a> (<code class=\"language-text\">RN</code>) as <strong>side skill\"</strong> for me. As general rule, I enjoy to have always something else than what I have to use at work, in my learning queue (not having all my eggs in the same basket), and usually it's funny how this new skills not needed at when I started learning it, become something useful far sooner than later (already experience it with <a href=\"https://wordpress.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Wordpress</a>, <a href=\"https://angularjs.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Angular</a> , <code class=\"language-text\">es6</code>, functional programming, static web generators like <a href=\"https://jekyllrb.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jekyll</a>, <a href=\"https://getgrav.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Grav</a>, <a href=\"https://www.gatsbyjs.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Gatsby</a> and more.</p>\n<p>I've been focused on <a href=\"https://reactjs.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React</a> for more than a year ago at <a href=\"https://precursive.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Precursive</a>, so when I heard about React Native and how it was supposed to produce real native iOS and android applications reusing all my javaScripts toolset, it was an opportunity I didn't want to miss. Honestly I tried little examples of it more than a year ago, because I thought this was going to be a technology similar to <a href=\"https://cordova.apache.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cordoba</a>, where you do execute the javaScript you code by and embed browser resulting into a slower end application than a real native one, but this was not the case at all with <code class=\"language-text\">RN</code> and I had had the time, I would love to had focus on it sooner, but well is always better later than never.</p>\n<h2>Where to learn new technologies</h2>\n<p>I know each developer is completely different in terms of how we consume learning material, we can learn from others code, going to classes, reading books, just reading breathly the documentation and by using the technology, listening to Podcasts or watching video tutorials. In my case, the faster/easier way is to consume good video tutorials. Even though, I use to go to the official documentation and guides from official sources.</p>\n<p>So, if I see high-quality courses, normally from <a href=\"https://tutsplus.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Tuts+</a>, <a href=\"https://frontendmasters.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Frontend Masters</a>, <a href=\"http://wesbos.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Wes Boss</a>, or like, in this case, <a href=\"https://www.leveluptutorials.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Level Up Tutorials</a>, I just go for it. Basically because is the faster way I know to transfer the skills you need to use this technology to your brain, and completely processed for you to just get the right way of how to use this library/framework to do real things.</p>\n<p>With <code class=\"language-text\">RN</code>, I started with the first <code class=\"language-text\">Level Up Tutorials</code> about it called <a href=\"https://www.leveluptutorials.com/tutorials/react-native-for-everyone\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React Native For Everyone</a>, it was very useful and I started to write pet applications just for fun and to explore the capacities of it. You really finish it producing <strong>a real native application</strong>.</p>\n<p>Then <a href=\"https://scotttolinski.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">he</a> released this <a href=\"https://www.leveluptutorials.com/tutorials/level-2-react-native-with-graphql\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">fabulous course</a>, this time like a continuation but adding graphql to it, and focusing on <a href=\"https://www.graph.cool/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">graphcool</a> database (<a href=\"https://graphql.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">graphql</a> with <a href=\"https://www.apollographql.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">apollo</a>). At that time I already had previous experience with <a href=\"https://www.meteor.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">meteor</a> and <code class=\"language-text\">grahpql</code> so was a good way to improve on this stack also. Like always, I do all the exercises suggested and explained on courses, but with the output I knew, even when it was a great functional \"Journal\" application, that (as far I understood), some parts were missing to use this as code base in my projects.</p>\n<p>So I thought it was a good idea to start with this <code class=\"language-text\">Level 2 React Native With Graphql</code> resulted project and iterate over it to incorporate the following improvements. I called it <a href=\"https://github.com/robertovg/journal-updated\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Journal Updated</a> and published to github (where more and more I'm trying to have a side projects public code portfolio).</p>\n<h2>Improvements to Journal</h2>\n<p>All these points are also on the Github project <a href=\"https://github.com/robertovg/journal-updated/blob/master/README.md\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Readme</a> but I'll explain them a little bit. (Not following the same structure to explain the points)</p>\n<h3>1) Adding <code class=\"language-text\">.eslintrc</code> and <code class=\"language-text\">.babelrc</code> with my rules to the project and fixing the code accordingly</h3>\n<p>Well, call me lazy, but I need to have then <code class=\"language-text\">linting</code> and the <code class=\"language-text\">prettier</code> set up correctly in any project. I'm used to doing it when I'm working in a team, so we follow the same code styles, and I found it very useful even working in a project as the only developer.</p>\n<p>Then I had to make a lot of changes to the resulting code, translating stateless components to pure function, adding PropTypes to props, avoiding duplicated code, removing unused import, refactoring components...</p>\n<p>Of course <code class=\"language-text\">babel</code> now days is a must for any web developer if you want to write good code before is supported by all browsers and platforms (more about it in <a href=\"https://robertovg.com/blog/reflections-about-mid-2018-java-script-state\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">my previous post</a>)</p>\n<p>There I faced some issues with <code class=\"language-text\">Babel</code> and <code class=\"language-text\">env-0</code> resolved by using <code class=\"language-text\">react-native-stage-0</code> preset instead of the default <code class=\"language-text\">stage-0</code>.</p>\n<h3>2) Having the possibility to have properties files</h3>\n<p>Moving the graphcool URL to an external configurable properties file so we could have different values depending on the environment and we don't hardcoded endpoints in our components. Resolved with <code class=\"language-text\">react-native-dotenv</code>.</p>\n<p>Any real application needs to have an easy to access places where our configurable properties live, so it's easier to make changes without having to dig in the code.</p>\n<h3>3) Updating react-navigation to <code class=\"language-text\">goBack</code> issue</h3>\n<p>The problem which made me investigate about <a href=\"https://github.com/react-navigation/react-navigation/issues/2454\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">goBack</code> issues with the 1.x react-navigation</a> was one I found after updating the Post title. After saving it, we back to the Post Component with the old title instead of the updated one.</p>\n<p>The issue was caused because after successfully updating the title, on the callback of <code class=\"language-text\">UpdatePost</code>, we called <code class=\"language-text\">navigation.goBack()</code> to return to <code class=\"language-text\">PostElement</code> where we load the title, not by the query itself but by the params passed from the <code class=\"language-text\">Posts</code> like that:</p>\n<div class=\"gatsby-highlight\" data-language=\"javascript\">\n      <pre class=\"language-javascript\"><code class=\"language-javascript\">  <span class=\"token keyword\">static</span> <span class=\"token function-variable function\">navigationOptions</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\"><span class=\"token punctuation\">{</span> navigation <span class=\"token punctuation\">}</span></span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    title<span class=\"token operator\">:</span> navigation<span class=\"token punctuation\">.</span>state<span class=\"token punctuation\">.</span>params<span class=\"token punctuation\">.</span>title<span class=\"token punctuation\">,</span>\n    <span class=\"token operator\">...</span>navStyles<span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>And the issue was <code class=\"language-text\">goBack</code> has no possibility to send a new state to update the params, so I thought to use <code class=\"language-text\">navigation.navigate</code> again so I can pass the update title to the <code class=\"language-text\">PostElement</code> component and the title is shown correctly updated. But then the problem was we where adding new items to the navigation queue, so we were not actually returning to the previous page, but going to the new one, so if you then click back on your phone, you return to the old state of the form to update the form... which is not what we want.</p>\n<p>Thankfully with the <a href=\"https://reactnavigation.org/blog/2018/04/06/react-navigation-2.0-rc.html#breaking-changes\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react-navigation-2.0-rc</a> the added a new smarter behavior to navigate) I think to avoid this problem, and if you navigate to a page which already exists, it reflected as if we returned back to the previous View (with the updated state)... Exactly what we want!</p>\n<p>Then actually I thought to update all the libraries in the same go, so I moved all the libraries versions to the last stable version so we keep the code base up-to-date.</p>\n<h3>4) Errors aware</h3>\n<p>After the course, any API call susceptible to raise an exception was treated only with a <code class=\"language-text\">console.log</code> in the <code class=\"language-text\">catch</code> section. And this is fine to understand the usage of <code class=\"language-text\">graphql</code> and the <code class=\"language-text\">mutations</code> but in a real-world example, you really want to do something else, like informing the user of the error which is happening.</p>\n<p>So I start treating the possible problems which we could get in any api call by raising the exceptions with an explication to the user information of what's going on makes sense in my opinion.</p>\n<p>In the parent component <code class=\"language-text\">UserForm</code> for the login and <code class=\"language-text\">PostForm</code> for the updates on Posts, I was dealing those exceptions and showing to the user with <code class=\"language-text\">Alerts</code> from React Native.</p>\n<p>Additionally, I added real validations to the login, so we are not able to Create a user or Login with empty email/password and things like or invalid emails or password, here the simple validations used:</p>\n<div class=\"gatsby-highlight\" data-language=\"javascript\">\n      <pre class=\"language-javascript\"><code class=\"language-javascript\"><span class=\"token function-variable function\">isEmailValid</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token operator\">!</span><span class=\"token operator\">!</span><span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>state<span class=\"token punctuation\">.</span>email<span class=\"token punctuation\">.</span><span class=\"token function\">match</span><span class=\"token punctuation\">(</span><span class=\"token regex\">/@/</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token function-variable function\">isPasswordValid</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>state<span class=\"token punctuation\">.</span>password<span class=\"token punctuation\">.</span>length <span class=\"token operator\">></span> <span class=\"token number\">5</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>The email should contain <code class=\"language-text\">@</code> and the password to contain at least 5 characters. If these conditions are not true, then submit form button is disabled and we inform with the property <code class=\"language-text\">success</code> property on each <code class=\"language-text\">Item</code> form elements (email and password)</p>\n<p>So now everything is a bit more error proof and in <strong>real applications, we always need to be prepared for any unexpected situation</strong> like an exception from an external call or input errors from the user.</p>\n<h3>5) Moving to es6 new async/await syntax</h3>\n<p>It's difficult to explain all the changes I made around this topic but this is also very important, for example, to continue with the treatment of exceptions for me was far more clear to use <code class=\"language-text\">async</code> / <code class=\"language-text\">await</code> instead of <code class=\"language-text\">try</code> <code class=\"language-text\">catches</code>.</p>\n<p>There is a generic <code class=\"language-text\">UserForm</code> component with the form validations for email and password but also with the high-level treatment of the specific form actions (one for <code class=\"language-text\">LoginUser</code> and <code class=\"language-text\">CreateUser</code>).</p>\n<p>The body of this method looks like:</p>\n<div class=\"gatsby-highlight\" data-language=\"javascript\">\n      <pre class=\"language-javascript\"><code class=\"language-javascript\"><span class=\"token function-variable function\">submitForm</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> email<span class=\"token punctuation\">,</span> password <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>state<span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props\n    <span class=\"token punctuation\">.</span><span class=\"token function\">onSubmit</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      email<span class=\"token punctuation\">,</span>\n      password<span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">.</span><span class=\"token function\">catch</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">error <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n      <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> message <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> error<span class=\"token punctuation\">;</span>\n      Alert<span class=\"token punctuation\">.</span><span class=\"token function\">alert</span><span class=\"token punctuation\">(</span>\n        message<span class=\"token punctuation\">,</span>\n        <span class=\"token keyword\">undefined</span><span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">[</span>\n          <span class=\"token punctuation\">{</span>\n            text<span class=\"token operator\">:</span> <span class=\"token string\">'Try Again'</span><span class=\"token punctuation\">,</span>\n          <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">{</span>\n          cancelable<span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">}</span>\n      <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>Then the methods passed as <code class=\"language-text\">onSubmit</code> params are async methods and they rise the specific exceptions with makes this <code class=\"language-text\">catch</code> section to be executed, this is the <code class=\"language-text\">onSubmit</code> method for the create user one.</p>\n<div class=\"gatsby-highlight\" data-language=\"javascript\">\n      <pre class=\"language-javascript\"><code class=\"language-javascript\"><span class=\"token function-variable function\">createUser</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\"><span class=\"token punctuation\">{</span> email<span class=\"token punctuation\">,</span> password <span class=\"token punctuation\">}</span></span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> createUser<span class=\"token punctuation\">,</span> signinUser<span class=\"token punctuation\">,</span> client <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">try</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">await</span> <span class=\"token function\">createUser</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      variables<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n        email<span class=\"token punctuation\">,</span>\n        password<span class=\"token punctuation\">,</span>\n      <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">const</span> signin <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> <span class=\"token function\">signinUser</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      variables<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n        email<span class=\"token punctuation\">,</span>\n        password<span class=\"token punctuation\">,</span>\n      <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token function\">signIn</span><span class=\"token punctuation\">(</span>signin<span class=\"token punctuation\">.</span>data<span class=\"token punctuation\">.</span>signinUser<span class=\"token punctuation\">.</span>token<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    client<span class=\"token punctuation\">.</span><span class=\"token function\">resetStore</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span> <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span>error<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    console<span class=\"token punctuation\">.</span><span class=\"token function\">error</span><span class=\"token punctuation\">(</span>error<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token comment\">// I know, very hard assumption...</span>\n    <span class=\"token comment\">// but just to don't omit the exception and show to the user</span>\n    <span class=\"token keyword\">throw</span> <span class=\"token function\">Error</span><span class=\"token punctuation\">(</span><span class=\"token string\">'Username already used'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code></pre>\n      </div>\n<p>In this way, we code like if there is no exception but with the try, we are save from unexpected situations.</p>\n<h3>6) Change color of indicators form iPhone ( network, time, etc)</h3>\n<p>This is a bit simple fix, but this because of the color of the header had the network, time, battery indicators from the iPhone black and the header has a dark color, was difficult to read.</p>\n<p>But in a very convenient way there is an easy fix for this: We can pass a property called <code class=\"language-text\">headerTitleStyle</code> which we can use for <code class=\"language-text\">navigationOptions</code> of our view components and add a white color to it, so we have the proper contrast between the iPhone indicators and the background of the header.</p>\n<h3>7) Allowing the user to hide the keyboard</h3>\n<p>Well for me this was new UX improvement, when we show the keyboard when clicking on the text area it doesn't hide any possible way, I had to select the input text of the <code class=\"language-text\">PostForm</code> to click on enter and hide it. But this was not very nice.</p>\n<p>So I found a way to hide the keyboard when just clicking out of the text area, . Instead of using a <code class=\"language-text\">View</code> we can display the content in a <code class=\"language-text\">ScrollView</code>, this component have a property called <code class=\"language-text\">keyboardShouldPersistTaps</code> which, if we set to false, the form does exactly what we wanted it to do.</p>\n<h3>8) Facing problems with Expo</h3>\n<p>But well, there is not only good things, I was blocked by expo long time just because for example was not able to recognize the new version of the application after serious changes, so to solve it I renamed the application and then it started to work, somehow expo CDN was not updating the old version in some point, so if you deploy and unstable version of your app and then you fixed and don't see the new version after updating it from expo, maybe try with a application name change.</p>\n<p>Actually, I faced one issue (<code class=\"language-text\">Nested React Native projects result in TypeError: undefined is not an object (evaluating self.fetch)</code>) published in <a href=\"https://github.com/facebook/react-native/issues/9599\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react-native official GitHub</a> and when it was resolved was still not able to update the deployed expo version.</p>\n<h3>9) Expo improvements</h3>\n<p>When we deploy the application con Expo, we show the icon of expo while the first loading process is happening and this is not what we want if we write our own application. Expo makes super easy to have our own first screen and logos updated with our brand, we only have to create folder in the root of our application called <code class=\"language-text\">assets</code> and inside create two files, <code class=\"language-text\">icon.png</code> and <code class=\"language-text\">splash.png</code> with the application icon and application first screen.</p>\n<p>I always follow warning console messages as soon as possible, I found that when you create projects with <code class=\"language-text\">Expo XDE.app</code> it was creating the application with his own version of React Native (<a href=\"https://github.com/expo/react-native/archive/sdk-27.0.1.tar.gz\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://github.com/expo/react-native/archive/sdk-27.0.1.tar.gz</a>) and changing it actually stop a warning to appear about this, so I just start using this Expo version of React Native instead.</p>\n<h3>10) Other Cosmetic improvements</h3>\n<p>I don't pretend to cover all little changes I made, but I improve some problems with the edition of the form when using smaller phones, centered the loading (always shown in a <code class=\"language-text\">View</code> section) and showing it always when an async update action was happening...</p>\n<h2>End of Part 1</h2>\n<p>Well, of course, this is not all that I wanted to finish, my <a href=\"https://github.com/robertovg/journal-updated/blob/master/README.md#todos\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">TODO list</a> for this project in this specific moment is not finish, but I think there is already enough information to be split into more than one part.</p>\n<blockquote>\n<p>The header image was taken from the course <a href=\"https://www.leveluptutorials.com/tutorials/level-2-react\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React 2 Native</a> from <a href=\"http://scotttolinski.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Scott Tolinski</a></p>\n</blockquote>\n<blockquote>\n<p>As with this article, I started to share code, I added to the blog the <a href=\"https://www.gatsbyjs.org/packages/gatsby-remark-prismjs/?=high\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">gatsby-remark-prismjs\n</a> to highlight code syntax, and after some small styles improvements to be ready for mobile, the experience has been fantastic, 100% recommendable.</p>\n</blockquote>"},{"id":"https:/robertovg.com/blog/reflections-about-mid-2018-java-script-state","url":"https:/robertovg.com/blog/reflections-about-mid-2018-java-script-state","title":"Reflections about mid-2018 javaScript state","date_published":"2018-05-16T00:00:00.000Z","date_modified":"2018-05-16T00:00:00.000Z","content_html":"<h3>Why I love js</h3>\n<p>One of the reasons <strong>why I'm so passionate about javaScript</strong>, since I meet it in my early years during my degrees studies, is how much is <strong>always changing and evolving</strong>.</p>\n<p>I know this forces you to spend extra effort to be on the top of the technology. Basically, I like to think about it as a continuous student status we have to maintain. Web/Applications technologies and are evolving continually and you have to keep learning or at least listen what is going on. For me is not a concern but more a way to keep my work environment challenging and interesting, but if you don't like this situation of never being able to stop this continuous evolution, well I think <strong>javaScript is not your territory</strong>.</p>\n<h3>When you master a technology, starts to be obsolete</h3>\n<p><strong>As soon as you think you master a technology usually it starts to be obsolete</strong>, I remember at work four years ago, we start \"Precursive v1\" with Angular, we build a great product, we really mastered everything around Angular, grunt ( then moved to gulp ), lodash... but, we omitted the Angular 2.0 release, well first we checked that moving our code to this major version was not straight at all, we had to refactor a lot of code just to use it, also we wrongly thought, as Google announced they will maintain 1.X branch, we don't really need to migrate... Right now, I look to this decision and I have to regret my call.</p>\n<p><strong>Angular 1.X</strong> is still maintained, updated and it works but has a death date written and <strong>is out of the market</strong>, so simple, if you don't agree with this I'm sure you are also out of the market. We continued writing code in a dead technology, and because of that, we have actually been at least 2 years below what was going on with the <strong>javaScript</strong> world. And this the best way to miss the \"feel of being in the cute edge\", maybe you will miss new features from the new versions of the new frameworks, libraries, maybe productive incorporations to the language, the toolset improvements...</p>\n<p>Happily, for us, we are reacted and start using <a href=\"https://reactjs.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React</a>, <a href=\"https://developer.salesforce.com/lightning\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Lightning</a> and as much new addition on ES6 to write as modern and functional code possible.</p>\n<h3>Functional Code is here and will stay</h3>\n<p>One thing is to feel dependencies to concrete technologies, which we should not, but another thing is to learn and try to play with different code styles which can help with the <strong>concreteness, robustness, and readability</strong> of our code, and this is what is <strong>provided by Functional Programming</strong>.</p>\n<p>It is hard at the beginning, especially when you work in a team and not everyone is not at the same level on the FP learning process, but usually reading others codes code helps to force everyone to make the move to FP, even though I highly recommend some courses or start material for beginners.</p>\n<p>With the time, and applying those good principles the code improve a lot, so is win-win to adopt all early javaScript features which help to move in this direction.</p>\n<h3>Try to write as agnostic code as possible</h3>\n<p>Additionally I feel with React and Vue, the code is not so dependent to third-party libraries as before, especially with Angular you trust on their engine to update values you add to the inputs of a form or to the text you show to the user, <code class=\"language-text\">double binding</code> and their rigid architecture (Controllers, Factories, Services, Directives, Filters...).</p>\n<p>Right now I try to resolve with native ES6 things I would rather resolve with, for example, <a href=\"https://lodash.com/docs\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lodash</a>, there is a great <a href=\"https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Github repo</a> for that, but of course not always it is possible. Even though just to be conscious about it, makes your code better.</p>\n<p>I've been with my focus on React for more than a year ago, and I'm in love with everything which it has incorporated into my code style. Well, I've been also making a big jump to FP consciously, I feel this is the right way to write code nowdays.</p>\n<h3>Even try to write future technology code</h3>\n<p>So basically, and because of the heavy incorporation of ES6 and all edge javaScript features included in the language I feel I write more functional, simpler, reusable, concrete and easy to be read and be test code, now I use to show my team solutions to concrete problems resolved to share the knowledge but honestly because I'm proud of it enough to show it more.</p>\n<p>Babel with the proper presets (<a href=\"https://www.npmjs.com/package/babel-preset-stage-0\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">stage0</a> and <a href=\"https://www.npmjs.com/package/babel-preset-env\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">env</a>) is a must on any new project nowdays, have the possibility of trying language syntax improvements even before they are implemented on browsers or node is something we should not miss. I love how Babel explain what it does to <strong>Babel, Use next-generation JavaScript, today.</strong>, just it.</p>\n<h3>Native applications</h3>\n<p>Well, of course, this is what I'm right now learning and applying, <a href=\"https://facebook.github.io/react-native/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">React Native</a>, really offers a powerful tool for frontend developers.</p>\n<p>So no doubts this is something which really makes us ask if we really need to maintain two versions of the same application with different code base ( one for iOS and one for Android ) when we could just write a proper React Native project instead.</p>\n<p>I would like to write a new article about it this fall.</p>\n<h3>Final thoughts</h3>\n<p>I love this <a href=\"https://stateofjs.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">JavaScript is great! JavaScript is a mess!</code> the initiative</a> and I wanted to use as excuse/reference to start this article. I think it helps to understand if you missed something year by year or where the market is moving objectively.</p>\n<p>So in my opinion, Functional Programming is something to really deep learn and integrate into our code, we have to not feel a technology as the keystone or the definite technology. Learn about it, prepare your self to use and enjoy the process as much as you can, but as soon as you feel you mastered it, start putting your sight on what's going on, what has appeared and prepared to release your current stack, because sooner than letter you have to jump to the next one again.</p>"},{"id":"https:/robertovg.com/blog/resolving-our-coworking-network","url":"https:/robertovg.com/blog/resolving-our-coworking-network","title":"Resolving our Coworking Network","date_published":"2018-04-23T00:00:00.000Z","date_modified":"2018-04-23T00:00:00.000Z","content_html":"<p>I've been working remotely more than 4 years already, and at least 3 of them I've been working from our own office.</p>\n<p>The Internet has been always a priority for me, especially since May we opened our own Coworking Space called <a href=\"https://corkerspace.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Corker Space</a>.</p>\n<p>I always worried about having a good Internet connection, but when you work in an office with more digital co-workers you realize, the Internet coming from your ISP is important, but how you manage your internal network is even more relevant and is there where I found more problems.</p>\n<p>By the way, the first point, our ISP, is resolved in CorkerSpace by a local company called <a href=\"http://www.redjam.es/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RedJam</a>. They provide a very stable 200Mb/s symmetric connection, and so far, we haven't detected concerns from their connection.</p>\n<p>As I previously commented, the second point is actually the one I really found challenging, I'll briefly explain the changes I made in our network and which issues we found with each of the routers and configurations until we found the really solid solution we have right now.</p>\n<blockquote>\n<p>This hasn't got the intention of being a professional review of the devices we have been using, but just a way to share our experience a and maybe help someone with it.</p>\n</blockquote>\n<h2>Initial setup - <a href=\"http://e.huawei.com/en/products/fixed-network/access/ont/optical-terminal\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Huway HG8245H</a></h2>\n<p>Well this was the router provided by the company, the problem we found with this one and the reason we change it doesn't provide a 5Ghz connection, and I wanted to be able to really get more speed from our provider, and the wifi bandwidth was the problem in this case, as 2.4Ghz network is not able to transmit more than 20-30Mb/s.</p>\n<h2>Improving Router - <a href=\"https://www.asus.com/us/Networking/RT-AC1200G/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">ASUS RT-AC1200G</a></h2>\n<p>Well, this was our first investment, we made it just after some weeks in the office as Coworking, and it really was a big change, we start being able to get more than 150Mb/s in the speed test and with 2 or three users in the space, we experience no problems, just a big improvement with the previous setup.</p>\n<p>The trick here was because of the new 5Ghz network the router was able to create, which by definition is able to perform faster connections.</p>\n<p>The problem started when more people and devices were added to the network ( printers, casting devices, scanners, and more PC and laptops ), at this moment, with maybe 20 clients, randomly some people started to disconnect from the network and were very tricky to understand the reason.</p>\n<p>Additionally, the fact of having 2 networks \"CorkerSpace\" (2,4Ghz) and \"CorkerSpace_5G\" (5Ghz) was also not obvious, at least not for people not familiarized with networks technology.</p>\n<p>In Corker Space, we have two 85m2 offices and I thought the issue was because of the distance from the people from the second office, so this leads me to the next addition to the network.</p>\n<h2>Adding an extensor - <a href=\"https://www.tp-link.com/us/products/details/cat-5508_RE355.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">TP-LINK RE355</a></h2>\n<p>Well, this is a very simple addition and most of the people know these kind elements. They are able to get the original network signal and create a twin one. So I place it in the optimal location in the second office, just in the middle of the two offices. And things started to get worse and worse.</p>\n<p>Know I understand everything a bit better, but if the original router already had problems with the number of devices to manage, adding a repeater which basically doubles the communication of the devices connected to the repeater, made things worse.</p>\n<h2>Improving the main router - <a href=\"https://www.linksys.com/fi/p/P-WRT3200ACM/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Linksys WRT3200ACM-EU</a></h2>\n<p>So again I read about best routers, and I thought let's try something more powerful which is able to avoid this problem managing all our clients.</p>\n<p>So this router is a beast especially comparing the specifications from the Asus one, Tri-Stream instead of two networks stream, 1,8 GHz CPU instead of 800 MHz and 512 MB than the 256MB.</p>\n<p>But the people connected through the repeater had problems, pages loading very slowly, problems trying to connect during the mornings, pages looking like offline when they where correctly resolved after resetting the router, so somehow something was not working, and of course it was not so bad, but digital worker know internet is a must when working, so I had to do something.</p>\n<h2>Changing to a Ubiquiti mesh system - <a href=\"https://amplifi.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Amplifi</a></h2>\n<p>I read about Mesh systems time ago and was something I wanted to try, the idea made sense, create a modular network system which is prepared from the beginning to add new nodes to the network, so those \"repeaters\" are smarter ( aware of any other point added ) and they don't cause saturations problems like usual repeaters do.</p>\n<p>Additionally, a friend of mine told me time ago about Ubiquiti, this is not maybe the faster solution ( looking to the speed test results ), and maybe people say there are betters solutions, more sophisticated...</p>\n<p>But the experience changed completely in the office from the day I disconnected all the other network devices and I added just an Amplifi HD home wi-fi router in the main office and one\nAmpliFi HD Mesh Point in the twin office.</p>\n<p>Basically now we have just one network, the system manages where you should connect, also the network you should use (5Ghz or 2,4Ghz) and the cool thing is 100% transparent, there is just one CorkerSpace network and all is simple.</p>\n<p>We spent already almost a month with this setup and even with more than 40 concurrent devices we had no problems, is incredible.</p>\n<p>And well just to finish talking about the Amplify, the design of the application and the router itself is amazing, yes, the post image is the Main router.</p>\n<p>Maybe there are better solutions but as someone who is not networking professional, I just wanted exactly what I have now in the our space, something which is transparent (nothing to manage or to configure), beautiful (we don't hide the router anymore) and which just really works.</p>"},{"id":"https:/robertovg.com/blog/moving-this-site-to-gatsby","url":"https:/robertovg.com/blog/moving-this-site-to-gatsby","title":"Moving This Site To Gatsby","date_published":"2018-03-22T00:00:00.000Z","date_modified":"2018-03-22T00:00:00.000Z","content_html":"<p>Has been a long time without updates on my site, and it wasn't because I had nothing to share, but maybe because I was more focused on doing than on writing about what I was doing.</p>\n<p>Anyway, I used (again) the excuse of try a new technology to update this site, and learn in the process.</p>\n<p>This is the third time I'm moving the site from one technology to another, but I think this time was a good move, when I first move from <code class=\"language-text\">Wordpress</code> to <code class=\"language-text\">Github pages</code> with <code class=\"language-text\">Jekyll</code> I did, because I thought, I don't need a database or admin panel, as I prefer to have a light environment and easy to customize, and <code class=\"language-text\">Jekyll</code> was a good option for that. The problem was the background technology, <code class=\"language-text\">Jekyll</code> is built with Ruby and the template engine used is <a href=\"https://shopify.github.io/liquid/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">liquid</a>, and even when is easy and powerful to use is out of my scope as frontend. So I don't feel it like a natural way to code templates.</p>\n<p>I've been always very into flat files CMS since I met <code class=\"language-text\">Jekyll</code>. I strongly believe you should avoid databases if possible to render public webpages than have to deal with caches and side problems of databases (unless you have the resources to deal with proper database administration) but is truth is piece of your architecture which needs to be properly resolved and managed if you want to do it well, and you need the knowledge and the time to invest in it, and flat files CMS give you quick performance and load times out of the box, and in most of cases (for usual webpages) is valid solution.</p>\n<p>For example, for our coworking space (<a href=\"https://corkerspace.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CorkerSpace</a>) I used <a href=\"https://getgrav.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Grav</a>, it has a lot of advantages if you compare it with <code class=\"language-text\">Jekyll</code>, for example, it has a very powerful administration panel, so the admins of the space can introduce changes without me having to deal with those changes, but the integration with git comes with a plugin which is a bit limited. In <a href=\"https://precursive.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Precursive</a> is build with <a href=\"https://statamic.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Statamic</a> and still is PHP but is a truth that has a better admin console (with the cost of its license).</p>\n<p>So I don't build websites as my main job, but I enjoy it as frontend so I like the idea of don't need to change my stack when I have to publish a site.</p>\n<p>Then since I moved to React, I found it so easy to build any kind of application; mobile, desktop, big projects, small PoC... and when I hear about <a href=\"https://www.gatsbyjs.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Gatsby</a> I was shocked.</p>\n<blockquote>\n<p>\"A CMS, easy to deploy, static, with great services and plugins around and based on serverside React rendering components and using <code class=\"language-text\">Graphql</code> to consume your data ( which could be images and posts from local files and even integrations with any imaginable service out there...)!\"</p>\n</blockquote>\n<p>I really was so excited, it means I have all the used and loved tools I choose to build applications available to build webpages and having a resulting product (webpage) far faster than any other CMS could even imagine... and here I am again 🤓.</p>\n<p>During the process is true you don't have so many fancy themes like with more matures solutions (<a href=\"https://wordpress.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Wordpress</a> is the king when we talk about more professionals and better-looking themes IMO), and also you have to code almost any special solution by your self, but well I do enjoy coding, so the effort is well paid back.</p>\n<p>Then later, of course, I arrived at the point of having to deploy the site and you find <a href=\"https://www.netlify.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Netlify</a>, well then is when you are really not able to believe it, so good. I promise the best way to explain it, is just to try it.</p>\n<p>I'll update if I have to change my page engine again, but honestly, I'm keen to try out the possibilities we could get with this stack, and this blog is just the beginning.</p>\n<p>Additionally I prepared a README file in the <a href=\"https://github.com/robertovg/robertovgGatsbyjs\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">website repo</a> to explain the problems and the solutions I implemented in the site, just if someone is interested, I will continue updating it while I update the page.</p>"},{"id":"https:/robertovg.com/blog/going-back-to-the-roots-to-evolve","url":"https:/robertovg.com/blog/going-back-to-the-roots-to-evolve","title":"Going back to the roots to evolve","date_published":"2014-11-13T00:00:00.000Z","date_modified":"2014-11-13T00:00:00.000Z","content_html":"<p>Since I started to work as developer I’ve been very worried about which code editor or IDE to chose in order to write as conformable and faster as posible.</p>\n<p>My first professional contact with <a target='_blank' rel=\"nofollow noopener noreferrer\" href='http://en.wikibooks.org/wiki/Java_Programming/Java_IDEs'>text editors</a> was with the Oracle Jdeveloper which offered a far best approach from old and rustic Kawa used during my practice classes at the University. It was a really helpful to have such helpers which underline what was wrong of your code before having to build the project, but still I was just looking at the surface of what modern IDE's will bring us as developers.</p>\n<p>When I started working full time, it was when I realized about the importance of a good IDE, and after some research and collage requests, I started with <a href='https://www.eclipse.org/downloads/' target='_blank' rel=\"nofollow noopener noreferrer\"> Eclipse IDE</a>. I spent a lot of time trying to find plugins, learning all key shortcuts to work faster and understanding how to use all the advanced features of it, ( <a href='https://wiki.eclipse.org/Main_Page' target='_blank' rel=\"nofollow noopener noreferrer\">eclipse wiki page</a> helped a lot ). After some years of usage, I was very proud of my work flow.</p>\n<p>But suddenly new topics come to scene; application deployment, <a href='http://maven.apache.org/' target='_blank' rel=\"nofollow noopener noreferrer\">maven</a> to manage our big projects and even some server administrator task, and at this time I knew that no advanced IDE will help me with this kind of tasks. The more far we where from defaults / typical projects, the more old school tools I was forced to use.</p>\n<p>The truth was that at first it was really hard to get used to all this kind of tools and the new problems that come with them ( lot of <a href='http://en.wikipedia.org/wiki/Bash_(Unix_shell)' target='_blank' rel=\"nofollow noopener noreferrer\"> bash</a> problems but, server exceptions, having to dig into logs, <a href='http://en.wikipedia.org/wiki/Out_of_memory' target='_blank' rel=\"nofollow noopener noreferrer\">Java Out Of Memory exceptions </a>...) but, like it happen with everything in life, I started to control this new environment. The more comfortable I was with this new scene, the less tools I was using, mostly <a href='http://www.vim.org/' target='_blank' rel=\"nofollow noopener noreferrer\"> VIM</a> + bash console to configure server remotely.</p>\n<p>Because my old companies restriction, I have always been force to use windows based machines, and because of that windos <a href='http://en.wikipedia.org/wiki/Cmd.exe' target='_blank' rel=\"nofollow noopener noreferrer\"> cmd</a> and even the new <a href='http://es.wikipedia.org/wiki/Windows_PowerShell' target='_blank' rel=\"nofollow noopener noreferrer\"> powersheel</a> were a little bit disappointing, mostly because paths restrictions, python, node.js and other environments poor integration with windows machines and so.</p>\n<p>The good news for me is that with my new professional path as freelance developer, I have freedom to choose the tools I want to use, and this means to be able to work with a unix machine ( in my case just a <a href='http://www.apple.com/macbook-air/' target='_blank' rel=\"nofollow noopener noreferrer\">macbook air</a> 13-inch ). This allow me to be able to work just with a text editor ( the awesome <a href='http://www.sublimetext.com/3' target='_blank' rel=\"nofollow noopener noreferrer\"> Sublime Text Editor 3 </a> ) + terminal console to do all my job tasks; Deployment task, Track my code against <a href='http://git-scm.com/'> git</a> repositories, have <a href='http://jekyllrb.com/' target='_blank' rel=\"nofollow noopener noreferrer\">jekyll</a> ( to work on my blog ), <a href='http://gruntjs.com/' target='_blank' rel=\"nofollow noopener noreferrer\"> grunt</a> servers ( at my daily job as front end developer ), <a href='http://es.wikipedia.org/wiki/Alias_(Unix)' target='_blank' rel=\"nofollow noopener noreferrer\" >alias</a> to run commands faster, use <a href='http://priapurnama.me/how-to-sync-your-documents-folder-to-dropbox-on-a-mac/' target='_blank' rel=\"nofollow noopener noreferrer\"> links to do really cool deployment things</a> in collaboration with <a href='https://www.dropbox.com/' taget='_blank'>Dropbox</a>, use all my VIM learned knowledge thanks this really really powerful <a href='https://www.sublimetext.com/docs/3/vintage.html' target='_blank' rel=\"nofollow noopener noreferrer\"> vintage </a> feature of sublime ... and far more.</p>\n<p>All that said, I can confirm I'm far more faster, reliable and versatile in my job after having forgotten about these fancy smart IDEs and having gone back with old school tools. That's something that some companies used to forget, believing that treat us as 'Software factories items' will improve our job, creating restrictions instead of helping to develop our creativity. So as summary, and in my personal experience, I would like to say that <strong> as the craftsman who need his own tools to create their own art pieces, a developer needs freedom to create his own work environment</strong>.</p>"},{"id":"https:/robertovg.com/blog/feeling-good-out-of-my-comfort-zone","url":"https:/robertovg.com/blog/feeling-good-out-of-my-comfort-zone","title":"Feeling good out of my comfort zone","date_published":"2014-03-26T00:00:00.000Z","date_modified":"2014-03-26T00:00:00.000Z","content_html":"<p>Well, after a long time without writing it's time to resume my occasional blogger activity, and for this fist 2014 post I want to talk about the new direction a have chosen for my life.</p>\n<p>I am from Cadiz but since I finished my career, six years ago, I have been living in Seville and working in big companies ( <a href='http://www.indracompany.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Indra</a>, <a href='http://es.wikipedia.org/wiki/Sadiel' target='_blank' rel=\"nofollow noopener noreferrer\">Sadiel</a> and <a href='http://www.fujitsu.com/fts/' target='_blank' rel=\"nofollow noopener noreferrer\">Fujitsu</a> ) for the most powerful Spanish client: Public Administration. This was my 'automatic professional direction', and although I was comfortable at job and I have learned A LOT during this period, I had the feeling to miss something, that's why I was always looking for something more.</p>\n<p>My studies gave me a good knowledge about Java and good experience but thanks to a couple of subjects at University I was also very excited with javaScript and its possibilities. That was the reason to build <a href='http://robertovg.com/side-projects/timelapse/' target='_blank' rel=\"nofollow noopener noreferrer\">TimeLapse</a> as my Final Degree Project, but in this time <a href='http://jquery.com/' target='_blank' rel=\"nofollow noopener noreferrer\">jQuery</a> was 'starting' to be popular and <a href='http://dojotoolkit.org/' target='_blank' rel=\"nofollow noopener noreferrer\">Dojo</a> was my election as it was one of the mature javaScript frameworks available. Even though, I wasn't able to find any professional option for this path and I just keep improving my javaScript skill as an complement in my CV. At work I was always trying to get all front end jobs I find to put into practice things I was learning as front end because I was hired as Java Developer.</p>\n<p>But two about two years ago, something changed, I started looking out of corporative <a href='http://en.wikipedia.org/wiki/Information_technology' target='_blank' rel=\"nofollow noopener noreferrer\">IT</a> world to improve, and found that getting new certifications or demanded courses was not the best way to improve in my daily work. I started attending 'non-typically' professional events as a <a href='http://robertovg.com/eventos/barcampes-sevilla-2012/' target='_blank' rel=\"nofollow noopener noreferrer\">Apache Barcamp</a>, <a href='http://www.abelsutilo.com/blog/open-space-sevilla/' target='_blank' rel=\"nofollow noopener noreferrer\">Open Space</a>, <a href='http://betabeers.com/community/betabeers-sevilla-26/' target='_blank' rel=\"nofollow noopener noreferrer\">Betabeers</a>, <a href='http://www.meetup.com/SevillaJS/' target='_blank' rel=\"nofollow noopener noreferrer\">SevillaJS</a>... showing me that a different path than working for big companies was also possible. Even I started to write my first <a href='http://robertovg.com/side-projects/audiostation-steroids/' target='_blank' rel=\"nofollow noopener noreferrer\">side project </a></p>\n<p>The other thing I was always <del>upset</del> worried about was the lack of ownership of my work working somewhere were I wanted to do my best not only because I have to but also because it's the way to work as a team, but in outsources service projects this was impossible, at least in Spain, where the important was to bill hours and not the quality of the final product.</p>\n<p>So after 3 year of English preparation in academies ( Spanish English Education it's thoroughly insufficient ) and a clear idea that I wanted to change my professional direction to javaScript and front end, the opportunity appear in front of me, and I, with no doubt, took it. This is currently the job I'm doing from the beginning of 2014, working in <a href='http://www.precursive.co.uk/' target='_blank' rel=\"nofollow noopener noreferrer\">Precursive</a> as Javascript developer.</p>\n<p>Then I realized that if I was living in Seville was only because my job were there and I always wanted to have the chance to live in <a href='http://www.pinterest.com/nuriaasb612/conilexperience/' target='_blank' rel=\"nofollow noopener noreferrer\">Conil de la Frontera</a>, were I like to go to relax and where the quality of life is unbeatable.</p>\n<p>The funniest thing about all these changes was the post-shock I got, even when the decision was logic and I was sure that I wanted to don't miss the opportunity it was given to me, I needed some time to adapt myself:</p>\n<ul>\n<li>From living in a big city to live in a little town.</li>\n<li>From working in a big company in person to work in a real start up from home ( teleworking ).</li>\n<li>From speaking with my mates in Spanish to work in English.</li>\n<li>From using Java, Tomcat, Maven to Javascript, <a href='http://www.salesforce.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Salesforce</a> ,<a href='http://angularjs.org/' target='_blank' rel=\"nofollow noopener noreferrer\">Angular</a>,<a href='http://yeoman.io/' target='_blank' rel=\"nofollow noopener noreferrer\">Yeoman</a>...</li>\n</ul>\n<p>So there is no reason to say I haven't gone out of my comfort zone and now I can really say that I have never been happier and more confident with my decisions, even when I have more responsibility over my shoulders and the work is far harder than at my last job... So it was worth.</p>"},{"id":"https:/robertovg.com/blog/getting-started-with-wordpress-in-openshift","url":"https:/robertovg.com/blog/getting-started-with-wordpress-in-openshift","title":"Getting started with Wordpress in Openshift","date_published":"2013-10-14T00:00:00.000Z","date_modified":"2013-10-14T00:00:00.000Z","content_html":"<p>First of all I would like to say that I don't use to write technical tutorials or guides but there's always a first time, isn't there?. Anyway this will be more some brief steps to follow more than a technical tutorial indeed but I hope it's useful in order to start using Openshift as your <a href='http://en.wikipedia.org/wiki/Platform_as_a_service' target='_blank' rel=\"nofollow noopener noreferrer\">PaaS</a>.</p>\n<p>Openshift is one of the best cloud platform recently created to make developers life easier, and once you <a href='https://www.openshift.com/products/architecture' target='_blank' rel=\"nofollow noopener noreferrer\">understand</a> how it work it and how to use it it will become a great place where deploy your projects. Otherwise it is also true that some time is needed to get ready to be productive with it. I like it because I think you have enough flexibility ( more than most of cloud PaaS available ) but it gives you a lot of work solved, without considering that there is <a href='https://www.openshift.com/products/online' target='_blank' rel=\"nofollow noopener noreferrer\">OpenShift Online</a> account that it's for free.</p>\n<p>There is a great documentation in the official Openshift webpage and a huge community which would help you with any issue you find. For instance to deploy wordpress in the 'official way' you can find their <a href='https://www.openshift.com/quickstarts/wordpress-3x' target='_blank' rel=\"nofollow noopener noreferrer\">documentation</a>, but the idea of this post is to explain how I stated using Openshift, deploying Wordpress instances and how I adapt the defaults instructions to work with a local environment synchronized with the Openshift instance.</p>\n<h1>Prerequisites</h1>\n<ol>\n<li>The first thing you need to do it's to <strong>create a new an Openshift account</strong> in <a href='https://www.openshift.com/' target='_blank' rel=\"nofollow noopener noreferrer\">www.openshift.com/</a>.</li>\n<li>Then you need to have <strong>installed the <a href='https://www.openshift.com/developers/rhc-client-tools-install' target='_blank' rel=\"nofollow noopener noreferrer\">OpenShift Client Tools (rhc)</a></strong>. You will previously need to have installed git and ruby to execute rhc, but the instructions below will also help with that.</li>\n<li>To <strong>configure your local rhc</strong> installation Openshift provides an easy to use command to generate all the configuration. The configuration will be stored in <code class=\"language-text\">~/.openshift/express.conf</code> file. The command to start with the wizard configuration is: <code class=\"language-text\">$rhc setup</code>.</li>\n</ol>\n<h2>Deploy in OpenShift</h2>\n<ol>\n<li>Once we have our environment ready to connect to Openshift, the next step is to execute the creation command using my forked <a href='https://github.com/robertovg/wordpress-example' target='_blank' rel=\"nofollow noopener noreferrer\">wordpress-example</a>. I created it because I changed some little things in my way such as deleted the worpdress sources ( so we use the last update in our installation directly instead of the old one in the official Openshift wordpres-example ) and I prepared some helpful alias in the deploy script ( so the configuration in the Openshift instance will be automatic and won't conflict with the local configuration, even using the same sources ). The following command will also <strong>clone the current gear structure in a folder</strong> called like 'yourWPName' ( of course you can change to the name you want for your wordpress installation ). <code class=\"language-text\">$rhc app create &#39;yourWPName&#39; php-5 mysql-5 --from-code=https:// github.com /robertovg/ wordpress-example</code>. The wizard will ask you about 'yournamespace' ( the name-space where all your gears will be allocated ).</li>\n<li>Then we have to <strong>download the Wordpress sources</strong> we want and unzip it into &#x3C;cloneDirectory>/php folder. It's important to remember where is our &#x3C;cloneDirectory> because we will use it again in the followings steps.</li>\n<li>Afterwards we <strong>add, commit and finally push all files to the git repository</strong>, so you will have an instance of the wordpress version you have downloaded up and running in the following url: <code class=\"language-text\">http://yourWPName- $yournamespace .rhcloud.com</code>.</li>\n<li>It is a good idea to <strong>configure your Wordpress instance</strong> through the web console (wp-config), do not install any plugins or theme yet. And with that you will have your Wordpress instance installed and running in Openshift.</li>\n</ol>\n<h2>Sync your local environment with Openshift</h2>\n<ol>\n<li>\n<p>First we need <strong>to have installed an Apache server compatible with PHP plus a MySQL database</strong> . You can do it in the way you prefer but I recommend you using <a href='http://www.mamp.info/en/index.html' target='_blank' rel=\"nofollow noopener noreferrer\">MAMP</a>, <a href='http://www.apachefriends.org/en/xampp.html' target='_blank' rel=\"nofollow noopener noreferrer\">XAMPP</a>, <a href='http://bitnami.com/' target='_blank' rel=\"nofollow noopener noreferrer\">bitnami</a> or a tool like these ones.</p>\n</li>\n<li>\n<p>We need <strong>to make a backup of our Openshift Wordpress Gear</strong> ( it's highly recommended to do it each time to keep your data secure ), so we can generate the same instance in our machine cloning the database, this is useful to have exactly the same configuration. So we execute this command <code class=\"language-text\">$rhc snapshot save yourWPName</code>, and in the current directory it will generate a 'tar.gz' file, once we unzip it we will find a 'app-root/data /mysql<em>dump</em>snapshot.gz' inside, now we need to connect to our local mysql and execute the script to have the same database as in Openshift instance. 'app-root/data' will also contain all uploaded data to the Openshift server ( gallery, plugins, themes, uploads).</p>\n</li>\n<li>\n<p>Then we need <strong>to configure our Apache</strong> to point to our &#x3C;cloneDirectory>/php. We can do it in very different ways but I recommend to use alias in the httpd.conf Apache config file. First we need to know we have enabled 'alias<em>module' at the beginning of the file. Then we need to add the following code in the `&#x3C;IfModule alias</em>module>` section or alias.conf file, if exists.</p>\n<p><code class=\"language-text\">Alias /yourWPName &#39;&lt;cloneDirectory&gt;/php&#39;</code> <br>\n<code class=\"language-text\">&lt;Directory &#39;&lt;cloneDirectory&gt;/php&#39;&gt;</code> <br>\n<code class=\"language-text\">Options Indexes MultiViews +FollowSymLinks</code> <br>\n<code class=\"language-text\">AllowOverride All</code> <br>\n<code class=\"language-text\">Order allow,deny</code> <br>\n<code class=\"language-text\">Allow from all</code> <br>\n<code class=\"language-text\">&lt;/Directory&gt;</code> <br></p>\n</li>\n<li>\n<p>The next thing is <strong>configure <a href='https://github.com/robertovg/wordpress-example/blob/master/php/.htaccess-alias' target='_blank' rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">.htaccess-alias</code></a> and <a href='https://github.com/robertovg/wordpress-example/blob/master/php/wp-config-local.php' target='_blank' rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">wp-config-local.conf</code></a></strong>. These files can be found in the &#x3C;cloneDirectory>/php. The first one indicate the configuration of the alias for our local Wordpress instance so we will need to change the 'alias' to 'yourWPName' or to the name of your local instance. The second file is the <a href='http://codex.wordpress.org/Editing_wp-config.php' target='_blank' rel=\"nofollow noopener noreferrer\">Wordpress configuration file</a>, you will need to configure the database information to make the just restored MySQL accessible.</p>\n</li>\n<li>\n<p>When we have these two files with the correct configuration, then we will need to <strong>create two alias</strong>. So that we move to the &#x3C;cloneDirectory>/php with the terminal and then we write:</p>\n<p><code class=\"language-text\">$ln -sf .htaccess-alias .htaccess</code><br>\n<code class=\"language-text\">$ln -sf wp-config-local.conf wp-config.conf</code><br></p>\n</li>\n<li>\n<p>The next thing to do is <strong>to change the 'siteurl' and 'home' rows in the 'wp_options' table</strong> of MySQL. This is important because, otherwise we won't be able to access to the server. So there will appear <code class=\"language-text\">http://yourWPName- $yournamespace .rhcloud.com</code> or something similar, and we have to change it to <code class=\"language-text\">http://localhost/yourWPName</code>.</p>\n</li>\n<li>\n<p>The next step is <strong>to start or restart your Apache server</strong> tool and start using our Wordpress locally.</p>\n</li>\n<li>\n<p>Finally you will be able <strong>to change themes, install plugins and so</strong>. All this changes first in the local environment and then add, commit and push new or updated files to the server. In this way your changes will be automatically deployed into the production ( Openshift ) environment and everything will be first checked locally and changes stored in the git repository. It's important to know that pages, post and this kind of information have to be pushed to the server with the MySQL script. So just to clear the information, <strong>plugin and themes changes from local to server and post ( through git )</strong>, <strong>pages and BD changes from Openshift instance to local ( through backups step 4 )</strong>.</p>\n</li>\n</ol>\n<blockquote>\n<p>So more or less this is a brief resume how I'm using Openshift to play with Wordpress instances.</p>\n</blockquote>"},{"id":"https:/robertovg.com/blog/let-me-introduce-you-to-audiostation-steroids","url":"https:/robertovg.com/blog/let-me-introduce-you-to-audiostation-steroids","title":"Let me introduce you to AudioStation Steroids","date_published":"2013-09-11T00:00:00.000Z","date_modified":"2013-09-11T00:00:00.000Z","content_html":"<p>Summer is almost over, colder days are coming and spending a few more time in front the screen developing at home looks far more logical than months ago.</p>\n<p>My first no-beach Sunday gave me time to finish and publish <strong>Audio Station Steroids</strong>, mi first <a href='https://chrome.google.com/webstore/category/extensions?hl=en' target='_blank' rel=\"nofollow noopener noreferrer\">Google Chrome Extension</a>.</p>\n<p>I have been using this extension for months because I wanted to keep my last.fm updated with the music I listen through my <a href='http://www.synology.com/dsm/dsm_for_home.php?lang=us' target='_blank' rel=\"nofollow noopener noreferrer\">DiskStation</a> but it hasn't had a good looking until <a href='https://twitter.com/nuriaasB612' target='_blank' rel=\"nofollow noopener noreferrer\">Nuria</a> helped me with the fantastic icon she designed to me.</p>\n<p>I've started this project because I really wanted to have real project where to put into practice the theory I have been learning and reading about the new wave of JavaScript that it has appeared recently with libraries such as <a href='http://backbonejs.org/' target='_blank' rel=\"nofollow noopener noreferrer\">backbone.js</a>, <a href='http://underscorejs.org/' target='_blank' rel=\"nofollow noopener noreferrer\">underscore.js</a>, <a href='http://expressjs.com/' target='_blank' rel=\"nofollow noopener noreferrer\">express.js</a>, <a href='http://nodejs.org/' target='_blank' rel=\"nofollow noopener noreferrer\">node.js</a>, <a href='http://visionmedia.github.io/mocha/' target='_blank' rel=\"nofollow noopener noreferrer\">mocha.js</a>, etc. Along the way I got some more knowledge, for example getting to know how to develop <a href='http://developer.chrome.com/extensions/index.html' target='_blank' rel=\"nofollow noopener noreferrer\">Google Chrome Extensions</a> or how to manage <a href='http://en.wikipedia.org/wiki/Platform_as_a_service' target='_blank' rel=\"nofollow noopener noreferrer\">PaaS</a> options like <a href='https://www.openshift.com/' target='_blank' rel=\"nofollow noopener noreferrer\">OpenShift</a> or <a href='https://www.appfog.com/' target='_blank' rel=\"nofollow noopener noreferrer\">AppFog</a> ( which finally I choose in this case ).</p>\n<p>So I could say that I wanted to do something useful ( firstly to me ) and it could bring me the opportunity to learn and practice with a project built from zero. And I did it! Let me explain this a little more.</p>\n<p>After some time using it I realize that, <strong>why not to publish it in the <a href='https://chrome.google.com/webstore?hl=en' target='_blank' rel=\"nofollow noopener noreferrer\">Chrome Web Store</a> and let other user of last.fm and with an Synology DiskStation use it?</strong> And now you can find the extension in the <a href='https://chrome.google.com/webstore/detail/audiostation-steroids/bmbaoffaphmekjaffppohjacnbpdnfej' target='_blank' rel=\"nofollow noopener noreferrer\">Chrome Web Store</a>.</p>\n<p>Another thing was, it's good to learn and practice all this new technologies together in a real project so, but it is very selfish to keep all this code stored in my machine so..., <strong>why not to publish the sources in a public repository of both the Chrome Extension and the BackendEnd needed to make <a href='http://www.last.fm/help/faq?category=Scrobbling' target='_blank' rel=\"nofollow noopener noreferrer\">Scrobblings</a> work securely?</strong> And again I also did it.</p>\n<ul>\n<li><strong>AudioStation Steroids</strong> Google Chrome Extension in this Github repository: <a href='https://github.com/robertovg/audiostation-steroids' target='_blank' rel=\"nofollow noopener noreferrer\">https://github.com/robertovg/audiostation-steroids</a>.</li>\n<li><strong>Steroids Gateway</strong> a node.js backend created for security proposes on this repository: <a href='https://github.com/robertovg/steroids-gateway' target='_blank' rel=\"nofollow noopener noreferrer\">https://github.com/robertovg/steroids-gateway</a>.</li>\n</ul>\n<p>The truth is that although I am not thoroughly proud of the result of this project, I am happy enough to show it. I hope that is useful.</p>"},{"id":"https:/robertovg.com/blog/is-there-cooperation-between-coworkers","url":"https:/robertovg.com/blog/is-there-cooperation-between-coworkers","title":"Is there cooperation between coworkers?","date_published":"2013-07-19T00:00:00.000Z","date_modified":"2013-07-19T00:00:00.000Z","content_html":"<p>We are currently living strange times where our path is no longer well defined for any of us. <strong>Financial Crack</strong>, Several <strong>Corruption Cases</strong> in all the layers of our system and the biggest <strong>Ethical Crisis</strong> never seen before makes ourselves keep lost, hopeless and without trusted model to follow.</p>\n<p>So with all social rules breaking our basic instinct and learned morals become more important to make decision but, what it's happening?\nI not writing to praise for isolated well acting or acts of kindness of some people, what would have always been the natural way of behaving between each other, but to complain about selfishness and cruelty I find these days in society, works environments and even families.</p>\n<p>I will try to focus on work environment where it's increasingly common to see people fighting each other at work to get a better position in their company, no matter what it cost. It's true this have usually happened in a few cases to promote, but now it about preventively keep their job. Colleges shows rivalry to their coworkers and act against them just to 'survive'. <strong>The worse our work conditions are, the worse people treat each other</strong>, even causing more hurt and more pressure to them on their daily job than their bosses do!. I have seen examples of this in both public and private sector.</p>\n<p>Two important deductions to get; <strong>Fighting each other would just create a new problems to resolve</strong>, and of course, <strong>helping our coworkers will rise our productivity, our results and even our happiness at work</strong>. So think twice before acting selfishly with the people you work with.</p>\n<p>Sadly the causes which triggered our crisis have not gone yet, we are more and more unmotivated <em>'to rise against the system'</em>, probably by the <a href='http://en.wikipedia.org/wiki/Learned_helplessness' target='_blank' rel=\"nofollow noopener noreferrer\">learned helplessness</a> our politicians have produced us with their passivity in helping people, lying in everything and making us feel not to have any control about the decisions the make about our future. We, as a whole, start to look more like a huge asleep group of starveling pigeons than humans. In summary it's difficult to find hope in this panorama until we start to react, to regroup and to fight.</p>\n<p>Consequently the worst is yet to come, therefore we had better try to make stronger communities to stay better prepared to shed light on these coming future shadows.</p>\n<blockquote class='pull-right'>Image by Flickr user <a href='http://www.flickr.com/photos/kali99/' target='_blank' rel=\"nofollow noopener noreferrer\">Kali99</a> <cite title='Creative Commons license'>used under a Creative Commons license.</cite></blockquote>"},{"id":"https:/robertovg.com/blog/were-like-wine-we-get-better-with-time","url":"https:/robertovg.com/blog/were-like-wine-we-get-better-with-time","title":"We're like wine, we get better with time","date_published":"2013-05-21T00:00:00.000Z","date_modified":"2013-05-21T00:00:00.000Z","content_html":"<p>It's curious how the time makes you improve with almost everything. People sometimes get the wrong idea of losing faculties with the time and this is only true for physical and mental <strong>deterioration</strong> but within healthful limits, you will be more productive to accomplish tasks you know with time.</p>\n<p>I enjoy switching my routines, learning new hobbies and changing the ways I take to achieve my goals. In this process it's easy to leave behind some abilities, in spite of what would be natural, we don't forget them but we improve what we know to do, <strong>like wine, our talent gets better with time</strong>.</p>\n<p>Well, it's true that there is nothing new with that, just the experience concept, but the amazing thing ( for me at least ) with is that you keep improving also without continue practicing a ability.</p>\n<p>I realized about this reflection some days ago, but it fits perfect in different aspects of my life. I, as developer, use to check it when I learn a new technology, library, framework for coding I use them better after a while rather than just after having learned them. Ok, the way for explaining this is simple <strong>you need time to assimilate what they have learned</strong>. But not only a little period, sometimes we are talking about years, and without practicing during that time, e.g. I've spent more than a year without coding <a href='http://en.wikipedia.org/wiki/PL/SQL' target='_blank' rel=\"nofollow noopener noreferrer\">PL/SQL</a> ( either <a href='http://en.wikipedia.org/wiki/SQL' target='_blank' rel=\"nofollow noopener noreferrer\">pure SQL</a> just some <a href='http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querycriteria.html' target='_blank' rel=\"nofollow noopener noreferrer\">criteria</a> queries which are too different ) and now it's by far easier for my to write difficult queries than before, and this is amazing, I remember better how to think in the old way of SQL than when I learned it.</p>\n<p>Even more astonish is what happen with the guitar and songs I learned with, with no rehearsal those songs I used to play, they sounds better when I start playing them again after some months or so.</p>\n<p>After more than one year using my reflex camera just for taking events pictures ( like christenings, weddings, communions, birthdays and other family events ) in which you don't use your camera for creating art photos but just to remember this moments, it awesome to realize how I master my abilities and I'm able to control all of them to do exactly what you want to express within a shot.</p>\n<p>Check this photo, from a set of pictures I took in <a href='http://www.flickr.com/photos/robertovg24/sets/72157633511463587/' target='_blank' rel=\"nofollow noopener noreferrer\">Río Tinto</a> in early May.</p>\n<p>Another good thing about it's the perspective you get when you resume an activity that you stopped practicing and the better election of the ways to resolve a problem o express a feeling you can do. Of course this is be caused because your brain sort what you have learned with time, giving you the right control over your learned skills.</p>\n<p>It's amazing the feeling that there is always place for more and what you already know will improve by itself, so you know; <strong>You can never learn too much</strong>.</p>\n<blockquote>\n<p>PD: This is my first time I use <a href='http://en.wikipedia.com/wiki/Markdown' target='_blank' rel=\"nofollow noopener noreferrer\">Markdown</a> in a writing, and I'm thoroughly pleasant with.</p>\n</blockquote>"},{"id":"https:/robertovg.com/blog/guide-to-online-sustainability","url":"https:/robertovg.com/blog/guide-to-online-sustainability","title":"Guide to online sustainability","date_published":"2013-01-25T00:00:00.000Z","date_modified":"2013-01-25T00:00:00.000Z","content_html":"<div>\n\tI would just like to explain some basic ideas about how the Internet Products and Services work and what is our role on this scenario.\n</div>\n<h3>Learn English:</h3>\n<div>\n\tInternet is made for and by a very different amount of people from everywhere, so in order to make their information as available as they can, is common to see English Language to be used as a <a href='http://meta.wikimedia.org/wiki/List_of_Wikipedias#All_Wikipedias_ordered_by_number_of_articles' target='_blank' rel=\"nofollow noopener noreferrer\">universal language</a>, in that way, the information written could reach more people.\n    <strong>If you, as a user, want to get the most out of Internet, you will need this language key.</strong>\n    It is incredible all the information you can find available once you know that and not only to be able to access <strong>more information but also to access the best, breaking news or even professional data</strong> could make you improve in your professional career.\n</div>\n<h3>Look for services instead app:</h3>\n<div>\n\tToday the everybody has access to 'private' applications stores. Apple has the <a href='http://www.apple.com/itunes/' target='_blank' rel=\"nofollow noopener noreferrer\">App Store</a> for iOS and <a href='http://www.apple.com/osx/apps/app-store.html' target='_blank' rel=\"nofollow noopener noreferrer\">Mac Store</a> for Mac, Android has <a href='https://play.google.com/store' target='_blank' rel=\"nofollow noopener noreferrer\">Google Play</a>, Windows 8 has just released his new <a href='http://windows.microsoft.com/is-IS/windows-8/apps' target='_blank' rel=\"nofollow noopener noreferrer\">Windows Store</a>, and all of them make thoroughly <strong>trivial accessing to these content and to spending money on it.</strong>\n    But something that is not so easy to realise that what you buy there, usually, only works there and if you change your fancy smartphone, buy a new computer with other Operative System or <strong>want to access to your own content from other device or directly through the Internet, you probably find that you can’t.</strong>\n    So a good solution is to <strong>look for Services that offers what you want</strong> and are available from your current device.\n    For example if you buy an e-book in iBooks or iTunes from Apple, then you will be unavailable to read it on a <a href='https://discussions.apple.com/thread/3072596?start=45&amp;tstart=0' target='_blank' rel=\"nofollow noopener noreferrer\">non-apple device</a>, but in opposition e-books bought on Amazon will be read on any kind of device, even directly from the web. I usually pay for services such as <a href='https://www.rememberthemilk.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Remember The Milk</a>, <a href='https://toshl.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Toshl</a>, <a href='https://keepersecurity.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Keeper</a>... instead buy just applications in the stores.\n</div>\n<h3>Be the client not the product:</h3>\n<div>\n\tThe Internet is a hostile virtual world where all inhabiting <strong>enterprises try to survive earning money</strong> ( like in the real world ). That is said, we as the Internet users, must realize about that fact, and with it on mind try to discover how the services we use day by day earn money, because we are directly connected with that process.\n    Trying to do the right things ( using legitimately services and application ) I really think we should pay for some of the services we use instead of using free one, or at least be aware of the fact that others will earn money with our personal information that could be extracted or sent through the use of their service, it means, <strong>you are the product and not the client</strong>. Without transparency it could be upset or even dangerous for your privacy.\n    For example <a href='http://news.cnet.com/8301-13578_3-57559710-38/instagram-says-it-now-has-the-right-to-sell-your-photos/' target='_blank' rel=\"nofollow noopener noreferrer\">Instagram changed their privacy policy </a>( although later they had to <a href='http://news.cnet.com/8301-1023_3-57559890-93/instagram-apologizes-to-users-we-wont-sell-your-photos/' target='_blank' rel=\"nofollow noopener noreferrer\">retract themselves </a>) that was because it is a free service whose purpose was to be sold, and when they achieved it ( Facebook <a href='http://www.sfgate.com/technology/article/Facebook-s-Instagram-purchase-final-3845127.php' target='_blank' rel=\"nofollow noopener noreferrer\">paid $741 million </a>for being the owners ), Facebook had to get their 'return on investment'.\n    Flickr in contrast allows you to decide your photo’s license and you will always be the one who have the control of your work.\n</div>\n<h3>Do not put your eggs all in one basket!</h3>\n<div>\n\tEverybody knows that <a href='http://en.wikipedia.org/wiki/Cloud_computing' target='_blank' rel=\"nofollow noopener noreferrer\">cloud</a> is a fashionable term, its a brand new horizon opened in front of us. It is amazing to be able to store your documents in applications and to access those files from other application. Dropbox, iCloud, Skydrive or the closed Megaupload.\n    <strong>All of them are services to store your data on the Internet and then share them, access to it from everywhere, but, what will happens if this services shuts down?</strong>\n    Because there is no border online, sometimes a services could close on account of a law.\n    So be aware of where you store your important data such as photos, personal documents, and so.\n</div>\n<div>\n\tThanks for reading!\n</div>\n<blockquote class='pull-right'>Image by Flickr user <a href='http://www.flickr.com/photos/jurvetson/5114191251/in/photostream/' target='_blank' rel=\"nofollow noopener noreferrer\">jurvetson</a> <cite title='Creative Commons license'>used under a Creative Commons license.</cite></blockquote>"},{"id":"https:/robertovg.com/blog/rise-against-procrastination","url":"https:/robertovg.com/blog/rise-against-procrastination","title":"Rise Against Procrastination","date_published":"2012-12-14T00:00:00.000Z","date_modified":"2012-12-14T00:00:00.000Z","content_html":"<p>\n\tI usually try to stay up to date, and it is obvious that as a programmer I use the Internet to do it, but <strong>the Internet is wild and huge enough to make you get lost</strong>.\n</p>\n<p>\n\tSo it is <strong>important to keep yourself focus on what you can do with the time you want to spend into</strong>. With this in mind, I would like you to explain how I usually 'rise against the procrastination'.\n</p>\n<p>\n\tI take the information from blogs through <strong><a href='http://www.google.com/reader' target='_blank' rel=\"nofollow noopener noreferrer\">Google Reader</a>, which is the easier, faster, and easy way to follow many websites</strong>. The problem is that saving time getting the content is not enough to me. So I split the news consuming process in two task;\n\t<ul>\n\t\t<li>Get the <strong>shorts or breaking News read, directly from Google Reader</strong></li>\n\t\t<li>All the important news, articles or even tutorials I haven't enough time to read directly from Google Reader, I just <strong>Read it Later</strong>.</li>\n\t</ul>\n</p>\n<p>\n\tThat is, there are a lot of services to read the web later; <a href='http://getpocket.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Pocket</a>, <a href='http://www.instapaper.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Instapaper</a>, <a href='http://support.apple.com/kb/PH5074' target='_blank' rel=\"nofollow noopener noreferrer\">Safari Read later feature</a> and <a href='http://howto.cnet.com/8301-11310_39-20120219-285/how-to-use-the-new-safari-features-in-ios-5/' target='_blank' rel=\"nofollow noopener noreferrer\">its integration with iOS 5</a> or later. There are services as strangers than <a href='http://blackstrap.it' target='_blank' rel=\"nofollow noopener noreferrer\">blackstrap.it</a>, which takes selected articles from your Instapaper or Pocket queue and binds them into a book. <strong>But with no doubt the best 'Read it Later' service was <a href='http://www.readability.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Readability</a></strong> (no longer available..., <a href='https://blogging.com/rss-dead' target='_blank' rel=\"nofollow noopener noreferrer\">here</a></strong> a 2018 guide of the best RSS Readers). Its usability is awesome, it has got applications for most of Operative Systems ( officials and unofficially applications through its <a href='https://www.readability.com/developers/api' target='_blank' rel=\"nofollow noopener noreferrer\">API</a> ), you can make any web site more reading-friendly just with a browser extension and it has the <strong>'send to kindle'</strong> feature witch allow you to read the articles, news and anything you can find on the Internet into your device. This is important because it is not very comfortable to read long texts into a computer screen and it is easier to carry with a <a href='https://kindle.amazon.com/' target='_blank' rel=\"nofollow noopener noreferrer\">kindle device</a> than with a computer. And last but not least, it is thoroughly <a href='https://www.readability.com/learn-more' target='_blank' rel=\"nofollow noopener noreferrer\">free</a>!.\n</p>\n<p>\n\tSo with a good plan to read, the Internet can be tamed without spending too much time.\n</p>\n<blockquote class='pull-right'>Image by Flickr user <a href='http://www.flickr.com/photos/villes/2865833414/in/photostream/' target='_blank' rel=\"nofollow noopener noreferrer\">ZeroOne</a> <cite title='Creative Commons license'>used under a Creative Commons license.</cite></blockquote>"},{"id":"https:/robertovg.com/blog/the-passionate-programmer","url":"https:/robertovg.com/blog/the-passionate-programmer","title":"The Passionate Programmer","date_published":"2012-11-23T00:00:00.000Z","date_modified":"2012-11-23T00:00:00.000Z","content_html":"<p>\n\tI've finally finished <a href='http://pragprog.com/book/cfcar2/the-passionate-programmer' target='_blank' rel=\"nofollow noopener noreferrer\">'The Passionate Programmer'</a> by <a href='http://www.chadfowler.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Chad Fowler</a> one of 'technical books' I've most enjoyed. Specifically this is not an technical book but a book for technical developers who want to learn about the experience of a successful engineer.\n</p>\n<p>\n\tThe book is based on Chad's personal experience. He always try to give you the good parts from each one allowing you to learn his conclusions directly from the text.\n</p>\n<p>\n\tThe stories you'll find inside the book ( I won't spoil it to much ) are not only about <a href='http://en.wikipedia.org/wiki/Software_industry' target='_blank' rel=\"nofollow noopener noreferrer\">Software Development Industry</a>, before he becoming a programmer he started his career as a full-time saxophonist and a lot of his lessons are extracted from this period and surprisingly all of them fit nicely into <a href='http://en.wikipedia.org/wiki/Information_technology' target='_blank' rel=\"nofollow noopener noreferrer\">IT</a> world. I'm also a musician, I play the guitar in a blues band, just for fun, so that all his music examples sounds familiar to me.\n</p>\n<p>\n\tOne of the good parts in the book is the end of each section called 'Act on it' in which Chad Fowler send you homework about the topic of latter section.\n</p>\n<p>\n\tThe books it's structured into five main blocks:\n</p>\n<ul>\n\t<li>Choosing Your Market</li>\n\t<li>Investing in Your Product</li>\n\t<li>Executing</li>\n\t<li>Marketing...Not Just for Suits</li>\n\t<li>Maintaining Your Edge</li>\n</ul>\n<p>\n\tA three first chapters brief resume could be the title of this one: <strong>'Love It or Leave It'</strong>, yes there are a lot of pieces of advices, so much useful, but the point is this one, according to Chad: <strong>'You have to be passionate about your work if you want to be great at your work'</strong> that simple, but it really is. If your are really interested into Software Development you will find the way to be become a good Developer. Having said that, if you are crazy about Software you will learn a lot reading it. I really like the point of view he transmits about your carer treating it as a product which you want to succeed.\n</p>\n<p>\n\tThe next chapter was the most useful for me, and I think that it's the one that most technical people usually forget. <strong>To have a good marketing is as necessary as to have a brilliant product, and I usually forget it</strong>.\n</p>\n<p>\n\tI feel the last chapter as series of challenge more than as  advices, but of course I think that all of these challenges are <strong>different steps that we, as programmers, must climb</strong>.\n</p>\n<p>\n\t<strong>Its price ( $15.00 ) thoroughly worth</strong>, so in conclusion I recommend it to everyone who loves and cares about Software Development!\n</p>"},{"id":"https:/robertovg.com/blog/barcampes-sevilla-2012","url":"https:/robertovg.com/blog/barcampes-sevilla-2012","title":"#barcampes Sevilla 2012","date_published":"2012-09-26T00:00:00.000Z","date_modified":"2012-09-26T00:00:00.000Z","content_html":"<p>\n\tPara este post me ha parecido conveniente dejar mis pretensiones por el bilingüismo aparcadas y limitarme a escribir en el idioma de Cervantes mi experiencia vivida en el #barcampes Sevilla 2012. Para empezar he de decir que <strong>pasé un sábado genial</strong>, tanto por las personas que formamos este <a href='https://twitter.com/i/#!/search/?q=%23barcampes' target='_blank' rel=\"nofollow noopener noreferrer\">barcamp</a> 2012, como por <a href='http://barcampspain.com/acerca-de/' target='_blank' rel=\"nofollow noopener noreferrer\">la organización</a> ( que estuvo increíble ), por <a href='http://barcampspain.com/sponsors/' target='_blank' rel=\"nofollow noopener noreferrer\">los patrocinadores</a> y por la calidad de las <a href='http://barcampspain.com/schedule/' target='_blank' rel=\"nofollow noopener noreferrer\">charlas</a> a las que asistí. <strong>Una experiencia más que recomendable para cualquier amante del mundo del desarrollo</strong>.\n</p>\n<p>\n\tLa primera charla en la que estuve fue la que dio <a href='https://twitter.com/ydarias' target='_blank' rel=\"nofollow noopener noreferrer\">@ydarias</a> sobre <strong><a href='http://coffeescript.org/' target='_blank' rel=\"nofollow noopener noreferrer\">CoffeScript</a></strong>. En ella nos hizo una presentación muy interesante en la que resaltó su funcionamiento y los problemas que JavaScript tiene como lenguaje ( los famosos JavaScript WTF ) y cómo CoffeScript los solucionaba.\n</p>\n<p>\n\tPosteriormente fui a una de herramientas webs, concretamente <a href='https://twitter.com/nachocoloma' target='_blank' rel=\"nofollow noopener noreferrer\">@nachocoloma</a> nos explicó los secretos de <strong>Google Chrome, <a href='http://www.sublimetext.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Sublime Text Editor 2</a> y <a href='http://lesscss.org/' target='_blank' rel=\"nofollow noopener noreferrer\">LESS</a></strong>. Me resultó muy rebeladora porque aunque trabajes habitualmente con estas herramientas, siempre enriquece mucho ver la forma de trabajar de un crack como Nacho.\n</p>\n<p>\n\tLa última charla a la que asistí, antes de la hora de la comida, fue una charla sobre <strong>BDD con Javascript</strong> que <a href='https://twitter.com/carlosble' target='_blank' rel=\"nofollow noopener noreferrer\">@carlosble</a> impartió. He de decir que leí su libro hace ya tiempo y que siempre lo he tenido como referente de cómo hacer 'bien las cosas' a la hora de programar. Disfruté como un enano viendo como utilizaba <a href='http://pivotal.github.com/jasmine/' target='_blank' rel=\"nofollow noopener noreferrer\">Jasmine</a> y como había resuelto el problema de tratar con los test punta a punta con javascript preguntando con dichos test por el resultado que el usuario espera obtener en el propio documento HTML.\n</p>\n<p>\n\tDespués de la comida <a href='https://twitter.com/csanchez' target='_blank' rel=\"nofollow noopener noreferrer\">@csanchez</a> nos estuvo enseñando <strong>git avanzado</strong>. Y, aunque más que una presentación fue una improvisación sobre cómo tratar con git de forma avanzada, se pudo sacar mucha información.\n</p>\n<p>\n\tLuego asistí a la charla de <a href='https://twitter.com/itortv' target='_blank' rel=\"nofollow noopener noreferrer\">@itortv</a> nos mostró los entresijos que hay detrás de <strong><a href='http://www.karmacracy.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Karmacrazy</a></strong>, experiencia muy valiosa que tuvo a bien compartir con todos los asistentes. No mucha gente muestra esa transparencia ya que no se cortó a la hora de responder a las preguntas que le formulamos, detalles sobre su arquitectura, costes de hosting, etc.\n</p>\n<p>\n\tYa por último, la mejor charla del #barcampes según el resultado de las votaciones de los asistentes (  realmente hubo un gran nivel en todas ellas, pero ya se sabe, solo puede haber un ganador ) que fue <a href='https://twitter.com/aitorciki' target='_blank' rel=\"nofollow noopener noreferrer\">@aitorciki</a> con su <strong>'Push and pull: web de tiempo real'</strong>. La verdad que me gustó mucho la manera que encontró de explicar las distintas soluciones que se le habían dado al tiempo real en la web hasta la llegada de websockets.\n</p>\n<p>\n\tSi tengo que destacar un aspecto con el que me quedo del evento sería la <strong>cercanía que demostraron todos los ponentes</strong> con los que tuve la oportunidad de charlar.\n</p>\n<p>\n\tFue una pena no poder asistir a la fiesta en la ºarbonería, pero al menos me quedé con un excelente sabor de boca con todo lo aprendido y la gente que conocí allí.\n</p>\n<p>\n\tPor supuesto repetiré el próximo año y animo a todo aquel que tenga la oportunidad de asistir y/o fomentar eventos de este tipo que lo hagan. <strong>Humanizan</strong> a todos los que estamos al otro lado de la pantalla.\n</p>\n<footer>Imagen cogida de la galería <a href='http://www.flickr.com/photos/barcampes' target='_blank' rel=\"nofollow noopener noreferrer\">Flickr</a> de Barcampes</footer>"},{"id":"https:/robertovg.com/blog/i-dont-need-you-itunes","url":"https:/robertovg.com/blog/i-dont-need-you-itunes","title":"I don't need you, iTunes","date_published":"2012-09-13T00:00:00.000Z","date_modified":"2012-09-13T00:00:00.000Z","content_html":"<p>\n\tSix month ago, I lost my dear iPod Classic 80 GB which I used every day for four years until this tragic moment... <strong>now I can say, I don't miss it at all</strong>.\n</p>\n<p>\n\tWhen I lost it, I had a big music library with about 70 GB and now it consists of more than 100 Gb of mp3. It's so comfortable to be able to listen to your full library always when you want and off-line (without Internet) only using this device, <strong>the bad part comes when you have to manage its content</strong>.\n</p>\n<p>\n\tYes, I know there are several alternatives to iTunes, but the owner of an iPod usually manages his library with iTunes ( Window's iTunes in my case ), which is the slowest program ever I've used just doing... everything and use to fail, especially when your library is on your local network because there's no enough free space in your PC's hard drive. With all the above I can ensure the process of add or edit music on this device was tedious, it forced me to have to use always the same PC, and it used to take me a long time...\n</p>\n<p>\n\tAt home I have a NAS where I put every digital thing, and my music library is not an exception, specifically it is the <a href='http://www.synology.com/us/products/DS211j/index.php' target='_blank' rel=\"nofollow noopener noreferrer\">Synology DS211j</a>, <strong>one of best purchases I've ever made</strong>, after the loss I started using it as music streamer as well as NAS. Synology has his own Operative System accessible via HTTP called <a href='http://www.synology.com/dsm/index.php?lang=us' target='_blank' rel=\"nofollow noopener noreferrer\">DSM</a>, so I can access to it anywhere and with any device. For example I listen to music at work via <a href='http://www.synology.com/dsm/home_home_applications_audio_station.php?lang=us' target='_blank' rel=\"nofollow noopener noreferrer\">Synology Audio Station</a> inside any browser, and with my iPhone and Android devices through <a href='http://www.synology.com/dsm/home_mobile_support_ds_audio.php?lang=us' target='_blank' rel=\"nofollow noopener noreferrer\">DS Audio</a> so, in this way, <strong>I can access to my personal music library anywhere </strong>if I am connected to Internet. In addition DS audio has the availability to make a buffer with the last songs you have heard and even specifically make any list off-line available...\n</p>\n<p>\n\tWell... this is not all, now <strong>the process to add songs to my library could not be easier</strong>, just add mp3 files or folders inside an specific folder DSM create for your music library ( /music ) and all these songs will be available on all each sources I enumerated above. And you many also edit ID3 tag of each song by revising its detail information to keep every piece of your music well-organized.\n</p>\n<p>\n\tAnd before finishing I would like to explain something more I usually do when I listen to songs with digital devices... <a href='http://www.last.fm/help/faq?category=Scrobbling' target='_blank' rel=\"nofollow noopener noreferrer\">scrobbling them</a> to last.fm. Of course when I used to synchronize my loss iPod with iTunes, <a href='http://www.last.fm/download' target='_blank' rel=\"nofollow noopener noreferrer\">the official last.fm scrobbler</a> did its work. The problem now is that neither Synology Audio Station nor DS Audio are last.fm compatibles and this problem has a partial solution: <a href='http://synologyscrobbler.apphb.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Synology Scrobbler</a>, this is a Google Chrome Extension which does the job of scrobbling and  which <strong>I had the honor of collaborating with thanks to <a href='http://twitter.com/dalager' target='_blank' rel=\"nofollow noopener noreferrer\">@dalager</a></strong>, but that's a different story.\n</p>"},{"id":"https:/robertovg.com/blog/i-prefer-githubpages-to-wordpresscom","url":"https:/robertovg.com/blog/i-prefer-githubpages-to-wordpresscom","title":"I prefer github:pages to wordpress.com","date_published":"2012-08-28T00:00:00.000Z","date_modified":"2012-08-28T00:00:00.000Z","content_html":"<p>This is the first article a write entirely in English and the first one I do in this platform with Jekyll, and I have to admit that I find it much more familiar than I expected, because it's such as write code documentation, and it makes me comfortable. Of course I know this article will have some spelling mistakes, but I really think the best way to learn English is to practice it, so ... here we are.</p>\n<p>In this article I would like to explain why I have changed my personal blog to github. Here goes the reasons:</p>\n<p>\n\t<ul>\n\t\t<li>\n\t\t\tOne of the main reasons is that with <strong>github:pages you have always the control</strong>. Github:pages allow me to change all documents html, css or js directly ( back to the roots ), I can redirect this page to my custom url domain name, or even I can make little js experiments without worry about the price I have to pay to do these things in your own blog.\n\t\t</li>\n\t\t<li>\n\t\t\tThe second reason is that is that it is <strong>simplest way of publish static content</strong>. I think most of websites of the Internet don't need to be in a dynamic server ( php, ruby, python, java or whatever your server language is). They just do what the most of web does, but if you only show content, why to use a CMS or something like that?. There are a lot of disadvantage, CMS are a more complicated way to publish, you need a database, the server side and to install the same things you have in production in your pc / mac to view what are you publishing before doing. And these are futures problems.\n\t\t</li>\n\t\t<li>\n\t\t  \t<strong>Static for the web is not as bad as it seems to be </strong>, if you don't need it. Ok, the problem of organizing and maintaining a big website with only statics files is there, but there are a little trick, just use a little of ruby to transform your organized files in a fully functional static web with <a href='http://jekyllrb.com' target='_blank' rel=\"nofollow noopener noreferrer\">jekyll</a> . You even have available template engine with <a href='http://liquidmarkup.org' target='_blank' rel=\"nofollow noopener noreferrer\">liquid</a> and <a href='http://yaml.org' target='_blank' rel=\"nofollow noopener noreferrer\">Yalm</a> to specifies properties of each post, and in that way it possible.\n\t\t</li>\n\t\t<li>\n\t\t\t<strong>This hosting it's free</strong>, and when I say free I mean in deep meaning ( without advertises as does happen in wordpress ) so <a href='http://pages.github.com/' target='_blank' rel=\"nofollow noopener noreferrer\">github:pages</a> is there to make developer life easier. There are such options as ruby + git hostings exists, for example; <a href='http://www.heroku.com' target='_blank' rel=\"nofollow noopener noreferrer\">Heroku</a>, but they are not completely free.\n\t\t</li>\n\t\t<li>\n\t\t\t<strong><a href='http://en.wikipedia.org/wiki/Dynamic_HTML' target='_blank' rel=\"nofollow noopener noreferrer\">dhtml</a> rocks!</strong> Well... this is my favorite argument, yes with javaScript you can do everything you are used to do in the server side running javaScript code in each client adding content in pages 'dynamically'. For example the comments in this blog exists because of <a href='http://disqus.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Disqus</a> service witch inject comments functionality after each article content by running a piece of code. And comments are only the beginning you can really do a Rich Internet Application without a dynamic server ( using other services that do have...).\n\t\t</li>\n\t\t<li>\n\t\t\t<strong>Jekyll is more accessible than it looks</strong>, if you are not developer but want to use this way of blogging there are easy to use 'frameworks' / 'engines' that allow you to make a blog without coding knowledge; <a href='http://octopress.org' target='_blank' rel=\"nofollow noopener noreferrer\">Octopress</a>, <a href='http://jekyllbootstrap.com' target='_blank' rel=\"nofollow noopener noreferrer\">Jekyll Bootstrap</a> or the own github:pages <a href='https://help.github.com/articles/creating-pages-with-the-automatic-generator' target='_blank' rel=\"nofollow noopener noreferrer\">automatic generator</a>, will help you to start.\n\t\t</li>\n\t</ul>\n</p>\n<p>So, is this information new to you? Do you agree or disagree with the possibility of doing a blog or a web page with jekyll instead of whatever CMS?</p>"},{"id":"https:/robertovg.com/blog/servicios-abiertos-o-cerrados-ii-imdb-y-filmaffinity","url":"https:/robertovg.com/blog/servicios-abiertos-o-cerrados-ii-imdb-y-filmaffinity","title":"Servicios Abiertos o Cerrados (II): IMDb y Filmaffinity","date_published":"2011-06-16T00:00:00.000Z","date_modified":"2011-06-16T00:00:00.000Z","content_html":"<p>\n\tEn el <a title='¿servicios abiertos o cerrados?(I): last.fm' href='/{{ page.category }}/servicios-abiertos-o-cerrados-i-last-fm' target='_blank' rel=\"nofollow noopener noreferrer\">post anterior</a> de esta serie, hablé un servicio que administra nuestros gustos <strong>musicales</strong>, ahora le toca el turno de hacer lo mismo pero con las películas y las series de televisión.\n\tEn el mundo de  además con más variedad: Tenemos dos servicios que podemos utilizar para administrar nuestros gustos\n</p>\n<p>\n\tIMDb semi-abierto para empresas cerrado para usuarios ( a no ser que tengas 15.000 $ para coger tus datos).\n</p>\n<p>\n\tPor ejemplo un servicio que guarda similitud con last.fm pero relacionado con el  <strong>mundo de las películas y series es <a title='Filmaffinity' href='http://filmaffinity.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Filmaffinity</a></strong>. Una gran idea, con muchísima funcionalidad, y que su cometido lo desempeña muy bien. La gran diferencia entre este primero, es que tus datos no son accesibles más bien es justo lo contrario no hay forma de sacar tus datos de Filmaffinity,  por lo cual siempre vas a estar atado a sus políticas de servicio, además me he puesto a buscar si había alguna forma de eliminar mi cuenta y no la he encontrado.\n</p>\n<p>\n\tEsto al menos en mi opinión, es una forma tonta de empobrecer tu servicio, en Internet tienes que hacer accesibles por diferentes medios tus datos, brinda apis, darles el control a los usuarios sobre sus datos a los usuarios, esto hace que no se sientan atados, y seguro que mejorando la confianza de tus usuarios, creces. Las políticas severas y cerradas, a mi entender no tienen cabida en lo nuevos tiempos.\n</p>"},{"id":"https:/robertovg.com/blog/servicios-abiertos-o-cerrados-i-last-fm","url":"https:/robertovg.com/blog/servicios-abiertos-o-cerrados-i-last-fm","title":"Servicios Abiertos o Cerrados (I): last.fm","date_published":"2011-02-23T00:00:00.000Z","date_modified":"2011-02-23T00:00:00.000Z","content_html":"<p>Hoy <strong>es habitual que guardes tus datos en</strong> la llamada nube,<strong> en Internet</strong> vamos. Es algo que haces constantemente y casi sin darte cuenta. Esto no es nada nuevo, seguro que utilizas <a href='http://mail.google.com/mail?hl=es' target='_blank' rel=\"nofollow noopener noreferrer\">gmail </a>o <a href='http://www.hotmail.com/' target='_blank' rel=\"nofollow noopener noreferrer\">hotmail</a> en vez de tu Outlook u otro programa de correo o escuchas tus canciones con <a title='Spotify' href='http://www.spotify.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Spotify</a> en vez de con ese viejo winamp 3.X que te acompañó durante tanto tiempo. Esto se puede plantear como un problema y también como una ventaja, pero lo que sí es cierto es que <strong>ésta es una tendencia general </strong>de los usuarios de Internet.</p>\n<p>Antes de valorar este hecho, me gustaría hablar de diferentes aplicaciones que se han servido de esta <strong>tendencia </strong>para sacarle partido con estrategias muy diferentes:<strong> last.fm, IMBd</strong> y <strong>Filmaffinity </strong>(dejaré éstas dos últimas para otro post).</p>\n<p>Last.fm es una de esas aplicaciones que <strong>utilizas casi sin darte cuenta</strong>, <strong>no te molestan</strong> y te <strong>aportan mucho</strong> cuando empiezas a comprender todas sus posibilidades, <em>y lo digo porque no es inmediato ver su potencial</em>.</p>\n<p>Por si aún no lo conocías, last.fm es un servicio que se encarga de <strong>conocer tus gustos musicales</strong>, <em>¿cómo un programa va a conocer qué es lo que te gusta?</em>, &#8230;pues bien, él simplemente se va a ir enterando de la música que escuchas.</p>\n<p>La idea del funcionamiento básico de last.fm se puede explicar en unas líneas. Se basa en algo que ellos denominan <em><strong>scrobblings </strong></em>y que representan cada tema que tu has escuchado. Cada vez que escuchas un tema en soporte digital, un &#8220;<em>programita</em>&#8221; que ellos te facilitan llamado <em><strong>s</strong><strong>crobbler </strong>se encarga de </em>&#8220;decriselo&#8221; a last.fm ya sea desde <strong>tu dispositivo</strong> iOS o Android o instalando el <strong>programa en tu ordenador</strong> windows, mac osx o linux. Así que resumiendo, last.fm se entera de lo que escuchas cuando:</p>\n<ul>\n\t<li>\n\t\tEscuchas una canción en tu ordenador a través de tu reproductor favorito, como por ejemplo <a title='Spotify' href='http://www.spotify.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Spotify</a>, <a href='http://www.apple.com/es/itunes/' target='_blank' rel=\"nofollow noopener noreferrer\">iTunes</a>, <a href='http://www.winamp.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Winamp</a>, <a href='http://windows.microsoft.com/es-ES/windows/products/windows-media' target='_blank' rel=\"nofollow noopener noreferrer\">Windows Media Player</a>, <a href='http://www.rhythmbox.org' target='_blank' rel=\"nofollow noopener noreferrer\">Rhythmbox</a>, <a href='http://banshee.fm/' target='_blank' rel=\"nofollow noopener noreferrer\">Banshee</a>, <a href='http://amarok.kde.org/' target='_blank' rel=\"nofollow noopener noreferrer\">Amarok</a>, <a title='Songbird' href='http://www.getsongbird.com/' target='_blank' rel=\"nofollow noopener noreferrer\">Songbird</a>, <a href='http://www.videolan.org/vlc/' target='_blank' rel=\"nofollow noopener noreferrer\">VLC</a> &#8230;(y un largo <a href='http://www.lastfm.es/group/Does%2520It%2520Scrobble' target='_blank' rel=\"nofollow noopener noreferrer\">etcétera</a>).\n\t</li>\n    <li>\n    \tCuando escuchas algo desde tu <a href='http://www.apple.com/es/ipod/' target='_blank' rel=\"nofollow noopener noreferrer\">ipod</a>, <a href='http://www.apple.com/es/iphone/' target='_blank' rel=\"nofollow noopener noreferrer\">iphone</a>, o cualquier <a href='http://www.google.com/phone/' target='_blank' rel=\"nofollow noopener noreferrer\">dispositivo con android</a>.\n    </li>\n    <li>O cuando sincronizas tu mp3 o mp4 con tu ordenador.</li>\n</ul>\n<p>Fondo de pantalla generado con las carátulas de mis discos más escuchados</p>\n<p>Es decir que last.fm realmente <strong>te puede conocer </strong>de muchísimas maneras y <strong>sin tener que cambiar tus hábitos</strong>, instalas el &#8220;<strong>programita&#8221; </strong>y te olvidas. <em>Pero a ver, ¿qué es lo que gano yo diciendoles a los de last.fm que es lo que escucho?</em></p>\n<ul>\n\t<li>Tienen la opción de pagar por una radio (3€ al mes) que como ya te conoce perfectamente, te va a poner música acorde con tus gustos.</li>\n\t<li>Te va a recomendar, nuevos artistas, nuevos discos, conciertos, festivales, etc.,  relacionados con la música que tu realmente escuchas.</li>\n\t<li>Tiene un componente social, que aunque no lo potencian todo lo que deberían, está muy conseguido. <em>Por ejemplo puedes buscar gente con gustos musicales parecidos a los tuyos para ver qué grupos escuchan y así conocer novedades.</em></li>\n\t<li>Por último, y para mí lo más importante<strong>, tu eres dueño de tus datos, </strong>aunque ellos lo administran, <strong>tu tienes el control</strong>.</li>\n</ul>\n<p>Last.fm hace que toda esa <strong>información </strong>que recogen de ti <strong>sea accesible </strong>de hecho puedes acceder a ella <strong>desde su web</strong>, a través de <strong>rss</strong> y desde la <strong><a href='http://www.lastfm.es/api' target='_blank' rel=\"nofollow noopener noreferrer\">api</a></strong> que ofrecen. Ello posibilita que terceras aplicaciones puedan enriquecer tu experiencia con todos esos datos. Además, <strong>tu eres quien tiene el cotrol de tus datos</strong>; puedes borrar de tu lista de scrobblings un artista o canción en concreto o si así lo decides, puedes borrar tu cuenta haciendo desaparecer todo el rastro que hayas dejado en el servicio.<em> Me parece muy importante tener todas estas opciones para sentirme agusto con un servicio web</em>.</p>\n<p>Pero no todo iban a ser cosas buenas, un fallo general de diseño que tiene <strong>last.fm </strong>es que no se pensó mucho en los <strong>scrobblings offlines. </strong>Estos scrobblings son los que se realizan sin conexión a internet, por ejemplo cuando escuchas canciones desde tu reproductor de mp3 o desde tu ordenador estando desconectado, que suelen ser la mayoría.<strong> La limitación es que no te deja hacer <em>scrobblings </em>con fechas &#8220;muy&#8221; antiguas si ya existen <em>scrobblings</em> más recientes</strong>. Esto no debería ser un problema, pues cuando escuchas una canción, la siguiente siempre la escucharás en una fecha más reciente. El problema viene cuando por ejemplo escuchas canciones en un reproductor, al día siguiente te pones a escuchar Spotify haciendo scrobblings y luego sincronizas tu reproductor con tu ordenador; todas esas reproducciones no se podrán enviar ya que al tener fechas más antiguas que las que le llegaron cuando pusiste el spotify, el servicio de last.fm directamente las ignora, para protegerse de peticiones erróneas.</p>\n<p>Parece un problema rebuscado, pero es algo que suele pasar más de lo que piensas, así que mi consejo es que si sueles utilizar un reproductor y también reproducir música desde el ordenador,<strong> lo tengas en mente y decidas</strong> qué vas a conectar a last.fm, ya que si lo conectas todo, puede que no se te actualicen las canciones escuchadas de manera <strong>offline.</strong></p>\n<p>Como dato curioso, decir que last.fm tiene hasta dispositivos físicos, como <a href='http://www.lastfm.es/group/Logitech+Squeezebox+Scrobblers'>éstos de Logitech</a> que reproducen su rádio:</p>\n<p>Squeezebox duet: dispositivo compatible con last.fm </p>\n<p>Y tú, ¿utilizas last.fm?, ¿conoces otro servicio similar?.</p>\n<p><em>Logotipo last.fm | <a href='http://en.wikipedia.org/wiki/Last.fm' target='_blank' rel=\"nofollow noopener noreferrer\">Wikipedia</a></em></p>\n<p><em>Fondo caratulas generado con &#8220;Last.Fm personal wallpaper generator&#8221; | <a href='http://lastfm.alekc.org/index.php' target='_blank' rel=\"nofollow noopener noreferrer\">URL</a></em></p>\n<p><em>Gama de dispositivos Squeezebox | <a href='http://www.logitech.com/es-es/speakers-audio/wireless-music-systems' target='_blank' rel=\"nofollow noopener noreferrer\">Logitech</a></em>\n</p>"},{"id":"https:/robertovg.com/blog/hola","url":"https:/robertovg.com/blog/hola","title":"hola","date_published":"2011-01-23T00:00:00.000Z","date_modified":"2011-01-23T00:00:00.000Z","content_html":"<p>Bueno, llevo bastante tiempo queriendo escribir, es una idea que siempre me ha asustado porque sinceramente las letras y yo nunca hemos hecho demasiadas migas. Aún así creo que puede ser una buena forma de <strong>aclarar y compartir mis ideas</strong> con la gente que hay al otro lado Internet (<strong>contigo</strong>) y con algo de suerte colaborar en crear contenido de calidad en internet, al fin y al cabo <em>The Internet is a Series of Blogs </em></p>\n<p>Aunque seguramente irá cambiando conforme transcurra el tiempo, me gustaría reflejar las intenciones que tengo a la hora de crear blog:</p>\n<ul>\n<li>Este <strong>no es un blog especializado</strong>, intentaré abarcar las<strong> distintas temáticas</strong> que me interesan o que no me dejan indiferente. Hablaré de <strong>informática </strong>(tanto como usuario como desarrollador), <strong>productividad, música, fotografía, sociedad, ideas, personas y experiencias</strong> que me influyen siempre y cuando vea que es relevante compartir.</li>\n<li>Con respecto al punto anterior, <strong>clasificaré las entradas </strong>con pocas categorías que reflejen las temáticas del blog. Mi idea es ofrecer un punto de entrada al contenido que te interesa según las temáticas que creas más importantes.</li>\n<li>Mi 'meta' es escribir <strong>entradas directas y densas</strong>, intentaré ser concreto y no rellenar cada entrada con 'paja'.</li>\n<li>Si la <strong>fuente</strong> de la chispa que desencadena un <strong>post es referenciable, lo referenciaré</strong>.</li>\n<li>\n<p>Por supuesto todo lo que escriba aquí va a ser <strong>subjetivo</strong>, esta es mi visión de las cosas.\nya por último, intentaré escribir al menos un <strong>post a la semana</strong>, ya que sin constancia ningún proyecto llega a buen puerto, y esto es un proyecto más que me planteo.</p>\n<p>Espero realmente que disfrutes de la lectura, nos vemos pronto.</p>\n<p><span style='font-style:italic;'>Foto de Cabecera | <a href='http://www.flickr.com/photos/ddac/'>Pablo Zárate's</a></span></p>\n<address><a href='http://www.flickr.com/photos/ddac/'></a></address>\n</li>\n</ul>"}]}