<?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: Julio Jimenez</title>
    <description>The latest articles on DEV Community by Julio Jimenez (@juliojimenez).</description>
    <link>https://dev.to/juliojimenez</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%2F532925%2F6455936c-bcb8-4120-a5d2-ccc362e15b8f.jpeg</url>
      <title>DEV Community: Julio Jimenez</title>
      <link>https://dev.to/juliojimenez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/juliojimenez"/>
    <language>en</language>
    <item>
      <title>VS Code: Forget History On Launch</title>
      <dc:creator>Julio Jimenez</dc:creator>
      <pubDate>Fri, 29 Jan 2021 17:26:09 +0000</pubDate>
      <link>https://dev.to/juliojimenez/vs-code-forget-history-on-launch-5c9n</link>
      <guid>https://dev.to/juliojimenez/vs-code-forget-history-on-launch-5c9n</guid>
      <description>&lt;p&gt;During a recent CTF challenge I had changed my laptop's power settings to not go to sleep while on battery.  Of course, I forgot to change it back. So after it being unplugged all night it was as dead as a doorknob this morning.&lt;/p&gt;

&lt;p&gt;I plugged it in, powered on, and fired up VS Code to keep hacking away at things. However, at the moment the laptop died I had about 10 separate VS Code windows with 5-10 files open in each. This is exactly what VS Code wanted to open again, all at once, and things were not going well.&lt;/p&gt;

&lt;p&gt;The only other apps running were a terminal window and Chrome with 44 tabs...nothing right? I mean a Pixelbook Go i7 with 16GB of memory should be able to handle that 🤷&lt;/p&gt;

&lt;p&gt;Regardless, I would prefer VS Code not remembering everything that was open on a cold start. It is also worth mentioning that I have Auto Save on.&lt;/p&gt;

&lt;h2&gt;
  
  
  stackoverflow, ftw
&lt;/h2&gt;

&lt;p&gt;Thanks to &lt;a href="https://stackoverflow.com/a/65217427/1820006"&gt;this&lt;/a&gt; very underrated answer I was able to quickly get back to business.&lt;/p&gt;

&lt;p&gt;I created &lt;code&gt;~/.vscode/tasks.json&lt;/code&gt; and &lt;code&gt;~/.vscode/launch&lt;/code&gt; as follows:&lt;/p&gt;

&lt;h3&gt;
  
  
  tasks.json
&lt;/h3&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;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tasks"&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="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"clear-editor-history"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${command:workbench.action.clearEditorHistory}"&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;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="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  launch
&lt;/h3&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;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"configurations"&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="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"preLaunchTask"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"clear-editor-history"&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;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="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Relaunch
&lt;/h2&gt;

&lt;p&gt;Because of the unstable state VS Code was in I went ahead and rebooted my machine, but now VS Code only launches what I ask it to. For added sugar, recent projects can still be found under &lt;strong&gt;Recent&lt;/strong&gt; in the Welcome tab 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Not a technically riveting article, but it was something that got me out of a tight spot, offered as an unaccepted answer in Stack Overflow.&lt;/p&gt;

&lt;p&gt;Hopefully this short article helps someone in a similar predicament, and if it does, please up-vote the Stack Overflow answer to which we're crediting this solution to.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>editor</category>
      <category>ide</category>
      <category>code</category>
    </item>
    <item>
      <title>Processing YAML In GitHub Workflows</title>
      <dc:creator>Julio Jimenez</dc:creator>
      <pubDate>Fri, 11 Dec 2020 16:54:23 +0000</pubDate>
      <link>https://dev.to/juliojimenez/processing-yaml-in-github-workflows-4en2</link>
      <guid>https://dev.to/juliojimenez/processing-yaml-in-github-workflows-4en2</guid>
      <description>&lt;p&gt;My team deploys infrastructure to the cloud using GitHub Workflows, allowing us to validate, test, and flexibly build infrastructure-as-code prior to applying changes. To target specific environments and solutions, we have developed global and per-project YAML configurations to accompany our workflow matrix strategy.&lt;/p&gt;

&lt;p&gt;To use these configurations, we need something in our workflow to read them. The GitHub Marketplace has a wide selection of YAML validators and linters, but only a couple of actual YAML processors.&lt;/p&gt;

&lt;p&gt;At the time of this writing, the processors in existence were of varying degrees of functionality and reliability, either in their ability, or inability, to set GitHub Workflow output variables by default, leaving the developer to add additional steps in creating the variables.  Others had the right idea as described in their README, but the action itself would not execute due to errors.&lt;/p&gt;

&lt;p&gt;As a temporary solution to unblock ourselves from jobs failing because of non-working actions, I came up with what I called the “Poor Man’s YAML Processor”, it is not pretty but it got the job done for the day.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- name: 'Config'
  run: echo "::set-output name=foo::$(echo $(egrep "^foo\:\ [^\S]*" .ci_config.yaml | cut -d':' -f2 | sed s/\S//g))"
  id: config

- name: ‘Use The Output’
  Run: echo “${{ steps.config.outputs.foo }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Enter The Dragon
&lt;/h1&gt;

&lt;p&gt;Try doing this for more than two values in your GitHub Workflow config file, and you will quickly feel the pain.  Enter the dragon...err...&lt;a href="https://github.com/marketplace/actions/yamler"&gt;yamler&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;yamler&lt;/strong&gt; is a GitHub Action that processes an entire YAML document and makes all elements available as GitHub Workflow output variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- name: yamler
  uses: juliojimenez/yamler@v0
  id: yamler
  with:
    yaml-file: "example.yaml"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say our example.yaml file contains the following...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;foo: bar
bar: foo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can access these key/values as GitHub Workflow output variables from the yamler step above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use the output from the yamler step
- name: Output
run: |
  echo "${{ steps.yamler.outputs.foo }}"
  echo "${{ steps.yamler.outputs.bar }}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;yamler preserves document structure using double-underscore (&lt;code&gt;__&lt;/code&gt;) notation. If a value is located at &lt;code&gt;foo.bar&lt;/code&gt;, the yamler output variable will become &lt;code&gt;foo__bar&lt;/code&gt;. Arrays are indexed in a similar way, the element &lt;code&gt;bar.foo[5]&lt;/code&gt; can be accessed with yamler at &lt;code&gt;bar__foo__5&lt;/code&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Faster Than Green Grass Through A Goose
&lt;/h1&gt;

&lt;p&gt;I was pheasantly surprised at our GitHub Check time savings after switching to yamler from the &lt;em&gt;other&lt;/em&gt; processor. The reason for this is that yamler is written in Typescript (which compiles to Javascript), and our previous processor was installed from a Docker container, which took almost an entire minute.&lt;/p&gt;

&lt;p&gt;You can find more information about different types of actions and creating your own actions &lt;a href="https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/about-actions"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for reading, and I hope yamler makes someones day easier. Drop us a star!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/marketplace/actions/yamler"&gt;https://github.com/marketplace/actions/yamler&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/juliojimenez/yamler"&gt;https://github.com/juliojimenez/yamler&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>yaml</category>
      <category>typescript</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
