<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Darshan Modani on Medium]]></title>
        <description><![CDATA[Stories by Darshan Modani on Medium]]></description>
        <link>https://medium.com/@darshanmodani?source=rss-4bbd806a49cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_qV7RQPb-0tRwHvdz6UC5Q.jpeg</url>
            <title>Stories by Darshan Modani on Medium</title>
            <link>https://medium.com/@darshanmodani?source=rss-4bbd806a49cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:45:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@darshanmodani/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What happens when you meditate for 10 hours a day for 10 days…]]></title>
            <link>https://medium.com/@darshanmodani/what-happens-when-you-meditate-for-10-hours-a-day-for-10-days-97a23494bdc6?source=rss-4bbd806a49cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/97a23494bdc6</guid>
            <category><![CDATA[meditation]]></category>
            <category><![CDATA[vipassana]]></category>
            <dc:creator><![CDATA[Darshan Modani]]></dc:creator>
            <pubDate>Mon, 21 Aug 2017 19:23:30 GMT</pubDate>
            <atom:updated>2017-08-21T23:47:15.429Z</atom:updated>
            <content:encoded><![CDATA[<p>As crazy as it sounds like, I am not exaggerating a bit. For the first time ever, I meditated and I meditated for 10 hours in a day when all I have done in past five years is code for 10 hours a day. Okay, that may be an exaggeration. For last 10 days, I attended a meditation retreat in the outskirts of Dallas, TX in the middle of nowhere. The meditation technique which was followed is called <a href="http://www.siri.dhamma.org/about/vipassana/">Vipassana</a>, which was the meditation performed by Gautama Buddha before he got fully enlightened and was totally liberated from all the miseries of the life. Sounds extreme, doesn’t it ?</p><p>The entire retreat followed a particular learning path which is prescribed by Gautama and is been taught in its purest form. Because of the nature of meditation, the entire retreat follows a monk like living for the entire 10 days. Without knowing what I was signing up for, Day 1 started with their regular schedule of waking up at 4:00 AM and meditate. It was this time, when I found out that sitting in meditation pose is no joke. Fifteen minutes into meditation and it started giving insane amounts of incessant excruciating pains in my back and glutes. Without a fact, there were quite a few moments when the body wanted to quit and return back to normal life. With strong determination, and with few trial and errors of different hip support cushions, I was able to find what worked best for me. In the end, I realized that the pains never ceased, but my mind got conditioned to take in those pains without getting bothersome and no longer generated aversion towards them. In fact, after a while, I started expecting them, inviting them and embracing them. Yes, quite strange, but it was this time when I realized that such an environment could bring out unique powers of your mind and matter.</p><p>I should mention this fact, that as a ground rule of the retreat, a student is not allowed to speak throughout 10 days. As scary as it sounds like, it was much of a liberating experience. One may feel that it is insane not to talk for a day, but I found out couple days into the whole not-talking thing, I started to enjoy the peace I was getting throughout and it grew as the course proceeded. After all my main motive of the retreat was to purify my mind and I think not-talking played an important role in giving that peaceful experience. Finally, I can be that guy in the corner table who is unsocial and does not give an eff about what’s going on around him.</p><p>The meditation technique itself was super difficult in nature and hence required complete seclusion from your regular life. Hence, no cellphones or any kind of external communication was permitted. I could not keep up with any Trump news, could not see my stock ticker, could not delete any unwanted spam constantly filling up my inbox, could not go through much unneeded Facebook wall nor could I get my daily dose of reading medium.com. I’d be lying if I said I did not crave my cellphone, after all that is the first thing I see when I wake up and last thing I see when I go to bed. It was Day 10, when I realized that this constant craving of going through notification as soon as they pop up is so not needed and your life will be just fine without that constant notification vibration of your cellphone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*0gjyMgGKBDhpxLvBqjj5MA@2x.jpeg" /><figcaption>My meditation cell</figcaption></figure><p>The 10 hours of meditation in a day seemed intense and it was as it sounds like. After each meditation session, I found that I was getting better and better in the Vipassana technique but always wondered that where is this all gonna lead to. One thing got clearer and clearer, that we all have a pretty unstable mind. My mind would constantly wanna wander and go into past and then future, then past and juggle between the two. The mind doesn’t wanna remain thoughtless and always needs to go into fantasy mode or digging through past memories, good or bad. More and more I directed my mind to not wander, more it resisted and hence this mediation retreat seemed like a CrossFit classes for my mind. As like muscles, the mind would resist and only through proper mental exercises, one can be a master of his or her mind and not be a slave of the mind.</p><p>It got so normal to see people clad in pajamas looking at stars and thinking about their life in seclusion. Taking a walk into the woods was the only form of exercise I did throughout 10 days and hence it would make me think, think and think and make plans for future, real or unreal. In, fact articulating my experience into a medium post was something I thought during one of those walks. I often found myself talking to myself or humming to some of my favorite numbers. Having no entertainment whatsoever, I would found entertainment in silly little things. Not killing any being makes the entire place super habitable for any kinds of animals and bugs. I found the most weirdest bugs in the woods and would fear if they are gonna give me a vicious bite. Eating only lunch and skipping dinner seemed soothing for stomach for a change. Waking up at 4:00 AM everyday did not seem like a torture at all. Half of the nights, I’d lucid dreams while being in an half asleep state. My half awaken state knows that the body is dreaming yet allowing it to see some bizarre illogical dreams.</p><p>There were few days when I wanted to run away but I completed 10 days, felt super relieved to be going back home. Neither my speech got disturbed by not talking, nor did I found myself fighting with my dreams. It feel like I had undergone a serious operation of mind throughout past 10 days, made it go through intense surgery. Over and above, I feel like I lost couple of pounds from my brains, cleared out some of the junk which had accumulated over last 29 years and made my mind at least 0.01 inch sharper. Overcoming all the body pains I was going through in each and every meditation session made my determination stronger. In closing, I’d say that it was indeed an interesting experience of testing ones perseverance and dedication and I would encourage y’all to try it out. I am not quite liberated, not even close, but I took the first step. I hope to continue on the path of liberation from cravings and aversions by practicing Vipassana.</p><blockquote>May all beings find real peace, happiness and harmony</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97a23494bdc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visual Regression in NodeJS Apps]]></title>
            <link>https://medium.com/@darshanmodani/visual-regression-in-nodejs-apps-11027a886bc2?source=rss-4bbd806a49cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/11027a886bc2</guid>
            <category><![CDATA[visual-regression]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Darshan Modani]]></dc:creator>
            <pubDate>Mon, 23 May 2016 02:02:56 GMT</pubDate>
            <atom:updated>2016-05-23T02:02:56.368Z</atom:updated>
            <content:encoded><![CDATA[<p>When a pull request is submitted from one of my co-workers which has CSS style changes, I have always wondered how this CSS style changes affect the looks of the components. I have no idea whether the CSS changes actually improves the components or breaks it. Have you ever ran into a similar problem ? Other than that problem, many times there are instances where a CSS change does the intended change to the components but breaks other components in the application. Moreover, how do you track changes to your front-end components? If the story sounds like a real problem you face, then you should probably consider doing visual regression.</p><h4>What is Visual Regression Testing ?</h4><p>Visual Regression testing is a new breed of testing and have seen being popular lately. In simple words, it is diff-ing screenshots of your application/components with set of already captured screenshots (commonly known as ‘baseline’). Just like how Github shows you a snapshot of which parts of code has been removed (in Red) and which parts have been added (in Green), visual diff shows you which parts of your images (screenshots of your application) changed.</p><h4>How to do Visual Regression Testing ?</h4><p>I believe the best place to do Visual Regression is in your Continuous Integration pipeline which runs when a Pull Request is submitted. Comparing the screenshots captured during the PR CI pipeline has following benefits -</p><ul><li>PR reviewers get a visual diff of the changes made in the PR. Reviewers can then decide whether the change is expected and hence the CSS style changes did the changes it was intended for.</li><li>Unexpected visual changes can be caught before the PR is merged into main codebase.</li></ul><h4>Do I have to write my own library for that ?</h4><p>Absolutely not. There are number of libraries and tools available to do visual regression, some of which are -</p><ul><li>PhantomCSS</li><li>Wraith</li><li>blink-diff</li></ul><p>A one which I have experimented with recently is <a href="https://github.com/yahoo/blink-diff"><strong>blink-diff</strong></a><strong>. </strong>Blink-diff was developed by Yahoo and is open sourced.</p><h4>Blink-diff Setup</h4><p>Using blink-diff in NodeJS is pretty simple and straightforward.</p><pre>npm install --save blink-diff</pre><p>Create a new file, lets say ‘visualdiff.js’</p><pre><strong>var </strong>BlinkDiff = require(&#39;blink-diff&#39;);<br><strong>var </strong>path = require(&#39;path&#39;);</pre><pre><strong>var </strong>screenshots_base = &quot;test/functional/screenshots/base&quot;;<br><strong>var </strong>screenshots_current = &quot;test/functional/screenshots/current&quot;;<br><strong>var </strong>screenshots_diff = &quot;test/functional/screenshots/diff&quot;;</pre><pre><strong>var </strong>screenshots = [<br>// Specify all the screenshot filenames here.<br>// Filenames should be same in base and current folder.<br>];<br><br>screenshots.forEach(<strong>function </strong>(screenshot) {<br>    <strong>var </strong>imageAPath = path.resolve(screenshots_base, screenshot);<br>    <strong>var </strong>imageBPath = path.resolve(screenshots_current, screenshot);<br>    <strong>var </strong>imageOutputPath = path.resolve(screenshots_diff, screenshot);<br><br>    <strong>var </strong>diff = <strong>new </strong>BlinkDiff({<br>        imageAPath: imageAPath,<br>        imageBPath: imageBPath,<br>        thresholdType: BlinkDiff.THRESHOLD_PERCENT,<br>        threshold: 0.01, // 1% threshold<br>        imageOutputPath: imageOutputPath<br>    });<br>    diff.run(<strong>function </strong>(error, result) {<br>        <strong>if </strong>(error) {<br>            <strong>throw </strong>error;<br>        } <strong>else </strong>{<br>            console.log(diff.hasPassed(result.code) ? &#39;Passed&#39; : &#39;Failed&#39;);<br>            console.log(&#39;Found &#39; + result.differences + &#39; differences.&#39;);<br>        }<br>    });<br>});</pre><p>You can run the visual diff by invoking</p><pre>node visualdiff.js</pre><p>Besides the above comparison options, there are bunch of other customizations which blink-diff offers like cropping the image before comparison, customizing the output colors, setting threshold levels of what is acceptable and what is not, doing a perceptual comparison and lots more.</p><h4>What does the diff looks like ?</h4><p>Here are few samples of visual comparisons looks like with blink-diff</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*0obcG6pzy9qovbV1SDApKg.png" /></figure><p>Notice how ‘Cancel’ button has been displaced from its original position and that change is clearly visible in the comparison.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yfsz-UXE31LW9SNhXWKa1w.png" /><figcaption>Image Source : <a href="https://github.com/yahoo/blink-diff">https://github.com/yahoo/blink-diff</a></figcaption></figure><p>The background color of blocks have changed the color and that is totally visible in the diff. Also notice, the 2 signs have interchanged their positions and has been highlighted in the diff image.</p><h4>In Closing</h4><p>There are bunch of benefits of a comprehensive testing tools in your projects which include visual regression as checkpoint to certify your pull requests and track changes of your UI. Though visual regression testing is fairly new, it is steadily getting more traction. Try it out in your next project and let me know in comments how it worked out for you.</p><h4>Further Reading</h4><ul><li><a href="https://github.com/Huddle/PhantomCSS">Huddle/PhantomCSS</a></li><li><a href="https://pantheon.io/docs/guides/visual-diff-with-wraith/">Using Wraith for Visual Regression Testing</a></li><li><a href="https://css-tricks.com/visual-regression-testing-with-phantomcss/">Visual Regression Testing with PhantomCSS | CSS-Tricks</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11027a886bc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>