<?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>Forem: Daniel Florido</title>
    <description>The latest articles on Forem by Daniel Florido (@pixelstorm).</description>
    <link>https://forem.com/pixelstorm</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%2F992639%2F934980a8-05b7-4648-9b65-bf4197a485af.png</url>
      <title>Forem: Daniel Florido</title>
      <link>https://forem.com/pixelstorm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/pixelstorm"/>
    <language>en</language>
    <item>
      <title>Keeping the tedious fun with Curl.</title>
      <dc:creator>Daniel Florido</dc:creator>
      <pubDate>Mon, 19 Dec 2022 05:27:24 +0000</pubDate>
      <link>https://forem.com/pixelstorm/keeping-the-tedious-fun-with-curl-7ai</link>
      <guid>https://forem.com/pixelstorm/keeping-the-tedious-fun-with-curl-7ai</guid>
      <description>&lt;p&gt;I like to keep the day job fun and productive by semi automating the everyday tediousness of web development.&lt;br&gt;
The main reason I use curl is to search a file to see if a webpage has the desired string or not.&lt;br&gt;
Its nice to be able to stay on the commandline to do this as its quicker then the manual process of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  open chrome,&lt;/li&gt;
&lt;li&gt;  right click,&lt;/li&gt;
&lt;li&gt;  view source code,&lt;/li&gt;
&lt;li&gt;  command f to find the string&lt;/li&gt;
&lt;li&gt;  bang head against monitor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Running the curl function below allows me to open the returned html in my favourite code editor, Vim.&lt;/p&gt;

&lt;p&gt;This way i can easily search the returned source code by simple typing '/string_name'.&lt;/p&gt;
&lt;h2&gt;
  
  
  function to add to bash_profile
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#get and open webpage html&lt;/span&gt;
&lt;span class="c"&gt;#provide url as param&lt;/span&gt;
&lt;span class="c"&gt;#keep it simple - doesnt work if you make it too complicated&lt;/span&gt;
&lt;span class="k"&gt;function &lt;/span&gt;get_html&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
   &lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads
    &lt;span class="nb"&gt;rm &lt;/span&gt;curled_html.html
    curl &lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Cache-Control: no-cache, no-store, must-revalidate"&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Pragma: no-cache"&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Expires: 0"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; curled_html.html
    vim curled_html.html
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;get_html https://example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>career</category>
      <category>vue</category>
      <category>react</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
