<?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: Milan Tarami</title>
    <description>The latest articles on DEV Community by Milan Tarami (@milantarami).</description>
    <link>https://dev.to/milantarami</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%2F190242%2F9db0bcfb-767a-4225-85a6-85042bb58aa5.jpg</url>
      <title>DEV Community: Milan Tarami</title>
      <link>https://dev.to/milantarami</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/milantarami"/>
    <language>en</language>
    <item>
      <title>How to create confirm box using TippyJS</title>
      <dc:creator>Milan Tarami</dc:creator>
      <pubDate>Wed, 01 Sep 2021 11:35:31 +0000</pubDate>
      <link>https://dev.to/milantarami/how-to-create-confirm-box-using-tippyjs-35nd</link>
      <guid>https://dev.to/milantarami/how-to-create-confirm-box-using-tippyjs-35nd</guid>
      <description>&lt;p&gt;&lt;a href="https://atomiks.github.io/tippyjs"&gt;Tippy.js&lt;/a&gt; is the complete tooltip, popover, dropdown, and menu solution for the web, powered by Popper.&lt;/p&gt;

&lt;p&gt;Javascript default confirm box also works well but UX matters. In this example, I am showing the easiest way to create eye pleasant confirm box with a great user experience.&lt;/p&gt;

&lt;p&gt;You can check out the below example in &lt;a href="https://jsfiddle.net/milantarami/d6js83zr/138/"&gt;JS Fiddle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example I'm using &lt;a href="https://tailwindcss.com/"&gt;TailwindCSS&lt;/a&gt; (a utility-first CSS framework) to style the document&lt;/p&gt;

&lt;p&gt;Add this code to your head tag&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;!-- TippyJS CDN --&amp;gt;
&amp;lt;script src="https://unpkg.com/@popperjs/core@2"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="https://unpkg.com/tippy.js@6"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;!-- TailwindCSS CDN --&amp;gt;
&amp;lt;link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's add an HTML button element, on the click event of this button a confirm box must appear.&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;button type="button" class="bg-red-600 px-2 py-1 rounded-md text-white"&amp;gt;
Trash
&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's add hidden HTML content for a custom confirm box innerHTML content.&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;div id="template" class="hidden"&amp;gt;
   &amp;lt;form action="http://myurl.domain/id" method="POST"&amp;gt;
   &amp;lt;/form&amp;gt;
   &amp;lt;div class="confirm__box p-3"&amp;gt;
      &amp;lt;div class="confirm__text text-center mb-4"&amp;gt;
         &amp;lt;strong&amp;gt;Are you sure ?&amp;lt;/strong&amp;gt;
         &amp;lt;p&amp;gt;
            You won't able to revert this back.
         &amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="confirm__action flex justify-between"&amp;gt;
         &amp;lt;button class="ok-btn w-10 text-white bg-green-600 px-1 rounded-sm"&amp;gt;
         Yes
         &amp;lt;/button&amp;gt;
         &amp;lt;button class="cancel-btn w-10 text-white bg-red-600 px-1 rouneded-sm"&amp;gt;
         No
         &amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
   &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;initialize button with tippyJS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const template = document.getElementById('template');
tippy('button', {

    content: template.innerHTML,
    allowHTML: true,
    theme: 'material',
    interactive: true,
    zIndex: 99999,
    placement: 'auto',
    trigger: 'click',
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;adding submit or cancel functionality&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    onCreate(instance) {
        instance.popper.querySelector('.cancel-btn').onclick = () =&amp;gt; {
            instance.hide();
        }

        instance.popper.querySelector('.ok-btn').onclick = () =&amp;gt; {
            instance.hide();
            instance.popper.querySelector('form').submit();
            alert('form submitted')
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check out the below example in &lt;a href="https://jsfiddle.net/milantarami/d6js83zr/138/"&gt;JS Fiddle&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tippyjs</category>
    </item>
    <item>
      <title>how to run storage:link in shared hosting</title>
      <dc:creator>Milan Tarami</dc:creator>
      <pubDate>Wed, 02 Dec 2020 16:40:54 +0000</pubDate>
      <link>https://dev.to/milantarami/how-to-run-storage-link-in-shared-hosting-47en</link>
      <guid>https://dev.to/milantarami/how-to-run-storage-link-in-shared-hosting-47en</guid>
      <description>&lt;p&gt;In shared hosting, if you don't have ssh access there is one way to run the artisan command is using &lt;code&gt;Artisan&lt;/code&gt; Facade but wait &lt;code&gt;Artisan::call('storage:link')&lt;/code&gt; throws an error&lt;/p&gt;

&lt;p&gt;We are going to solve this issue,  add this code to web.php within a route or to any controller&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use Illuminate\Support\Facades\File;

File::link(storage_path('app/public'), public_path('storage'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
      <category>laravel</category>
    </item>
    <item>
      <title>GIT Commands ( Woking with git branch )</title>
      <dc:creator>Milan Tarami</dc:creator>
      <pubDate>Sat, 26 Sep 2020 07:53:58 +0000</pubDate>
      <link>https://dev.to/milantarami/git-commands-woking-with-branch-3lck</link>
      <guid>https://dev.to/milantarami/git-commands-woking-with-branch-3lck</guid>
      <description>&lt;p&gt;&lt;strong&gt;Creating a new branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git checkout -b YOUR_NEW_BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;View all &lt;em&gt;local&lt;/em&gt; branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git branch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;View all &lt;em&gt;local&lt;/em&gt; and &lt;em&gt;remote&lt;/em&gt; branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git branch -a
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Pushing a &lt;em&gt;local&lt;/em&gt; branch to a &lt;em&gt;remote&lt;/em&gt; server&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git push origin YOUR_BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Set upstream branch&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;upsteam allows to use "git push" command&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git push -u origin BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Switching between branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git checkout BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Merging branch&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;make sure you have committed all changes before merging&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// first switch to destination branch, where branch needs to be merged

$ git checkout DESTINATION_BRANCH_NAME


// and run below command to merge

$ git merge BRANCH_NAME_TO_BE_MERGED
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Deleting a local branch without merging&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// switch to any other branch

$ git branch -D BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Deleting a local branch after merging&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;make sure you need to be in the destination branch to delete merged branch&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git branch -d BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Deleting a branch from a remote server&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git push origin -d BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Pulling remote branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git pull origin BRANCH_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Getting changes from master branch to other branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// switch to branch
$ git checkout DESTINATION_BRANCH_NAME

$ git rebase master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;em&gt;I will be updating this post if I became more familiar with other git commands while working on git branch&lt;/em&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
comment down if I made mistake&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
    </item>
  </channel>
</rss>
