<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marco Pugliese on Medium]]></title>
        <description><![CDATA[Stories by Marco Pugliese on Medium]]></description>
        <link>https://medium.com/@pugia?source=rss-7128fa5a64ca------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*uoV6sIYlR3ycgWnK.jpeg</url>
            <title>Stories by Marco Pugliese on Medium</title>
            <link>https://medium.com/@pugia?source=rss-7128fa5a64ca------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 04:25:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pugia/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mi annoio quindi scrivo (codice)]]></title>
            <link>https://medium.com/@pugia/mi-annoio-quindi-scrivo-codice-db9e41c07392?source=rss-7128fa5a64ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/db9e41c07392</guid>
            <category><![CDATA[italiano]]></category>
            <category><![CDATA[web-history]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Marco Pugliese]]></dc:creator>
            <pubDate>Tue, 31 Mar 2020 22:38:02 GMT</pubDate>
            <atom:updated>2020-04-01T07:24:56.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUevn4GvGK-Io7QTucEVhg.jpeg" /></figure><p>Mi è sempre piaciuta l’idea di scrivere, o meglio, l’idea di saper scrivere e raccontare quello che faccio, ma non l’ho praticamente mai fatto seriamente per diversi motivi: inizialmente forse era solo questione di tempo, poi ho iniziato a pensare che molto probabilmente non faccio niente di così esaltante da meritare di essere raccontato. Ci ho anche provato di recente, ormai qualche anno fa quando ho rimesso in piedi il mio sito <a href="https://pugia.com/">pugia.com</a>, ci ho scritto anche un paio di articoli su come lo stavo impostando. A quei tempi ho pensato “scrivo in inglese così ho più audience e mi esercito anche a scrivere”…bella cazzata.</p><p>La verità è che probabilmente l’unico modo per farsi prendere dalla scrittura è farlo per se stessi, senza pensare a chi lo leggerà.</p><p>Quindi eccomi qua, mi chiamo Marco Pugliese ho 34 anni e oggi ragionavo che scrivo codice da più della metà dei miei anni. È il mio lavoro da circa 12 anni e ho l’enorme fortuna di amare quello che faccio.</p><p>Ho sempre programmato principalmente per il web, tutto è iniziato al liceo con il sito della classe, era comodo per scambiarci le versioni di latino fatte da quelli bravi, o gli appunti di biologia, sempre fatti da quelli bravi…io diciamo che ci mettevo la piattaforma.</p><p>A quei tempi avere accesso a una carta di credito era complicato per un quindicenne e le prime pagine web stavano su servizi dal sapore nostalgico come Altervista, Geocities, CJB.net, Xoom, credo di averli provati tutti, davano a disposizione l’esorbitante spazio di 100 mega, 500 quando andava bene, ce ne erano tantissimi.</p><p>Le pagine web si facevano con Microsoft Frontpage o Dreamweaver craccati, con complicatissimi sistemi di tabelle innestate l’una dentro l’altra, <em>colspan</em> e <em>rowspan</em> che non sballavano sempre e tutta una serie di immagini tagliate in modo da andare a formare un qualcosa di più complesso quando inserite nelle celle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/1*0g378kuDFrKyVc3HEfAL_A.png" /><figcaption>La buonanima di Frontpage</figcaption></figure><p>Mi ha sempre fatto molto ridere parlare di queste cose ai colleghi più giovani, loro che sono partiti già con le comodità del <em>display: flex</em> e che non conoscono l’inferno di impaginare con layout flottanti, dei clearfix e di quella landa di disperazione e sofferenza che era IE6.</p><p>Il mio dominio sono riuscito a registrarlo nel 2004, quando ho iniziato anche a smanettare con il PHP e con l’infinità di possibilità che poteva dare!</p><p>Sono andato a vedere sulla Wayback Machine di Archive.org se c’era ancora qualche residuato bellico e ho trovato questo come primo risultato visibile:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TyAPLid9Pz1OGGBPX-j5MA.png" /><figcaption><a href="https://web.archive.org/web/20041202114009/http://www.pugia.com/">https://web.archive.org/web/20041202114009/http://www.pugia.com/</a></figcaption></figure><p>Non ha memoria delle immagini statiche, però mi ha fatto ricordare di quello che per me ai tempi era stato uno dei più grandi risultati possibili: quell’url delle immagini con il testo:</p><pre>img_pulsanti.php?t=GIOCHI&amp;d=21</pre><p>Ero riuscito a far stampare un’immagine in maniera dinamica partendo da un parametro, usando il font che volevo, assegnando una dimensione e mettendo anche il bordo attorno, fatto con la stessa scritta in nero più grande di qualche pixel.</p><p>Quello è stato uno di quei momenti che mi hanno fatto iniziare a pensare una frase che mi sono sempre ripetuto, e ho usato spesso con clienti e amici all’inizio di progetti anche complicati:</p><blockquote>Tutto si può fare, ci vuole solo più o meno tempo</blockquote><p>Presa da un punto di vista quasi filosofico se ci pensate però è vero, se nel 2004 uno avesse pensato al framework moderni, ai siti internet sul cellulare, alle single page application, alle PWA, chiunque avrebbe detto che non si poteva fare, perché la tecnologia semplicemente non c’era. C’era bisogno di tempo per arrivarci.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8ucCxtgN6sc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8ucCxtgN6sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8ucCxtgN6sc%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/61a3d9816df920a1677d0c8e17047ebf/href">https://medium.com/media/61a3d9816df920a1677d0c8e17047ebf/href</a></iframe><p>Voleva essere un articolo di presentazione, volevo raccontare cosa faccio adesso, come lo faccio, ma è diventato un nostalgico tuffo nel passato.</p><p>Poco male, avrò tempo di scrivere durante questa quarantena.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db9e41c07392" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building pugia.com ~ adding some structure]]></title>
            <link>https://medium.com/@pugia/building-pugia-com-adding-some-structure-24b4879bdbbc?source=rss-7128fa5a64ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/24b4879bdbbc</guid>
            <category><![CDATA[pug]]></category>
            <category><![CDATA[personal-website]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[routing]]></category>
            <dc:creator><![CDATA[Marco Pugliese]]></dc:creator>
            <pubDate>Tue, 25 Jul 2017 21:43:19 GMT</pubDate>
            <atom:updated>2017-07-25T21:43:19.359Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok, now that the fist step is done, I can add some structure to the website.</p><p>Right now I don’t have a specific idea of what I want to put in it, basically I want to list these articles, and maybe some section with custom content. The first one will be probably a section called WILT (<strong>W</strong>hat <strong>I</strong> <strong>L</strong>earned <strong>T</strong>oday), in which I’d like to link something new everyday… 🤓</p><p>So let’s start with a general structure: since at work we use <a href="https://pugjs.org/api/getting-started.html">Pug</a> (ex Jade), I think I will use it also on my personal page. I don’t know the path structure that the site will have, I want to keep the structure as flexible as possible, so I’ll create a simple <a href="http://expressjs.com/en/guide/routing.html">routing with Express</a>, passing a JSON with small data Pug rendering (right now it’s basically only the title of the page).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wS3JCFBy7gpG-T5bfT9gPg.png" /><figcaption>Folder tree, server, about route and Pug template</figcaption></figure><p>It’s pretty simple, I create a single file for every route, in the folder routes I have a file for every route, including the index. The server read these files with a readdirSync looking for routes to render</p><pre>// find routes in routes folder<br><strong>const </strong>routes = fs.readdirSync(SRC_PATH + &#39;routes/&#39;);<br><strong>for </strong>(<strong>var </strong>x <strong>in </strong>routes) {<br>    <strong>if </strong>(routes.hasOwnProperty(x)) {<br>        <strong>const </strong>route = path.basename(routes[x], &#39;.js&#39;);<br>        <strong>if </strong>(route === &#39;index&#39;) {<br>            app.use(&#39;/&#39;, require(&#39;./src/routes/index&#39;));<br>        } <strong>else </strong>{<br>            app.use(&#39;/&#39; + route, require(&#39;./src/routes/&#39; + route));<br>        }<br>    }<br>}</pre><p>On the front design side of the page everything is still the same, I’m still waiting for my logo from <a href="https://medium.com/u/45513664db84">FrancescoScalambrino</a>, maybe with some UI/UX hint… 😙</p><p>The page is obviously still 100/100 on Google Pagespeed, that is my background goal.</p><p>The next step will be to separate the content from the layout, and publish the repo, so that everyone can laugh at my code… 😅</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24b4879bdbbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building pugia.com ~ Let’s start again]]></title>
            <link>https://medium.com/@pugia/building-pugia-com-lets-start-again-12ba49f370b?source=rss-7128fa5a64ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/12ba49f370b</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[express]]></category>
            <category><![CDATA[personal-website]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[page-speed]]></category>
            <dc:creator><![CDATA[Marco Pugliese]]></dc:creator>
            <pubDate>Fri, 30 Jun 2017 18:31:01 GMT</pubDate>
            <atom:updated>2017-06-30T18:31:01.199Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u35k7b4XMchyr0YomCd7xA.png" /><figcaption>Version 0.0.1 of Pugia.com website</figcaption></figure><p>When I started the project <a href="http://20lines.com/">20lines</a> a friend told me that I should have used a framework to build it, my reply at the time was that “I wanted to have control over everything”. With hindsight I can say that he was right, if you don’t have any particular technologic reason, it’s always better to rely on a consolidated framework, it would have saved me a lot of time, (thanks anyway <a href="https://twitter.com/risinglf">Luca</a>).</p><p>On the other hand, in my opinion using a framework remove a lot of fun, and since with this website I just want to have fun, I’ll try to use them as little as possible. Obviously this website is not a big project but I’d like to develop it as it will be.</p><p>Since three years <a href="https://pugia.com/">Pugia.com</a> is no more hosted on a classic hosting service, it was on the smallest instance possible of AWS EC2. Last time I logged in the console I saw this new service from Amazon called <a href="http://lightsail.aws.amazon.com/">Lighsail</a> that basically simplify the deploy of virtual machines. Since the first year is free I decided to give it a try.</p><p>So I started the smallest instance, with Ubuntu 16.04 on it and proceed to install Node.js with Nginx as reverse proxy, make it run as a service using <a href="http://pm2.keymetrics.io/">pm2</a> and I also added the support to https with let’s encrypt. I followed these great tutorials of DigitalOcean:</p><ul><li><a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04">How To Set Up a Node.js Application for Production on Ubuntu 16.04 | DigitalOcean</a></li><li><a href="https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04">How To Secure Nginx with Let&#39;s Encrypt on Ubuntu 16.04 | DigitalOcean</a></li></ul><p>Once the server was up and running, I created the simplest possible HTML home page and served with the node server as a static asset:</p><pre>// dependencies<br><strong>const </strong>express = require(&#39;express&#39;);<br><strong>const </strong>app = express();<br><br>// variables<br><strong>const </strong>PORT = 3000;<br><br>// routing<br>app.use(&#39;/public&#39;, express.static(__dirname + &#39;/public&#39;))</pre><pre>// start server<br>app.listen(PORT, <strong>function </strong>() {<br>    console.log(&#39;%d listening on %d&#39;, process.pid, PORT);<br>});</pre><p>The first test you can do on a website is the <a href="https://developers.google.com/speed/pagespeed/insights/">PageSpeed</a> test by Google, it analyze the page and give you a score from 0 to 100. I want to keep my site as close as possible to the 100/100.</p><p>In my current design I don’t have any image or css asset (thanks <a href="http://www.andreaperato.com/">Perry</a>), only static html page so if I run the PageSpeed I got a great 100/100!! 🎉</p><p>That was easy! Pugia out… #micdrop</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o7qDSOvfaCO9b3MlO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fobama-mic-drop-out-3o7qDSOvfaCO9b3MlO&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2F3o7qDSOvfaCO9b3MlO%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="309" frameborder="0" scrolling="no"><a href="https://medium.com/media/824d3453fbe7285905bee64c2aaa8880/href">https://medium.com/media/824d3453fbe7285905bee64c2aaa8880/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12ba49f370b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>