<?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: Gishan Chaminga Abeysinghe</title>
    <description>The latest articles on DEV Community by Gishan Chaminga Abeysinghe (@gishan_abeysinghe).</description>
    <link>https://dev.to/gishan_abeysinghe</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%2F750293%2Fd19048d8-a307-49c1-9014-e6d619840bed.jpeg</url>
      <title>DEV Community: Gishan Chaminga Abeysinghe</title>
      <link>https://dev.to/gishan_abeysinghe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gishan_abeysinghe"/>
    <language>en</language>
    <item>
      <title>How to show loading when changing pages in Nuxt3</title>
      <dc:creator>Gishan Chaminga Abeysinghe</dc:creator>
      <pubDate>Mon, 22 Sep 2025 11:01:17 +0000</pubDate>
      <link>https://dev.to/gishan_abeysinghe/how-to-show-loading-when-changing-pages-in-nuxt3-f28</link>
      <guid>https://dev.to/gishan_abeysinghe/how-to-show-loading-when-changing-pages-in-nuxt3-f28</guid>
      <description>&lt;p&gt;I am showing here how to make loading screen when changing pages, there should be asynchronous calls with await to make it show in this method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default defineNuxtPlugin((nuxtApp) =&amp;gt; {
  const global = useGlobalLoading()

  nuxtApp.hook('page:start', () =&amp;gt; {
    global.showLoading()
  });
  nuxtApp.hook('page:loading:end', () =&amp;gt; {
    global.hideLoading()
  });
})

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export function useGlobalLoading() {
  const isGlobalLoading = useState('global-loading', () =&amp;gt; false)

  function showLoading() {
    isGlobalLoading.value = true
  }

  function hideLoading() {
    isGlobalLoading.value = false
  }

  return {
    isGlobalLoading,
    showLoading,
    hideLoading,
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your app.vue&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;script setup lang="ts"&amp;gt;
import Loading from './components/Loading.vue'

const globalLoading = useGlobalLoading()
&amp;lt;/script&amp;gt;

&amp;lt;template&amp;gt;
  &amp;lt;div class="h-screen w-full flex justify-center items-center relative"&amp;gt;
    &amp;lt;div
      v-show="globalLoading.isGlobalLoading.value"
      class="h-full w-full flex justify-center items-center fixed bg-gray-400/50 z-[9999]"
    &amp;gt;
      &amp;lt;Loading /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="h-full w-full"&amp;gt;
      &amp;lt;NuxtLayout&amp;gt;
        &amp;lt;NuxtPage /&amp;gt;
      &amp;lt;/NuxtLayout&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

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

&lt;/div&gt;



</description>
      <category>aws</category>
    </item>
    <item>
      <title>Learning .NET</title>
      <dc:creator>Gishan Chaminga Abeysinghe</dc:creator>
      <pubDate>Thu, 05 Dec 2024 16:50:42 +0000</pubDate>
      <link>https://dev.to/gishan_abeysinghe/learning-net-95m</link>
      <guid>https://dev.to/gishan_abeysinghe/learning-net-95m</guid>
      <description>&lt;p&gt;Here are my learnings of .Net,&lt;/p&gt;

&lt;p&gt;I got the chance to work in a C# project and I had to learn things from the beginning.&lt;/p&gt;

&lt;p&gt;first I installed the .Net sdk, to check the version you can use following command in the terminal&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I used docker to install the sqlserver&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=YourStrong@Passw0rd -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2022-latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then I had to migrate the database. for that we need a dotnet tool called dotnet-ef, we have to install it first&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet tool install --global dotnet-ef&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;you can get more idea about the dotnet-ef by using --help as follows&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet ef --help&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to do the database migration &lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet ef database update --project [project-name].Infrastructure --startup-project [project-name]&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
to run the project&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet run --project [project-name]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to run the project with launch profile you can use &lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet run --project [project-name] --launch-profile https&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;there are three launch profiles&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;default&lt;/li&gt;
&lt;li&gt;http&lt;/li&gt;
&lt;li&gt;https&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Haskell - part 1 - Introduction</title>
      <dc:creator>Gishan Chaminga Abeysinghe</dc:creator>
      <pubDate>Wed, 29 Dec 2021 07:39:00 +0000</pubDate>
      <link>https://dev.to/gishan_abeysinghe/haskell-part-1-introduction-552i</link>
      <guid>https://dev.to/gishan_abeysinghe/haskell-part-1-introduction-552i</guid>
      <description>&lt;p&gt;When I was doing my master's I learned an alienated programming language. subject name was functional programming. As I am a programming languages enthusiast I just chose the subject without knowing how its gonna be. though I heard its all about a language called Haskell I really didnt bother much to search about it.&lt;/p&gt;

&lt;p&gt;So lets come to the Intro.&lt;/p&gt;

&lt;p&gt;Haskell is a functional programming language. what? yeah all the other languages also have functions. whats new in here then.&lt;/p&gt;

&lt;p&gt;So in haskell everything is a pure function.&lt;/p&gt;

&lt;p&gt;okay. what is a pure function?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It always gives you the same output when you provide same input.&lt;/li&gt;
&lt;li&gt;No side effects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What are side effects then.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A side effects are when a function relies on, or modifies, something outside its parameters to do something.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I copied the definition. Anyways I can give you some examples. If you do an API call, IO operation, database calls or even console logs these thing are called as side effects.&lt;/p&gt;

&lt;p&gt;So now you might get a doubt on how we can do those side effects.&lt;/p&gt;

&lt;p&gt;Actually in Haskell there is a concept called "Monads" to handle it. In a coming blog i will explain how to write a monad. As it has a more learning curve.&lt;/p&gt;

&lt;p&gt;This is just a small introduction. will meet the next blog soon. till then enjoy coding.&lt;/p&gt;

&lt;p&gt;Cheers!!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Configure more than one git accounts locally.</title>
      <dc:creator>Gishan Chaminga Abeysinghe</dc:creator>
      <pubDate>Sat, 13 Nov 2021 08:06:02 +0000</pubDate>
      <link>https://dev.to/gishan_abeysinghe/configure-more-than-one-git-accounts-locally-obg</link>
      <guid>https://dev.to/gishan_abeysinghe/configure-more-than-one-git-accounts-locally-obg</guid>
      <description>&lt;p&gt;After joining my first job they gave me a new mac mini, previously I used to work on my laptop but mac mini feels more convenient now. As you all know new company means you will get your new working email id. then you might need to use it create a new github account. (github is just for an example, this process valid for any git remote provider)&lt;/p&gt;

&lt;p&gt;Then the real struggle starts. How to manage personal and work github accounts in the same machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  First Step
&lt;/h3&gt;

&lt;p&gt;Generate 2 ssh keys, means you have to have two public keys and two private keys in your .ssh folder&lt;br&gt;
ex:- id_rsa_work id_rsa_personal id_rsa_work.pub id_rsa_personal.pub&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Second Step
&lt;/h3&gt;

&lt;p&gt;copy public ssh keys, work ssh goes to work github and personal ssh goes to personal github. so now you have added your public keys respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pbcopy &amp;lt; ~/.ssh/id_rsa_work.pub
pbcopy &amp;lt; ~/.ssh/id_rsa_personal.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Third Step
&lt;/h3&gt;

&lt;p&gt;Now we have to create another file in .ssh folder called config and paste the code below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal GitHub
Host personal
  HostName github.com
  User git
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa_personal

# Work GitHub
Host work
  HostName github.com
  User git
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa_work

Host *
  IdentitiesOnly yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Fourth Step
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Scenario 1 - Cloning a repo
&lt;/h4&gt;

&lt;p&gt;Suppose you want to clone a repo from your working github account.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone git@github.com:work-account/project.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you have to replace &lt;code&gt;git@github.com&lt;/code&gt; with &lt;code&gt;work&lt;/code&gt;. so it will look follows. actully &lt;code&gt;work&lt;/code&gt; is the name you gave in the config file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone work:work-account/project.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 2 - New repo / Existing repo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add origin git@github.com:work-account/project.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;change to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add origin work:work-account/project.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this will make your life easier and happy version controlling. &lt;/p&gt;

&lt;p&gt;cheers!!&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>gitlab</category>
      <category>bitbucket</category>
    </item>
    <item>
      <title>How to convert an Ajax call to a Promise</title>
      <dc:creator>Gishan Chaminga Abeysinghe</dc:creator>
      <pubDate>Thu, 11 Nov 2021 07:57:10 +0000</pubDate>
      <link>https://dev.to/gishan_abeysinghe/how-to-convert-an-ajax-call-to-a-promise-bd0</link>
      <guid>https://dev.to/gishan_abeysinghe/how-to-convert-an-ajax-call-to-a-promise-bd0</guid>
      <description>&lt;p&gt;As you know $.ajax is the most famous way to do an ajax call to any api, but sometimes you might need to convert this callback based ajax call to promise based. Actually using this method you can convert any callback to a promise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function ajaxPromise(data, url, type) {
   return new Promise(function (resolve, reject) {
        $.ajax({
          type,
          url,
          data,
          success: function (response) {
            resolve(response);
          },
          error: function (error) {
            reject(error);
          },
        });
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  What are the real benefits of this method
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Now you can use this inside an try catch block with async await.&lt;/li&gt;
&lt;li&gt;You can call your ajax calls in a for loop.&lt;/li&gt;
&lt;li&gt;Avoid callback hell.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
   for (let index = 0; index &amp;lt; ajaxCalls.length; index++) {
       const { url, data,type } = ajaxCalls[index];
       res = await ajaxPromise(data, url, type);
   }
} catch (error) {
    console.log(error);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this article is useful for you.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>promise</category>
      <category>ajax</category>
      <category>convert</category>
    </item>
  </channel>
</rss>
