<?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: Ashish Mehra</title>
    <description>The latest articles on Forem by Ashish Mehra (@mehraas).</description>
    <link>https://forem.com/mehraas</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%2F67417%2Fcfe43776-c6dc-4b14-b516-0141064d7bba.jpeg</url>
      <title>Forem: Ashish Mehra</title>
      <link>https://forem.com/mehraas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mehraas"/>
    <language>en</language>
    <item>
      <title>Image upload via buffer</title>
      <dc:creator>Ashish Mehra</dc:creator>
      <pubDate>Thu, 29 Nov 2018 12:27:11 +0000</pubDate>
      <link>https://forem.com/mehraas/image-upload-via-buffer-11n0</link>
      <guid>https://forem.com/mehraas/image-upload-via-buffer-11n0</guid>
      <description>&lt;p&gt;I'm using buffer in Node.js for image upload in cloudinary but cloudinary doesn't have any option for image transformation for buffer upload.&lt;/p&gt;

&lt;p&gt;Is there is any package which have the ability to resize image by reading buffer and return buffer back after resizing it.&lt;/p&gt;

</description>
      <category>help</category>
      <category>node</category>
    </item>
    <item>
      <title>IOS &amp; Android API Oauth implementation in Node.js</title>
      <dc:creator>Ashish Mehra</dc:creator>
      <pubDate>Thu, 29 Nov 2018 05:42:46 +0000</pubDate>
      <link>https://forem.com/mehraas/ios--android-api-oauth-implementation-in-nodejs-157m</link>
      <guid>https://forem.com/mehraas/ios--android-api-oauth-implementation-in-nodejs-157m</guid>
      <description>&lt;p&gt;I'm new in mobile API's development &amp;amp; I have to integrate fb oauth in my API for both ios and android.Is this is correct way to implement fb oauth in API ? &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XopRY-md--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/sudhx5x7yev8wtpe9kj7.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XopRY-md--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/sudhx5x7yev8wtpe9kj7.PNG" alt="API Snippet" width="694" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>javascript</category>
      <category>node</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Destination Charges in stripe </title>
      <dc:creator>Ashish Mehra</dc:creator>
      <pubDate>Wed, 24 Oct 2018 07:54:37 +0000</pubDate>
      <link>https://forem.com/mehraas/destination-charges-in-stripe--2lln</link>
      <guid>https://forem.com/mehraas/destination-charges-in-stripe--2lln</guid>
      <description>

&lt;p&gt;Here is the link of stripe documentation for creating destination charges&lt;br&gt;
&lt;a href="https://stripe.com/docs/connect/destination-charges"&gt;https://stripe.com/docs/connect/destination-charges&lt;/a&gt; &lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Set your secret key: remember to change this to your live secret key in production&lt;/span&gt;
&lt;span class="c1"&gt;// See your keys here: https://dashboard.stripe.com/account/apikeys&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;stripe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"stripe"&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="s2"&gt;"sk_test_############"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;stripe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;charges&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"usd"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tok_visa"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;account&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{CONNECTED_STRIPE_ACCOUNT_ID}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;charge&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// asynchronously called&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

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



&lt;p&gt;What CONNECTED_STRIPE_ACCOUNT_ID is ? and how I suppose to retreive it ?&lt;/p&gt;


</description>
      <category>help</category>
      <category>stripe</category>
      <category>node</category>
    </item>
    <item>
      <title>[Entry] Photo Fight Application</title>
      <dc:creator>Ashish Mehra</dc:creator>
      <pubDate>Sat, 12 May 2018 11:22:16 +0000</pubDate>
      <link>https://forem.com/mehraas/photo-fight-application-5f7i</link>
      <guid>https://forem.com/mehraas/photo-fight-application-5f7i</guid>
      <description>

&lt;h1&gt;
  
  
  What I built
&lt;/h1&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/yxcz9pRJEmY"&gt; &lt;/iframe&gt;&lt;/p&gt;

&lt;p&gt;This is a simple live photo polling application which updates the chart in real time and also the count of votes in homepage. This application has admin panel which allows admin to start and stop the competition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Admin Login :&lt;/strong&gt; &lt;br&gt;
email : &lt;a href="mailto:admin@admin.com"&gt;admin@admin.com&lt;/a&gt;&lt;br&gt;
password : 123456789&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;PUSHER CHANNELS:&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;I'm using 3 channels in my application :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Home Channel for updating the homepage vote counts.&lt;/p&gt;

&lt;p&gt;Admin Channel for updating the poll chart of the admin page.&lt;/p&gt;

&lt;p&gt;User Channel for informing the owner of a photo when the competition starts or ends.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Demo Link
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://photo-fight-app.herokuapp.com/"&gt;https://photo-fight-app.herokuapp.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/mashish584/photo-fight-app"&gt;https://github.com/mashish584/photo-fight-app&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  How I built it
&lt;/h1&gt;

&lt;p&gt;I used : &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Express JS for creating the backend of this application.&lt;/em&gt;&lt;br&gt;
 &lt;em&gt;mLab for for hosting Mongo Database.&lt;/em&gt;&lt;br&gt;
 &lt;em&gt;Cloudinary for hosting image files.&lt;/em&gt;&lt;br&gt;
 &lt;em&gt;Pusher API for notifications and live updates.&lt;/em&gt;&lt;br&gt;
 &lt;em&gt;Heroku for app deployment.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Additional Resources/Info
&lt;/h1&gt;

&lt;p&gt;I learned Pusher, Woaah.&lt;/p&gt;

&lt;p&gt;Special thanks to Dev.to team for this contest, Zan Markan for clearing my doubts and Traversy Media for short and simple pusher tutorial intro series. &lt;/p&gt;


</description>
      <category>pushercontest</category>
      <category>express</category>
      <category>photopolling</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Is this is the right way to notify the particular user with PUSHER?</title>
      <dc:creator>Ashish Mehra</dc:creator>
      <pubDate>Fri, 04 May 2018 01:44:07 +0000</pubDate>
      <link>https://forem.com/mehraas/is-this-is-the-right-way-to-send-notify-the-particular-user-with-pusher-6be</link>
      <guid>https://forem.com/mehraas/is-this-is-the-right-way-to-send-notify-the-particular-user-with-pusher-6be</guid>
      <description>&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/19366545/using-pusher-api-notify-particular-user"&gt;https://stackoverflow.com/questions/19366545/using-pusher-api-notify-particular-user&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>CSS 3D cube </title>
      <dc:creator>Ashish Mehra</dc:creator>
      <pubDate>Thu, 19 Apr 2018 16:28:24 +0000</pubDate>
      <link>https://forem.com/mehraas/css-3d-cube--4lmh</link>
      <guid>https://forem.com/mehraas/css-3d-cube--4lmh</guid>
      <description>&lt;p&gt;In this short tutorial, I will show you how easy it is to create a 3d cube with CSS.&lt;/p&gt;

&lt;h3&gt;HTML&lt;/h3&gt;

&lt;p&gt;Here In HTML file, we have a parent div which have an id of a &lt;strong&gt;wrapper&lt;/strong&gt; and a child div with a class of &lt;strong&gt;cube&lt;/strong&gt;. And At last, we have six child div which represent 6 phases of a cube.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"wrapper"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"cube"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!--Front--&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!--Back--&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!--Left--&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!--Right--&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!--Top--&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!--Bottom--&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;CSS&lt;/h3&gt;

&lt;p&gt;In CSS, first of all, we set a style for our parent div by targeting it's id &lt;strong&gt;#wrapper&lt;/strong&gt; and style for our child div by targeting it's class &lt;strong&gt;.cube&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For wrapper, we set its width and height equal to 300px and margin to 100px auto to place the div in the center of the page and 100px off from the top. &lt;/p&gt;

&lt;p&gt;For a cube, we set it's position to relative and width and height equal to 150px. And we also apply some degree of rotation on both X and Y axis to make it look like as a 3D object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nf"&gt;#wrapper&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;300px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;300px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;perspective&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;700px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-perspective&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;700px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;100px&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.cube&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;150px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;150px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform-style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;preserve-3d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;rotateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;35deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;rotatex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-38deg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In above two styles, we have 2 new properties which allow us to create a 3D space in a browser.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Perspective create 3d space in our browser.Lower the value higher the 3d depth will be.&lt;/p&gt;

&lt;p&gt;We're using transform-style which is common property but we set its value to &lt;strong&gt;preserve-3d&lt;/strong&gt; which will set all the children of &lt;strong&gt;.cube&lt;/strong&gt; in 3d space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here comes the final part of 3D cube we're making.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.cube&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;150px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;150px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Here, first of all, we're targeting all the child div's and setting the position of all those div's to absolute and after that we're setting the height and width of a div as 100% which is equal to &lt;strong&gt;(150px * 150px)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Placing the child div on Z'axis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Right now we have all those child div's over each other in same Z-axis.The best part of 3d space is that it allows us to place an item on differnt Z-axis.&lt;/p&gt;

&lt;p&gt;This is how Z'axis looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcodropspz-tympanus.netdna-ssl.com%2Fcodrops%2Fwp-content%2Fuploads%2F2014%2F10%2Faxes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcodropspz-tympanus.netdna-ssl.com%2Fcodrops%2Fwp-content%2Fuploads%2F2014%2F10%2Faxes.png" alt="3D Space Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's do some CSS work for setting the position of each child to make a cube.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.cube&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;1&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;translateZ&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;75px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#237A57&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.cube&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;180deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translateZ&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;75px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#005AA7&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.cube&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-90deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translateZ&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;75px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#DA4453&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.cube&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;4&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;rotateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;90deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translateZ&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;75px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#a8c0ff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.cube&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;5&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;90deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translateZ&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;75px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#fc4a1a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.cube&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;6&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;rotateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-90deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translateZ&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;75px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#f7b733&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Here we're targeting each child div with pseudo selector called &lt;strong&gt;nth-child&lt;/strong&gt; and passing the position of div we want to style.&lt;/p&gt;

&lt;p&gt;We just set the &lt;strong&gt;Z-axis&lt;/strong&gt; of all the div to &lt;strong&gt;75px&lt;/strong&gt; which is the half of width of our cube i.e. &lt;strong&gt;150/2 = 75px&lt;/strong&gt;. And after setting up Z-axis for all child elements we're also placing each div using &lt;strong&gt;rotateX&lt;/strong&gt; and &lt;strong&gt;rotateY&lt;/strong&gt; in correct position on Z-axis to form a cube.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftjbd9ekqn4qaxyxcnyyq.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftjbd9ekqn4qaxyxcnyyq.JPG" alt="Cube without Z-Axis"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you don't give a Z-axis value to the child div's than all those div's will rotate on same Z-axis(0 by default) which will create an image shown above.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h6&gt;MY PEN : &lt;/h6&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/mehra_as/embed/KRKPBq?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Avoid boolean values comparison with "==" in JavaScript</title>
      <dc:creator>Ashish Mehra</dc:creator>
      <pubDate>Sat, 14 Apr 2018 03:22:51 +0000</pubDate>
      <link>https://forem.com/mehraas/avoid-boolean-values-comparison-with--in-javascript-1lok</link>
      <guid>https://forem.com/mehraas/avoid-boolean-values-comparison-with--in-javascript-1lok</guid>
      <description>

&lt;p&gt;All of us use "==" daily for performing the comparison in JavaScript to execute particular code block only when certain condition meets.&lt;/p&gt;

&lt;p&gt;But do you know how "==" actually works in JavaScript?&lt;/p&gt;

&lt;p&gt;In JavaScript "==" compare number values instead of boolean values by performing implicit coercion.&lt;/p&gt;

&lt;p&gt;Here is a simple example : &lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

 &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"10"&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
     &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Woo! Condition is true."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;

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


&lt;p&gt;&lt;em&gt;In above block of code we're comparing string value of &lt;b&gt;"10"&lt;/b&gt; with a integer value of const variable &lt;b&gt;a&lt;/b&gt; which is 10.&lt;br&gt;So here, JavaScript will first perform implicit coercion on non-number type value i.e. &lt;b&gt;"10"&lt;/b&gt; and will convert it into a number and then perform comparsion.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;Why you should avoid comparison of boolean values with "=="?&lt;/h4&gt;

&lt;p&gt;We are now aware of the fact that &lt;b&gt;"=="&lt;/b&gt; compare integer value type not boolean type.So comparing boolean values with &lt;b&gt;"=="&lt;/b&gt; will not give desired result to you every time.&lt;/p&gt;

&lt;h4&gt;Examples of Wrong Implementation for value check :&lt;/h4&gt; 
 

&lt;p&gt;&lt;em&gt;Example 1&lt;/em&gt;&lt;/p&gt;


&lt;div class="runkit-element"&gt;
  &lt;code&gt;&lt;/code&gt;
  &lt;code&gt;const a = 10;

if(a == true){
    console.log("Condition is true.");
}else{
    console.log("Condition is false.");
}

&lt;/code&gt;
&lt;/div&gt;



&lt;p&gt;&lt;i&gt;Number equivalent of &lt;b&gt;true&lt;/b&gt; is 1.&lt;br&gt; &lt;strong&gt;False&lt;/strong&gt; : 10 is not equal to 1.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example 2&lt;/em&gt;&lt;/p&gt;


&lt;div class="runkit-element"&gt;
  &lt;code&gt;&lt;/code&gt;
  &lt;code&gt;const a = "1";

if(a == true){
    console.log("Condition is true.");
}else{
    console.log("Condition is false.");
}

&lt;/code&gt;
&lt;/div&gt;
 

&lt;p&gt;&lt;i&gt;Number equivalent of &lt;b&gt;true&lt;/b&gt; is 1 and &lt;b&gt;a&lt;/b&gt; is 1.&lt;br&gt;&lt;strong&gt;True&lt;/strong&gt; : 1 is equal to 1.&lt;/i&gt;&lt;/p&gt;

&lt;h4&gt;Examples of Correct Implementation for value check :&lt;/h4&gt; 
 

&lt;p&gt;&lt;em&gt;Example 1&lt;/em&gt;&lt;/p&gt;


&lt;div class="runkit-element"&gt;
  &lt;code&gt;&lt;/code&gt;
  &lt;code&gt;const a = 10;

if(a){
    console.log("Condition is true.");
}else{
    console.log("Condition is false.");
}

&lt;/code&gt;
&lt;/div&gt;
 

&lt;p&gt;&lt;i&gt;&lt;strong&gt;True&lt;/strong&gt; : Because the boolean equivalent of &lt;strong&gt;a&lt;/strong&gt; is true.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example 2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;


&lt;div class="runkit-element"&gt;
  &lt;code&gt;&lt;/code&gt;
  &lt;code&gt;const a = "1";

if(a){
    console.log("Condition is true.");
}else{
    console.log("Condition is false.");
}

&lt;/code&gt;
&lt;/div&gt;
 

&lt;p&gt;&lt;i&gt;&lt;strong&gt;True&lt;/strong&gt; : Because the boolean equivalent of &lt;strong&gt;a&lt;/strong&gt; is true.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example 3&lt;/em&gt;&lt;/p&gt;


&lt;div class="runkit-element"&gt;
  &lt;code&gt;&lt;/code&gt;
  &lt;code&gt;const a = "";

if(a){
    console.log("Condition is true.");
}else{
    console.log("Condition is false.");
}

&lt;/code&gt;
&lt;/div&gt;
 

&lt;p&gt;&lt;i&gt;&lt;strong&gt;False&lt;/strong&gt; : Because the boolean equivalent of &lt;strong&gt;a&lt;/strong&gt; is false.&lt;/i&gt;&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Try to avoid using boolean values comparison with "==". It will work for you in many cases but it is not a right way to perform a condition check. &lt;/p&gt;


</description>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
