<?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 Wolfgang Pfretzschner on Medium]]></title>
        <description><![CDATA[Stories by Wolfgang Pfretzschner on Medium]]></description>
        <link>https://medium.com/@WolfgangPfretzschner?source=rss-cf3f35f1b21d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GK5LTN-vFy3DQXW2qfOMAQ.jpeg</url>
            <title>Stories by Wolfgang Pfretzschner on Medium</title>
            <link>https://medium.com/@WolfgangPfretzschner?source=rss-cf3f35f1b21d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:25:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@WolfgangPfretzschner/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[Resizing react native for all screens]]></title>
            <link>https://medium.com/@WolfgangPfretzschner/resizing-react-native-for-all-screens-f65e732e895e?source=rss-cf3f35f1b21d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f65e732e895e</guid>
            <dc:creator><![CDATA[Wolfgang Pfretzschner]]></dc:creator>
            <pubDate>Mon, 17 Dec 2018 04:25:53 GMT</pubDate>
            <atom:updated>2018-12-17T04:25:53.037Z</atom:updated>
            <content:encoded><![CDATA[<h3>Tip 2: AspectRatio</h3><p>Remember the keyword <strong>Proportion. </strong>Now we know the width<strong>, we gonna use aspectRatio to set the height, or vice versa</strong>. (Note: aspectRatio is ONLY<strong> </strong>in React-Native, NOT<strong> </strong>a css standard).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f65e732e895e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t Just Tell Mom, Show Her!]]></title>
            <link>https://medium.com/@WolfgangPfretzschner/dont-just-tell-mom-show-her-a73248f9c200?source=rss-cf3f35f1b21d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a73248f9c200</guid>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Wolfgang Pfretzschner]]></dc:creator>
            <pubDate>Wed, 22 Aug 2018 16:09:58 GMT</pubDate>
            <atom:updated>2018-08-22T16:09:58.577Z</atom:updated>
            <content:encoded><![CDATA[<p>So here is the dilemma. You are attending a coding bootcamp that costs a lot of money and is also not in your hometown. It is far far away from your family and especially from your mom. She is all upset because she doesn&#39;t get to see you anymore and even worse she does not know what you are actually doing in this “bootcamp”. All she hears is you on the phone telling her about some code this and code that. She is wondering why she can’t see your accomplishments and getting kind of suspicious, because you have proven in the past not always to be trusted…</p><p>So now the questions remains: How can you show off your awesome projects to your mom at home???</p><p>The answer is Ngrok!</p><p>Enter <a href="http://www.ngrok.com/">ngrok</a>, a very cool, lightweight tool that creates a secure tunnel on your local machine along with a public URL you can use for browsing your local site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*hrWqMW0aDHvXPGzM9tnU8g.png" /></figure><h4>How it works</h4><p>You download and run a program on your machine and provide it the port of a network service, usually a web server.</p><p>It connects to the ngrok cloud service which accepts traffic on a public address and relays that traffic through to the ngrok process running on your machine and then on to the local address you specified.</p><p>Once you have your free account created you can download the program to your machine. The download has all your account information attached so in the future to run ngrok you don’t even have to log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlbRXL8XakBAwkFD5usViA.png" /></figure><p>Once in your download folder it is a good idea to store it in /usr/local/bin folder. To do that you cd into your download folder and copy it like this sudo cp ngrok /user/local/bin .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*J7DoxTiPjBRS8QxX0zcj8A.png" /></figure><p>Now go ahead and start your app locally as you usually would. In this example I will run a backend on localhost/3000 the frontend at localhost/3001 and then from anywhere in the terminal I can call ngrok and tell it what port to expose like so ngrok http 3001 .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*ujA_JOJpfKYuww5Mk8HSSQ.png" /></figure><p>You should now see a screen the looks like this, telling you all about your connection and most important it will give you a public domain for you to send to your mom, remember, the whole reason we are doing this in the first place…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z-Q2N4Ete3G82wQ4g29ZHw.png" /></figure><p>Here is your locally running app…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TY9VQ2lUFxcGsrQ8Ri3ZRA.png" /></figure><p>and here is your publicly show off to mom domain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RMfhBUFAARCCPch4HKpvqA.png" /></figure><p>Now that you have the ability to share your accomplishments to family and friends or even clients in the future, your reputation as a worthy offspring has been saved.</p><p>This is in my opinion the most important feature ngrok can help you with and best of all it is free. They offer different plans and many different services, for example if you want to be able to a have individualized DNS they can do that for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sKcA-M96jvrKCdX2F1OjVA.png" /></figure><p>But here I just wanted to demonstrate the easy way to share your app as if someone would be sitting in front of your computer.</p><p><a href="https://dashboard.ngrok.com/get-started">ngrok - secure introspectable tunnels to localhost</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a73248f9c200" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Canvas, a Creative Playing Field inside HTML]]></title>
            <link>https://medium.com/@WolfgangPfretzschner/canvas-your-creative-playing-field-17b074a3b46d?source=rss-cf3f35f1b21d------2</link>
            <guid isPermaLink="false">https://medium.com/p/17b074a3b46d</guid>
            <dc:creator><![CDATA[Wolfgang Pfretzschner]]></dc:creator>
            <pubDate>Tue, 07 Aug 2018 21:03:18 GMT</pubDate>
            <atom:updated>2018-08-08T14:19:37.895Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is the canvas?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*X6td9tPAQujPjZTLLxsZIA.jpeg" /></figure><p>…No, not so much for what we want to do here. That canvas is one of the most widely used standards for rendering 2D graphics on the Web. It is used in games and complex visualizations. More technical the canvas is an html5 container, similar to a div on a website. The canvas element is a special container for graphics where JavaScript is used to actually draw the graphics. Canvas has several methods for drawing paths, boxes, circles, text, and adding images. But you can also render images and svgs and animate these images on the canvas.</p><p>Here is a basic setup to get a canvas to show up on your screen. We insert the canvas with the id of &quot;myCanvas” in our html&lt;canvas id=&quot;myCanvas&quot;&gt;&lt;/canvas &gt; . To get something to show up on the canvas we have to first grab the canvas tag from our site, using the Javascript document.getElementById() function like so. <br>var canvas = document.getElementById(“myCanvas”) <br>After that we can call a special method called getContext(“2d”) on the canvas variable we just created and store it in another variable. Lets call it ctx which is short for context.<br> var ctx = canvas.getContext(&quot;2d&quot;)</p><p>From now, if we want something to appear on the canvas we will use the ctx variable. It is like the <strong>brush</strong> for a real canvas.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fembed%2Fpreview%2FgjQYgp%3Fheight%3D600%26slug-hash%3DgjQYgp%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fpen%2FgjQYgp&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/1031981fc384af821de6f5c692e429e9/href">https://medium.com/media/1031981fc384af821de6f5c692e429e9/href</a></iframe><p>We have several methods to draw on our canvas. Here we see the rectangle method for example to draw on the canvas. Like many others methods to draw we use the coordinates x and y to tell the objects upper left corner where to appear as well as the hight and width of the object using pixels. We can also use math on the coordinates and sizes to change the manipulate our objects. Changing the color and other styling can be done with methods like fillStyle() or strokeStyle().</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*72II7JJoLugWTsztSaBN8w.png" /></figure><p>We can also draw shaped by telling canvas where to start a path by calling moveTo() and give it the x and y coordinates, then we keep giving more coordinates in the lineTo() method to draw the lines and create an object that way. Here we created two forward slashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YMZPKZ1RRWGrCV-TxP3JDQ.png" /></figure><p>Animation</p><p>This is all dandy and sweet but the true power of the canvas lies in the capabilities of animating objects and updating them in a rate of up to 100 times per second. This continuous loop of updates will give us the effect of animation.</p><p>In order to do demonstrate animation we will create just a red square and make it move with the touch of our arrow keys. It is similar to the creation of our objects above but we also have to add functionality to be able to re-render the object on different positions on the canvas.</p><ol><li>We will wrap the creation of our objects in a function. This also gives us the capability to make more object very easily.</li><li>Also, we have to wrap our calls to these functions inside another function wich will have a setInterval() feature so it can call the functions inside of it every so often, creating the animation loop.</li><li>The canvas itself will be put inside an object so we can store and excess all its information easy form other places in our code.</li></ol><p>Let see how this is done in the codePen below</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fembed%2Fpreview%2FOwBjJr%3Fheight%3D600%26slug-hash%3DOwBjJr%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fpen%2FOwBjJr%3Feditors%3D1010&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2244446.OwBjJr.small.8217096c-eb8a-47e8-ab40-fc44e9aea78c.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b26f4ebf756afb672a5b0175417baf7a/href">https://medium.com/media/b26f4ebf756afb672a5b0175417baf7a/href</a></iframe><p>In the example above we have created a red square and we are able to animate it with the press of our arrow keys. <br>To explain the code: <br>We created 4 functions and 2 variables. <br>startAnimation() is being called from our html when the page loads and kicks off the entire animation cycle.<br> `rectComponent()` can create rectangles we instantiate in our variable rectangle1 <br>The function onKeyPress() handles the input form the user with the arrow keys.<br>Updating the canvas in every iteration of our loop is the job of the updateCanvasArea().</p><p>Now the canvas is able to react to user input and change the position of the rectangle. In terms of performance, our little demonstration is nothing for the canvas. It is made to handle hundreds of even more complex animations.</p><p>Other examples on how canvas is being used are in the folowing codePens</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fembed%2Fpreview%2FYjRzZp%3Fheight%3D600%26slug-hash%3DYjRzZp%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fpen%2FYjRzZp&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/f151b5995794df85aeb1351c9fdd00a8/href">https://medium.com/media/f151b5995794df85aeb1351c9fdd00a8/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fembed%2Fpreview%2FmjQdmm%3Fheight%3D600%26slug-hash%3DmjQdmm%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FWolfmeister%2Fpen%2FmjQdmm&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f6c27bd130ea7fea70fad2b21a84256/href">https://medium.com/media/5f6c27bd130ea7fea70fad2b21a84256/href</a></iframe><p>Now what if we want to animated animations? What? Yes. Canvas can do that as well. But that’s what the next blog will be about.</p><p>If you want to read more about canvas please follow my resources here:</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations">Basic animations</a></li><li><a href="https://www.w3schools.com/graphics/canvas_intro.asp">HTML Canvas</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17b074a3b46d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Home Automation]]></title>
            <link>https://medium.com/@WolfgangPfretzschner/home-automation-199afcaa1d2d?source=rss-cf3f35f1b21d------2</link>
            <guid isPermaLink="false">https://medium.com/p/199afcaa1d2d</guid>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Wolfgang Pfretzschner]]></dc:creator>
            <pubDate>Wed, 25 Jul 2018 17:14:19 GMT</pubDate>
            <atom:updated>2018-07-25T18:02:18.286Z</atom:updated>
            <content:encoded><![CDATA[<p>The Internet of Things is the most trending technology today. The concept is simple: Devices in your home (or wherever they are) have the capability to communicate with each other via the internet. This technology usually uses sensors to pass data to the internet. Imagine a sensor installed in your garden that uploads data like temperature, humidity, and soil purity to the internet, and this data is visible to you from anywhere in the world. Or imagine home automation systems you can use to control appliances in your home like lights, door locks, and air conditioning through a web interface or smartphone application. A lot of technologies are being developed around this concept, such as independent lightweight IoT networks and protocols for passing data. What can you do with home automation today?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Bq0TM0Bqt6mXB3AFxoobA.jpeg" /></figure><h3>What can you do with home automation?</h3><p>With a full home automation you can program your home to automatically change conditions like lights and temperature of your home, control your home from anywhere there is an internet connection. You could even program your home to start music, set a certain light mode and set the temperature of the living room all with the click of a button or even better automatically when you walk in the house. Most popular applications might include:</p><ul><li>security system notify you when intruders are in your home</li><li>lights can be controlled and combined with other sensors to automate</li><li>lighting</li><li>heating and cooling</li><li>sound systems</li><li>windows and shades</li><li>cameras</li><li>garage door openers</li><li>water and power usage monitors</li><li>motion sensors to trigger events</li><li>appliances like washer can sends you a message when the laundry is done</li><li>even dog and cat feeders</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*-EgEwjUbwaWzw-2H-SQOzA.jpeg" /></figure><h3>The US is the biggest market in home automation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*H1HSvrjkDI_Uftpn15a0Jw.jpeg" /></figure><h3>How to get started with home automation?</h3><p>Today it is actually a straight forward process to connect your home to the internet since there are many companies out there that offer a complete ecosystem with a minimum on setup to get you going. To name a couple companies you have:</p><ul><li>August <strong>Smart Lock</strong></li><li>Notion</li><li>Canary</li><li>Iris</li><li><strong>HomeSeer</strong></li><li><strong>Control4</strong></li><li>Vera</li><li><strong>Savant</strong></li></ul><p>You always need a hub which is connected to your router. This hub connects the different devices to the internet. Usually this communication is accomplished with a wireless protocol like:</p><ul><li>INSTEON</li><li>Z-WAVE</li><li>ZIGBEE</li><li>WI-FI</li><li>BLUETOOTH</li><li>THREAD</li><li>APPLE HOMEKIT</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcgeCG1pVIM6ROPHbEpAMw.png" /><figcaption>you can start with wifi controlled outlets to turn lights and appliances on and off with your phone.</figcaption></figure><p><strong>A reasonable drawback</strong> <strong>to this approach</strong> is that you are limited to the devices this company offers. Most devices are not cross compatible. So if you would like to implement devices from two different companies you would have two ecosystems, two hubs and two apps to control each companies device.</p><p>A lot of people do not like this limitation. If you would like to have the most flexible solution you built your own system with a computer like the raspberry pi as a server and additional hardware and software to be able to connect any device you wish to connect and even built you own devices. How would you do this you might be wondering? Lets take a look how we can achieve this.</p><h3>Home automation with the raspberry pi?</h3><p>You can choose from many setups for you own personal home automation network but by far the most popular device to use as a central server is the credit card sized mini computer Raspberry Pi. For only $35 dollars you have a server that is capable of delegating the communication between all your devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*R3wNCmHAOjadQA04YIVn_g.png" /><figcaption>Here the raspberry pi is controlling two relays that can turn power to light switches or outlets on or off</figcaption></figure><p>Also a huge plus if you do a custom HA setup is the ability to integrate your entire homes wiring if you choose to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*ZjMgHCvdD52EXG9J0Ljg4w.jpeg" /></figure><p>Further more you need the mostly wireless devices from the manufacturer you would like to use in your home as well as their hub to be able to talk to these devises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*0yp4Ti7HKoVyTSlQF1sV6A.jpeg" /></figure><p>Now with your devices and wiring set up you can choose between several home automation open source software. Here I will show you IOBroker which is written in JavaScript. IOBroker is a framework that with the help of adapters is able to communicate with hardware devices. The open source community writes these adapters to make more and more devices and hubs work with IOBroker so it can stay up to date with the steadily growing market of home automation devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7IqkbYanyz2x_VBKAdjvMg.jpeg" /></figure><p>After installing IOBroker on your raspberry pi and adding the adapters you need to communicate with your devices you can setup a user interface to control all your devices from one spot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wpD6I9vtlDFjjavkK9r9Ow.png" /></figure><p>Now you are able to control everything in your home, from the coffee maker to the vacuum cleaner.</p><p>In the future home automation will become second nature and people might be wondering how we were living in a world where we had to turn lights on or off and even open door by hand because all of this will be automated for us to increase our steadily growing comfort of living.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=199afcaa1d2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fibonacci Everywhere!]]></title>
            <link>https://medium.com/@WolfgangPfretzschner/fibonacci-everywhere-fda3b76a8e37?source=rss-cf3f35f1b21d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fda3b76a8e37</guid>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Wolfgang Pfretzschner]]></dc:creator>
            <pubDate>Wed, 11 Jul 2018 16:44:20 GMT</pubDate>
            <atom:updated>2018-07-11T16:44:20.482Z</atom:updated>
            <content:encoded><![CDATA[<p>I first learned about this interesting sequence when I was playing around with forex trading (which is trading different currencies) and learned that the fibonacci sequence is a technical analysis tool used in conjunction with other tools used by professional traders to calculate the forecast of a potential end of a correction by taking a percentage of the previous move.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UC8nGfADA1LRV6iYx67p8Q.png" /></figure><p>As you can see I did not know how to properly apply this analytical tool and missed out on becoming filthy rich with trading currencies and now I have to learn to become a programmer to make living in the future…</p><h3><strong>So who was Fibonacci?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*bDxz_7peAkJVkinUDJ9Vzw.jpeg" /></figure><p>The fibonacci numbers are named after Leonardo Fibonacci of Pisa, Italy, who actually did not discover the sequence which had been described in Indian mathematics long ago. It was Leonardo Fibonacci who <em>introduced the sequence to Western European mathematic s</em> through the used in his important book ”Liber Abaci” (Book of Calculation) in 1202 were he used the sequence trying to explain the population of rabbits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*i62j9I4_eTfXpWPcHr1KIQ.jpeg" /><figcaption>Leonardo considers a hypothetical situation where there is a pair of rabbits put in the field. They mate at the end of one month and by the end of the second month the female produces another pair. The rabbits never die, mate exactly after a month and the females always produce a pair (one male, one female). The puzzle that Fibonacci posed was: how many pairs will there be in one year? If one calculates then one will find that the number of pairs at the end of nth month would be Fn or the nth Fibonacci number. Thus the number of rabbit pairs after 12 months would be F12 or 144.</figcaption></figure><h3>Fibonacci and the Golden Ration</h3><p>As you might already know the sequence starts with 1 and 1, after that, each new number is the product of adding the previous two numbers. So you end up with</p><p><strong><em>1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144…</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*keS1Io-VsoLjotdcOS34iA.gif" /></figure><p>If you divide the numbers for example 144/89 you end up with a number of <strong><em>1.618</em></strong> which is considered to be the “Golden Number or Golden Ratio”</p><p>The proportion is also said to be aesthetically pleasing due to which several artists and architects, including <em>Salvador Dali</em> and <em>Le Corbusier</em>, have proportioned their work close to the golden ratio. The Fibonacci sequence and the golden ratio are intimately interconnected. The ratio of consecutive Fibonacci numbers <em>converges and approaches the golden ratio</em> and the closed-form expression for the Fibonacci sequence involves the golden ratio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*ZNmg_t35QpviDcT8XiuL-Q.gif" /><figcaption>Each line is 1.618… times longer than the one before it. (Conversely, a section drawn at 0.618 (or 61.8%) of each line equals the length of the one before it.)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*AH2OwwlJXKoBnEY6_d6sjw.png" /><figcaption>A <a href="https://en.wikipedia.org/wiki/Golden_rectangle">golden rectangle</a> (in pink) with longer side <strong><em>a</em></strong> and shorter side <strong><em>b</em></strong>, when placed adjacent to a square with sides of length <strong><em>a</em></strong>, will produce a <a href="https://en.wikipedia.org/wiki/Similarity_(geometry)">similar</a>golden rectangle with longer side <strong><em>a + b</em></strong>and shorter side <strong><em>a</em></strong>. This illustrates the relationship {\displaystyle {\frac {a+b}{a}}={\frac {a}{b}}\equiv \varphi }</figcaption></figure><p>A Fibonacci spiral is a series of connected quarter-circles drawn inside an array of squares with Fibonacci numbers for dimensions. The squares fit perfectly together because of the nature of the sequence, where the next number is equal to the sum of the two before it. Any two successive Fibonacci numbers have a ratio very close to the Golden Ratio, which is roughly 1.618034. The larger the pair of Fibonacci numbers, the closer the approximation. The spiral and resulting rectangle are known as the Golden Rectangle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*U5XxfH2nGGsmKH_MmtkPzA.png" /></figure><h3>Why I think this sequence is so fascinating.</h3><p>The Fibonacci numbers describe a variety of phenomena in art, music, and nature. The numbers of spirals on most pinecones and pineapples are Fibonacci numbers. The arrangement of leaves or branches on the stems of many plants are Fibonacci numbers. On a piano, the number of white (8) keys and black (5) keys in each octave (13) are all Fibonacci numbers. The lengths and widths of many rectangular objects such as index cards, windows, playing cards, and light-switch plates are consecutive Fibonacci numbers.</p><h3>Fibonacci in Nature</h3><p>Sunflowers are excellent examples of the Fibonacci sequence because the seed heads in the centre of the flower are organized in two sets of spirals — short ones running clockwise from the centre, and longer ones running counter-clockwise. If you count the spirals in a consistent manner, apparently you will always find a Fibonacci number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*NImRsK7uaIEkiccQ2K2m9g.jpeg" /></figure><p>The Fibonacci sequence can also be seen in the way tree branches form or split. A main trunk will grow until it produces a branch, which creates two growth points. Then, one of the new stems branches into two, while the other one lies dormant. This pattern of branching is repeated for each of the new stems. A good example is the sneezewort. Root systems and even algae exhibit this pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*ugtWFmyksbrvcZ7f787QCA.jpeg" /></figure><p>Here are a couple more examples where you could find the fibonacci spiral in nature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*YCdwK0Jn3waiHo9Tmo5pDQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZrhOu3GBFc_jx2SISjqLaw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Z8as2-VqtdthwuVoe4UT6Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*ill2Utlr7vee-cvlmaFMaw.jpeg" /></figure><p>Not surprisingly, spiral galaxies also follow the familiar Fibonacci pattern. The Milky Way has several spiral arms, each of them a logarithmic spiral of about 12 degrees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*apU1U-GZWKISwsVzgX5xUA.jpeg" /></figure><h3>Fibonacci in the human body</h3><p>There are many examples but let me use the hand and in particular the finger to demonstrate the accurance of fibunacci.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*idoDyNk9WeHXL7z4G-O9kg.gif" /></figure><p>Each section of your index finger, from the tip to the base of the wrist, is larger than the preceding one by about the Fibonacci ratio of 1.618, also fitting the Fibonacci numbers 2, 3, 5 and 8</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*9VRw6L6mt324gIT97xZUkA.png" /></figure><h3>Fibonacci in Photography and art</h3><p>In photography the phi grid is the interpolation of the fib spiral and is these days, considered to be a fundamental technique to establish a pleasing composition in a frame. The goal is to align your subject with the lines created by the spiral or use it as a kind of separator to create the right feel for a frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XJyH9jpWl6EWePA2hXUaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jNQfU-Y-sDM1GBsPxnGmog.png" /></figure><p>As you can see there are plenty of examples where the fibunacci sequence appears all around us and we don’t pay attention to this mathematical miracle that feels like a mysterious quotient bringing a universal form of harmony to elements of nature mathematic musics art.</p><p>Also I found the single reason why Donald Trump was elected president…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*ehV_-Af7kt-OWMO8TueNJQ.jpeg" /></figure><p>So never underestimate the hidden powers of the Fibonacci sequence.</p><p>Sources</p><ul><li><a href="https://theresakishkan.com/2013/08/06/spirals-and-sequences/">spirals and sequences</a></li><li><a href="https://petapixel.com/2016/10/24/golden-ratio-better-rule-thirds/">Why The Golden Ratio Is Better Than The Rule Of Thirds</a></li><li><a href="https://en.wikipedia.org/wiki/Fibonacci_number">Fibonacci number - Wikipedia</a></li><li><a href="https://www.goldennumber.net/human-hand-foot/">Human Hand and Foot - Phi 1.618: The Golden Number</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fda3b76a8e37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Collaborating Workflow in GitHub and a Helper Called Stash]]></title>
            <link>https://medium.com/@WolfgangPfretzschner/collaborating-workflow-in-github-and-a-little-helper-called-stash-8cfb6fa729c6?source=rss-cf3f35f1b21d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cfb6fa729c6</guid>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Wolfgang Pfretzschner]]></dc:creator>
            <pubDate>Wed, 27 Jun 2018 13:43:01 GMT</pubDate>
            <atom:updated>2018-06-27T17:18:56.806Z</atom:updated>
            <content:encoded><![CDATA[<p>The goal of this blog is to improve your work-flow and level of comfort when using Git and GitHub. Most of us use it everyday and yet we handle it like a raw egg because we don’t want to break something or even worst delete code we just wrote.</p><p>So lets walk through a scenario where we initialize a new project and want to collaborate with a team member. We want to make sure:<br>-&gt;everybody has access to the code,<br>-&gt;nothing gets deleted by accident,<br>-&gt;everybody can work on their own version of the project so it <br>-&gt;can be merged later on.</p><p>There are two basic collaboration strategies.</p><p><strong>1.Shared Repository Model</strong></p><p><strong>2. Fork and Pull Model</strong></p><p>Here we will be focusing on the shared repository model. This is usually used for smaller projects where collaborators have push and pull access to the central repo. So we have to be careful with what we are doing.</p><p>Let’s get a new project started from inside the CLI.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dba1206a142f0af9889c9a51d1ce1af5/href">https://medium.com/media/dba1206a142f0af9889c9a51d1ce1af5/href</a></iframe><p>For now our repository is empty -&gt; Lets add some files -&gt; Add them to staging and commit them to the repository. Notice how we now have a (master) branch on line 73</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c7dd4d97cc486f0fe82a4388dd4c27c/href">https://medium.com/media/6c7dd4d97cc486f0fe82a4388dd4c27c/href</a></iframe><p>Next head over to your GitHub and create a repository inside your account.</p><ul><li>Go to <a href="https://github.com/">github</a>.</li><li>Log in to your account.</li><li>Click the <a href="https://github.com/new">new repository</a> button in the top right. You’ll have an option there to initialize the repository with a README file.</li><li>Click the “Create repository” button.</li><li>After this you will see this screen. We have already called git init and also git commit -m &quot;first commit&quot; . So just copy the the highlighted line with the git address and run this in your terminal.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXuDleCjpJQCxBN6vMUgFA.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0fce98c7ec339296b8fa4558ca0e6e8/href">https://medium.com/media/a0fce98c7ec339296b8fa4558ca0e6e8/href</a></iframe><p>Nice! Now that we have a project to work on which is connected to GitHub, lets invite a collaborator! In order to do this we just follow the simple steps outlined on the GitHub site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQJqUEufPNXZHsqlmJr5nw.png" /></figure><p>Now the collaborator has to clone the code down to his/her local machine.<br>The important part here is to make a copy of the master branch right away. git checkout -b MyNewBranch<br>If you want to create another branch and download the remote repository in one step:</p><pre>git checkout -t origin/branch-name</pre><p>As always make your changes on your branch and stage them with git add, commit your changes locally with git commit -m &quot;description of your commit” and upload the changes (including your new branch) to GitHub with git push origin MyNewBranch.</p><p>Now the file can be merged into the master from either branch of each collaborator: <br>git checkout &lt;branch_master&gt; followed by <br>git merge &lt;feature_branch&gt;.<br>To compare the two branches and see their changes in the terminal we can call git diff on them as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a23c9343a52d90c2697d053e590b1707/href">https://medium.com/media/a23c9343a52d90c2697d053e590b1707/href</a></iframe><p>This is pretty much the workflow of a shard repository model.</p><h3>Stashing your work</h3><p>Now here is an interesting scenario. Let’s say you are working on your branch and would like to checkout another branch a collaborator just pushed to the project to work on. You want to checkout of your branch but you can’t!! Oh no. Since you have not staged and committed your changes yet you are stuck in your branch until you finish your work… or are you?</p><p>No! You have this…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0O-BTyEmo7goCDx9cklnNg.jpeg" /></figure><p><strong>No,</strong> you have a “<strong>get out of Branch Free</strong>” card. It is called git stash and it makes working with branches a lot more flexible. Let me tell you about it.</p><p>Stashing takes the ‘dirty state’ of your working directory — that is, your modified tracked files and staged changes — and saves it on a stack of unfinished changes that you can reapply at any time.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/12e5ffce7011d79250a9dfae6f1701fe/href">https://medium.com/media/12e5ffce7011d79250a9dfae6f1701fe/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac0ee68e105f5b416e1f98d162aa3918/href">https://medium.com/media/ac0ee68e105f5b416e1f98d162aa3918/href</a></iframe><p>Now you want to switch branches, but you don’t want to commit what you’ve been working on yet; so you’ll stash the changes. Just run git stash:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f8c978b5b9b676bd191ae0d62598295/href">https://medium.com/media/0f8c978b5b9b676bd191ae0d62598295/href</a></iframe><p>Now your working directory is empty. That means all the changes to the files are reverted and stored in the stash.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0e038ba5d8ed9993aff459554491a4a/href">https://medium.com/media/f0e038ba5d8ed9993aff459554491a4a/href</a></iframe><p>At this point, you can easily switch branches and do work elsewhere. Your changes are stored on your stack. To see which stashes you’ve stored, you can use git stash list:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/447910c3e1bf7e6b84f593892ff497d4/href">https://medium.com/media/447910c3e1bf7e6b84f593892ff497d4/href</a></iframe><p>In this example, two stashes were created previously, so you have access to three different stashed works.</p><p>The git stash show command shows you the changes in the last stash.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e34d6ca18595250a0ee184a50e152d5e/href">https://medium.com/media/e34d6ca18595250a0ee184a50e152d5e/href</a></iframe><p>Reapply stashes:</p><p>You can reapply the one you just stashed by using the command shown in the help output of the original stash command: <br>git stash apply. <br>If you want to apply one of the older stashes, you can specify it by naming it, like this: <br>git stash apply stash@{2}. <br>If you don’t specify a stash, Git assumes the most recent stash and tries to apply it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/304401d42b0bfa4f01872e8a52f571c7/href">https://medium.com/media/304401d42b0bfa4f01872e8a52f571c7/href</a></iframe><p>You can even save a stash on one branch, switch to another branch later, and try to reapply the changes. You can also have modified and uncommitted files in your working directory when you apply a stash.</p><p>If you would like to delete the stashes you can just call drop on</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b05b08e691cefe77c13a2dfea3f0de4c/href">https://medium.com/media/b05b08e691cefe77c13a2dfea3f0de4c/href</a></iframe><p>Lastly I would like to mention that you can create a new branch from a stash. Just call git stash branch &lt;branch_name&gt; and a new branch with the stash changes will be generated for you.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1ed720b70f115275f46b4a4da2c8cbf/href">https://medium.com/media/f1ed720b70f115275f46b4a4da2c8cbf/href</a></iframe><h3>Conclusion</h3><p>There are many different workflows, and tools available when working with Git. Understanding how to compare branches, and using tools like stash will solidify your process and help you move more freely between branches and eventually you will become a GOAT (à la <em>“greatest of all time” by LL Cool J).</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F1ntLC9V0TGkEw%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fgoat-goats-hairdo-1ntLC9V0TGkEw&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F1ntLC9V0TGkEw%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="429" frameborder="0" scrolling="no"><a href="https://medium.com/media/48f2b73b2f227bed01ac08b01e7a029b/href">https://medium.com/media/48f2b73b2f227bed01ac08b01e7a029b/href</a></iframe><p>Resources:</p><ul><li><a href="https://git-scm.com/docs/git-stash">Git - git-stash Documentation</a></li><li><a href="https://git-scm.com/book/en/v1/Git-Tools-Stashing">Git - Stashing</a></li><li><a href="https://uoftcoders.github.io/studyGroup/lessons/git/collaboration/lesson/">Collaborating on GitHub</a></li><li><a href="http://guides.beanstalkapp.com/version-control/branch-comparisons.html">An introduction to version control * Beanstalk Guides</a></li><li><a href="https://uoftcoders.github.io/studyGroup/lessons/git/collaboration/lesson/">Collaborating on GitHub</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cfb6fa729c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>