<?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: LG</title>
    <description>The latest articles on DEV Community by LG (@projektorius96).</description>
    <link>https://dev.to/projektorius96</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%2F560535%2Fb6d32e7e-8f10-4e31-9f46-7becc63f4588.jpg</url>
      <title>DEV Community: LG</title>
      <link>https://dev.to/projektorius96</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/projektorius96"/>
    <language>en</language>
    <item>
      <title>Git bash for Windows users PS1 variable (aka prompt) customization</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Fri, 22 Dec 2023 14:09:17 +0000</pubDate>
      <link>https://dev.to/projektorius96/git-bash-for-windows-users-ps1-variable-aka-prompt-customization-47m2</link>
      <guid>https://dev.to/projektorius96/git-bash-for-windows-users-ps1-variable-aka-prompt-customization-47m2</guid>
      <description>&lt;p&gt;This assumes that you are located in &lt;code&gt;%USERPROFILE%&lt;/code&gt; (File Explorer), otherwise, init Git bash for Windows shell session at &lt;code&gt;cd ~&lt;/code&gt;: once you are there, touch &lt;code&gt;.bash_profile&lt;/code&gt; via Git the bash session. Following these third-party guidelines (see &lt;a href="https://devtut.github.io/bash/customizing-ps1.html#colorize-and-customize-terminal-prompt" rel="noopener noreferrer"&gt;link&lt;/a&gt;) we can customize our PS1 as we want to:&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="nv"&gt;MY_ALIAS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"vanillacamp"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PS1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'\e[0;32m$MY_ALIAS@\[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Let's clarify the snippet above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;MY_ALIAS&lt;/code&gt; is a bash variable, that later on will be referred to using a dollar sign as the following: &lt;code&gt;$MY_ALIAS&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the &lt;code&gt;export&lt;/code&gt; keyword makes sure the PS1 will be valid among sessions (system-wise)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PS1 variables follow ANSI-escaping standards for colouring and formatting including some special escape sequences such as &lt;code&gt;\u&lt;/code&gt; for system (admin) username, or relevant&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the &lt;code&gt;$MSYSTEM&lt;/code&gt; is part of MSYS2 toolchain; depending on platform &lt;code&gt;$MSYSTEM&lt;/code&gt; most likely be one of the following values: &lt;a href="https://www.msys2.org/docs/environments/" rel="noopener noreferrer"&gt;MINGW32|MINGW64|MSYS&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;__git_ps1&lt;/code&gt; is part of Git version control that, essentially, provides the current branch as part of your prompt, thus PS1 variable you currently trying to modify&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Happy modifying, cheers!&lt;/p&gt;

</description>
      <category>gitbash</category>
      <category>msys</category>
      <category>terminal</category>
      <category>shell</category>
    </item>
    <item>
      <title>More explicit interface implementation in Go using simple function signature | 3 ed.</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Fri, 06 Jan 2023 23:47:15 +0000</pubDate>
      <link>https://dev.to/projektorius96/explicit-golang-interface-implementation-using-simple-function-signature-4hac</link>
      <guid>https://dev.to/projektorius96/explicit-golang-interface-implementation-using-simple-function-signature-4hac</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;NOTE : Go and Golang – are synonyms !&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Rather than implicitly stating &lt;code&gt;methodSignature() methodType&lt;/code&gt; without any reserved keyword such as &lt;code&gt;implement&lt;/code&gt; for method we can write what I call "JavaScript-like callback" i.e. function that wraps interface signature(s) for more explicit interface implementation based upon an arbitrary named convention [2 example]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 Example&lt;/strong&gt; – consider initial pseudo_code (Go syntax) :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;someInterface&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;methodSignature&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;methodType&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// empty struct is still a valid entity to define a method&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;yourStruct&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// struct field[s] (if any)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;receiver&lt;/span&gt; &lt;span class="n"&gt;yourStruct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;methodSignature&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;methodType&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// method logic&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2 Example&lt;/strong&gt; – consider the following optimised pseudo_code (Go syntax) :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="s"&gt;"fmt"&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;someInterface&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;methodSignature&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;methodType&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// 1/3 empty struct is still a valid entity to define a method&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;yourStruct&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// struct field[s] (if any) : empty string would be still valid &lt;/span&gt;
    &lt;span class="n"&gt;someType&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// 3/3A : wrapper for more explicit interface implementation&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;explicitInterface〳implements&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;interfaceReceiver&lt;/span&gt; &lt;span class="n"&gt;someInterface&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="n"&gt;interfaceReceiver&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;methodSignature&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// 2/3&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;structAccessor&lt;/span&gt; &lt;span class="n"&gt;yourStruct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;explicitInterface〳implements&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c"&gt;/* 3/3B : &amp;lt;= as if written someInterface.methodSignature() but in Golang syntax-enforced fashion  */&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Engineering name: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;structAccessor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;someType&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;h3&gt;
  
  
  &lt;u&gt;Practical example (REPL)&lt;/u&gt; :
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://replit.com/@projektorius96/interfaces#implementInterfaceWrapper.go" rel="noopener noreferrer"&gt;Runnable code example on REPLIT&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Open shell instance and type: &lt;code&gt;go run explicitInterfaceImplementation.go&lt;/code&gt; # &amp;lt;= this might change in the future so don't think hard, think smart !&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;If you found any typo, or think you can suggest a better solution, please leave a comment below . Stay tuned for more coming from Go . Cheers !&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Most sophisticated embedding pattern in Go: embedded interface within a struct</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Fri, 06 Jan 2023 20:03:39 +0000</pubDate>
      <link>https://dev.to/projektorius96/most-sophisticated-embedding-pattern-in-go-embedded-interface-within-a-struct-5fdg</link>
      <guid>https://dev.to/projektorius96/most-sophisticated-embedding-pattern-in-go-embedded-interface-within-a-struct-5fdg</guid>
      <description>&lt;p&gt;From my point of view, this pattern is one of many explanatory examples, but should be learnt by heart until completely comprehended . It's like writing an explicit callback for another callback in JavaScript – takes time to make a final "Gotcha!"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="s"&gt;"fmt"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// 1.3) define interface siganture(s)&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Logic&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Process&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="c"&gt;// # signature 1&lt;/span&gt;
    &lt;span class="c"&gt;/* Argc (data []string) int  */// # signature 2 : keeping 2 as commented out &lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// 1.1) empty struct is prerequisite to provide a method&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;MethodProvider&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;isEmpty&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// 1.2) thanks to empty struct above we can define method that will be our implicitly implemented Logic interface field i.e. Process in this case;&lt;/span&gt;
&lt;span class="c"&gt;// Process method with returning type, in this case, it's a (labeled .......string)&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;methodReceiver&lt;/span&gt; &lt;span class="n"&gt;MethodProvider&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;methodReturnType&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// business logic&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;methodReceiver&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isEmpty&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"methodReceiver that provides implicit Logic.Process signature implementation"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// DEV_NOTE: another struct embedding Logic.Process : we say Client "HAS" (i.e. "EMBEDS") Logic.Process not "IS" as embedding vs. inheriting is not the same !&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;ClientProvider&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;LogicImplementor&lt;/span&gt; &lt;span class="c"&gt;/* &amp;lt;= is an alias for =&amp;gt; */&lt;/span&gt; &lt;span class="n"&gt;Logic&lt;/span&gt; &lt;span class="c"&gt;/* interface */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// Program method with returning type, in this case, it's a .....string&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clientReceiver&lt;/span&gt; &lt;span class="n"&gt;ClientProvider&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Program&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pseudo_argv0&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="c"&gt;// get data from somewhere&lt;/span&gt;
    &lt;span class="n"&gt;clientReceiver&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LogicImplementor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Client Process"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Exit with pseudo code 0"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;ClientProvider&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;LogicImplementor&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MethodProvider&lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Program&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"$PATH_TO_pseudo_argv0.exe"&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;&lt;a href="https://replit.com/@projektorius96/interfaces#embedded-interf2--advanced.go" rel="noopener noreferrer"&gt;runnable code example on REPLIT&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Open shell instance and type: &lt;code&gt;go run embedded-interf2--advanced.go&lt;/code&gt; # &amp;lt;= this might change in the future so don't think hard, think smart !&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;u&gt;Related articles&lt;/u&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://duncanleung.com/understand-go-golang-interfaces/" rel="noopener noreferrer"&gt;understand-interfaces&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://eli.thegreenplace.net/2020/embedding-in-go-part-3-interfaces-in-structs/" rel="noopener noreferrer"&gt;interfaces-in-structs: practical side of such embedding&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you found any typo, or think you can suggest a better solution, please leave a comment below . Stay tuned !&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>patterns</category>
      <category>go</category>
    </item>
    <item>
      <title>Golang encapsulation for protected fields – quick insight</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Tue, 03 Jan 2023 22:45:38 +0000</pubDate>
      <link>https://dev.to/projektorius96/golang-encapsulation-for-protected-fields-quick-insight-epm</link>
      <guid>https://dev.to/projektorius96/golang-encapsulation-for-protected-fields-quick-insight-epm</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;My personal insight (&lt;strong&gt;TL;DR&lt;/strong&gt;) :&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;"&lt;em&gt;A struct encapsulation within dedicated module with structs' un-exported fields, but exported setter-like and getter-like method(s) within such dedicated module yields similar practice of protected class behaviour in such languages as e.g. – PHP&lt;/em&gt;"&lt;/p&gt;

</description>
      <category>mentorship</category>
      <category>career</category>
      <category>learning</category>
    </item>
    <item>
      <title>TypeScript for prototyping: bijective function example with generics' notation</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Mon, 02 Jan 2023 21:03:13 +0000</pubDate>
      <link>https://dev.to/projektorius96/typescript-for-prototyping-bijective-function-example-with-generics-notation-16l7</link>
      <guid>https://dev.to/projektorius96/typescript-for-prototyping-bijective-function-example-with-generics-notation-16l7</guid>
      <description>&lt;p&gt;&lt;strong&gt;Bijective function&lt;/strong&gt; (&lt;em&gt;one-to-one correspondence&lt;/em&gt;) function in layman's terms with TypeScript generic notation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;bijective&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arg2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="cm"&gt;/* &amp;lt;= instead of "return;" do "void" */&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;arg1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;arg2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="cm"&gt;/* return; */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;bijective&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// #  "0=&amp;gt;false" &lt;/span&gt;
&lt;span class="nx"&gt;bijective&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// # "1=&amp;gt;true" &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>agile</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Carbon-design-system for Svelte: dynamic import is your only solution !</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Thu, 22 Dec 2022 22:26:46 +0000</pubDate>
      <link>https://dev.to/projektorius96/carbon-design-system-for-svelte-dynamic-import-is-your-only-solution--44n9</link>
      <guid>https://dev.to/projektorius96/carbon-design-system-for-svelte-dynamic-import-is-your-only-solution--44n9</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;DISCLAIMER&lt;/strong&gt;: install sveltekit, carbon design with sveltekit+vite works out of the box !&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I've opened issue on &lt;a href="https://github.com/carbon-design-system/carbon-components-svelte/issues/1564" rel="noopener noreferrer"&gt;IBM community&lt;/a&gt; to find a solution rather than importing via &lt;code&gt;&amp;lt;svelte:head&amp;gt;&lt;/code&gt;, although I could not even get any answer to that . After sometime of scratching my head and couple of tests on Webpack behaviour, I've managed to crack &lt;a href="https://carbon-components-svelte.onrender.com/" rel="noopener noreferrer"&gt;carbon-design-system for Svelte&lt;/a&gt; once and for all . Repeating myself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;POSSIBLE REASON WHY WE NEED DYNAMIC IMPORT RATHER THAN STATIC ONE IS&lt;/strong&gt; : Svelte acts asynchronously subsequently static import at svelte compiler build stage has not YET registered Carbon-design, in order to upload the Carbon-design theme files (CSS) via Svelte to Dom stage, common sense, you must use dynamic import, onMount cycle just makes sure theming would load within first Svelte load&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;package.json&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// webpack.config.js&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
 &lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;modules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node_modules&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="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;&lt;u&gt;App.svelte&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// App.svelte&lt;/span&gt;
        &lt;span class="nf"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &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="c1"&gt;// e.g. import ./white.css theme:&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;carbon-components-svelte/css/white.css&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enjoy coding with Svelte &lt;code&gt;&amp;lt;3&lt;/code&gt;&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>webdev</category>
      <category>tricksntips</category>
    </item>
    <item>
      <title>Type checking in Go – alternative approach</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Tue, 20 Dec 2022 22:28:15 +0000</pubDate>
      <link>https://dev.to/projektorius96/type-checking-in-go-alternative-approach-cm4</link>
      <guid>https://dev.to/projektorius96/type-checking-in-go-alternative-approach-cm4</guid>
      <description>&lt;p&gt;Instead of &lt;code&gt;reflect.Valueof(&amp;lt;variable&amp;gt;).Kind()&lt;/code&gt; we can think about implementing this _switch wrapper :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NOTE: I cannot ensure which is better, but thumb of rule is baked-in features should be faster, more efficient ? – Remains a question . Still as alternative approach consider the following :&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag__replit"&gt;
  &lt;iframe height="550px" src="https://repl.it/@projektorius96/controlflow?lite=true"&gt;&lt;/iframe&gt;
&lt;/div&gt;


</description>
      <category>svelte</category>
      <category>react</category>
      <category>frontend</category>
      <category>career</category>
    </item>
    <item>
      <title>JavaScript web__constants (Node.js-friendly)</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Thu, 08 Dec 2022 20:44:05 +0000</pubDate>
      <link>https://dev.to/projektorius96/javascript-webconstants-nodejs-friendly-3h27</link>
      <guid>https://dev.to/projektorius96/javascript-webconstants-nodejs-friendly-3h27</guid>
      <description>&lt;h3&gt;
  
  
  Intro
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;All magic based upon &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta" rel="noopener noreferrer"&gt;import.meta operator&lt;/a&gt; natively baked-in on ES6 modules (ESM)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Bear in mind the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;/* --- This is also mentioned in the code ---
&lt;span class="p"&gt;URL scheme depending on :
a) server (web, Node.js) =&amp;gt; http(s)://
b) file-system (Node.js only) =&amp;gt; file:///
&lt;/span&gt;*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="ltag__replit"&gt;
  &lt;iframe height="550px" src="https://repl.it/@projektorius96/esmexportsmeta?lite=true"&gt;&lt;/iframe&gt;
&lt;/div&gt;



&lt;p&gt;Open sanbox in a dedicated tab &amp;amp; run the following on a shell:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;node index.mjs&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>es6</category>
      <category>metaprogramming</category>
    </item>
    <item>
      <title>Initial konva-svelte public pre-release</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Sat, 29 Oct 2022 21:41:19 +0000</pubDate>
      <link>https://dev.to/projektorius96/initial-konva-svelte-public-pre-release-3mfa</link>
      <guid>https://dev.to/projektorius96/initial-konva-svelte-public-pre-release-3mfa</guid>
      <description>&lt;p&gt;React for Konva ? - Of cource !, Vue for Konva ? – Of cource, Finally, Svelte for Konva, here it go :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/projektorius96/svelte-konva/releases/tag/v1.0.0" rel="noopener noreferrer"&gt;svelte-konva&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Map-based (functional) namespacing</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Thu, 20 Oct 2022 23:55:37 +0000</pubDate>
      <link>https://dev.to/projektorius96/map-based-functional-namespacing-ll2</link>
      <guid>https://dev.to/projektorius96/map-based-functional-namespacing-ll2</guid>
      <description>&lt;h3&gt;
  
  
  Motivation
&lt;/h3&gt;

&lt;p&gt;As far as I know PHP is lack of definition of modular namespacing, although PHP &lt;code&gt;\App&lt;/code&gt;-like signature of namespaces is one the features I was missing for ages in JavaScript implementation (ECMAScript specification) . However, it seems we can reproduce similar behaviour via Maps since ES6, except that the signature looks more "Erlangish" (i.e. "functional"), code base :&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/map-based-functional-namespaces-js-17z0hi"&gt;
&lt;/iframe&gt;
&lt;/p&gt;




&lt;h3&gt;
  
  
  References :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/projektorius96/constructorless-namespaces-in-es5-es6-14pk"&gt;Constructorless namespaces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/lNaWD7kRBC8?t=1" rel="noopener noreferrer"&gt;PHP namespaces by Dave Hollingworth&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Git : feature-branch is nth commits behind</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Wed, 14 Sep 2022 13:40:06 +0000</pubDate>
      <link>https://dev.to/projektorius96/git-feature-branch-is-nth-commits-behind-i41</link>
      <guid>https://dev.to/projektorius96/git-feature-branch-is-nth-commits-behind-i41</guid>
      <description>&lt;p&gt;The more I work with Git version control , the more I want to write a book from scratch that would be easy to read, that would include maintainable (up-to-date) link to real life examples, including many of developers experience in one precise volume – I already have a vision how it would look like, although it would take time to write one as I am still learning the git fundamentals, not mentioning some of its boring intrinsic parts of the git ... &lt;/p&gt;

&lt;p&gt;However, in this post I'd really like share one small issue I've dealt recently with ; consider we worked for a while on &lt;strong&gt;feature-branch&lt;/strong&gt; that remotely (I said not locally, but remotely !) was merged to remote base branch named &lt;strong&gt;develop&lt;/strong&gt; (&lt;u&gt;or main, master – whichever suits your imagination best&lt;/u&gt;) : by convention any default merge action is commit action as well – remote develop becomes -ahead, feature-branch becomes -behind (keep in mind it could be a case of -ahead &amp;amp; -behind mixture), which would subsequently make aforementioned &lt;u&gt;remote &lt;strong&gt;feature-branch&lt;/strong&gt;&lt;/u&gt; stay N-th of commits -behind (&lt;u&gt;&lt;strong&gt;prerequisite&lt;/strong&gt; : to state that some branch is &lt;em&gt;-ahead&lt;/em&gt; or &lt;em&gt;-behind&lt;/em&gt; your local copy of feature-branch must be [pre-]tracked with remote one&lt;/u&gt;) . In my case it was both -ahead &amp;amp; -behind remotely . Ignore the -ahead part whereas we interested in -behind part only : -ahead part basically says that you made couple of commits ahead, but you have not yet decided to merge it to base branch remotely .&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Feature-branch is -behind n-th of commits [solution]&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;Prerequisites : The solution suggested assumes you are using GitHub Desktop&lt;/p&gt;

&lt;p&gt;Instead of two step process i.e. pulling remote develop to update things locally &amp;amp; then merge local develop to the local copy of remote feature-branch, just do one step process what is called "Update from ..." (in my case it was Update from &lt;strong&gt;develop&lt;/strong&gt;) or Ctrl + Shift + P on GitHub Desktop respectively . This action would remove n-th commits -behind message on your GitHub account for feature-branch or any relevant name of your feature-branch . &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Svelte : declare component without tags</title>
      <dc:creator>LG</dc:creator>
      <pubDate>Sat, 03 Sep 2022 20:47:32 +0000</pubDate>
      <link>https://dev.to/projektorius96/svelte-declare-component-without-tags-146n</link>
      <guid>https://dev.to/projektorius96/svelte-declare-component-without-tags-146n</guid>
      <description>&lt;h3&gt;
  
  
  INTRO
&lt;/h3&gt;

&lt;p&gt;No, this is not one more example of &lt;code&gt;&amp;lt;svelte:component this={Child} /&amp;gt;&lt;/code&gt; . This is example whereas you can instantiate Svelte component keeping "React-&lt;em&gt;ish&lt;/em&gt;" vibe on the line . &lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;PREREQS&lt;/strong&gt; : The only prerequisite is that &lt;u&gt;new App({target}) inside &lt;strong&gt;index.js&lt;/strong&gt;&lt;/u&gt; &amp;amp; &lt;u&gt;new Component({target}) inside &lt;strong&gt;App.svelte&lt;/strong&gt;&lt;/u&gt; would share same target property e.g. as follows :&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TIP&lt;/strong&gt; : try to open codesandbox in the seperate tab, or copy paste to your local environment, as you may experience error "props is not defined" which is not true ;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE BEFORE CODEBASE EXAMINATION&lt;/strong&gt; : we use refs.js to share target dynamically, although if it's only couple of targets, common sense, we can hard-coded in , although hardcoding is considered bad practice whatsoever ; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/svelte-component--no-tags-fnsnz0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NOTE : doing this way we exclude use props, apply inline styling through attributes, moreover this is just some alternative way of instatiating components rather than the mentioned way in the Intro or as e.g. self closing tags &lt;code&gt;&amp;lt;Child /&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

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