<?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>Forem: Rohit Pakhrin</title>
    <description>The latest articles on Forem by Rohit Pakhrin (@roitpak).</description>
    <link>https://forem.com/roitpak</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%2F1266726%2F2faef0e8-0618-4ad7-8f41-47a2fed44b55.JPG</url>
      <title>Forem: Rohit Pakhrin</title>
      <link>https://forem.com/roitpak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/roitpak"/>
    <language>en</language>
    <item>
      <title>PWA: Turning Your Web App into a Native-Like App</title>
      <dc:creator>Rohit Pakhrin</dc:creator>
      <pubDate>Fri, 28 Jun 2024 06:29:01 +0000</pubDate>
      <link>https://forem.com/roitpak/pwa-turning-your-web-app-into-a-native-like-app-4d3a</link>
      <guid>https://forem.com/roitpak/pwa-turning-your-web-app-into-a-native-like-app-4d3a</guid>
      <description>&lt;h2&gt;
  
  
  Progressive web app
&lt;/h2&gt;

&lt;p&gt;&lt;a href="//github.com/roitpak/Blog/pull/55/files"&gt;github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="//www.rohitpakhrin.com.np/667bf45e605d249f35c5"&gt;www.rohitpakhrin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;React web app can be converted to be used as native app with help of PWA&lt;/p&gt;

&lt;p&gt;This blog website &lt;a href="//rohtpakhrin.com.np"&gt;rohtpakhrin.com.np&lt;/a&gt; was added PWA feature for native app experience.&lt;/p&gt;

&lt;p&gt;Adding PWA feature is very simple and straightforward in react web app. In contrast the steps are only adding manifest.json file and icons. &lt;/p&gt;

&lt;p&gt;All the other things will work seamlessly afther this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add manifest.json
&lt;/h2&gt;

&lt;p&gt;Add manifest.json file inside public folder with following contents.&lt;br&gt;
&lt;code&gt;{&lt;br&gt;
    "short_name": "Rohit Blog",&lt;br&gt;
    "name": "Pakhrin's Coding journey",&lt;br&gt;
    "icons": [&lt;br&gt;
      {&lt;br&gt;
        "src": "icon-192*192.png",&lt;br&gt;
        "sizes": "192x192",&lt;br&gt;
        "type": "image/png"&lt;br&gt;
      },&lt;br&gt;
      {&lt;br&gt;
        "src": "icon-512*512.png",&lt;br&gt;
        "sizes": "512x512",&lt;br&gt;
        "type": "image/png"&lt;br&gt;
      }&lt;br&gt;
    ],&lt;br&gt;
    "start_url": ".",&lt;br&gt;
    "display": "standalone",&lt;br&gt;
    "theme_color": "#000000",&lt;br&gt;
    "background_color": "#ffffff"&lt;br&gt;
  }&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Index.html changes
&lt;/h2&gt;

&lt;p&gt;Add following to the html file.&lt;br&gt;
        &lt;code&gt;&amp;lt;link rel="manifest" href="%PUBLIC_URL%/manifest.json"&amp;gt;&lt;br&gt;
        &amp;lt;meta name="theme-color" content="#000000"&amp;gt;&lt;br&gt;
        &amp;lt;link rel="apple-touch-icon" href="%PUBLIC_URL%/icon-192*192.png"&amp;gt;&lt;br&gt;
        &amp;lt;meta name="apple-mobile-web-app-capable" content="yes"&amp;gt;&lt;br&gt;
        &amp;lt;meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"&amp;gt;&lt;br&gt;
        &amp;lt;meta name="apple-mobile-web-app-title" content="Your app name"&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Icons -&amp;gt; File structure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9zmf9tljogpyoyluk7e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9zmf9tljogpyoyluk7e.png" alt="Image description" width="462" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The file structure after adding the icons and manifest.json file inside public folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development Steps are Complete
&lt;/h2&gt;

&lt;p&gt;After this you can build your app and check in your mobile browser. &lt;/p&gt;

&lt;h2&gt;
  
  
  Adding to Home Screen
&lt;/h2&gt;

&lt;p&gt;Step 1: Opening in Safari&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdy9fz2zhlieicgd0yne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdy9fz2zhlieicgd0yne.png" alt="Image description" width="800" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open your website in safari and press share button at the bottom of the screen.&lt;/p&gt;

&lt;p&gt;Step 2: Adding to Home Screen&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwgvp18qga9hohd883iq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwgvp18qga9hohd883iq.png" alt="Image description" width="800" height="555"&gt;&lt;/a&gt;&lt;br&gt;
Then press add to home screen. This will generate a app icon on your home screen&lt;/p&gt;

&lt;p&gt;Step 3: Click on app icon and use like a native app&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkqrued9mp2d2hda23juh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkqrued9mp2d2hda23juh.png" alt="Image description" width="800" height="654"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;App Icon will be available in your home screen and you can use it as a native app. App will be full screen as you have added standalone in your manifest.json file.&lt;/p&gt;

&lt;p&gt;And the best thing is notifications will also work without opening the app. (It will require separate setup methods)&lt;/p&gt;

&lt;p&gt;You can checkout here in the link what web app can do.&lt;br&gt;
&lt;a href="//whatwebcando.today"&gt;whatwebcando.today&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Optional: Keys breakdown
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;short_name&lt;br&gt;
This is the short name of your web app, which is used when there is insufficient space to display the full name (e.g., under the app icon on the home screen).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;name&lt;br&gt;
This is the full name of your web app, which is used in contexts where there is more space available (e.g., in the installation prompt).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;icons&lt;br&gt;
This array contains objects that define the icons used for your web app. Each icon object includes:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;start_url&lt;br&gt;
This is the URL that your web app will start at when launched. Using "." means the root of your app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;display&lt;br&gt;
This parameter defines the display mode of your web app. "standalone" makes your app look and feel like a native app without the browser UI (e.g., no address bar or browser navigation buttons).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;theme_color&lt;br&gt;
This is the color of the theme for your web app. It affects the color of the app's title bar in some browsers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;background_color&lt;br&gt;
This is the background color of your web app's splash screen, which is displayed while your app is loading.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>pwa</category>
      <category>react</category>
    </item>
    <item>
      <title>Removing sensitive content from GIT | BFG</title>
      <dc:creator>Rohit Pakhrin</dc:creator>
      <pubDate>Wed, 19 Jun 2024 09:35:32 +0000</pubDate>
      <link>https://forem.com/roitpak/removing-sensitive-content-from-git-bfg-5blf</link>
      <guid>https://forem.com/roitpak/removing-sensitive-content-from-git-bfg-5blf</guid>
      <description>&lt;h2&gt;
  
  
  Using BFG
&lt;/h2&gt;

&lt;p&gt;BFG is one great open source tool which is an alternative for git filter repo maintained by Roberto Tyley.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Case
&lt;/h2&gt;

&lt;p&gt;Today I am using this to clear alias key and password that I unknowingly pushed to the repo and is present in all the commits. It is present in gradle.properties inside android folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4jk2xubwu9r9gtu61y4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4jk2xubwu9r9gtu61y4.png" alt="Image description" width="349" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can download jar file from BFG website and install using java.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing with brew
&lt;/h2&gt;

&lt;p&gt;You can use: &lt;code&gt;brew install bfg&lt;/code&gt;&lt;br&gt;
command to install bfg directly from terminal&lt;/p&gt;

&lt;p&gt;I had to use arch -arm64 in my m1Mac book.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;arch -arm64 brew install bfg&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating backup
&lt;/h2&gt;

&lt;p&gt;It is recommended to create backup before performing the modification.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cp -R path/to/Project path/to/Project_backup&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create replacements.txt file
&lt;/h2&gt;

&lt;p&gt;Write the codes or passwords in this file that you want to be removed. &lt;/p&gt;

&lt;p&gt;BFG crawls your repo and removes the codes from this file.&lt;/p&gt;

&lt;p&gt;Default is changed to &lt;strong&gt;Removed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fub3v7gisw5r4xr6461im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fub3v7gisw5r4xr6461im.png" alt="Image description" width="674" height="274"&gt;&lt;/a&gt;&lt;br&gt;
source: &lt;a href="https://stackoverflow.com/a/15730571/10153866"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Run replace text command
&lt;/h2&gt;

&lt;p&gt;Now run the following command. This will change the passwords to &lt;strong&gt;&lt;em&gt;REMOVED&lt;/em&gt;&lt;/strong&gt; or custom texts and crawls all the commits and also updates them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bfg --replace-text  path/to/replacements.txt  path/to/Project&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After running above command, it will prompt following to be executed:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git reflog expire --expire=now --all &amp;amp;&amp;amp; git gc --prune=now --aggressive&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Commit protection
&lt;/h2&gt;

&lt;p&gt;I ran into commit protection where adding this --no-blob-protection&lt;br&gt;
solved it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pushing to git
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9z3edhq7nttnmb81l7am.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9z3edhq7nttnmb81l7am.png" alt="Image description" width="554" height="273"&gt;&lt;/a&gt;&lt;br&gt;
Now you can push to git using force push&lt;/p&gt;

&lt;p&gt;git push -uf&lt;/p&gt;

&lt;p&gt;You can now check in Git, if your updates are present now.&lt;/p&gt;

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