<?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 Ana Makarochkina on Medium]]></title>
        <description><![CDATA[Stories by Ana Makarochkina on Medium]]></description>
        <link>https://medium.com/@korshunad?source=rss-4b6535d4dd04------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*DF06g_1BJu34wmj3.jpg</url>
            <title>Stories by Ana Makarochkina on Medium</title>
            <link>https://medium.com/@korshunad?source=rss-4b6535d4dd04------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:12:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@korshunad/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[Genuine Novice Intro to Generators]]></title>
            <link>https://medium.com/@korshunad/genuine-novice-intro-to-generators-5bbaf22bb5c3?source=rss-4b6535d4dd04------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bbaf22bb5c3</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[generator]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Ana Makarochkina]]></dc:creator>
            <pubDate>Sat, 18 Feb 2017 14:34:20 GMT</pubDate>
            <atom:updated>2017-02-18T14:52:50.781Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aAEbhdjUFlr9MIhlDGEUg.png" /><figcaption>This is Mongolia steppe. As flat as your future async code.</figcaption></figure><p>Suppose you have this small app, like magic 8 ball. It is your pet project, Freecodecamp zip line or whatever else. You already avoided the greatest horrors of <a href="http://callbackhell.com/">callback hell</a>, and fetching Promises, catching errors, chaining then’s takes no effort.</p><p>But you know, it’s 2017 already, async is all the rage, new standard es2017 already came out, and you still investigating es2015. So here’s one of the es2015 features of interest here — how to use generators in such apps?</p><p>Generators already have had reputation of something too complex to understand and it’s been explained quite comprehensively as well. The main point is that generators can stop themselves and then resume from the place they were stopped.</p><h4>How can it be used?</h4><ul><li>code like this var i = 0; while(true) do i++; always got you thrilled? Finally you have an option to use it in a generator without crashing your browser. Little hint ahead: that’s possible because — once again — generator stops itself at each next() step.</li><li>you successfully shifted to Promises on your way out the callback hell? wow, that’s symbolic</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*aDLj9cc-2tIvQvuGxb4l7w.jpeg" /><figcaption>Orpheus tried to get Eurydice from hell, but broke the promise, so you’re more lucky!</figcaption></figure><p>… now you can flatten the code and make asynchronous look like synchronous even more!</p><p>I am going to show you examples of going asynchronous using generators in three variations on a quite basic app — magic 8-ball, which you ask the question, shake, and wait for an answer.</p><p>Short recap: JavaScript is a single-threaded language, meaning that all code runs line after line. However, when you make the request to some external source, you wouldn’t really like stop all your program from running. For instance, in my 8-ball app I would like the 8-ball to continue shaking (because its fun) and to prepare for showing the “answer” even after the request for the quotes is made.</p><h4>What is a generator?</h4><p>(I did not understand it from the first reading of one article… or another… so just relax if it is not all clear at once)</p><p>Generator is a function, which looks like this</p><pre>function *justAgenerator() { yield &#39;grapes&#39; }</pre><p>or</p><pre>function* justAgenerator() { yield &#39;grapes&#39; } </pre><p>The asterisk near the function or function name denotes not only that it is a generator function, which returns iterable Generator object, but also the exclusivity of yield keyword usage. (More on iterables you can read <a href="https://ponyfoo.com/articles/es6-iterators-in-depth">here</a>, basically an iterable is an object whose prototype has <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Iterators_and_Generators">built-in iteration method</a> — Array, String, TypedArray, Set, Map)</p><p>You store Generator object in a variable:</p><pre>var gen = justAgenerator()</pre><p>and iterate with next(), which will get you an object with properties done and value, done shows whether there are more yields to iterate and can be true or false, and value can be any value.</p><pre>console.log(gen.next())<br>// -&gt; { done: false, value: &#39;grapes&#39; }</pre><p>return with return()</p><pre>console.log(gen.return(&#39;and tomatoes&#39;))<br>// -&gt; { done: true, value: &#39;and tomatoes&#39; }</pre><pre>or instead</pre><pre>console.log(gen.return())<br>// -&gt; { done: true, value: undefined }</pre><p>throw errors with throw()</p><pre>function* justAgenerator() {<br>  while(true) {<br>    try {<br>       yield &#39;harmony&#39;;<br>    } catch(e) {<br>      console.log(&#39;oh why did you do that mistake! we all doomed&#39;);<br>    }<br>  }<br>}<br><br>var gen = justAgenerator();</pre><pre>console.log(gen.next());<br>// -&gt; { value: &#39;harmony&#39;, done: false }</pre><pre>gen.throw(new Error(&#39;Something went wrong&#39;));<br>// -&gt; &#39;oh why did you do that mistake! we all doomed&#39;</pre><pre>console.log(gen.next());<br>// -&gt; { value: &#39;harmony&#39;, done: false }</pre><p>You could also go through Generator values with come custom function or with for... of loop, which runs generator to completion, but ignores the return statement (or some more methods listed <a href="http://exploringjs.com/es6/ch_generators.html#_ways-of-iterating-over-a-generator">here</a>).</p><p>Also note yield* keyword, which is used to give out each value one by one of another generator or iterable object.</p><pre>function* gen(x) {<br>   console.log(76)<br>  yield* x<br>  console.log(96)<br>  return 5<br>}</pre><pre>var it = gen(&#39;hi&#39;);</pre><pre>let arr=[]</pre><pre>//for...of loop to iterate and store yielded values in an array<br>// or console.log([...it]) would output the same</pre><pre>for (x of it) {<br>  arr.push(x)<br>}<br>//76<br>//96<br>//[&quot;h&quot;,&quot;i&quot;]</pre><p>Brace yourselves! More complexity is coming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*oacnyM36sc3JPo2SIqDkpQ.jpeg" /></figure><p>Yield may take value in along as give a value out. Let’s take a look at generator example first:</p><pre>function* generator(x) {</pre><pre>var y = yield x;<br>var z = yield y;<br>var w = yield z;<br>return w;</pre><pre>}</pre><p>Suppose you feed it some values:</p><pre>var gen = generator(1);</pre><pre>console.log(gen.next(2)); <br>// -&gt; { done: false, value: 1 }</pre><pre>console.log(gen.next(3)); <br>// -&gt; { done: false, value: 3 }</pre><pre>console.log(gen.next(4)); <br>// -&gt; { done: false, value: 4 }</pre><pre>console.log(gen.next(5)); <br>// -&gt; { done: true, value: 5 }</pre><pre>console.log(gen.next(6)); <br>// -&gt; {value: undefined, done: true}</pre><p>What happened? Generator took your value, proceeded until next yield and stopped, returning some value (in this case value is the same); on the next next() call it substituted the previous yield and proceeded until the next again, and so it goes until the last yield expression or return. As it goes, yield smth expression (where generator stopped before) is replaced by incoming value. All of it happens as follows:</p><pre>function* generator(x) {<br>// here generator 1) returns value of x I initialized generator with, <br>// and 2) stops at yield x.</pre><pre>    var y = yield x;</pre><pre>// second gen.next() call <br>// 1) substitutes yield x for given value (3), <br>// 2) y = 3, <br>// 3) y value is returned, <br>// 4) function stops at yield y</pre><pre>    var z = yield y; </pre><pre>// third gen.next() call does the same: <br>// returns value z = 4, <br>// function runs until next yield z on the next line</pre><pre>    var w = yield z; </pre><pre>// fourth call: no more yields, <br>// generator still returns value:5 (value of w), <br>// but iteration is done, so done: true;</pre><pre>    return w;<br>}</pre><pre>var gen = generator(1); // initialize generator with x=1</pre><pre>console.log(gen.next(2)); // any value given here is thrown away, and initializing variable (or operation with it) is returned<br>// -&gt; { done: false, value: 1 }</pre><pre>console.log(gen.next(3)); <br>// -&gt; { done: false, value: 3 }</pre><pre>console.log(gen.next(4)); <br>// -&gt; { done: false, value: 4 }</pre><pre>console.log(gen.next(5)); // this value is kept and returned, but not by yield, by return, iteration is done<br>// -&gt; { done: true, value: 5 }</pre><pre>console.log(gen.next(6)); // no more yields, no return, so no value is returned<br>// -&gt; {value: undefined, done: true}</pre><p><a href="http://codepen.io/korshunad/pen/KaLNMW?editors=1111">Here</a> you can experiment with this code for better understanding.</p><h4>How did I apply it</h4><p>Honestly saying, applying generators, alone or with a flow-control library like <strong>co</strong> is not that hard (if you have examples! like mine :) or other resources like the ones I listed in the end of the post). I struggled much more on making the ball wiggle as I liked — that is, shaking as is if you’re shaking real magic 8-ball.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZsHk7GNMLMc%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZsHk7GNMLMc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZsHk7GNMLMc%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e138574c784e83e883c2fe774673b31c/href">https://medium.com/media/e138574c784e83e883c2fe774673b31c/href</a></iframe><p>Here are code samples of all four Promise-based variants you can use by now. For Promises, I used <strong>fetch API</strong>, and also <a href="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.2/fetch.min.js">polyfill</a> for it. For all 4 examples logic is the following: you get the JSON file from Firebase with all quotes. Now, randomly getting a single one from that is fairly simple — but suppose for training purposes I still need to make yet another request to get actual quote, using random id, generated based on the JSON length.</p><h4>Just Promises</h4><p><a href="http://codepen.io/korshunad/pen/KaZwoo">The first example</a> is simply fetching and chaining Promises. This one you probably know. For short recap, Promise is a proxy object for value which is not yet here with three states: pending, fulfilled and rejected, and such superpowers as chaining Promise methods .then() and .catch() one after another, each returning Promises as well.</p><pre>function getQuote() {</pre><pre>// getting 1st JSON<br>  fetch(&#39;<a href="https://ball-7d2f9.firebaseio.com/.json&#39;">https://ball-7d2f9.firebaseio.com/.json&#39;</a>)<br>    .then(function(response) {<br>      if (response.ok) {<br>        return response.json();        <br>      }<br>      throw new Error(&#39;Network response was not ok.&#39;);<br>    })<br>    .then(function(response) {</pre><pre>// getting random id to fetch one quote<br>      var id = &#39;&#39; + (Math.floor(Math.random() * response.length) + 1);</pre><pre>fetch(`<a href="https://ball-7d2f9.firebaseio.com/$%7Bid%7D.json%60">https://ball-7d2f9.firebaseio.com/${id}.json`</a>)<br>        .then(function(answer) {<br>          if (answer.ok) {<br>            return answer.json();<br>          }<br>        <br>          throw new Error(&#39;Network response was not ok.&#39;);<br>        })<br>        .then(function(theAnswer) {<br>          document.getElementById(&#39;test&#39;).innerHTML = JSON.stringify(theAnswer).slice(1, theAnswer.length + 1);<br>        })<br>    })<br>    .catch(function(error) {<br>// if nothing loaded, at least &#39;Yes&#39; or &#39;No&#39; will guide your executive decision</pre><pre>      if (Math.random() &gt; 0.5) {<br>        document.getElementById(&#39;test&#39;).innerHTML = &#39;Yes&#39;<br>      } else {<br>        document.getElementById(&#39;test&#39;).innerHTML = &#39;No&#39;<br>      }<br>    });<br>}</pre><pre>getQuote()</pre><h4>Same with GENERATORS</h4><p>Syntactic sugar or not, I am just a fan of generators already, with generators code is one level flatter, and it is clear, when does the function stop and resume.</p><p>To use generator function in your app write a generator function, which yields, takes in and passes down the Promises, and outputs the answer in HTML. Wrap all of this into try...catch and write the case if there is an error — if nothing is loaded, you can randomly output ‘Yes’ or ‘No’. Then you need a function, that will run this generator and respond to errors, which may work as follows:</p><ul><li>run next() method on generator to get yield value</li><li>if yielded value is not last in the generator (e.g. done: false) you work with the Promise that generator gives you back: if fulfilled, you call execute function to iterate generator once again with returned value; if rejected, you throw error and generator randomly returns ‘Yes’ or ‘No’.</li></ul><p>You can look at the same <a href="http://codepen.io/korshunad/pen/pRLqzj">magic 8-ball app using generators</a>. Not much difference, may be just a bit slower.</p><pre>//generator function, that yields and resolves each Promise step by step</pre><pre>function* getQuote() {</pre><pre>let theAnswer;</pre><pre>try {<br>    let allFetch = yield fetch(&#39;<a href="https://ball-7d2f9.firebaseio.com/.json&#39;">https://ball-7d2f9.firebaseio.com/.json&#39;</a>);<br>    let allInfo = yield allFetch.json();<br>    let l = allInfo.length;<br>    let id = Math.floor(Math.random() * l + 1);<br>    let theAnswerFetch = yield fetch(`<a href="https://ball-7d2f9.firebaseio.com/$%7Bid%7D.json%60">https://ball-7d2f9.firebaseio.com/${id}.json`</a>);<br>    let theAnswer = yield theAnswerFetch.json();<br><br>  } catch (e) {<br>    let theAnswer = Math.random() &gt;=0.5 ? &#39;Yes&#39; : &#39;No&#39;<br>    <br>  }<br>  document.getElementById(&#39;test&#39;).innerHTML = theAnswer;<br>}</pre><pre>// function,running the generator until it is exhausted</pre><pre>function execute(generator, yieldValue) {</pre><pre>let next = generator.next(yieldValue);</pre><pre>if (!next.done) {<br>    next.value.then(<br>      result =&gt; execute(generator, result),<br>      err =&gt; generator.throw(err)<br>    )<br>  }<br>}</pre><pre>execute(getQuote());</pre><h4>Generators with CO</h4><p>To use <strong>co </strong>you may add it via CDN (<a href="https://cdnjs.cloudflare.com/ajax/libs/co/4.1.0/index.js">https://cdnjs.cloudflare.com/ajax/libs/co/4.1.0/index.js</a>) or npm install co(<a href="https://github.com/tj/co">https://github.com/tj/co</a>). In Codepen, I added CDN link for <a href="http://codepen.io/korshunad/pen/XpYEOW">app axample with <strong>co</strong></a><strong> </strong>(using code below).</p><p>You could apply the yield* to fancy things up a bit, and just wrap the last generator in <strong>co</strong>:</p><pre>function* fetchQuote(url) {<br>  let allQuotesFetch = yield fetch(url);<br>  let allQuotes = yield allQuotesFetch.json();<br>  let l = allQuotes.length;<br>  let id = Math.floor(Math.random() * l + 1);<br>  let quote = yield fetch(`<a href="https://ball-7d2f9.firebaseio.com/$%7Bid%7D.json%60">https://ball-7d2f9.firebaseio.com/${id}.json`</a>);<br>  let q = yield quote.json();<br>  return q;<br>}</pre><pre>function* getQuote() {</pre><pre>  let quote;</pre><pre>  try {<br>    quote = yield* fetchQuote(&#39;<a href="https://ball-7d2f9.firebaseio.com/.json&#39;">https://ball-7d2f9.firebaseio.com/.json&#39;</a>);<br>  } catch(e) {<br>    quote = &#39;Yes&#39;<br>  }<br>  document.getElementById(&#39;test&#39;).innerHTML =  <br>  JSON.stringify(quote).slice(1, quote.length+1)<br><br>}</pre><pre><strong>co(getQuote())</strong>;</pre><p>Or you could just take generator function from previous example, and simply run it with <strong>co</strong>:</p><pre>function* getQuote() {</pre><pre>let theAnswer;</pre><pre>try {<br>    let allFetch = yield fetch(&#39;<a href="https://ball-7d2f9.firebaseio.com/.json&#39;">https://ball-7d2f9.firebaseio.com/.json&#39;</a>);<br>    let allInfo = yield allFetch.json();<br>    let l = allInfo.length;<br>    let id = Math.floor(Math.random() * l + 1);<br>    let theAnswerFetch = yield fetch(`<a href="https://ball-7d2f9.firebaseio.com/$%7Bid%7D.json%60">https://ball-7d2f9.firebaseio.com/${id}.json`</a>);<br>    let theAnswer = yield theAnswerFetch.json();<br><br>  } catch (e) {<br>    let theAnswer = Math.random() &gt;=0.5 ? &#39;Yes&#39; : &#39;No&#39;<br>    <br>  }<br>  document.getElementById(&#39;test&#39;).innerHTML = theAnswer;<br>}</pre><pre><strong>co(getQuote())</strong></pre><h4>Async functions</h4><p>To use async functions you would need to use Babel and Babel Polyfill <a href="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser-polyfill.min.js">(https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser-polyfill.min.js</a>). The code below is live <a href="http://codepen.io/korshunad/pen/BpPzKW">here</a>.</p><p>As you saw before, generators need an additional function or an external library to get them going. So the async functions are intended to alleviate the pain of always adding these boilerplates, basically containing the generator inside. You may just take the previous generator function, rename it and replace yield with await.</p><pre>async function getQuote() {<br>  let theAnswer;<br>  try {<br>    let resultResponse = await fetch(&#39;<a href="https://ball-7d2f9.firebaseio.com/.json&#39;">https://ball-7d2f9.firebaseio.com/.json&#39;</a>);<br>    let response = await resultResponse.json()<br>    let l = response.length;<br>    let id = Math.floor(Math.random() * l + 1);<br>    let answerResponse = await fetch(`<a href="https://ball-7d2f9.firebaseio.com/$%7Bid%7D.json%60">https://ball-7d2f9.firebaseio.com/${id}.json`</a>)<br>    let answer =  await answerResponse.json();<br>    theAnswer = JSON.stringify(answer).slice(1, answer.length + 1);<br>  } catch (err) {<br>    console.log(err.message)<br>    theAnswer = Math.random() &gt;=0.5 ? &#39;Yes&#39; : &#39;No&#39;<br>  }<br>  document.getElementById(&#39;test&#39;).innerHTML = theAnswer;<br>}</pre><pre>getQuote();</pre><p>That is pretty much it! :)</p><p>Last thing I’d like to mention is some great resources that helped me to build understanding of this topic, and which you can use to know more:</p><ul><li>“Exploring ES6” by Dr. Axel Raushmayer, <a href="http://exploringjs.com/es6/ch_generators.html#ch_generators">chapter about generators</a> is the ultimate place to get all the reference, although it may sound a bit complicated, but that it because of lots and lots of details about how things actually work.</li><li>“You Don’t Know JS: Async &amp; Performance” by Kyle Simpson, about <a href="https://www.safaribooksonline.com/library/view/you-dont-know/9781491905197/ch04.html">generators</a> and <a href="https://www.safaribooksonline.com/library/view/you-dont-know/9781491905197/ch03.html#chapter-3-promises">Promises</a>.</li><li>“ES6 Generators” series of posts by Kyle Simpson helped a lot of people to understand generators and <a href="https://davidwalsh.name/async-generators">also ES7 async functions, going async with them</a>, and even <a href="https://davidwalsh.name/concurrent-generators">concurrent</a>, so you definitely should check those out!</li><li><a href="https://tc39.github.io/ecmascript-asyncawait/">Async functions documentation</a></li><li><a href="https://ponyfoo.com/articles/es6-generators-in-depth">Ponyfoo take on Generators</a> by Nicolás Bevacqua is also very thorough and extensive.</li><li>And, if (by accident) you know Russian —<a href="https://learn.javascript.ru/generator"> this part</a> on generators from learning JavaScript series is quite helpful as well.</li></ul><p>And no matter how hard this topic may go, just go ahead and</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*OuOKF51hXg4E1pWzBZlXFw.png" /><figcaption>Be the miracle.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bbaf22bb5c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zero to React: there’s no bad weather, just bad gear.]]></title>
            <link>https://medium.com/@korshunad/from-zero-to-react-theres-no-bad-weather-just-bad-gear-9d1a51884037?source=rss-4b6535d4dd04------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d1a51884037</guid>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[weather-apps]]></category>
            <dc:creator><![CDATA[Ana Makarochkina]]></dc:creator>
            <pubDate>Wed, 17 Aug 2016 21:22:29 GMT</pubDate>
            <atom:updated>2016-08-17T21:22:29.710Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQNDW4rvoyfgEE%2Ftwitter%2Fiframe&amp;src_secure=1&amp;url=http%3A%2F%2Fgiphy.com%2Fgifs%2Fmad-max-QNDW4rvoyfgEE&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FQNDW4rvoyfgEE%2Fgiphy-downsized-large.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3ef3b550fabf901fa632bfd8e6a3253/href">https://medium.com/media/c3ef3b550fabf901fa632bfd8e6a3253/href</a></iframe><h3>From Zero to React: there’s no bad weather, just bad gear.</h3><p>Sometimes it takes some courage to start over. This is something I felt in my arts classes, starting attending each fall, and quitting it almost each spring (but always returning next year to start over). Now I had a break, could not write nor podcasts nor posts for my <a href="https://medium.com/@korshunad/from-zero-to-react-26c5709c1858#.i2pfafqdr">Zero to React Challenge</a> — but here I am again, with a new challenge from <a href="https://www.freecodecamp.com/challenges/show-the-local-weather">FreeCodeCamp</a> covered, each step closer to mastering Javascript and heading towards React.</p><h3>The App</h3><p>The challenge was to build an app, which shows local weather in a user’s location, allows to toggle between Celsius and Fahrenheit, and displays appropriate landscape and/or an icon. After I saw the <a href="http://codepen.io/FreeCodeCamp/full/bELRjV">example</a> I loved its minimalism and shiny icons, which were an animated icon set from behance, and decided to try to do my own.</p><h3>The Structure</h3><p>First I figured out, how to build the app, how it will determine the user’s location, which by the time with the navigator.geolocation object, then how the <a href="http://openweathermap.org/api">weather service API</a> works, including getting the API key, figuring out how to form a call to the API and which information I’d need to display (such as location, weather overall description, specific measurements such as wind speed, temperature). That took me some time, especially when I mistakenly found an error in temperature of my home city I was currently in — only to find out later that I misread the API documentation and by default get the temperature in Kelvins.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fr4KWyE2bXGcX6%2Ftwitter%2Fiframe&amp;src_secure=1&amp;url=http%3A%2F%2Fgiphy.com%2Fgifs%2Ffacepalm-r4KWyE2bXGcX6&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fr4KWyE2bXGcX6%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef9529debac2cd008dc38f900b88e374/href">https://medium.com/media/ef9529debac2cd008dc38f900b88e374/href</a></iframe><h3>The Animation</h3><p>After that I immersed myself into the animated icons creation! There was an option to try Adobe After Effects, but why not code more? so the next step was finding proper JavaScript animation library (there are many, animate.js, animate.css, svg.js, three.js, and others, just choosing one is delightful, as for the ones <a href="https://www.sitepoint.com/top-9-animation-libraries-use-2016/">here</a>), finally stopping at velocity.js. I chose the svg elements to be animated (mostly from flaticon.com and nounproject artists, when <a href="http://codepen.io/korshunad/full/rLkGRW/">this</a> one took too long to code and position all svg elements), combined them with css, and experimented with animations so the clouds, sun, drops and etc. behave more or less naturally. I had to make some compromises, when stuck to implement some particular solution (like the drops falling or mimicking falling through fading <a href="http://codepen.io/korshunad/full/OXodLE/">in this one</a>). I ended up with <a href="http://codepen.io/korshunad/">17 animated icons</a>, including weather conditions for day and for night.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fkorshunad%2Fembed%2Fpreview%2FXKEzdv%3Fheight%3D600%26amp%3Bslug-hash%3DXKEzdv%26amp%3Bdefault-tabs%3Dhtml%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fkorshunad%2Ffull%2FXKEzdv%2F&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F698312.XKEzdv.small.1ed9c197-8048-4b1f-a898-582c3645e985.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/399f6256e37214787ef9b96b2a42ed8f/href">https://medium.com/media/399f6256e37214787ef9b96b2a42ed8f/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fkorshunad%2Fembed%2Fpreview%2FoLJLdd%3Fheight%3D600%26amp%3Bslug-hash%3DoLJLdd%26amp%3Bdefault-tabs%3Dhtml%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fkorshunad%2Ffull%2FoLJLdd%2F&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F698312.oLJLdd.small.4d7b1685-ac0f-484f-939c-571d3c70a19d.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/86a25609c9be9ef1d07f70a8403f608e/href">https://medium.com/media/86a25609c9be9ef1d07f70a8403f608e/href</a></iframe><h3>The Unexpected Obstacle</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FsU0h3QaTDwRO0%2Ftwitter%2Fiframe&amp;src_secure=1&amp;url=http%3A%2F%2Fgiphy.com%2Fgifs%2FsU0h3QaTDwRO0&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FsU0h3QaTDwRO0%2Fgiphy-downsized-large.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/b729f4786f5aa50ee71e2bdd6f3cf172/href">https://medium.com/media/b729f4786f5aa50ee71e2bdd6f3cf172/href</a></iframe><p>So I had everything set up and the geolocation stopped working. Reading a lot of posts with confusing information led to a simple solution: using geolocation api based on ip. Still the app could not load from github, which as I later found out was due to https sending request to the http pages, which was blocked by the browser, to guarantee overall security of the page and loaded scripts. So digging into <a href="http://enable-cors.org/">CORS</a> did not help, as I was hosting the app on the codepen and github, so I decided to go with only CodePen version for now.</p><h3>The End</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*IEtyYHbhGtderRsGaGwVQg.jpeg" /></figure><p>And after cutting off the odd functionality, which I was tempted to add, looking at other projects, I ended up with a minimalistic weather app, it’s <a href="http://codepen.io/korshunad/full/WxPvdz/">here</a>! ヾ(o✪‿✪o)ｼ</p><p>Many solutions were inspired by other projects, such as an idea to express the temperature degrees in round numbers, or reflect the time of the day in the color of the background, and put in the default text and icon in case the scripts would not work. I bet those who will go through these challenges later will have more advanced and polished applications, I already saw a lot of great projects, some with ever increasing functionality or design sophistication, and that’s great!</p><p>Now I move on to the next FreeCodeCamp challenge — <a href="https://www.freecodecamp.com/challenges/build-a-wikipedia-viewer">Wikipedia Viewer</a>, and keep an eye on React documentation and newly appearing <a href="http://www.reactenlightenment.com/">tutorials</a>, remembering my longer-term goal as well :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d1a51884037" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zero to React, Week One: Let it Quote!]]></title>
            <link>https://medium.com/@korshunad/from-zero-to-react-week-one-let-it-quote-febbc9e5efc6?source=rss-4b6535d4dd04------2</link>
            <guid isPermaLink="false">https://medium.com/p/febbc9e5efc6</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[self-learning]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ana Makarochkina]]></dc:creator>
            <pubDate>Mon, 04 Jul 2016 19:26:00 GMT</pubDate>
            <atom:updated>2016-07-05T07:00:12.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8Vcia4Aty4tovv01Uwf6Q.png" /></figure><p>Above I posted a screen-shot of <a href="https://korshunad.github.io/Random-Frankl/">my solution</a> to a FreeCodeCamp assignment for building a random quote generating machine. Building it turned out to be a journey itself with its ups and downs. First I wanted to rebuild the random <a href="http://ergofabulous.org/luther/">Lutheran insulter</a> <a href="http://ergofabulous.org/luther/%28it">(it</a> is awesome, by the way xD), but decided to create something new.</p><p>The initial thought was to implement it in a day. Very naive :) A lot of posts solving similar challenges and saying “wow it took me so long… three hours!” have shaken my confidence. After some doubts I moved on, even when accidentally and irreversibly deleting all the work from codepen.io — the worst nightmare of any scholar coming true, but never prevented until first accident.</p><p>And the purest happiness is when flaws get fixed, one by one — when creating a GitHub static page or finally getting the transparency of the well class right! There are many flaws — I am so at the beginning… but also a lot of joy when something works :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*h87L05wtpNn1zh0K3J0olg.gif" /></figure><p>This week turned out to be very fruitful for my coding practice, summed up in competing the Random Quoting Machine challenge. Previously I’ve skimmed through the W3schools tutorial on Javascript, it both overloaded me with theory and helped along my way through the FreeCodeCamp challenges on Javascript, it seems to be a very nice reference material.</p><p>There are a lot of helping materials on the web! Also the medium posts, summarizing the necessary materials and skills, such as FreeCodeCampers’ summaries of great resources for learning <a href="https://medium.freecodecamp.com/from-zero-to-front-end-hero-part-1-7d4f7f0bff02#.lf3vsnlgz">front-end</a>, but <a href="https://medium.freecodecamp.com/the-practical-guide-to-becoming-a-professional-web-developer-2f255bc25c90#.83cnit628">also back-end</a> development.</p><p>After going through all the FreeCodeCamp Javascript tutorial and basic algorithms and so on time came to approach the Random Quoting machine. This is when I grew anxious that I don’t know where to start, that I forgot everything, that I am not prepared. This is sort of fear you have when you are used to mastering the theory at first and only then moving to practice. Here come the shorter learning-to-practice cycles, given the lack of time for learning all the theory underlying programming. Similar viewpoint was expressed in a <a href="https://medium.com/@chancancode/rethinking-computer-science-education-319a60709b30#.73e010spf">post discussing Computer Science education</a>, but from another side: the author of this post actually got the Computer Science degree and the arguments pro formal Computer Science education are valid for other spheres as well: great managers and philosophers also don’t always graduate from famous business schools or universities “where Hegel taught”. As in the post, the formal Computer Science develops the skill of perseverance through the “unknown but well-documented technology”, crucial for advancing software development. Having tried to jump in using JQuery without at least basic thoughtful exercising with it, as I rushed in the actual development assignments, I vividly felt the need for developing such a skill.</p><p>However, throughout my challenges, some documented in the podcasts, some only in the browser history (numerous search queries about various mistakes, etc), and also as mentioned by another FreeCodeCamper— <a href="https://medium.freecodecamp.com/is-free-code-camp-enough-to-become-a-successful-developer-f5df0c33caa8#.1bc3l2gw2">practice is essential</a>. And practice cannot be unconscious, just passing through all the assignments as fast as possible, learning requires some creativity to apply what you have learnt. And bold desire to make it work :) anyway, as Scott Young put it: <a href="https://www.scotthyoung.com/blog/2016/04/12/no-hard-subjects/">There are no hard subjects, only missing prerequisites</a> — nice framing to move from anxiety to feasible tasks :)</p><p>I plan to continue on the FreeCodeCamp challenges and projects, to build the Weather app, Wikipedia viewer, twitch.tv streamer and move on along the FreeCodeCamp path — with the long-term goal in my mind — learning React.</p><p>And I wrap up this post with a person, great believer in humanity, who inspired me enough to build his personal quote generator, but also seems to cheer anyone up with some practical idealism :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fwr6itOBLVQA%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dwr6itOBLVQA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fwr6itOBLVQA%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/41cdd715871d4b5227184bbb4091e9ba/href">https://medium.com/media/41cdd715871d4b5227184bbb4091e9ba/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=febbc9e5efc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From zero to React.]]></title>
            <link>https://medium.com/@korshunad/from-zero-to-react-26c5709c1858?source=rss-4b6535d4dd04------2</link>
            <guid isPermaLink="false">https://medium.com/p/26c5709c1858</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ana Makarochkina]]></dc:creator>
            <pubDate>Wed, 22 Jun 2016 18:10:05 GMT</pubDate>
            <atom:updated>2016-08-17T16:48:07.080Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi there, my name is Anastasia and — OMG — I propose that I will grow from zero to the React.js professional until the end of this year. (Starting in the middle of the year is fun!).</p><p>Let me introduce myself.</p><p>I always was a “liberal arts” kid. Loved languages, drawing and writing, went to classical gymnasium, focusing on this track. I had some notion of programming in ICT classes, but no room for practice, only a computer with just a keyboard to navigate sites. Grew into thinking about life, but also wanted to get a profession along with language learning. This brought me to Cultural Studies in Philosophy Institute. I loved it! Still looking forward to dive into Hegel and Heidegger some day. But I already felt something was missing — solid practical skills. I took the Plato’s wish the philosophers to rule as a guiding principle and went to the Management School. In parallel I tried self-learning Web Design and some programming, even took scary sounding Object Oriented Development of Distributed Applications course while on exchange… Never finished all of that, lacking a goal and determination to achieve it. Less than two weeks ago I graduated. Thanks to my determination not to upset anybody. Then I had a moment to rethink everything, to start over from scratch once again. In programming!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*G-AFCzk_bE-f5-zP2IVqQA.gif" /></figure><p>I found inspiration in my boyfriend, who is a self-taught programmer. He has built his career all driven by his own desire to learn. Without his example I would stay indecisive for quite a few years more, believing that I can learn while working somewhere I don’t like.</p><p>So here I am. Ordinary for my network where everyone goes to the university before deciding anything about who they are and what they want. With a dream of building my professional career in front-end engineering.</p><p>I have no previous knowledge of programming, only faint introductory knowledge of HTML. And I choose to learn React pretty much because I can.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*j8g11O5FdL-Zn4SPIiFVwQ.gif" /></figure><p>I think that React has begun a revolution in front-end development and is here to stay. When I succeed, I can proceed to learning other exciting technologies and building great applications!</p><p>My plan is the following. From now on I will make my <a href="https://soundcloud.com/user-422467487">Daily Scrums podcast</a>, where I capture challenges I have, progress I made and plans for the day. I will summarize my experience in a weekly blog post. I plan to start with JavaScript basics and new JavaScript features available in Babel (I heard it’s vital part of good development experience in React community). Then I will proceed to the React itself. Will refine the plan on my way. Any ideas on my hobby projects are welcome as well! :)</p><p>I want this to become an example that it is never too late to try something you want to. That you can achieve your dreams, when you put all your concentrated efforts into it.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5-sfG8BV8wU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5-sfG8BV8wU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5-sfG8BV8wU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a25a340dc5d435f51fdddc49b5afdcd4/href">https://medium.com/media/a25a340dc5d435f51fdddc49b5afdcd4/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26c5709c1858" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>