<?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: Abhishek Singh</title>
    <description>The latest articles on DEV Community by Abhishek Singh (@abhishekcode).</description>
    <link>https://dev.to/abhishekcode</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%2F1029%2F2hxvfwrG.jpg</url>
      <title>DEV Community: Abhishek Singh</title>
      <link>https://dev.to/abhishekcode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhishekcode"/>
    <language>en</language>
    <item>
      <title>Github gist + Github pages</title>
      <dc:creator>Abhishek Singh</dc:creator>
      <pubDate>Sat, 02 Nov 2019 11:00:12 +0000</pubDate>
      <link>https://dev.to/abhishekcode/github-gist-github-pages-3lf8</link>
      <guid>https://dev.to/abhishekcode/github-gist-github-pages-3lf8</guid>
      <description>&lt;p&gt;I host my personal website on Github pages, Every time whenever I wanted to update website I had to update code, because data was part of repo. &lt;/p&gt;

&lt;p&gt;Recently I learned that we can access gist by api, So now I am hosting my data on gists and loading it dynamically with API call. Which is pretty cool.&lt;/p&gt;

&lt;p&gt;Without Database and backend now I can update website anytime without actually updating code.&lt;/p&gt;

&lt;p&gt;Here is sample code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let url ="https://api.github.com/gists/9052ef9a070e0d5ab046fa3464d026c4";
fetch(url).then(response =&amp;gt; {
   response.json().then(data =&amp;gt; {
     let profileData =JSON.parse(data.files["personalData.json"].content)
   })
 })
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;




&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--SnsoWloL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1037739956637036544/G3dyf3Bc_normal.jpg" alt="Abhishek Singh profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Abhishek Singh
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @abvishek
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      Github Gist + Github pages = Awesome&lt;br&gt;&lt;br&gt;&lt;a href="https://t.co/Y0tMrH53my"&gt;github.com/AbhishekCode/A…&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      10:22 AM - 02 Nov 2019
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1190574901217726465" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1190574901217726465" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      0
      &lt;a href="https://twitter.com/intent/like?tweet_id=1190574901217726465" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      0
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


</description>
      <category>github</category>
    </item>
    <item>
      <title>Publish react app on Facebook Instant Game </title>
      <dc:creator>Abhishek Singh</dc:creator>
      <pubDate>Wed, 22 Aug 2018 18:00:56 +0000</pubDate>
      <link>https://dev.to/abhishekcode/publish-react-appcreate-react-app-on-facebook-instant-game--6j4</link>
      <guid>https://dev.to/abhishekcode/publish-react-appcreate-react-app-on-facebook-instant-game--6j4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;: &lt;/p&gt;

&lt;p&gt;I'm frontend developer and I use ReactJS at my day job but before all this I was a game developer, I still love making games, specially small html5 games which I can make quickly. For this instead of using a game engine I generally prefer create-react-app, It is good for making small game. &lt;/p&gt;

&lt;p&gt;So I made &lt;a href="https://abhishekcode.github.io/word-tetris/"&gt;this game&lt;/a&gt;. I wanted to share it on facebook and while searching I came across facebook instant game feature, where you can publish html5 games and users can play it directly from messenger and facebook. So I decided to publish it there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Facebook instant game setup and issues with CRA build&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Setup is very straightforward, As per &lt;a href="https://developers.facebook.com/docs/games/instant-games/getting-started/quickstart"&gt;official documentation&lt;/a&gt; just include to SDK and initialise the script and start loading game.&lt;/p&gt;

&lt;p&gt;But by default create-react-app  generates one index.html and minified JS file. where JS file is directly called, so by default this doesn't work on Instant Game.&lt;/p&gt;

&lt;p&gt;In instant game we have to first initialise sdk then only we can load our app's javascript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So I played around build files generated by create-react-app, and did following changes in index.html file to make it work on Instant game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Remove script tag which loads minified JS file.&lt;/strong&gt; &lt;br&gt;
Generally it is at end of index.html. Mine looked like this&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type="text/javascript" src="/static/js/main.34f1754e.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;PS:&lt;/strong&gt; &lt;code&gt;main.34f1754e.js&lt;/code&gt; this was name of generated file, it will be different every time new build is generated.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Include Instant Game SDK in head&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="js/mock/fbinstant.6.0.mock.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;3) Initialise and start loading minified JS.&lt;/strong&gt;&lt;br&gt;
Here is how i did it, when i get success callback for initialisation I start loading minified JS bundle generated by create react app.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;script&amp;gt;
    window.onload = function () {
        FBInstant.initializeAsync().then(function () {
            function loadScript() {
                return new Promise(function (resolve, reject) {
                    var s;
                    s = document.createElement('script');
                    s.src = "static/js/main.34f1754e.js";
                    s.onload = resolve;
                    s.onerror = reject;
                    document.head.appendChild(s);
                });
            }
            loadScript().then(res =&amp;gt; console.log(res)).catch(err =&amp;gt; console.log(err));
        }).catch(err =&amp;gt; {
            console.log(err)
        });
    };

&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So this way we can publish ReactJS app created by CRA to facebook's instant game. If you are interested in Game development and find learning Game engines hard(I actually find phaser/Cocos really really hard) please start with CRA or just plain JS is also good. Good thing about CRA is you can directly start using ES6-:).   Unless you are going  to make graphics heavy game You don't really need a game engine&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I didn't publish my game to FB Instant Game, because later i figured out in order to actually publish you need to provide apple id and I didn't had that (:-&lt;br&gt;
I think facebook should allow instant game on android and Web without apple Id, iOS I can understand, But anyways it was fun doing all this.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Thank you for reading this. Let me know your thoughts in comment sections.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>showdev</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Hi, I'm Abhishek Singh</title>
      <dc:creator>Abhishek Singh</dc:creator>
      <pubDate>Mon, 02 Jan 2017 08:34:41 +0000</pubDate>
      <link>https://dev.to/abhishekcode/hi-im-abhishek-singh</link>
      <guid>https://dev.to/abhishekcode/hi-im-abhishek-singh</guid>
      <description>&lt;p&gt;I have been coding for 4 years.&lt;/p&gt;

&lt;p&gt;You can find me on Twitter as &lt;a href="https://twitter.com/Abvishek" rel="noopener noreferrer"&gt;@Abvishek&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I live in Mumbai.&lt;/p&gt;

&lt;p&gt;I work for Tekhne.&lt;/p&gt;

&lt;p&gt;I mostly program in these languages: JavaScript.&lt;/p&gt;

&lt;p&gt;I am currently learning more about ReactJS and NodeJs.&lt;/p&gt;

&lt;p&gt;Nice to meet you.&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
