<?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: João Freitas</title>
    <description>The latest articles on DEV Community by João Freitas (@freitzzz).</description>
    <link>https://dev.to/freitzzz</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%2F253421%2F010fa058-eafe-4e40-b92d-090224b72b5b.png</url>
      <title>DEV Community: João Freitas</title>
      <link>https://dev.to/freitzzz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/freitzzz"/>
    <language>en</language>
    <item>
      <title>Scripts should be written using the project main language</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Mon, 25 Mar 2024 19:43:54 +0000</pubDate>
      <link>https://dev.to/freitzzz/scripts-should-be-written-using-the-project-main-language-40hj</link>
      <guid>https://dev.to/freitzzz/scripts-should-be-written-using-the-project-main-language-40hj</guid>
      <description>&lt;p&gt;This is an &lt;strong&gt;hot-take&lt;/strong&gt; I've been feeling for a long time.&lt;/p&gt;

&lt;p&gt;Almost all projects I've worked on have scripts we wrote to automate a &lt;strong&gt;repetitive process&lt;/strong&gt;. Consecutively, the majority of the scripts became obsolete and unmaintainable after some weeks, because we either didn't need them anymore or they have become too &lt;strong&gt;complex&lt;/strong&gt; to be looked at. Afterwards, these scripts are either refactored or they stay forever in the &lt;em&gt;scripts graveyard&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffreitzzz%2Fcinderela%2Fmaster%2Fblog%2Fgeneral%2Fclipart%2Ftombstone-128.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffreitzzz%2Fcinderela%2Fmaster%2Fblog%2Fgeneral%2Fclipart%2Ftombstone-128.png" alt="A clipart styled tombstone labeled with RIP"&gt;&lt;/a&gt;&lt;p&gt;Never forget to pay your respects for all the scripts we left to rot 🫡 (&lt;a href="https://clipart-library.com/clipart/rTjKGajec.htm" rel="noopener noreferrer"&gt;Source&lt;/a&gt;)&lt;/p&gt;&lt;/p&gt;

&lt;p&gt;I think one of the major reasons that lead to this outcome is that we wrote the scripts in &lt;code&gt;Bash&lt;/code&gt; or &lt;code&gt;Python&lt;/code&gt;. Don't get me wrong, I'm a big fan of the two, but I feel like teams can &lt;strong&gt;win&lt;/strong&gt; more if they write scripts using the &lt;strong&gt;main&lt;/strong&gt; language their project is developed with. From the start, &lt;em&gt;time&lt;/em&gt; and &lt;em&gt;effort&lt;/em&gt; required to write them is reduced since:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The learning curve is &lt;strong&gt;minimal&lt;/strong&gt;, since you already know the corners of the language&lt;/li&gt;
&lt;li&gt;Internal language APIs can be leveraged, which drastically changes the &lt;strong&gt;mental model&lt;/strong&gt; to write the script (for the better)&lt;/li&gt;
&lt;li&gt;Scripts feel more &lt;strong&gt;natural&lt;/strong&gt; and eventually &lt;strong&gt;maintainability&lt;/strong&gt; increases. Team members are &lt;strong&gt;familirized&lt;/strong&gt; with the language!&lt;/li&gt;
&lt;li&gt;Development machines &lt;strong&gt;compatibility&lt;/strong&gt; increases. Windows users can finally run all scripts. 🤭
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The downside of going on this direction is the main language &lt;strong&gt;runtime&lt;/strong&gt; support. Not every language is multi-paradigm or was designed to support scripting. For example, writing scripts on &lt;code&gt;JVM&lt;/code&gt; languages would require additional effort to build a &lt;strong&gt;toolchain&lt;/strong&gt; that compiles and runs files on the fly, with short start time. But if you work on a web frontend project (&lt;code&gt;JavaScript&lt;/code&gt;), the power is in your hands.&lt;/p&gt;

&lt;p&gt;At the end of the day, it is up to teams to talk and establish an &lt;strong&gt;agreement&lt;/strong&gt; on which language fits best their needs and &lt;strong&gt;standardize&lt;/strong&gt; their scripting language. If they can use the main language, awesome. If they can't, an higher level scripting language with native support (e.g., &lt;code&gt;Python&lt;/code&gt;) should be adopted, since it provides the means to increase maintainability on the long run.&lt;/p&gt;

</description>
      <category>opinion</category>
      <category>softwareengineering</category>
      <category>scripting</category>
      <category>python</category>
    </item>
    <item>
      <title>Why you should use a terminal editor to write a commit message</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Wed, 20 Mar 2024 23:52:22 +0000</pubDate>
      <link>https://dev.to/freitzzz/why-you-should-use-a-terminal-editor-to-write-a-commit-message-2f1f</link>
      <guid>https://dev.to/freitzzz/why-you-should-use-a-terminal-editor-to-write-a-commit-message-2f1f</guid>
      <description>&lt;p&gt;Ever since starting to only use Git in the command line, I've been writing commit messages through a &lt;strong&gt;terminal editor&lt;/strong&gt; (&lt;code&gt;nano&lt;/code&gt;), instead of passing the message (&lt;code&gt;-m&lt;/code&gt;) flag. Some colleagues find it odd that I do it this way, so here are &lt;strong&gt;seven&lt;/strong&gt; reasons in favor of using a terminal editor:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First of all, you need to &lt;strong&gt;pass&lt;/strong&gt; the &lt;code&gt;-m&lt;/code&gt; flag, and that alone is costing you time.&lt;/li&gt;
&lt;li&gt;You need to &lt;strong&gt;wrap&lt;/strong&gt; your message in quotes/ticks (""). Finding them on your keyboard can be somewhat hard.&lt;/li&gt;
&lt;li&gt;You can't break lines in your message. Your brain is always under pressure to not click the &lt;strong&gt;enter&lt;/strong&gt; key, otherwise, you will need to &lt;em&gt;amend&lt;/em&gt; the commit message.&lt;/li&gt;
&lt;li&gt;If the repository is configured with &lt;code&gt;pre-commit&lt;/code&gt; hooks, they won't be executed until you click the &lt;strong&gt;enter&lt;/strong&gt; key. This is particularly bad if commit messages need to follow a specific structure.&lt;/li&gt;
&lt;li&gt;Oh, you managed to click the enter key and &lt;strong&gt;accidentally created&lt;/strong&gt; a commit? You need to repeat the whole process to amend the commit message (this includes copying/writing the message and passing the &lt;code&gt;--amend&lt;/code&gt; flag).&lt;/li&gt;
&lt;li&gt;Your terminal shell interpreter (&lt;code&gt;bash/zsh/csh...&lt;/code&gt;) is very &lt;strong&gt;sensitive&lt;/strong&gt; to &lt;strong&gt;special characters&lt;/strong&gt;. To include them, you will need to think of ways to either escape them or make sure the interpreter won't evaluate them. (e.g., imagine you need to write this message: &lt;code&gt;fix: apply "$HOME" instead of using single ticks (''))&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Copy-pasting a message might give you a hard time. If the message includes &lt;strong&gt;Unicode&lt;/strong&gt; characters that your terminal has issues to &lt;strong&gt;render&lt;/strong&gt;, like emojis, it will be a pain to &lt;strong&gt;correct&lt;/strong&gt; them. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All of these issues can be avoided if you learn the basics of a terminal editor (&lt;code&gt;nano&lt;/code&gt; is really simple!) and type &lt;code&gt;git commit&lt;/code&gt; (or even better, declare a shorthand alias like &lt;code&gt;gc&lt;/code&gt; that will save you a ton of time).&lt;/p&gt;

&lt;p&gt;Cross-Post: &lt;a href="https://joaomagfreitas.link/why-you-should-use-a-terminal-editor-to-write-a-commit-message/"&gt;https://joaomagfreitas.link/why-you-should-use-a-terminal-editor-to-write-a-commit-message/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Background Image: &lt;a href="https://cbea.ms/git-commit/"&gt;https://cbea.ms/git-commit/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>softwaredevelopment</category>
      <category>softwareengineering</category>
      <category>git</category>
      <category>linux</category>
    </item>
    <item>
      <title>Ukoreh - Demo Flutter projects on the fly</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Tue, 23 May 2023 21:19:06 +0000</pubDate>
      <link>https://dev.to/freitzzz/ukoreh-demo-flutter-projects-on-the-fly-2mln</link>
      <guid>https://dev.to/freitzzz/ukoreh-demo-flutter-projects-on-the-fly-2mln</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8YIDtYth--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fmmovtzc3dar0wo7x09q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8YIDtYth--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fmmovtzc3dar0wo7x09q.png" alt="Image description" width="412" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;Platform to demo Flutter apps by deploying them as &lt;strong&gt;web apps&lt;/strong&gt; using GitHub &lt;strong&gt;actions&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Category Submission:
&lt;/h3&gt;

&lt;p&gt;DIY Deployments&lt;/p&gt;

&lt;h3&gt;
  
  
  App Link
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://ukoreh.github.io/ukoreh.fun"&gt;https://ukoreh.github.io/ukoreh.fun&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Screenshots
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Loading&lt;/th&gt;
&lt;th&gt;Initial page&lt;/th&gt;
&lt;th&gt;Loading&lt;/th&gt;
&lt;th&gt;Stepper&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---p0RHnFl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vb48wpto1aest8talmal.png" alt="Image description" width="800" height="1731"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vKQt6e8B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ofhw1gmb86bmjgy8bo9.png" alt="Image description" width="800" height="1733"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MjwE0YLz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lszoem0cylwbl48fkwla.png" alt="Image description" width="800" height="1733"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mMIgAHLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qt2fmg3n4t9bcrt99isi.png" alt="Image description" width="800" height="1731"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Description
&lt;/h3&gt;

&lt;p&gt;Ukoreh is a tool for Flutter developers. It aims to increase the openness of open-source projects by allowing developers to easily demo Flutter projects as web apps since any project is most of the time cross-platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tXEMVT3T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qej66n37llswvhy35lfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tXEMVT3T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qej66n37llswvhy35lfi.png" alt="wizard cat" width="412" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to Source Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/ukoreh"&gt;https://github.com/ukoreh&lt;/a&gt; (org)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ukoreh/gecgecgecgecgec"&gt;https://github.com/ukoreh/gecgecgecgecgec&lt;/a&gt; (frontend)&lt;br&gt;
&lt;a href="https://github.com/ukoreh/fold"&gt;https://github.com/ukoreh/fold&lt;/a&gt; (serverless functions)&lt;br&gt;
&lt;a href="https://github.com/ukoreh/actions"&gt;https://github.com/ukoreh/actions&lt;/a&gt; (actions)&lt;/p&gt;

&lt;h3&gt;
  
  
  Permissive License
&lt;/h3&gt;

&lt;p&gt;MIT&lt;/p&gt;

&lt;h2&gt;
  
  
  Background (What made you decide to build this particular app? What inspired you?)
&lt;/h2&gt;

&lt;p&gt;We all love to view and research new projects on GitHub. Some of them have screenshots and videos, others don't. Well, wouldn't it be great if, at the distance of a click, you could get a demo of that particular project?&lt;/p&gt;

&lt;p&gt;We made that possible for Flutter projects: since most Flutter apps are cross-compatible in different platforms (mobile, web, desktop), even if one built an app for iOS, I could test it as a web app.&lt;/p&gt;

&lt;h3&gt;
  
  
  How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?)
&lt;/h3&gt;

&lt;p&gt;Our stack is composed of four technologies: &lt;strong&gt;Svelte&lt;/strong&gt;, &lt;strong&gt;Cloudflare Workers&lt;/strong&gt;, &lt;strong&gt;GitHub Pages&lt;/strong&gt; and &lt;strong&gt;GitHub Actions&lt;/strong&gt;. Let's start with the last one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We leveraged &lt;a href="https://github.com/ukoreh/actions"&gt;actions&lt;/a&gt; to establish a workflow starting from cloning the target repo, polishing it, building as a Flutter web app and publishing it to GitHub Pages.&lt;/li&gt;
&lt;li&gt;We used &lt;a href="https://github.com/ukoreh/fold"&gt;Cloudflare Workers&lt;/a&gt; as the middleman between the platform you request a repo to be deployed and triggering an action via GitHub API.&lt;/li&gt;
&lt;li&gt;Finally, we used Svelte to build the &lt;a href="https://github.com/ukoreh/gecgecgecgecgec"&gt;platform&lt;/a&gt;. It could have been React, Vue, some random JS framework I don't know, or even pure HTML. However, we chose Svelte because &lt;strong&gt;we are learning it&lt;/strong&gt; as we believe it's the top-standing JS framework for building web apps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---bs2TVw5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/ukoreh/.github/master/workflow.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---bs2TVw5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/ukoreh/.github/master/workflow.svg" alt="workflow diagram" width="800" height="289"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;We did find some issues along the way and learned a lot from them. One of these issues, is the fact that GitHub does not give you back the &lt;strong&gt;workflow run id&lt;/strong&gt; when you start a new workflow for a given action.&lt;/p&gt;

&lt;p&gt;To overcome this issue, we had to do some &lt;em&gt;shenanigans&lt;/em&gt; in both the actions and workers code. In short, the action finds the most recent workflow run and then sets the identifier in the action local storage. Then, the worker patiently waits for this identifier to be set and get's it via GitHub API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources/Info
&lt;/h3&gt;

&lt;p&gt;This project was thought about way back in 2020! Thankfully it got to see the daylight after 3 years, thanks to this hackathon.&lt;/p&gt;

</description>
      <category>githubhack23</category>
    </item>
    <item>
      <title>Micro Libraries</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Mon, 01 May 2023 10:00:00 +0000</pubDate>
      <link>https://dev.to/freitzzz/micro-libraries-4fff</link>
      <guid>https://dev.to/freitzzz/micro-libraries-4fff</guid>
      <description>&lt;p&gt;Some weeks ago I stumble upon the concept of &lt;em&gt;micro apps&lt;/em&gt;: apps that serve only one &lt;a href="https://en.wikipedia.org/wiki/Microapp"&gt;functionality/purpose&lt;/a&gt;, being minimal in most of the cases. And I question myself: if we have microservices and micro apps, it's only logical that we have micro libraries, right?&lt;/p&gt;

&lt;p&gt;So, what do these libraries offer? You guessed it, one &lt;strong&gt;feature/functionality&lt;/strong&gt;. The earliest moment I remember seeing one of these libraries, was the &lt;code&gt;isX&lt;/code&gt; libraries drama, where people claimed that JavaScript projects were becoming bloated because of the over-dependence on predicate function libraries, such as "is-number", for something as simple as asserting if a value is a number (&lt;a href="https://www.npmjs.com/package/is-number"&gt;is-number&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;While I agree that these type of libraries contribute to bloatiness, building them can be quite satisfying, because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;they are fast to build&lt;/li&gt;
&lt;li&gt;they are easy to maintain&lt;/li&gt;
&lt;li&gt;they integrate with ease&lt;/li&gt;
&lt;li&gt;you are challenged to build without external dependencies and for optimization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's an additional rule for micro-libraries: what you build must be &lt;strong&gt;shipped through a single function&lt;/strong&gt;. For JS/TS libraries, you can achieve this by exporting only that function in the main module file.&lt;/p&gt;




&lt;p&gt;One big advantage of using micro-libraries, is that &lt;strong&gt;you get what you pay for&lt;/strong&gt;. For example, if you only need feature &lt;code&gt;X&lt;/code&gt; from library &lt;code&gt;Y&lt;/code&gt;, why should you also depend on feature &lt;code&gt;Z&lt;/code&gt;, &lt;code&gt;W&lt;/code&gt;, &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; that are bundled with &lt;code&gt;Y&lt;/code&gt;?&lt;br&gt;
This was my motivation for building &lt;code&gt;github-upsert&lt;/code&gt;: a micro library for uploading/updating files in a GitHub repo.&lt;/p&gt;

&lt;p&gt;I can now use this library on my Cloudflare Workers (&lt;a href="https://developers.cloudflare.com/workers/platform/limits/#worker-size"&gt;that are limited to 1M bundle size&lt;/a&gt;) without depending on all the &lt;a href="https://bundlephobia.com/package/octokit@2.0.14"&gt;GitHub JS SDK&lt;/a&gt; features, just to update a file on my GitHub repo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/web-pacotes/github-upsert"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ykT4oE85--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://opengraph.githubassets.com/9ebd196be9d01128c68af9334765364e508eca3c872ac342df11f95a5b0bf713/web-pacotes/github-upsert" alt="github-upsert repo on github" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>microlibraries</category>
      <category>npm</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>On Lindenmayer Systems</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Sat, 29 Apr 2023 13:04:55 +0000</pubDate>
      <link>https://dev.to/freitzzz/on-lindenmayer-systems-16ip</link>
      <guid>https://dev.to/freitzzz/on-lindenmayer-systems-16ip</guid>
      <description>&lt;p&gt;Yesterday I learned about Lindenmayer Systems (&lt;strong&gt;L-System&lt;/strong&gt;) through &lt;a href="https://github.com/gildurao"&gt;Gil Durão&lt;/a&gt; talk at &lt;a href="https://www.meetup.com/flutterportugal/events/292828244/"&gt;Flutter Talk Porto 2023&lt;/a&gt;. It's a formal specification of a grammar primarly used to model bacteria, algae, plants and tree growth, as originally proposed by &lt;a href="https://www1.biologie.uni-hamburg.de/b-online/e28_3/lsys.html"&gt;Aristid Lindenmayer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At its core there are three components (&lt;code&gt;G=⟨V,ω,P⟩&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;alphabet&lt;/strong&gt;, which is a list of symbols that can be combined to create strings (e.g., &lt;code&gt;ABC&lt;/code&gt;, &lt;code&gt;+-*/&lt;/code&gt;), denoted as &lt;code&gt;V&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;axiom&lt;/strong&gt;, which defines the starting point of the L-System (e.g., &lt;code&gt;BC&lt;/code&gt;), denoted as &lt;code&gt;ω&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A set of &lt;strong&gt;production rules&lt;/strong&gt;, which determine how each symbol of the alphabet is transformed into other symbols (e.g., &lt;code&gt;A -&amp;gt; AB, B -&amp;gt; AC, C -&amp;gt; CB&lt;/code&gt;), denoted as &lt;code&gt;P&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal behind these systems is to specify &lt;strong&gt;finite&lt;/strong&gt; or &lt;strong&gt;infinite&lt;/strong&gt; strings, which are constructed iteratively by applying the production rules to the symbols from the previous iteration. Using the example above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;BC&lt;/code&gt; (Axiom - Iteration 0)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ACCB&lt;/code&gt; (Iteration 1)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ABCBCBAC&lt;/code&gt; (Iteration 2)&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Production rules specify the class/type of L-Systems, with the simplest one being &lt;code&gt;D0L-system&lt;/code&gt; (deterministic and context-free L-System), which are represented by functions that take symbols as input and deterministically map them to other symbols as output. You can learn more about different classes on this &lt;a href="https://jsantell.com/l-systems/"&gt;article&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Okay, but what exactly can we use L-Systems for?
&lt;/h2&gt;

&lt;p&gt;While many people use them to generate fractals (because fractals are cool), you can also use L-Systems to leverage your &lt;strong&gt;procedural generation game&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/freitzzz/cinderela/blob/master/blog/general/l-system/game-mechanics-l-system.pdf"&gt;Video-game Maps and Entities (objects)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/freitzzz/cinderela/blob/master/blog/general/l-system/road-networks-l-systems.pdf"&gt;Road Networks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/freitzzz/cinderela/blob/master/blog/general/l-system/LMusic_An_Approach_To_Assisted_Music_Composition_Using_LSystems.pdf"&gt;Music&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;del&gt;Maybe even creating pixel art as part of your NFT project?&lt;/del&gt; &lt;a href="https://web.archive.org/web/20230429113512/https://www.pyragraph.com/2020/10/background-art-penrose-substitution-by-jared-tarbell/"&gt;Art&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gil prepared a demo of using L-Systems to generate fractals with Flutter. You can check it out &lt;a href="http://joaomagfreitas.link/flutter-lsystems-example/"&gt;here&lt;/a&gt;. Also, his &lt;a href="https://github.com/freitzzz/cinderela/blob/master/blog/general/l-system/Creating%20images%20and%20sound%20with%20strings%20using%20L-Systems.pdf"&gt;presentation&lt;/a&gt; is free, so be sure to grab it!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V1dN-yoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://raw.githubusercontent.com/freitzzz/cinderela/master/blog/general/l-system/1557607174548.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V1dN-yoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://raw.githubusercontent.com/freitzzz/cinderela/master/blog/general/l-system/1557607174548.gif" alt="gif of a l-system describing a growing plant" width="500" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>math</category>
      <category>art</category>
      <category>flutter</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>When to create a GitHub organization</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Fri, 21 Apr 2023 19:30:00 +0000</pubDate>
      <link>https://dev.to/freitzzz/when-to-create-a-github-organization-2d4d</link>
      <guid>https://dev.to/freitzzz/when-to-create-a-github-organization-2d4d</guid>
      <description>&lt;p&gt;Whenever I'm starting to work on a new (side) project, I end up facing myself at creating a new GitHub organization to work on it. But why is this the case?&lt;/p&gt;

&lt;p&gt;I've sat down and compiled a list of reasons for why creating a new org makes sense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You will need to create multiple repositories for different codebases&lt;/li&gt;
&lt;li&gt;You want to segregate development areas across multiple repositories (e.g., backend, frontend, infrastructure, business, documentation)&lt;/li&gt;
&lt;li&gt;You want to use the organization GitHub profile as the frontpage of your project&lt;/li&gt;
&lt;li&gt;Multiple people are working on the same project&lt;/li&gt;
&lt;li&gt;The project you're working on will eventually become a viable product, so you want to brand it&lt;/li&gt;
&lt;li&gt;You want to market your product as built by an entity (your organization) and not by yourself&lt;/li&gt;
&lt;li&gt;You want a cool little square logo in your GitHub profile (swag) 😎&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(this list may be updated from time to time whenever I discover more reasons)&lt;/p&gt;

</description>
      <category>github</category>
      <category>reflection</category>
      <category>blog</category>
    </item>
    <item>
      <title>Why your GitHub action is not triggered by other actions</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Sat, 18 Mar 2023 09:42:56 +0000</pubDate>
      <link>https://dev.to/freitzzz/why-your-github-action-is-not-triggered-by-other-actions-1254</link>
      <guid>https://dev.to/freitzzz/why-your-github-action-is-not-triggered-by-other-actions-1254</guid>
      <description>&lt;p&gt;In this blog post I explain why GitHub actions don’t trigger each other by default, helping you how to achieve it.&lt;/p&gt;

&lt;p&gt;Last week I wrote about &lt;a href="https://joaomagfreitas.link/this-blog-changes-its-theme-every-day/"&gt;how I configured a GitHub action to change this blog theme every day&lt;/a&gt;. Today I will explain you why I lost some time trying to understand why that action was not triggering my deploy to GitHub Pages action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before
&lt;/h2&gt;

&lt;p&gt;Let's first do a side by side comparison on how each action is triggered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;publish&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deploy is based on commits made to master&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;update-theme-color&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change blog theme color is based on a cron job&lt;/p&gt;

&lt;p&gt;Intuitively you would think that once the &lt;code&gt;update-theme-color&lt;/code&gt; action runs, which creates a new commit in master, triggers the &lt;code&gt;publish&lt;/code&gt; action, since it reacts to master branch updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  However...
&lt;/h2&gt;

&lt;p&gt;That is not the case! By default GitHub Actions don't trigger each other to &lt;a href="https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow"&gt;prevent recursive runs&lt;/a&gt;. For an action &lt;code&gt;X&lt;/code&gt; to be triggered by action &lt;code&gt;Y&lt;/code&gt;, then action &lt;code&gt;X&lt;/code&gt; needs to observe action &lt;code&gt;Y&lt;/code&gt; execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  How
&lt;/h2&gt;

&lt;p&gt;To observe actions execution, the &lt;a href="https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run"&gt;&lt;code&gt;workflow_run&lt;/code&gt;&lt;/a&gt; reaction needs to be included. Here's how I reconfigured the &lt;code&gt;publish&lt;/code&gt; action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;publish&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;
  &lt;span class="na"&gt;workflow_run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;update-theme-color"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;completed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>hugo</category>
      <category>githubpages</category>
      <category>githubactions</category>
      <category>blog</category>
    </item>
    <item>
      <title>This blog changes its theme every day</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Sun, 12 Mar 2023 12:01:56 +0000</pubDate>
      <link>https://dev.to/freitzzz/this-blog-changes-its-theme-every-day-4m3b</link>
      <guid>https://dev.to/freitzzz/this-blog-changes-its-theme-every-day-4m3b</guid>
      <description>&lt;p&gt;Minimalistic blogs may get boring sometimes. We want to reduce visual polution, but our brain needs some visual sugar from time to time! That's why I configured a workflow for this blog that changes its theme color every day. Today you're seeing this color (yellow), but tomorrow you might see this color (red).&lt;/p&gt;

&lt;h2&gt;
  
  
  How
&lt;/h2&gt;

&lt;p&gt;If you have read my &lt;a href="https://joaomagfreitas.link/"&gt;about&lt;/a&gt; page, you know that this blog is built with the following stack: Hugo, Bear Blog Theme and GitHub Pages. Content is published to the web whenever my pages GitHub repository is updated, triggered by a GitHub Action.&lt;/p&gt;

&lt;p&gt;The process to update theme color is seemingly the same: have a GitHub Action that is triggered every day by midnight.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;update-theme-color&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-20.04&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;submodules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# Fetch Hugo themes (true OR recursive)&lt;/span&gt;
          &lt;span class="na"&gt;fetch-depth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;# Fetch all history for .GitInfo and .Lastmod&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Change color&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash scripts/update_theme_color.bash&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Commit and push&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash scripts/action_repo_commit_and_push_all.bash "Update theme color"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But how is each color chosen? Initially I thought that randomizing a color using the updating date as a seed (e.g., &lt;code&gt;2023-03-12&lt;/code&gt;), but then I remembered that could lead to undesirable situations such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(#FFFFFF) "really light" text on light theme&lt;/li&gt;
&lt;li&gt;(#000000) "really dark" text on dark theme&lt;/li&gt;
&lt;li&gt;(#4A412A) or even this! (light theme users, can you point the differences?)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To overcome this issue, I decided that the best option is to handfully pick a set of colors and then choose at random one of them. All I needed to do is create a source of great colors&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#F94144
#F3722C
#F8961E
...
#A9DEF9
#E4C1F9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then use bash scripting commands to chose one from the source and updated it in my blog &lt;code&gt;config.toml&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="nv"&gt;script_dir_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;dirname&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;realpath&lt;/span&gt; &lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;colors_file_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$script_dir_path&lt;/span&gt;&lt;span class="s2"&gt;/good_colors.lst"&lt;/span&gt;

&lt;span class="nv"&gt;random_color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;shuf&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 1 &lt;span class="nv"&gt;$colors_file_path&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{sub(/link_color.*/, "link_color = \"'&lt;/span&gt;&lt;span class="nv"&gt;$random_color&lt;/span&gt;&lt;span class="s1"&gt;'\"")}1'&lt;/span&gt; config.toml&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$config&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; config.toml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>hugo</category>
      <category>githubpages</category>
      <category>githubactions</category>
      <category>blog</category>
    </item>
    <item>
      <title>DEV on Jekyll Now</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Sat, 26 Sep 2020 14:28:58 +0000</pubDate>
      <link>https://dev.to/freitzzz/dev-on-jekyll-now-6em</link>
      <guid>https://dev.to/freitzzz/dev-on-jekyll-now-6em</guid>
      <description>&lt;p&gt;You may have heard of &lt;a href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt;. It is a &lt;em&gt;simple static site generator&lt;/em&gt; that you can use to create blogs and websites in general to expose your thoughts and content. Most of people use Jekyll as it is a ready to use solution for Github Pages, a free place on the Internet where you can host a website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/barryclark/jekyll-now"&gt;Jekyll Now&lt;/a&gt; is a Jekyll theme that integrates already most of the features that you need for your blog, such as adding content using Markdown or YAML, styling using SASS and mobile responsive support. Although the coolness of Jekyll Now, it has a downside which is that it hasn't been updated for more than two years now (last commit on April, 2018). The lack of updates scars some of the features it provides. One of these scar features is social media referring on the footer of your blog.&lt;br&gt;
Jekyll Now has a main configuration file name &lt;code&gt;_config.yml&lt;/code&gt;. When you stumble upon it, you notice that you can refer your social media profile, which will later be shown as an icon that upon clicking will redirect to your profile. For example you can reference your Github page, Twitter profile or even LinkedIn. However you can't reference your dev.to or even Medium profile. To enable we need to dig deep in Jekyll Now "engine" and perform some updates.&lt;/p&gt;

&lt;p&gt;Heading over to &lt;code&gt;_includes&lt;/code&gt; folder we notice a file with references for the available footer links: &lt;code&gt;svg-icons.html&lt;/code&gt;. This is the first step to include our custom footer social media link, the HTML. By copying one of the lines and replacing the website name with dev.to, we create a reference link for DEV.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% if site.footer-links.dev-to %}&amp;lt;a href="https://dev.to/{{ site.footer-links.dev-to }}"&amp;gt;&amp;lt;i class="svg-icon dev-to"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;{% endif %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;center&gt;Code Snippet 1 - dev.to footer link included in svg-icons.html&lt;/center&gt;

&lt;p&gt;Once having the HTML defined, we need to customize it, by adding some CSS. You may have noticed that the footer element is composed by an &lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt; element that refers a CSS class: &lt;code&gt;svg-icon&lt;/code&gt;. If it is referring some CSS class, then this class must be also living on the engine. As referred before, Jekyll Now uses SASS for styling. A folder named &lt;code&gt;_sass&lt;/code&gt; can be found, which includes the styling for &lt;code&gt;svg-icon&lt;/code&gt;. Similar to what has been done before on &lt;code&gt;svg-icons.html&lt;/code&gt;, by opening &lt;code&gt;_svg-icons.scss&lt;/code&gt; we can extend the class to support the dev.to icon. Copying a line and replacing previous references with what was defined in the &lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt; element will style the HTML element that we just created. Just make sure to correctly refer the base64 string of the icon SVG icon and adopt the icon size (otherwise SVG layers may be displayed duplicated).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;.dev-to{ background-image: url(data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjxwYXRoICBmaWxsPSIjMDAwMDAwIiBkPSJNMTIwLjEyIDIwOC4yOWMtMy44OC0yLjktNy43Ny00LjM1LTExLjY1LTQuMzVIOTEuMDN2MTA0LjQ3aDE3LjQ1YzMuODggMCA3Ljc3LTEuNDUgMTEuNjUtNC4zNSAzLjg4LTIuOSA1LjgyLTcuMjUgNS44Mi0xMy4wNnYtNjkuNjVjLS4wMS01LjgtMS45Ni0xMC4xNi01LjgzLTEzLjA2ek00MDQuMSAzMkg0My45QzE5LjcgMzIgLjA2IDUxLjU5IDAgNzUuOHYzNjAuNEMuMDYgNDYwLjQxIDE5LjcgNDgwIDQzLjkgNDgwaDM2MC4yYzI0LjIxIDAgNDMuODQtMTkuNTkgNDMuOS00My44Vjc1LjhjLS4wNi0yNC4yMS0xOS43LTQzLjgtNDMuOS00My44ek0xNTQuMiAyOTEuMTljMCAxOC44MS0xMS42MSA0Ny4zMS00OC4zNiA0Ny4yNWgtNDYuNFYxNzIuOThoNDcuMzhjMzUuNDQgMCA0Ny4zNiAyOC40NiA0Ny4zNyA0Ny4yOGwuMDEgNzAuOTN6bTEwMC42OC04OC42NkgyMDEuNnYzOC40MmgzMi41N3YyOS41N0gyMDEuNnYzOC40MWg1My4yOXYyOS41N2gtNjIuMThjLTExLjE2LjI5LTIwLjQ0LTguNTMtMjAuNzItMTkuNjlWMTkzLjdjLS4yNy0xMS4xNSA4LjU2LTIwLjQxIDE5LjcxLTIwLjY5aDYzLjE5bC0uMDEgMjkuNTJ6bTEwMy42NCAxMTUuMjljLTEzLjIgMzAuNzUtMzYuODUgMjQuNjMtNDcuNDQgMGwtMzguNTMtMTQ0LjhoMzIuNTdsMjkuNzEgMTEzLjcyIDI5LjU3LTExMy43MmgzMi41OGwtMzguNDYgMTQ0Ljh6Ij48L3BhdGg+PC9zdmc+);}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;center&gt;Code Snippet 2 - Custom styling for dev-to HTML element&lt;/center&gt;

&lt;p&gt;The final step is to edit the &lt;code&gt;_config.yml&lt;/code&gt; file to include our dev-to profile display. Under the &lt;code&gt;footer-links&lt;/code&gt; collection, add the following tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dev-to: &amp;lt;your_dev.to_username&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;center&gt;Code Snippet 3 - YAML tag for displaying dev.to profile&lt;/center&gt;

&lt;p&gt;That's it. If everything went well, you should see the dev.to icon on the footer of your blog and when clicking on it, it should redirect to your profile!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2UhOQ_6c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/csv3nnhnndd9bb5a14l4.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2UhOQ_6c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/csv3nnhnndd9bb5a14l4.gif" alt="Screen Recording2020-09-26at15.13.10.mov" width="500" height="305"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>blog</category>
      <category>jekyll</category>
      <category>github</category>
    </item>
    <item>
      <title>Continuous Deployment for Flutter Web with Travis CI and Github Pages</title>
      <dc:creator>João Freitas</dc:creator>
      <pubDate>Fri, 31 Jan 2020 18:09:52 +0000</pubDate>
      <link>https://dev.to/freitzzz/continuous-deployment-for-flutter-web-with-travis-ci-and-github-pages-13pe</link>
      <guid>https://dev.to/freitzzz/continuous-deployment-for-flutter-web-with-travis-ci-and-github-pages-13pe</guid>
      <description>&lt;h1&gt;
  
  
  Some brief notes about this guide
&lt;/h1&gt;

&lt;p&gt;Flutter Web, also known as the the Hummingbird project, was recently released on the beta channel of Flutter for developers to test and try the build of Flutter applications as web applications. This guide aims to help developers agilize their deployment processes in a &lt;strong&gt;free&lt;/strong&gt; and reliable solution, as well as to spread the word and love of Flutter Web.&lt;/p&gt;

&lt;p&gt;I hope this guide helps you out :)&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Github account and a repository to host the built web application files&lt;/li&gt;
&lt;li&gt;Travis CI account&lt;/li&gt;
&lt;li&gt;Flutter SDK (beta channel)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Workflow
&lt;/h3&gt;

&lt;p&gt;Before setting up the pipeline on Travis and creating the Flutter Web application, it is necessary to decide which branching model is to be adopted as this decision influences the pipeline design. As this example serves as a guide on how to integrate Flutter Web and Travis CI, a single branch model (Trunk Based Development) will be used.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flutter Web
&lt;/h3&gt;

&lt;p&gt;Once the workflow is decided, we need to setup Flutter in order to be able to run and "compile" for the web. As the time that this guide is being written (2020/01/30), Flutter Web is still in its early stages and it is necessary to use the SDK provided in the beta channel. If your Flutter version is still not pointing to the beta channel, you can switch to it by running the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flutter channel beta
flutter upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once on the beta channel you need to enable support for Flutter web. To do such run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;flutter config --enable-web&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If everything went well &lt;code&gt;flutter doctor&lt;/code&gt; should now also print the following message:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[✓] Chrome - develop for the web&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We can now initialize our application. Just like any other Flutter project you perform such with the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;flutter create &amp;lt;name_of_my_app&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once created, you can now run it on a Chrome browser (As the time this guide is being written, Flutter Web &lt;strong&gt;debug&lt;/strong&gt; &lt;a href="https://flutter.dev/docs/get-started/web#requirements"&gt;is only available on Chrome&lt;/a&gt;), with the typical &lt;code&gt;flutter run&lt;/code&gt; command (add &lt;code&gt;-d chrome&lt;/code&gt; if other devices such as simulators are detected by Flutter Doctor)&lt;/p&gt;

&lt;p&gt;Thats it! You are done with the Flutter Web setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  Travis CI
&lt;/h3&gt;

&lt;p&gt;For Travis to detect changes in your repository, you need to first register it in the dashboard. Head over to &lt;a href="https://travis-ci.org/"&gt;https://travis-ci.org/&lt;/a&gt; if your repository is public, or &lt;a href="https://travis-ci.com/"&gt;https://travis-ci.com/&lt;/a&gt; if it is private.&lt;/p&gt;

&lt;p&gt;In Travis you implement the pipeline under the &lt;em&gt;YAML&lt;/em&gt; schema, defined on a file named &lt;code&gt;.travis.yml&lt;/code&gt;. For a clean setup create this file on the root of your repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pipeline Machine Configuration
&lt;/h3&gt;

&lt;p&gt;The first lines of .travis.yml normally identify the configuration of the machine to be used to run the pipeline. As Flutter uses &lt;code&gt;dart2js&lt;/code&gt;, a tool to &lt;strong&gt;transpile&lt;/strong&gt; Dart code in Javascript code, there is no constraint related to the operating system environment in order to build the application so you can choose whathever operating system that you desire to build for the web. In this example it is used the &lt;code&gt;Ubuntu Bionic (18.04)&lt;/code&gt; distribution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;os: linux
distro: bionic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Build Phase
&lt;/h3&gt;

&lt;p&gt;Before building the application, Travis needs to have Flutter setup in the machine. One of the ways this can be performed is by defining this setup as steps to be run &lt;strong&gt;before&lt;/strong&gt; the build script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;before_script:
  - git clone https://github.com/flutter/flutter.git -b beta
  - export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
  - flutter config --enable-web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for the build of the application, declare it under &lt;code&gt;script&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;script:
    - flutter build web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates all necessary files to represent a Flutter application as a single-page application, and stores them on &lt;code&gt;build/web&lt;/code&gt; folder inside of your application folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy Phase
&lt;/h3&gt;

&lt;p&gt;Travis already provides support to deploy to Github Pages, using the &lt;a href="https://docs.travis-ci.com/user/deployment/pages/"&gt;&lt;code&gt;deploy&lt;/code&gt;&lt;/a&gt; job, and we only need to configure it for our workflow. The essential configuration is the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;provider&lt;/code&gt; in deploy job as &lt;code&gt;pages&lt;/code&gt;. By doing so, Travis will recognize that a deploy in Github Pages needs to be done.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;skip_cleanup&lt;/code&gt; must be true, or else Travis will delete all files created in the build, which prevents the deploy of the static files generated in the application build. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;github_token&lt;/code&gt; a &lt;a href="https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line"&gt;personal access token&lt;/a&gt; with read and write permissions of the repository which will serve the Github Pages static files. Once you obtain the token, define it as an environment variable in Travis pipeline settings.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;keep_history&lt;/code&gt; decides to keep the history of the branch in which the files will be pushed to (if set to true, history is kept, otherwise Travis performs a force push).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;local_dir&lt;/code&gt; the relative path from the pipeline build workspace to the directory in which the static files to be deployed are located.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;deploy:
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN
  keep_history: true
  local_dir: build/web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default Travis pushes the files to &lt;code&gt;gh-pages&lt;/code&gt; branch of the repository that triggered the pipeline build. You can configure the deploy to other branch or repository using the &lt;code&gt;repo&lt;/code&gt; and &lt;code&gt;target_branch&lt;/code&gt; keys. Take in consideration that if your want to modify the repository to be deployed, you need to include the username of the repository owner (&lt;code&gt;&amp;lt;repo_owner&amp;gt;/&amp;lt;repo_to_deploy&amp;gt;&lt;/code&gt;). Another cool feature which Travis provides is the set of the custom domain to be used on Github Pages. This is done by modifying the value of &lt;code&gt;fqdn&lt;/code&gt;. See all the other cool features that Travis provides &lt;a href="https://docs.travis-ci.com/user/deployment/pages/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thats all, trigger a push/pull request on the build branch and Travis will deploy your Flutter application! Best part? It's all free!&lt;/p&gt;

&lt;p&gt;You can see the live version of the classic Flutter Counter &lt;a href="https://freitzzz.dev/flutter-web-cd-travis-ghpages"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  References and Acknowledgments
&lt;/h2&gt;

&lt;p&gt;The write of this guide was possible and inspired by the following guides / documentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://flutter.dev/docs/get-started/web"&gt;https://flutter.dev/docs/get-started/web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://flutter.dev/docs/development/platform-integration/web"&gt;https://flutter.dev/docs/development/platform-integration/web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.travis-ci.com/user/deployment/pages"&gt;https://docs.travis-ci.com/user/deployment/pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/apolloblog/automatically-build-your-flutter-apps-with-travis-ci-4c1e47a5ae69"&gt;https://medium.com/apolloblog/automatically-build-your-flutter-apps-with-travis-ci-4c1e47a5ae69&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/flutter/samples/blob/master/.travis.yml"&gt;https://github.com/flutter/samples/blob/master/.travis.yml&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>flutter</category>
      <category>web</category>
      <category>travis</category>
      <category>github</category>
    </item>
  </channel>
</rss>
