<?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: Shubham Pandey</title>
    <description>The latest articles on DEV Community by Shubham Pandey (@shubham9411).</description>
    <link>https://dev.to/shubham9411</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%2F54885%2Fff8fe528-cd92-4a48-afe1-fc352faf4e4e.png</url>
      <title>DEV Community: Shubham Pandey</title>
      <link>https://dev.to/shubham9411</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shubham9411"/>
    <language>en</language>
    <item>
      <title>Setup different gitconfig based on Folder with SSH Config</title>
      <dc:creator>Shubham Pandey</dc:creator>
      <pubDate>Sat, 07 Aug 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/shubham9411/setup-different-gitconfig-based-on-folder-with-ssh-config-31bn</link>
      <guid>https://dev.to/shubham9411/setup-different-gitconfig-based-on-folder-with-ssh-config-31bn</guid>
      <description>&lt;p&gt;Recently, one of my PR got merged in React Core. I was over the moon to see it merged and I took a screenshot and shared it on social media. I was quite happy thinking my name would now show up in the contributors’ section in the GitHub repository of &lt;a href="https://github.com/facebook/react/pulls?q=author%3Ashubham9411"&gt;&lt;code&gt;facebook/react&lt;/code&gt;&lt;/a&gt;. But here is the twist - it was not! &lt;/p&gt;

&lt;p&gt;Normally the name shows up in GitHub if you have even one single PR. It got me thinking why wasn't my name on that list. I had configured the SSH correctly for work and private GitHub;  then why  would this happen?&lt;/p&gt;

&lt;p&gt;I had to go back and figure out how GitHub shows the contribution chart. &lt;/p&gt;

&lt;p&gt;My findings:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;When you first install the git in your system, you have to provide two values to the local git - your name and your commit email. Then, when you commit anything in any git repository, it associates those two values with the commit. So, when I set up the git first time in the current system it was my work email. This meant all of the commits I did during the last six months were signed by my work email. And I thought I knew enough git to be dangerous!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next thing I did was to search if we can use different emails for different projects. One solution was to setup an email for every folder, which is not practical if you clone git repos every now and then. Instead, I needed a generic workflow that could help me use different emails for different folders. I had already segregated folders for work and private so that would have been a more natural solution for the way I organize git repos in my system. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I have found a solution to this problem. &lt;a href="https://github.blog/2017-05-10-git-2-13-has-been-released/"&gt;&lt;code&gt;Conditional Configuration&lt;/code&gt;&lt;/a&gt; was released to git back in 2017. For future me, I am writing this blog  listing all the configurations I need when setting up git in a new machine. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Setting up SSH
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a key from terminal
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"me@shubhampandey.in"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;eval "$(ssh-agent -s)"&lt;/code&gt; to &lt;code&gt;.zshrc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Adding Key to agent &lt;code&gt;ssh-add -K ~/.ssh/id_ed25519&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create SSH config in &lt;code&gt;~/.ssh&lt;/code&gt; folder (example)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  Host &lt;span class="k"&gt;*&lt;/span&gt;
      AddKeysToAgent &lt;span class="nb"&gt;yes
      &lt;/span&gt;UseKeychain &lt;span class="nb"&gt;yes
      &lt;/span&gt;IdentityFile ~/.ssh/personal
  Host bitbucket.org
      AddKeysToAgent &lt;span class="nb"&gt;yes
      &lt;/span&gt;UseKeychain &lt;span class="nb"&gt;yes
      &lt;/span&gt;IdentityFile ~/.ssh/workkey
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now add the keys to their respective git providers GitHub, bitbucket etc.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Setting up different git config based on Folder
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In home folder you can add &lt;code&gt;.gitconfig&lt;/code&gt; for different situations
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  user]
      name &lt;span class="o"&gt;=&lt;/span&gt; Shubham Pandey
      email &lt;span class="o"&gt;=&lt;/span&gt; shubham.pandey@example.com       &lt;span class="c"&gt;# default email if no config provided&lt;/span&gt;
      useConfigOnly &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;includeIf &lt;span class="s2"&gt;"gitdir:~/mysites/work/"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;       &lt;span class="c"&gt;# For Work folder&lt;/span&gt;
      path &lt;span class="o"&gt;=&lt;/span&gt; ~/mysites/work/.gitconfig         &lt;span class="c"&gt;# use this config file, you can define them in any folder&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;includeIf &lt;span class="s2"&gt;"gitdir:~/mysites/experiment/"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="c"&gt;# For Personal folder&lt;/span&gt;
      path &lt;span class="o"&gt;=&lt;/span&gt; ~/mysites/experiment/.gitconfig   &lt;span class="c"&gt;# use this config file&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now create those two configs in their paths. (example for personal folder)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="o"&gt;[&lt;/span&gt;user]
      email &lt;span class="o"&gt;=&lt;/span&gt; me@shubhampandey.in
      name &lt;span class="o"&gt;=&lt;/span&gt; Shubham pandey
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Now you have configured two different emails for two different folders, now I can commit in peace. Hopefully, my next PR to react comes sooner. &lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Google font and image performance</title>
      <dc:creator>Shubham Pandey</dc:creator>
      <pubDate>Sat, 03 Oct 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/shubham9411/google-font-and-image-performance-1e2j</link>
      <guid>https://dev.to/shubham9411/google-font-and-image-performance-1e2j</guid>
      <description>&lt;p&gt;I have recently revamped this blog. I was using Hugo earlier it is also a good framework for the blog but seeing all those "I'm using gatsby" tweets I also wanted to learn it and change my site too. Earlier I used a default theme available in gatsby theme store and started moving my content to it but I never succeded fully. After thinking and procrastinating on this for long finally I did it last Saturday(26 Sep).&lt;/p&gt;

&lt;p&gt;I have customised the theme used by &lt;a href="https://sophiali.dev/"&gt;Sophia Li&lt;/a&gt; which is a variant of &lt;a href="https://tania.dev/"&gt;tania.dev's&lt;/a&gt; site. My gratitude to them for creating the theme and letting it used by anyone on the internet free of cost. I have also added some new flavours to it and will customize more in future.&lt;/p&gt;

&lt;p&gt;Some changes I did today are related with some google perf issues. Last week my agenda was to push my blog to production as fast as I could, so I overlooked some aspects of performance which I am fixing this week.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problems Identified
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Large download size for a blog site&lt;/li&gt;
&lt;li&gt;Render blocking issues by fonts&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Solutions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Large Download size for a blog site
&lt;/h3&gt;

&lt;p&gt;You can google &lt;a href="https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fshubhampandey.in%2F&amp;amp;tab=mobile&amp;amp;hl=en"&gt;page insights&lt;/a&gt; or &lt;a href="https://web.dev/performance-scoring/"&gt;lighthouse&lt;/a&gt; tool to check how fast your site loads in a slow network. When I checked it for this site it gave me a score of 96 with two warnings one of which was to reduce the size of the image which is about 437 KiB while the total size of the page was 564 KiB you can see it clearly in the image below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pagespeed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c-WqZ2KB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://shubhampandey.in/google-font-and-image-perf/pagespeed-old.webp" alt="pagespeed old"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The image of mine on the landing page was 80% of the total size of all the assets. The solution was clear in my mind that was to convert the image to webP format(as was suggested by lighthouse and also by &lt;a href="https://twitter.com/search?q=%40dassurma%20webp&amp;amp;src=typed_query"&gt;Surma&lt;/a&gt; in his various videos on youtube). So now the problem and its solution were in front of me, I had to just convert png image to webP but I did not knew how much I am going to save after changing the image to webP. I was hoping for at least a 50% reduction in file size.&lt;/p&gt;

&lt;p&gt;I search on bing &lt;em&gt;Convert png to webP&lt;/em&gt;. Clicked on the first result that came. Uploaded file and got the image output and the file size of the downloaded image file was 275 KiB, which was more than 40% reduction in size. I was not that impressed but yeah now I had the same file in almost half the size, I pushed it to production. I then remembered there is also a terminal command which converts images to webP which I guess that website was also be using in the background. So I just searched and got the command. I ran the command and I was surprised by the final size of the webP image after that for the same 400+ KiB png file. The new size was 21 KiB which is 5% of the size of the original image. That was an awe moment. I had heard a lot about the improvement on images by using webP but did not knew it is that good.&lt;/p&gt;

&lt;p&gt;Anyway, If you are a web developer you must knew that compatibility between different browsers is still not that good. here the browser in question is Safari, after all these years it still doesn't have the &lt;a href="https://caniuse.com/?search=webp"&gt;webP support&lt;/a&gt; and will throw an error on webP images. I just used a hack there to use the old png image, which I reduced in size by changing the resolution. The hack I used here was to change back the &lt;code&gt;src&lt;/code&gt; of the &lt;code&gt;img&lt;/code&gt; tag back to the old image if there is an error. That way we not only can support safari but also the older IE browsers. Reference of the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;webpImage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changeImageFromWebP&lt;/span&gt; &lt;span class="o"&gt;=&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pngUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;shubham9411.png&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="nx"&gt;webpImage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pngUrl&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="nx"&gt;render&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;img&lt;/span&gt;
      &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"shubham9411.webp"&lt;/span&gt;
      &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headshot&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Photo of Shubham Pandey"&lt;/span&gt;
      &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;webpImage&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;changeImageFromWebP&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Updated sizes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pagespeed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mjrvXcBn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://shubhampandey.in/google-font-and-image-perf/pagespeed-new.webp" alt="pagespeed-new"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Render blocking issues by fonts
&lt;/h3&gt;

&lt;p&gt;This was just a straight-up issue of fonts blocking the main thread and taking time to download fonts first and then loading the content after it. Render blocking for js is easier to fix as you just have to use &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;defer&lt;/code&gt; according to the need. In the case of CSS, they are treated as &lt;a href="https://developers.google.com/web/fundamentals/performance/critical-rendering-path/render-blocking-css"&gt;render blocking resource by default&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But in my case the fonts are not that important to be loaded on the first view it can use swapping after loading at any time because there is no fancy font is being used. The hack I used here was to use the link attribute as &lt;code&gt;preload&lt;/code&gt; and on &lt;code&gt;onLoad&lt;/code&gt; change it back to &lt;code&gt;stylesheet&lt;/code&gt; see below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changePreload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&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;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
    &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;stylesheet&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;render&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;link&lt;/span&gt;
        &lt;span class="na"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"preload"&lt;/span&gt;
        &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&amp;amp;display=swap"&lt;/span&gt;
        &lt;span class="na"&gt;as&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"style"&lt;/span&gt;
        &lt;span class="na"&gt;onLoad&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;changePreload&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;noscript&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;link&lt;/span&gt;
          &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&amp;amp;display=swap"&lt;/span&gt;
          &lt;span class="na"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
          &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text/css"&lt;/span&gt;
        &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;noscript&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You need that &lt;code&gt;noscript&lt;/code&gt; tag to load normal font if javascript is not available.&lt;/p&gt;




&lt;p&gt;So yeah that was it about the performance upgrades. After pushing new code to Github I checked the new score of the site from &lt;a href="https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fshubhampandey.in%2F&amp;amp;tab=mobile&amp;amp;hl=en"&gt;pagespeed insights&lt;/a&gt;. It was 99 this time with no extra warnings and the size of the site reduced to 116.6 KiB in total. So today's learning was to use webP wherever you can and if possible to automate using webP. The other was to watch out for the render blocking issues and try to fix them as much you can.&lt;/p&gt;

</description>
      <category>react</category>
      <category>beginners</category>
      <category>performance</category>
    </item>
    <item>
      <title>Need help in Integration testing ruby</title>
      <dc:creator>Shubham Pandey</dc:creator>
      <pubDate>Wed, 01 Aug 2018 17:37:52 +0000</pubDate>
      <link>https://dev.to/shubham9411/need-help-in-integration-testing-ruby-3ek8</link>
      <guid>https://dev.to/shubham9411/need-help-in-integration-testing-ruby-3ek8</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello DEV.to community!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am a bit nervous to ask this question here. But I really need your help on this.&lt;br&gt;
I am new to ruby and test driven development. I just wanted to know how you guys do &lt;em&gt;Integration testing&lt;/em&gt; in your rails project. Integration test are too slow and sometime fails. I want to know how you guys do Integration testing in your projects and make them faster. Also how you manage to do testing for different screen sizes like mobile and tablets.&lt;/p&gt;

&lt;p&gt;I am a beginner rubyist. If you can suggest any good platform/community to ask this ques please recommend that too. 😁&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>testing</category>
      <category>rails</category>
      <category>help</category>
    </item>
    <item>
      <title>My experience on submitting First theme- Kafal to WordPress.org</title>
      <dc:creator>Shubham Pandey</dc:creator>
      <pubDate>Fri, 01 Sep 2017 02:30:26 +0000</pubDate>
      <link>https://dev.to/shubham9411/my-experience-on-submitting-first-theme--kafal-to-wordpressorg--2bce</link>
      <guid>https://dev.to/shubham9411/my-experience-on-submitting-first-theme--kafal-to-wordpressorg--2bce</guid>
      <description>&lt;p&gt;The post &lt;a href="https://shubhampandey.in/experience-submitting-first-theme-kafal-wordpress-org/" rel="noopener noreferrer"&gt;My experience on submitting First theme- Kafal to WordPress.org&lt;/a&gt; appeared first on &lt;a href="https://shubhampandey.in" rel="noopener noreferrer"&gt;Shubham Pandey' Blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In February I wrote a blog on &lt;a href="https://shubhampandey.in/open-source-and-wordpress-theme/" rel="noopener noreferrer"&gt;Open Source and WordPress theme&lt;/a&gt; and decided that I will submit a theme to &lt;a href="http://wordpress.org/" rel="noopener noreferrer"&gt;WordPress.org&lt;/a&gt;. And now I am back with another blog on my WordPress theme Kafal. It's a pleasure to inform you all the readers that my theme passed the review process and accepted in the WordPress.org repository. Theme '&lt;a href="https://wordpress.org/themes/kafal/" rel="noopener noreferrer"&gt;Kafal&lt;/a&gt;' is now live and have been downloaded 1500+ times and currently active on 200+ blogs/websites. I am that much happy about it that every day at least 5 times I check the theme details in &lt;a href="https://wordpress.org/" rel="noopener noreferrer"&gt;WP.org&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It was all started in February when I don't have much work besides my academics. At that time I was craving for the work. Then after a lot of research, I published the blog on &lt;a href="https://shubhampandey.in/open-source-and-wordpress-theme/" rel="noopener noreferrer"&gt;Open Source and making a theme&lt;/a&gt;. At that time I was already a member of WordPress slack. I think &lt;a href="https://make.wordpress.org/chat/" rel="noopener noreferrer"&gt;slack&lt;/a&gt; is the best place to start your journey. In this blog, I'm going to share my experience, what I've learned during this period.&lt;/p&gt;




&lt;h3&gt;
  
  
  Coding Improvements
&lt;/h3&gt;

&lt;p&gt;I started my HTML career with &lt;code&gt;&amp;lt;!Doctype html&amp;gt;&lt;/code&gt;, which means started with HTML5 but never understand what the &lt;a href="https://stackoverflow.com/questions/134727/whats-the-key-difference-between-html-4-and-html-5#answer-577778" rel="noopener noreferrer"&gt;difference between the HTML 4 and HTML5&lt;/a&gt;. In this theme, I've used new semantic elements from HTML5 like &lt;code&gt;header&lt;/code&gt;, &lt;code&gt;header&lt;/code&gt;, &lt;code&gt;footer&lt;/code&gt;, &lt;code&gt;article&lt;/code&gt;, &lt;code&gt;main&lt;/code&gt;, &lt;code&gt;aside&lt;/code&gt; etc.&lt;/p&gt;

&lt;p&gt;WordPress provides many &lt;a href="https://codex.wordpress.org/WordPress_APIs" rel="noopener noreferrer"&gt;APIs&lt;/a&gt; and I've used many of them. This time what was new for me is the &lt;a href="https://codex.wordpress.org/Theme_Customization_API" rel="noopener noreferrer"&gt;Theme Customization API&lt;/a&gt;. Added live preview option for custom options like 'Header Color' and 'Blog Title &amp;amp; Tagline' etc. That's a cool API for designing good UX for theme users.&lt;/p&gt;

&lt;p&gt;Previously while developing a theme I've never bothered on using escaping and sanitizing functions. If you check my first theme &lt;a href="https://github.com/shubham9411/Makes-me-wonder" rel="noopener noreferrer"&gt;'Makes me Wonder'&lt;/a&gt; that I've created in my second year, I've never used any escaping function. Or if I've used it then it must be a code that I've copied from &lt;a href="https://stackoverflow.com/" rel="noopener noreferrer"&gt;SO&lt;/a&gt; or &lt;a href="https://codex.wordpress.org/" rel="noopener noreferrer"&gt;codex&lt;/a&gt;. But now whenever a code that involves DB or User inputs, the first thing that comes to my mind is escaping and sanitization of the data. Writing a poor code with less security can lead to an XSS attack to the site.&lt;/p&gt;

&lt;p&gt;I have learnt much more things about the coding style, that I can't recall at this time but I will surely share them in future.&lt;/p&gt;

&lt;h3&gt;
  
  
  Theme Customization API and Bootswatch themes
&lt;/h3&gt;

&lt;p&gt;Created theme repository named '&lt;a href="https://github.com/shubham9411/solitude" rel="noopener noreferrer"&gt;Solitude&lt;/a&gt;' and started working on it. I wanted it to be like the best of its type. And started designing the theme. I am a great fan of &lt;a href="https://bootswatch.com/" rel="noopener noreferrer"&gt;Bootswatch&lt;/a&gt;, as they provide cool themes for the Bootstrap. I wanted to create a theme that you can change the theme variant with these &lt;a href="https://bootswatch.com/" rel="noopener noreferrer"&gt;Bootswatch&lt;/a&gt; themes. So I downloaded different Bootswatch themes and integrated them into the theme with the &lt;a href="https://codex.wordpress.org/Theme_Customization_API" rel="noopener noreferrer"&gt;Theme Customization API&lt;/a&gt;. You can change your bootstrap theme with the different variant of Bootstrap. But due to lack of design skills and other works, I stopped working on the theme 'Solitude'. This theme has more options but it lags in design and has a poor coding style. I will work in this theme maybe in future.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using _s (underscores)
&lt;/h3&gt;

&lt;p&gt;After 'Solitude' it was a leap of 2 months when I started again working on the theme. This time with more enthusiasm, more energy. But when it comes to writing the same code again just for scaffolding it's kind of a heavy task for me. So now this time what I did was, I forked '&lt;a href="https://github.com/automattic/_s" rel="noopener noreferrer"&gt;_s(underscores)&lt;/a&gt;' the starter theme created by Automattic for hacking. Created my own branch and started hacking the theme.&lt;/p&gt;

&lt;p&gt;By the way, I'll not prefer using _s if you are just starting out in WordPress and don't know the basics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using basic testing methods &amp;amp; build tools
&lt;/h3&gt;

&lt;p&gt;I wrote a blog on &lt;a href="https://shubhampandey.in/integrating-travis-ci-wordpress-theme/" rel="noopener noreferrer"&gt;Integrating Travis CI with WordPress Theme&lt;/a&gt;. Using build tools and CI(continuous Integration) is must for the projects because a single human error can be a huge problem. So we teach machines to check our code and warn us about our mistakes. I've used Travis CI to test my theme, if it is passing the WordPress coding standards or not. There are also some plugins that can test your themes with the WordPress coding standards like '&lt;a href="https://wordpress.org/plugins/theme-check/" rel="noopener noreferrer"&gt;Theme Check&lt;/a&gt;'. These tools will help is making a good theme with Coding Standards.&lt;/p&gt;

&lt;h3&gt;
  
  
  Various Open Source Licenses
&lt;/h3&gt;

&lt;p&gt;When I first submitted my theme on 19th June(&lt;a href="https://themes.trac.wordpress.org/ticket/44006" rel="noopener noreferrer"&gt;Trac ticket&lt;/a&gt;), the ticket closed 2 days after that on 21st June. That was a quick review by one of the &lt;a href="https://make.wordpress.org/themes/handbook/about/members/" rel="noopener noreferrer"&gt;theme reviewer team&lt;/a&gt; lead &lt;a href="https://profiles.wordpress.org/poena" rel="noopener noreferrer"&gt;@poena&lt;/a&gt;. The theme got rejected because of having more than 5 different errors. The first and most important error was declaring the license of the theme.&lt;/p&gt;

&lt;p&gt;I was aware that for uploading to WordPress.org the theme should have an open source license GPLv3 or compatible. But I haven't declared it. By saying theme I also mean the assets used in the theme like images, libraries etc. You can check the conversation over the &lt;a href="https://themes.trac.wordpress.org/ticket/44006" rel="noopener noreferrer"&gt;ticket&lt;/a&gt; and check all the links she provided about theme development.&lt;/p&gt;

&lt;p&gt;For learning about the licenses &lt;a href="https://choosealicense.com/" rel="noopener noreferrer"&gt;choosealicense.com&lt;/a&gt; is a good source.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Realistic Deadlines
&lt;/h3&gt;

&lt;p&gt;Without a deadline, a side project may become garbage because it will never be completed. What I learned is that setting a realistic deadline increases the productivity. Be it our assignments, project reports etc. Even we start studying just before the exams. Moving out from the comfort zone, doing the projects that you love &amp;amp; stop procrastination. I have also set a deadline for the theme and yes because of that I have a commit in git with 'Hackathon' (check the dates)  !😛&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/shubhampandey.in/wp-content/uploads/2017/09/Screenshot-from-2017-09-01-03-08-06.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi2.wp.com%2Fshubhampandey.in%2Fwp-content%2Fuploads%2F2017%2F09%2FScreenshot-from-2017-09-01-03-08-06.png%3Fresize%3D328%252C158" alt="Hackathon for Kafal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hackathon for Kafal&lt;/p&gt;

&lt;h3&gt;
  
  
  Everybody wants to help you just ask
&lt;/h3&gt;

&lt;p&gt;I am not an active member in WordPress Slack but I often open it and read the conversation happened. I always learn something new every time I open it. The volunteers always try to give you the right piece of information even if you ask silly questions.&lt;/p&gt;

&lt;p&gt;WordPress is a community that has lots of nice peoples always willing to share their knowledge. If you have any question just ask it and you will definitely get an answer. Want a demo, check the trac tickets &lt;a href="https://themes.trac.wordpress.org/ticket/44111" rel="noopener noreferrer"&gt;44111&lt;/a&gt; and &lt;a href="https://themes.trac.wordpress.org/ticket/44006" rel="noopener noreferrer"&gt;44006&lt;/a&gt;.  !😉&lt;/p&gt;

&lt;h3&gt;
  
  
  Patience
&lt;/h3&gt;

&lt;p&gt;Yes, you read it right Patience. Patience after submitting my theme for the second time, a new ticket was assigned to me. Silence for 2 months. Nothing happened until my theme got on the top of the review. It needs a lot of patience to see your theme on the review queue.&lt;/p&gt;

&lt;p&gt;On 8 August finally, &lt;a class="mentioned-user" href="https://dev.to/kafleg"&gt;@kafleg&lt;/a&gt; as a reviewer is assigned to my theme. This time it(theme) was having 3-4 small issues. So I finished working on them and updated new changes. After that, I was waiting for the reviewer's another reply on the theme. This time I the reply was this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/shubhampandey.in/wp-content/uploads/2017/09/Screenshot-from-2017-09-01-03-24-12.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi2.wp.com%2Fshubhampandey.in%2Fwp-content%2Fuploads%2F2017%2F09%2FScreenshot-from-2017-09-01-03-24-12.png%3Fresize%3D525%252C142" alt="Theme set to live"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Theme set to live&lt;/p&gt;

&lt;p&gt;That was an 'Aha' moment, I was like telling everybody that my theme got selected and check out the link and email. I am very happy to see my theme on WP.org.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rivers know this: there is no hurry. We shall get there some day.”&lt;/p&gt;

&lt;p&gt;–&lt;a href="https://www.goodreads.com/author/show/81466.A_A_Milne" rel="noopener noreferrer"&gt;A.A. Milne&lt;/a&gt;, &lt;a href="https://www.goodreads.com/work/quotes/1225592" rel="noopener noreferrer"&gt;Winnie-the-Pooh&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It sounds awesome when you think that lots of users are using your theme. The piece of code we have written is worth something. Giving back to the community, is it what is Open Source is all about?&lt;/p&gt;




&lt;p&gt;Now the happiness is, seeing the badge of Theme Developer in &lt;a href="https://profiles.wordpress.org/shubham9411/" rel="noopener noreferrer"&gt;My Profile&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/shubhampandey.in/wp-content/uploads/2017/09/Screenshot-from-2017-09-01-03-37-58.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi1.wp.com%2Fshubhampandey.in%2Fwp-content%2Fuploads%2F2017%2F09%2FScreenshot-from-2017-09-01-03-37-58.png%3Fresize%3D525%252C213" alt="Profile Shubham Pandey WordPress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Profile Shubham Pandey WordPress&lt;/p&gt;

&lt;p&gt;Have any views about this, please let me know in the comment section.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>wordpress</category>
      <category>bestpractices</category>
      <category>beginners</category>
    </item>
    <item>
      <title>First, solve problem Then, write code</title>
      <dc:creator>Shubham Pandey</dc:creator>
      <pubDate>Tue, 28 Jun 2016 14:17:33 +0000</pubDate>
      <link>https://dev.to/shubham9411/first-solve-problem-then-write-code-4g6l</link>
      <guid>https://dev.to/shubham9411/first-solve-problem-then-write-code-4g6l</guid>
      <description>&lt;p&gt;At starting of my developing journey when I used to code the HTML and CSS and create some static pages that look awesome (if you don’t compare them with other online websites). I used to experiment on the divisions and the architecture first without applying any style on it so that I just simply add the classes and id’s to it, it is like creating a frame that is just without any style just a normal frame.&lt;/p&gt;

&lt;p&gt;So that I can create as many designs from it by just changing or adding the color in the class that I assigned to it. So that I can change the pages by only changing the CSS file. In the Tech Fest of my college “Kaivalya” I worked on my very first project for web. &lt;a href="https://docs.google.com/document/d/1WufLJYEcUvykcZYU-B35HZgOykA-tC8uoecW5ZEiOJU/edit?usp=sharing"&gt;The task&lt;/a&gt; is just to make a front end for the website for the college Computer Science Club after making the front end you have to make a backend for it.&lt;/p&gt;

&lt;p&gt;When I first see that task I was thinking about how I start building the website. So i just searched many of the websites and choose a website that is very simple in design. At that time I did not know any software principles and the designing aspects. I see the websites and if I like a feature so I added it to my website.&lt;/p&gt;

&lt;p&gt;Without proper planning and design I created that website because it is a small project and if there any problem occur I can recreate it from scratch also, but what if I am going to work on bigger project and use this type of approach that I used to create my website then what’s gonna happen. Then the website is not manageable one of the example that when I am working on the WordPress theme creation for the first time I faced the problem in the sidebar that every time I change a bit CSS of main content the sidebar get exploded.&lt;/p&gt;

&lt;p&gt;It is because I did not settled the width of the divisions of main and sidebar content but then I first created a diagram for that and defined that how much part of the screen it is going to be covered by the different containers. The theme has many other flaws but it is just the starting of my WordPress Journey.&lt;/p&gt;

&lt;p&gt;Design is the creation of the plan, the solution to the problem, that it be like how one will see the problem in his aspect, everyone have a different solution. We just have to think in every direction. I am reading a book named &lt;a href="http://www.amazon.in/Code-Complete-Steve-Mcconnell/dp/9350041243"&gt;Code Complete&lt;/a&gt; and in it an example is given with a topic “Design Is a Wicked Problem” it is about design of a Bridge named “&lt;a href="https://en.wikipedia.org/wiki/Tacoma_Narrows_Bridge_(1940)"&gt;Tacoma Narrows bridge&lt;/a&gt;“.&lt;/p&gt;

&lt;p&gt;At that time when the Bridge was built the main focus of engineers is to give it a strength that it is strong enough to support the load. But due to the &lt;a href="https://en.wikipedia.org/wiki/Aeroelasticity#Flutter"&gt;Aeroelastic Flutter&lt;/a&gt; of the wind and the bridge is not ready to handle the air of speed 68km/h so it get collapsed. A nearby photographer recorded a footage of it when this happened. This footage is still shown to engineering, architecture, and physics students as a cautionary tale.&lt;/p&gt;

&lt;p&gt;But what is the moral of the story. In my opinion the moral is about the seeing the problem in every direction and generate your own test cases as if they were aware of the Aerodynamics thing they will make a design that the bridge can withstand in the high-speed of air also. And it be like Trial and error method that they created a bridge and it get collapsed only in 4 months of creation so that they find out about the aerodynamics of the bridge and created a new design for the next bridges so that it will never happen in future.&lt;/p&gt;

&lt;p&gt;We have to learn from our previous errors and have to try new things. Cause design is not an algorithmic process it is heuristic in nature. One of the problem like this occurred with us that we three &lt;a href="https://www.linkedin.com/in/nitinkshatriya"&gt;Nitin&lt;/a&gt;, &lt;a href="https://www.linkedin.com/in/dhirajkathayat"&gt;Dhiraj&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/shubham9411"&gt;Me&lt;/a&gt; are working on a plugin for Hiring System for ColoredCow. The problem is that when we are said to create the plugin that displays the Vacancies available we think about in a way that it will be like a widget for the site that will show the vacancies in a carousel way.&lt;/p&gt;

&lt;p&gt;So we created a widget but then after delivery we find out that what they want is other than this Widget thing they just wants a shortcode method that wherever they want to put that carousel they just have to add the shortcode. This is not a big deal but it will be like an example of not seeing the problem in different way or may be not seeing in the clients way of using the Software. Now we added that feature too.&lt;/p&gt;

&lt;p&gt;For our college group for Web Development we created a task that is just to check the designing skills of the students. It is more like an experiment that how they react on the task and derive their answers.&lt;/p&gt;

&lt;p&gt;The task is to create a website for a firm with a basic functionalities eg. Home page, About Page etc.. Everyone come up with different designs and some of them added the exact pages that we mentioned some used their creativity and added other features and pages to the website. It relates me to the topic of Managing complexity in the “Code Complete” that the webpages we mentioned are the basic requirement and are essential for a website. But the other accidental features are also demanded by any firm that he does not mention like in above example client may be think that we add the event and notice bar our self or anything.&lt;/p&gt;

&lt;p&gt;It is depends on person to person how they design and the time factor or may be other factors also. First Solving the problem then starting the design phase will help more in coding phase then directly starting the code without the plan or Design. As the John Johnson said&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;First, solve the problem. Then, write the code.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

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