<?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: Sakari</title>
    <description>The latest articles on DEV Community by Sakari (@mskri).</description>
    <link>https://dev.to/mskri</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%2F220656%2Ff411fec9-3aaa-4413-913e-98484f535fb0.jpeg</url>
      <title>DEV Community: Sakari</title>
      <link>https://dev.to/mskri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mskri"/>
    <language>en</language>
    <item>
      <title>Converting opacity from percentage to hexadecimal in cli</title>
      <dc:creator>Sakari</dc:creator>
      <pubDate>Mon, 18 May 2020 18:41:29 +0000</pubDate>
      <link>https://dev.to/mskri/converting-opacity-from-percentage-to-hexadecimal-in-cli-4nj9</link>
      <guid>https://dev.to/mskri/converting-opacity-from-percentage-to-hexadecimal-in-cli-4nj9</guid>
      <description>&lt;p&gt;I have been working on my own color theme for the past couple of weeks. As I have been working with colors a lot I realized that I was checking this really useful &lt;a href="https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4"&gt;Hexadecimal color code for transparency&lt;/a&gt; gist multiple times per coding session to check what is e.g. 30% opacity in hex &lt;em&gt;(btw it's 4D, I got it memorized!)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Always checking the gist became tiring and over the weekend, I created this nifty npm package to quickly convert any opacity value into hex directly from my cli.&lt;/p&gt;

&lt;p&gt;You can install it with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @mskri/hex-opacity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed you can then run following command in your cli to get the percentage value in hexadecimal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hex-opacity &amp;lt;opacity value&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example converting 30% opacity to hexadecimal would be&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;hex-opacity 30
4D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check out the package at &lt;a href="https://www.npmjs.com/package/@mskri/hex-opacity"&gt;https://www.npmjs.com/package/@mskri/hex-opacity&lt;/a&gt;&lt;/p&gt;

</description>
      <category>npm</category>
    </item>
    <item>
      <title>Recording iOS simulator and Android device screen</title>
      <dc:creator>Sakari</dc:creator>
      <pubDate>Mon, 04 May 2020 18:06:43 +0000</pubDate>
      <link>https://dev.to/mskri/recording-ios-simulator-and-android-device-screen-1c1h</link>
      <guid>https://dev.to/mskri/recording-ios-simulator-and-android-device-screen-1c1h</guid>
      <description>&lt;p&gt;At work I like to add gifs or screenshots to pull requests to make it easier for my fellow developers and designers to review the changes. Its easier to show something visual than to explain it in text. I find videos especially helpful when showing steps to reproduce some complex bug.&lt;/p&gt;

&lt;p&gt;Gifs are great but sometimes they are not enough. For more longer and more complex things I wanted to figure out how take recording of iOS simulator and my Android test device screens. Have not had need for Android emulator recording yet.&lt;/p&gt;

&lt;p&gt;Turns out you can record iOS simulator without any additional software but Android requires you to download a tool. I am using Macbook so these are MacOS specific findings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recording iOS simulator screen
&lt;/h2&gt;

&lt;p&gt;For iOS recording simulator screen was pretty straightforward and it can be done via command line. I used to use Quicktime to record but once I found out about the cli command I have not used Quicktime. It is much more quicker to do a short recording versus Quicktime.&lt;/p&gt;

&lt;p&gt;You can record iOS simulator from cli with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;xcrun simctl io booted recordVideo file.mov
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To stop recording interrupt the command with &lt;code&gt;ctrl + c&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recording Android device screen
&lt;/h2&gt;

&lt;p&gt;Android is a bit more tricky and requires software to be installed. I found a tool called &lt;a href="https://github.com/Genymobile/scrcpy"&gt;srcpy&lt;/a&gt; which offered a way to record Android screen. It also allows you to mirror your device's screen. That's really useful for remote demos!&lt;/p&gt;

&lt;p&gt;You can record Android device screen from cli with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scrcpy &lt;span class="nt"&gt;--record&lt;/span&gt; file.mp4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To stop recording interrupt the command with &lt;code&gt;ctrl + c&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I prefer to limit the size of the recoded screen size using &lt;code&gt;-m size&lt;/code&gt; parameter. It makes the recording's max width or height be the given value (which ever goes above the maximum first).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scrcpy &lt;span class="nt"&gt;-m&lt;/span&gt; 720 &lt;span class="nt"&gt;--record&lt;/span&gt; file.mp4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Making life easier with bash aliases
&lt;/h2&gt;

&lt;p&gt;As I have started to use these commands often I have made my life easier with these two aliases.&lt;/p&gt;

&lt;p&gt;Adding these your &lt;code&gt;~/.bashrc&lt;/code&gt;, &lt;code&gt;~/.zshrc&lt;/code&gt; or other place where you keep your aliases allows you to record iOS simulator with &lt;code&gt;record-ios &amp;lt;filename&amp;gt;&lt;/code&gt; and &lt;code&gt;record-android &amp;lt;filename&amp;gt;&lt;/code&gt;.&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="c"&gt;# Record iOS simulator&lt;/span&gt;
&lt;span class="c"&gt;#   $1: filename, e.g. `recording`&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# To stop recording interrupt with `ctrl-c`&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Usage: `record-ios ~/Desktop/file`&lt;/span&gt;
&lt;span class="k"&gt;function &lt;/span&gt;record-ios&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  xcrun simctl io booted recordVideo &lt;span class="nv"&gt;$1&lt;/span&gt;.mov
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# Record Android device (requires https://github.com/Genymobile/scrcpy)&lt;/span&gt;
&lt;span class="c"&gt;#   $1: filename, e.g. `recording`&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# To stop recording interrupt with `ctrl-c`&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Usage: `record-android ~/Desktop/file`&lt;/span&gt;
&lt;span class="k"&gt;function &lt;/span&gt;record-android&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  scrcpy &lt;span class="nt"&gt;-m&lt;/span&gt; 720 &lt;span class="nt"&gt;--record&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt;.mp4
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>recording</category>
      <category>ios</category>
      <category>android</category>
    </item>
  </channel>
</rss>
