<?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: Steve Klassen (They/Them)</title>
    <description>The latest articles on DEV Community by Steve Klassen (They/Them) (@mrxinu).</description>
    <link>https://dev.to/mrxinu</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%2F22321%2F71a9c682-4b68-44e5-955e-7d8cc8a4bae5.jpg</url>
      <title>DEV Community: Steve Klassen (They/Them)</title>
      <link>https://dev.to/mrxinu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mrxinu"/>
    <language>en</language>
    <item>
      <title>Git Log Clears Screen</title>
      <dc:creator>Steve Klassen (They/Them)</dc:creator>
      <pubDate>Mon, 03 May 2021 14:45:32 +0000</pubDate>
      <link>https://dev.to/mrxinu/git-log-clears-screen-54cd</link>
      <guid>https://dev.to/mrxinu/git-log-clears-screen-54cd</guid>
      <description>&lt;p&gt;I'm completely new to Mac and one of the things that kept cropping up was the output of a command showing up and then clearing as soon as I exited it (e.g., git log).&lt;/p&gt;

&lt;p&gt;I thought I had slain that dragon with a desperate plea to my Twitter timeline, but I was having to add one for each git command for which I didn't want the behavior. And I'm not even entirely sure blowing away paging entirely even made sense.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pager.branch&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false
&lt;/span&gt;pager.status&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false
&lt;/span&gt;pager.diff&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally this morning I happened upon &lt;a href="https://serebrov.github.io/html/2014-01-04-git-log-and-less-keep-output.html"&gt;this article&lt;/a&gt; from 2014 that had the following suggesting I add it to my &lt;code&gt;.zshrc&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="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LESS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;-iXFR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally it's solved and I could cry happy tears.&lt;/p&gt;

</description>
      <category>git</category>
      <category>clearing</category>
      <category>less</category>
      <category>zsh</category>
    </item>
    <item>
      <title>Generating UTC Timestamps for Postman Requests</title>
      <dc:creator>Steve Klassen (They/Them)</dc:creator>
      <pubDate>Sun, 06 Sep 2020 00:26:32 +0000</pubDate>
      <link>https://dev.to/mrxinu/generating-utc-timestamps-for-postman-requests-4k7g</link>
      <guid>https://dev.to/mrxinu/generating-utc-timestamps-for-postman-requests-4k7g</guid>
      <description>&lt;p&gt;&lt;strong&gt;Update: Evidently using &lt;code&gt;new Date().toISOString()&lt;/code&gt; works just fine and avoids all this moment lib nonsense. Much &amp;lt;3 to Josh &amp;amp; Liv for the update to my brain.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You're using Postman, like you do, to test your API endpoints before you get into the code. You're going through the POST request and building that JSON when you get to the part where it wants a timestamp in UTC. Hmm, alright, well you probably don't want to have to create a fresh timestamp every time.&lt;/p&gt;

&lt;p&gt;Enter JavaScript and Postman's excellent choice to give us access to the Moment library which you can read more about at &lt;a href="http://www.momentjs.com"&gt;www.momentjs.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For this particular request we need two things: the current UTC timestamp, and a later UTC timestamp (7 days later, for this example). First we'll import the library and then we'll use it, setting two environment variables using the built-in &lt;code&gt;pm.environment.set&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;moment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;moment&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;pm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;now&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;moment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;utc&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;toJSON&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;pm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;later&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;moment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;utc&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;days&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toJSON&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all there is to it! Drop that into the pre-request script area of your request and that'll run before the request is submitted to the endpoint.&lt;/p&gt;

&lt;p&gt;To make use of the timestamps, embed them where appropriate in your JSON request with double curly-braces around them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"nodes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"unmanageFrom"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{{now}}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"unmanageUntil"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{{later}}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"relativeTime"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're using a relatively recent version of Postman, the variable will turn orange even though they're inside a string. if they're red, you've either misspelled them in your JavaScript or in your request. Give it a closer look.&lt;/p&gt;

</description>
      <category>postman</category>
      <category>javascript</category>
      <category>time</category>
    </item>
  </channel>
</rss>
