<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fabio Franchino</title>
    <description>The latest articles on DEV Community by Fabio Franchino (@abusedmedia).</description>
    <link>https://dev.to/abusedmedia</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F79519%2F4c2d01f9-ad2a-47ae-9be9-308cb50ad234.png</url>
      <title>DEV Community: Fabio Franchino</title>
      <link>https://dev.to/abusedmedia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abusedmedia"/>
    <language>en</language>
    <item>
      <title>Presenta Lib, js presentation library</title>
      <dc:creator>Fabio Franchino</dc:creator>
      <pubDate>Mon, 02 Nov 2020 07:22:29 +0000</pubDate>
      <link>https://dev.to/abusedmedia/presenta-lib-js-presentation-library-1l05</link>
      <guid>https://dev.to/abusedmedia/presenta-lib-js-presentation-library-1l05</guid>
      <description>&lt;p&gt;Hello there!&lt;/p&gt;

&lt;p&gt;I’d like to introduce my very own open-source project, &lt;a href="https://lib.presenta.cc/"&gt;PRESENTA Lib&lt;/a&gt;, a javascript library that helps creating expressive web presentations in seconds.&lt;/p&gt;

&lt;p&gt;Any feedback are much appreciated&lt;/p&gt;

</description>
      <category>presentation</category>
      <category>slides</category>
      <category>javascript</category>
      <category>library</category>
    </item>
    <item>
      <title>Create a public screenshot service with one click</title>
      <dc:creator>Fabio Franchino</dc:creator>
      <pubDate>Wed, 08 Jan 2020 17:27:33 +0000</pubDate>
      <link>https://dev.to/abusedmedia/create-a-public-screenshot-service-with-one-click-2cbc</link>
      <guid>https://dev.to/abusedmedia/create-a-public-screenshot-service-with-one-click-2cbc</guid>
      <description>&lt;p&gt;I wrote a tutorial about creating a service that takes an URL to produce a PNG file from it &lt;a href="https://fabiofranchino.com/blog/create-website-screenshot-service-with-puppeteer-on-heroku/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can skip it completely and deploy with &lt;a href="https://github.com/fabiofranchino/puppeteer-heroku-screenshot-service"&gt;one click&lt;/a&gt; (thanks to Heroku) your own service.&lt;/p&gt;

&lt;p&gt;Happy screenshotting!&lt;/p&gt;

</description>
      <category>puppeteer</category>
      <category>heroku</category>
      <category>screenshot</category>
    </item>
    <item>
      <title>Using Netlify functions to fetch external files</title>
      <dc:creator>Fabio Franchino</dc:creator>
      <pubDate>Thu, 13 Jun 2019 06:48:07 +0000</pubDate>
      <link>https://dev.to/abusedmedia/using-netlify-functions-to-fetch-external-files-1a4b</link>
      <guid>https://dev.to/abusedmedia/using-netlify-functions-to-fetch-external-files-1a4b</guid>
      <description>&lt;p&gt;In my recent &lt;a href="https://www.svgmator.com/"&gt;side project&lt;/a&gt;, I had the need to load external files from within the browser, such as an SVG file hosted on a remote server, in order to inject them in the DOM for further manipulation.&lt;/p&gt;

&lt;p&gt;It's a nice little UX add-on to avoid the user downloading a particular file and then to upload it on SVGmator. Providing the URL, the software would be able to download and upload behind the scene on behalf of the user.&lt;/p&gt;

&lt;p&gt;It's a simple task, but the security model of the browser prevents to fetch, via javascript, external text files that belong to different domains, thus, this simple script is not going to work out of the box:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://www.examples.com/myfile.svg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Welcome Lambda Functions
&lt;/h2&gt;

&lt;p&gt;It these days it's quite common to find services that provide the so-called lambda functions. Briefly, they are (usually Node.js) scripts that can be invoked through an API call, performing a task and returning a result. You don't have to deal with their hosting and other server stuff (indeed they are part of the serverless movement!).&lt;/p&gt;

&lt;p&gt;Back to my problem, here the code that accomplishes the mentioned requirement, using &lt;a href="https://www.netlify.com/docs/functions/"&gt;Netlify Functions&lt;/a&gt; in this case (the Netlify version of the lambda thing).&lt;/p&gt;

&lt;p&gt;The browser needs to make a POST request to the lambda, passing a parameter, such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/.netlify/getsvg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://www.examples.com/myfile.svg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The above code (it's ES6, it needs to be within an async function) will get a raw SVG code that can be eventually injected in the DOM.&lt;/p&gt;

&lt;p&gt;The lambda function is a Node.js script that actually fetches the SVG and returns it as raw source:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;That's approximately all. Please refer to the &lt;a href="https://www.netlify.com/docs/functions/"&gt;Netlify documentation&lt;/a&gt; about how to use the service.&lt;/p&gt;

&lt;p&gt;This article has beed originally published on my &lt;a href="https://fabiofranchino.com/blog/using-netlify-lambda-function-to-load-externals/"&gt;blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>lambda</category>
      <category>netlify</category>
      <category>fetch</category>
    </item>
    <item>
      <title>Vue.js dependency dilemma</title>
      <dc:creator>Fabio Franchino</dc:creator>
      <pubDate>Thu, 30 May 2019 07:59:01 +0000</pubDate>
      <link>https://dev.to/abusedmedia/vue-js-dependency-dilemma-460</link>
      <guid>https://dev.to/abusedmedia/vue-js-dependency-dilemma-460</guid>
      <description>&lt;p&gt;During a Vue.js project, I'm asking all the time this question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Where to insert the Vuex (store) dependency in components?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's very easy and fast binding a Vuex getter to computed props in components, this way the component in not anymore totally decoupled.&lt;/p&gt;

&lt;p&gt;What's your best practice when a little button needs to emit an action to modify a property? You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;allow the button to commit straight to the store&lt;/li&gt;
&lt;li&gt;walk the whole hierarchy component tree in order to reach a root component/view that is enabled to commit the store?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any hints?&lt;/p&gt;

</description>
      <category>vue</category>
      <category>vuex</category>
    </item>
    <item>
      <title>I've launched SVGmator</title>
      <dc:creator>Fabio Franchino</dc:creator>
      <pubDate>Fri, 24 May 2019 04:38:31 +0000</pubDate>
      <link>https://dev.to/abusedmedia/i-ve-launched-svgmator-38o8</link>
      <guid>https://dev.to/abusedmedia/i-ve-launched-svgmator-38o8</guid>
      <description>&lt;p&gt;A side project and a little tool built in a week.&lt;br&gt;
&lt;a href="https://fabiofranchino.com/blog/launch-of-svgmator-1/"&gt;Here&lt;/a&gt; few words about its story.&lt;/p&gt;

</description>
      <category>sideprojects</category>
      <category>svg</category>
      <category>tool</category>
    </item>
    <item>
      <title>Develop a JS lib these days</title>
      <dc:creator>Fabio Franchino</dc:creator>
      <pubDate>Sat, 13 Apr 2019 16:51:31 +0000</pubDate>
      <link>https://dev.to/abusedmedia/develop-a-js-lib-these-days-1jne</link>
      <guid>https://dev.to/abusedmedia/develop-a-js-lib-these-days-1jne</guid>
      <description>&lt;p&gt;I wrote about my attempt to wrap my head on writing a js lib these days &lt;a href="https://fabiofranchino.com/blog/develop-a-js-lib-these-days/"&gt;on my blog&lt;/a&gt; using Rollup.js and Babel.js of course, making a proof-of-concept in the hope it might be useful to someone.&lt;/p&gt;

&lt;p&gt;I'd love to see other attempts from others.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>lib</category>
      <category>es6</category>
      <category>rollup</category>
    </item>
    <item>
      <title>Make a simple client-side search engine in Vue.js with Lunr.js</title>
      <dc:creator>Fabio Franchino</dc:creator>
      <pubDate>Tue, 29 Jan 2019 15:25:36 +0000</pubDate>
      <link>https://dev.to/abusedmedia/make-a-simple-client-side-search-engine-in-vuejs-with-lunrjs-5851</link>
      <guid>https://dev.to/abusedmedia/make-a-simple-client-side-search-engine-in-vuejs-with-lunrjs-5851</guid>
      <description>&lt;p&gt;Hi there, I wrote &lt;a href="https://fabiofranchino.com/blog/how-to-make-a-client-side-search-engine-with-vue-and-lunr/"&gt;a little tutorial&lt;/a&gt; about the topic the title suggests.&lt;/p&gt;

&lt;p&gt;I'm still wondering if a specific part can be improved to avoid possible performance bottleneck on Vue.js.&lt;/p&gt;

&lt;p&gt;I'm referring to the last snippet, the implementation related to the integration between the Lunr results and the array needed by Vue.js for list display.&lt;br&gt;
If any Vue.js internal experts out there, maybe might shed some lights.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

</description>
      <category>vue</category>
      <category>lunr</category>
      <category>search</category>
      <category>engine</category>
    </item>
  </channel>
</rss>
