<?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: a</title>
    <description>The latest articles on DEV Community by a (@annihil).</description>
    <link>https://dev.to/annihil</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%2F133589%2Feeadcbb4-12bf-4ff3-8e45-471ecb8bcb99.png</url>
      <title>DEV Community: a</title>
      <link>https://dev.to/annihil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/annihil"/>
    <language>en</language>
    <item>
      <title>👨‍🚀 Revolut Emergency: Story time of building an Electron React app</title>
      <dc:creator>a</dc:creator>
      <pubDate>Mon, 04 Nov 2019 08:06:07 +0000</pubDate>
      <link>https://dev.to/annihil/revolut-emergency-story-time-of-building-an-electron-react-app-3ebl</link>
      <guid>https://dev.to/annihil/revolut-emergency-story-time-of-building-an-electron-react-app-3ebl</guid>
      <description>&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Annihil"&gt;
        Annihil
      &lt;/a&gt; / &lt;a href="https://github.com/Annihil/revolut-emergency"&gt;
        revolut-emergency
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      👨‍🚀 Unofficial Revolut PC app – Freeze cards, list transactions, get notifications, contact support
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;
    &lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/5acc8d3f0c4f3dd933318ae5ec689ba1687d5e4f/68747470733a2f2f692e696d6775722e636f6d2f4a493472445a612e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/5acc8d3f0c4f3dd933318ae5ec689ba1687d5e4f/68747470733a2f2f692e696d6775722e636f6d2f4a493472445a612e706e67" height="150" width="150"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;This small app let you&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;See transactions of all your pockets (split or unified view)&lt;/li&gt;
&lt;li&gt;Freeze your cards&lt;/li&gt;
&lt;li&gt;See your pockets' balance&lt;/li&gt;
&lt;li&gt;Get system notifications of new transactions&lt;/li&gt;
&lt;li&gt;Contact customer support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;in case of emergency such as loss of phone.&lt;/p&gt;

&lt;p&gt;
    &lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/048cfec5b99ee2dcca5d82d401a96cb6333b26d6/68747470733a2f2f692e696d6775722e636f6d2f576946466e6a772e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/048cfec5b99ee2dcca5d82d401a96cb6333b26d6/68747470733a2f2f692e696d6775722e636f6d2f576946466e6a772e706e67"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/824161ec84326c429d8a7fa497eaaa9bf1d24e10/68747470733a2f2f692e696d6775722e636f6d2f715853643839492e676966"&gt;&lt;img src="https://camo.githubusercontent.com/824161ec84326c429d8a7fa497eaaa9bf1d24e10/68747470733a2f2f692e696d6775722e636f6d2f715853643839492e676966" alt=""&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/8e0a885c4f3d9a79366ba76e11237151dcfa6418/68747470733a2f2f692e696d6775722e636f6d2f3468494e35354d2e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/8e0a885c4f3d9a79366ba76e11237151dcfa6418/68747470733a2f2f692e696d6775722e636f6d2f3468494e35354d2e706e67" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Annihil/revolut-emergency/releases/latest/download/r-emergency.dmg"&gt;Download for macOS&lt;/a&gt; •
&lt;a href="https://github.com/Annihil/revolut-emergency/releases/latest/download/r-emergency.exe"&gt;Download for Windows&lt;/a&gt; •
&lt;a href="https://github.com/Annihil/revolut-emergency/releases/latest/download/r-emergency.snap"&gt;Download for Linux&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
Install from source&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;Clone or download this repository&lt;/li&gt;
&lt;li&gt;Install NodeJS&lt;/li&gt;
&lt;li&gt;Open a terminal and &lt;code&gt;cd&lt;/code&gt; to the downloaded folder&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;npm install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;npm start&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Enjoy 🙂
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;
Troubleshooting&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;I did not receive an SMS verification code?
The first time you log in with the desktop app, since it is a new device, the verification code will be sent via email, you can find it &lt;a href="https://github.com/Annihil/revolut-emergency/wiki/How-to-login-with-email"&gt;this way&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;I cannot open the app on macOS (unidentified developer)
Instead of double clicking on the R Emergency.app, right click → Open
If that is still not enough, you will have to go to…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Annihil/revolut-emergency"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Living in the UK, it is almost impossible not to be tempted to try the new challenger banks such as Revolut, Starling and Monzo. I am currently using Revolut as my main bank account and felt the need to access it from my computer.&lt;/p&gt;

&lt;p&gt;Alas, Revolut does not offer a web app and it does not seem to be in their pipeline, so I went ahead and started building a small web app for my personal use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lHpntTI_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7hnzba7oq0x4juwog1ll.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lHpntTI_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7hnzba7oq0x4juwog1ll.gif" alt="Login"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I quickly found that I could not hit their API in a browser, preflights requests were blocked due to a lack of CORS headers.&lt;br&gt;
So I started looking at ElectronJS, making the requests using NodeJS and bridging the results using Electron IPC mechanism.&lt;/p&gt;

&lt;p&gt;It was too cumbersome, so I started checking at another way of making http requests from the renderer side without obeying CORS. One way would be to disable web securities in the chrome flags, but since the app would be to access my bank, it wouldn't be a good idea, so I opted to enable node integration, and used Axios with node's http adapter. It works seamlessly albeit not being able anymore to see requests in the devtools.&lt;/p&gt;

&lt;p&gt;For security reasons, I wanted to use SSL certificate pinning but it turned out Axios does not provide this option out of the box so I submitted a &lt;a href="https://github.com/axios/axios/pull/2498"&gt;PR&lt;/a&gt; to add it, this way NodeJS rejects http requests if the fingerprint of the certificate does not match our pinned fingerprint, preventing proxy eavesdropping.&lt;/p&gt;

&lt;p&gt;The second problem that I faced was that the list of my transactions was large, containing 2000+ items (hey please don't judge :p) &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ATDSsE6a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/qFtpEL4.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ATDSsE6a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/qFtpEL4.gif" alt=""&gt;&lt;/a&gt; React was taking a long time rendering it all at once.&lt;br&gt;
I did not want to use react-virtualized, mostly because I had poor experiences using it in the past and that it would break searching in the dom for text, so I opted to manually delay the rendering of items in the list using a react hook, and to reduce memory footprint and improve scrolling performance, I chose to use the WebComponent &lt;code&gt;&amp;lt;virtual-scroller&amp;gt;&lt;/code&gt; since Electron gives us the ability to enable experimental blink flags. The main drawback of using that WebComponent is that list items must be &lt;code&gt;display: block&lt;/code&gt; and since I am a big fan of &lt;code&gt;display: flex&lt;/code&gt; everywhere, I had to style the old fashion way again ...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wL50l-nE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c9jf8iogtn3j6zp9n1h5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wL50l-nE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c9jf8iogtn3j6zp9n1h5.gif" alt="App"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the navigation, I decided not to use react-router as it is a rather simple app. Electron does not show URL anyway, so I shouldn't have to deal with routes. Instead, I used a combination of localStorage and React Context API, and was satisfied of the outcome.&lt;br&gt;
For animations, I used React-Lottie to have lightweight, high frame rate, JS/SVG animations.&lt;br&gt;
Most of the application were made with React using Styled Components.&lt;br&gt;
To render the cards, I had to absolute position text elements on a div with rounded corners and pick the same font as credit cards use: OCRA10. The end result is pretty close to what the mobile app displays.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WzUcMgnR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/k63wypl6rfbxajhu72qf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WzUcMgnR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/k63wypl6rfbxajhu72qf.gif" alt="Cards"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading the journey of this small app, be sure to check out &lt;a href="https://github.com/Annihil/revolut-emergency"&gt;the repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w7lOCAQ2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/Q5RljvB.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w7lOCAQ2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/Q5RljvB.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>react</category>
      <category>electron</category>
    </item>
    <item>
      <title>👾 GitHub Spray: Draw on your GitHub contrib graph</title>
      <dc:creator>a</dc:creator>
      <pubDate>Sat, 02 Feb 2019 14:06:23 +0000</pubDate>
      <link>https://dev.to/annihil/github-spray-4e7n</link>
      <guid>https://dev.to/annihil/github-spray-4e7n</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--anR4B00T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://i.imgur.com/nPZyGNo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--anR4B00T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://i.imgur.com/nPZyGNo.gif" width="600" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This may sound like a pointless project, but truth is, we all love to differentiate ourselves from others, and perhaps you might like to have this small touch on your GitHub page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Annihil/github-spray" rel="noopener noreferrer"&gt;This open source CLI&lt;/a&gt;, available as an npm module, gives you the ability to "spray"  your GH profile page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7yo67dr4sgnt3hl46kh9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7yo67dr4sgnt3hl46kh9.png" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The naming idea comes from Counter Strike, where you could spray walls with your custom image, it was very popular, to the point that a very famous technique was to spray a sexy half naked lady on a wall to drag enemies' attention and annihilate them while their defenses were lowered.&lt;/p&gt;

&lt;p&gt;With this tool, you can draw on your 53 by 7 pixels calendar heatmap which is displayed on your profile.&lt;/p&gt;

&lt;p&gt;It already contains several fonts so that you can easily write text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;github-spray &lt;span class="nt"&gt;-t&lt;/span&gt; hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjvkoqb4q1q45yg3cvr4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjvkoqb4q1q45yg3cvr4.png" width="740" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Otherwise, you can be more creative and design your own pattern.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;github-spray &lt;span class="nt"&gt;-f&lt;/span&gt; my_octocat_heart_smiley_pattern.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1u5o0m3u6oyc69xd5q74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1u5o0m3u6oyc69xd5q74.png" width="800" height="103"&gt;&lt;/a&gt;&lt;br&gt;
I made &lt;a href="https://annihil.github.io/github-spray-generator/" rel="noopener noreferrer"&gt;an handy web app&lt;/a&gt; to ease the creation.&lt;/p&gt;

&lt;p&gt;It has numerous of options such as specifying the start date, the font, invert colors, adjust colors, flip horizontally or vertically the spray, set a repo origin url and push to it.&lt;/p&gt;

&lt;p&gt;You only live once, go for it: &lt;a href="https://github.com/Annihil/github-spray" rel="noopener noreferrer"&gt;GitHub Spray&lt;/a&gt; 🤙&lt;br&gt;
Btw, the spray isn't permanent, you can delete it by removing the repo 🙂&lt;/p&gt;

&lt;p&gt;Edit: &lt;strong&gt;Huge thanks to DEV Community&lt;/strong&gt; for making the repo appear on the &lt;a href="https://github.com/trending/javascript?since=daily" rel="noopener noreferrer"&gt;GitHub Javascript trending page&lt;/a&gt;,  I love you guys!! &amp;lt;3&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>github</category>
      <category>npm</category>
      <category>node</category>
    </item>
  </channel>
</rss>
