<?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: subliminal_大衛</title>
    <description>The latest articles on DEV Community by subliminal_大衛 (@subliminal_guy).</description>
    <link>https://dev.to/subliminal_guy</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%2F452563%2F54e7a965-87cf-4262-884e-2dcd6a33aed8.png</url>
      <title>DEV Community: subliminal_大衛</title>
      <link>https://dev.to/subliminal_guy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/subliminal_guy"/>
    <language>en</language>
    <item>
      <title>Abecedario Espanol</title>
      <dc:creator>subliminal_大衛</dc:creator>
      <pubDate>Sat, 05 Nov 2022 14:03:02 +0000</pubDate>
      <link>https://dev.to/subliminal_guy/abecedario-espanol-3i0e</link>
      <guid>https://dev.to/subliminal_guy/abecedario-espanol-3i0e</guid>
      <description>&lt;p&gt;My girlfriend is from Sevilla (Spain) and is currently looking for a job as language or history teacher in Berlin. I wanted to help her a bit by creating a website for her. While the website is far from being ready, we decided to begin with a teeny-tiny app that teaches you to pronounce the spanish alphabet, which has quite a few pecularities. The alphabet is represented by little black boxes with clickable letters. Special character are being identified by a small black cross that reveals more info when clicked.&lt;/p&gt;

&lt;p&gt;The prototype is currently deployed on Netlify: &lt;a href="https://teresais-alfabeto.netlify.app/" rel="noopener noreferrer"&gt;teresais-alfabeto&lt;/a&gt;. The source code is on &lt;a href="https://gitlab.com/subliminal_guy/abecedario" rel="noopener noreferrer"&gt;Gitlab&lt;/a&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fql7lanwon7eh3k4s939j.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fql7lanwon7eh3k4s939j.png" alt="Screenshot of the site"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does the Browser speak spanish?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What may appear complicated is in fact really easy. I learned the basics in Wes Bos’s wonderful Vanilla JS course &lt;a href="https://javascript30.com/" rel="noopener noreferrer"&gt;JavaScript30&lt;/a&gt;. With only a few lines of code you can use the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance" rel="noopener noreferrer"&gt;SpeechSynthesis Constructor&lt;/a&gt; by MDN Web Docs. So all i really had to do was to define a new object instance in the data section of my App.vue.&lt;/p&gt;

&lt;p&gt;Ups! Did I mention that I used Vue for the site? If you don’t know what Vue is you’ll find a free tutorial on the &lt;a href="https://scrimba.com/learn/learnvue" rel="noopener noreferrer"&gt;Scrimba&lt;/a&gt; site. It is really basic but should suffice to understand my code.&lt;/p&gt;

&lt;p&gt;Anyway I defined some variables in the data section, namely &lt;strong&gt;synth&lt;/strong&gt; and &lt;strong&gt;pronounciation&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data () {
    return {
      data: this.$store.state.alphabet,
      synth: window.speechSynthesis,
      voiceSpanish: [],
      pronounciation: new window.SpeechSynthesisUtterance
    }
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the method section I started with the method &lt;strong&gt;speakLetter()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;methods: {
    speakLetter({msg}) {
      var voiceList = this.synth.getVoices()
      this.voiceSpanish = voiceList.filter(item =&amp;gt; item.name === "Jorge")
      this.pronounciation.text = msg.toLowerCase()
      this.pronounciation.voice = this.voiceSpanish[0]
      this.synth.speak(this.pronounciation)
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First I call the list of available voices with the &lt;strong&gt;.getVoices()&lt;/strong&gt;-method using the &lt;strong&gt;synth&lt;/strong&gt;-variable we declared above and filter through it looking for the “Jorge”-voice. (My daughter seems to like this particular voice ;-)) Then we’ll set the &lt;strong&gt;text&lt;/strong&gt;-attribute of the &lt;strong&gt;SpeechSynthesisUtterance&lt;/strong&gt; instance to the text submitted in the function parameter and the &lt;strong&gt;voice&lt;/strong&gt;-attribute to the voice of “Jorge”. Finally the &lt;strong&gt;speak()&lt;/strong&gt;-method does the job of firing the voice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The LetterShow-Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;LetterShow&lt;/strong&gt;-component is being called by &lt;strong&gt;App.vue&lt;/strong&gt; to show the responding letters. For this purpose I have prepared a &lt;strong&gt;data.json&lt;/strong&gt;-file that i’ve loaded into the Vuex-store.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jxc4dqnzkddd88bqsio.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jxc4dqnzkddd88bqsio.png" alt="Foto of a code partition"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is really just an object that contains the letters and indicates if they have some special features or not. If so, those are being specified in the &lt;strong&gt;infotextRojo&lt;/strong&gt; and &lt;strong&gt;infotextVerde&lt;/strong&gt;-keys (Indicating strong and weak consonants in the spanish language).&lt;/p&gt;

&lt;p&gt;I’m looping through this object with a &lt;strong&gt;v-for&lt;/strong&gt;-directive and showing every letter with the &lt;strong&gt;LetterShow&lt;/strong&gt;-component. Here is the HTML-part of it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div class="letter-box"&amp;gt;
      &amp;lt;h1 class="main-letter" @click="speak"&amp;gt;{{ msg }}&amp;lt;/h1&amp;gt;
      &amp;lt;p v-if="special" class="info-letter" @click="showModal"&amp;gt;&amp;amp;#x2795;&amp;lt;/p&amp;gt;
      &amp;lt;p v-else class="info-letter"&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;If the letter is special we’ll show a cross that activates the &lt;strong&gt;Modal&lt;/strong&gt;-component to show the special cases. Both, the &lt;strong&gt;LetterShow&lt;/strong&gt; and the &lt;strong&gt;Modal&lt;/strong&gt;-component, fire Custom Events to trigger the &lt;strong&gt;speakLetter&lt;/strong&gt;-method. That’s about it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Misc&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I guess my explication is somewhat abstract, so I’m inviting you to clone the &lt;a href="https://gitlab.com/subliminal_guy/abecedario" rel="noopener noreferrer"&gt;repository&lt;/a&gt; and play around with it on your machine.&lt;/p&gt;

&lt;p&gt;Currently it is not running on the mobile browsers I tried and I’m guessing it has to do with the experimental nature of the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance" rel="noopener noreferrer"&gt;SpeechSynthesis Constructor&lt;/a&gt;. &lt;br&gt;
Also, to make sure that I’m really getting the “Jorge”-voice I had to fire the &lt;strong&gt;speakLetter&lt;/strong&gt;-method once on page mount, because the SpeechSynthesis starts with the voice of an american woman by default.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mounted() {
    this.speakLetter({msg: ""})
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, i’m just calling the speakLetter*-method with an empty message, so that it is forced to load “Jorge” afterwards.&lt;/p&gt;

&lt;p&gt;Have fun playing around!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a devblog with Site.js and Hugo static site generator</title>
      <dc:creator>subliminal_大衛</dc:creator>
      <pubDate>Sun, 31 Jan 2021 19:50:45 +0000</pubDate>
      <link>https://dev.to/subliminal_guy/building-a-devblog-with-site-js-and-hugo-static-site-generator-2bpl</link>
      <guid>https://dev.to/subliminal_guy/building-a-devblog-with-site-js-and-hugo-static-site-generator-2bpl</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Some days ago i stumbled upon the amazing &lt;a href="https://small-tech.org"&gt;small-tech.org&lt;/a&gt; project by Aral Balkan and Laura Kalbag. I have been following their work for a while and i'd like to support them a bit by using and exploring their &lt;a href="https://sitejs.org"&gt;Small Web construction set&lt;/a&gt;. It comes bundled with the &lt;a href="https://gohugo.io"&gt;Hugo static site generator&lt;/a&gt;, so I was immediately able to use the nice &lt;a href="https://github.com/jbub/ghostwriter"&gt;Ghostwriter Theme&lt;/a&gt; for this blog.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Site.js and Initiating a Hugo project
&lt;/h2&gt;

&lt;p&gt;Everything started with the installation of &lt;a href="https://sitejs.org"&gt;Site.js&lt;/a&gt; as recommended by the developer. Type the following code in your favourite command line tool (i use &lt;a href="https://hyper.is/"&gt;Hyper&lt;/a&gt; or the built-in terminal from VSCode).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -s https://sitejs.org/install | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you are ready to create a folder for your Hugo project and jump into it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir my-hugo-blog
cd my-hugo-blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and create a new site using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;site hugo new site .hugo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you'll find the Hugo folder structure in the directory you created. Open this in your favourite code editor. &lt;/p&gt;

&lt;h2&gt;
  
  
  Installing a Hugo Theme
&lt;/h2&gt;

&lt;p&gt;For starters i chose the Ghostwriter Theme from &lt;a href="https://themes.gohugo.io"&gt;https://themes.gohugo.io&lt;/a&gt;, but this is really up to you. &lt;br&gt;
Instead of cloning the repo into my directory i chose to download the .zip from the &lt;a href="https://github.com/jbub/ghostwriter/archive/master.zip"&gt;Github Page&lt;/a&gt; and unpacked it in the &lt;strong&gt;themes&lt;/strong&gt;-folder of my Hugo project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o2d5VBr8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/guqk7nbvchu8uo46ohmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o2d5VBr8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/guqk7nbvchu8uo46ohmd.png" alt="Alt Text" width="358" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we have to tell our project that we want to use the installed Theme. Open the &lt;strong&gt;config.toml&lt;/strong&gt; file in the projects root directory. Mine looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;baseURL = "/"
languageCode = "en-us"
title = "SubGuy's Devblog"
theme = "ghostwriter-master"
paginate = "10"

[Author]
name = "Subliminal_Guy"


[Params]
mainSections = ["post"]
intro = true
headline = "subguy's devblog "
description = "babbeling code since 2017" 
github = "https://github.com/SubliminalGuy"
gitlab = "https://gitlab.com/subliminal_guy"
twitter = "https://twitter.com/SubKid"
opengraph = true
shareTwitter = true
dateFormat = "Mon, Jan 2, 2021"
authorbox = true

[Permalinks]
post = "/:filename"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy everything. The most important part for now is, that you set the &lt;strong&gt;title&lt;/strong&gt; as you like and the &lt;strong&gt;theme&lt;/strong&gt; to "ghostwriter-master" (or whatever the directory name for your installed theme is - it has to be verbatim). &lt;br&gt;
Take a look at the [Params]. Most of them are pretty self-explanatory. You can play around with them later.&lt;/p&gt;

&lt;p&gt;Now you can copy the &lt;strong&gt;post&lt;/strong&gt;-folder in "themes/ghostwriter-master/exampleSite/content" &lt;em&gt;(respectively "themes/YOUR-THEME-FOLDER-NAME/exampleSite/content")&lt;/em&gt; into the &lt;strong&gt;content&lt;/strong&gt;-folder of your projects root directory.&lt;/p&gt;
&lt;h2&gt;
  
  
  Launching the blog
&lt;/h2&gt;

&lt;p&gt;Now start the development server by typing the following command into the terminal. This should work from your root directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;site
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you now check your browser at &lt;a href="https://localhost"&gt;https://localhost&lt;/a&gt; you should see the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KbQD-n1V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8eiexdv7fqb8jgnqvv7z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KbQD-n1V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8eiexdv7fqb8jgnqvv7z.png" alt="Alt Text" width="863" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I deleted all the blogposts and created a new one with the following prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;site hugo new post/building-a-devblog.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this file I finally entered the Markdown for my first blog post that you're currently reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  And now?
&lt;/h2&gt;

&lt;p&gt;The deployment of this blog on a VPS of your choice is as easy as it gets. Simply install &lt;a href="https://sitejs.org"&gt;Site.js&lt;/a&gt; in the designated directory, upload the files we created and enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;site enable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your blog should be live immediately. Enjoy!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
