<?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: armstrca</title>
    <description>The latest articles on DEV Community by armstrca (@armstrca).</description>
    <link>https://dev.to/armstrca</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%2F1119799%2F0013dd9f-84a4-4bb7-8ea6-066cadfc18c1.png</url>
      <title>DEV Community: armstrca</title>
      <link>https://dev.to/armstrca</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/armstrca"/>
    <language>en</language>
    <item>
      <title>Umbrella project</title>
      <dc:creator>armstrca</dc:creator>
      <pubDate>Mon, 31 Jul 2023 15:23:58 +0000</pubDate>
      <link>https://dev.to/armstrca/umbrella-project-1aio</link>
      <guid>https://dev.to/armstrca/umbrella-project-1aio</guid>
      <description>&lt;p&gt;I think the hardest part of this project was keeping track of which sets of information in the external APIs were arrays and which were hashes. The second hardest part was printing out the "in x hours from now, there's a y% chance of precipitation" bit. &lt;br&gt;
At times, the code block variable "|x|" feels like a magic tool that just intuits whatever I'm thinking for it, so I think I need to review how it works. &lt;br&gt;
Additionally, there were a couple different times when I tried to just output incremented integers from 1-12 rather than, as the "possible solution" does, do it based on the relative time. But I seemed to have trouble figuring out how to do that in the brief and simple way I felt like I should be able to do. I would say that the first half of the code I wrote feels self-generated enough to me, whereas for the second half I relied more and more on the "possible_solution.rb" file.&lt;br&gt;
For the precipitation chart, I didn't really feel like I had much choice but to copy and paste most of the code, and then had to work with the GPT to figure out how to add x-axis labels. I also tried for a while to get the code to generate a visible y-axis even if all 12 hours showed 0 precipitation probability, but after various attempts with and without GPT help I gave up on that.&lt;br&gt;
The one last thing I might like to do to improve the code is to include a conditional for cases in which the user input is either not specific enough (i.e. "Springfield") or too poorly misspelled for Google's api to correct. Right now it just throws an error about an index being out of bounds.&lt;/p&gt;

&lt;p&gt;Here's the code in full:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require "http"
require "json"
require "ascii_charts"
pp "What location would you like weather info for?"
user_location = gets.chomp.gsub(" ","_")
gmaps_key = ENV.fetch("GMAPS_KEY")
google_url = "https://maps.googleapis.com/maps/api/geocode/json?address=#{user_location}&amp;amp;key=#{gmaps_key}"
user_location = user_location.gsub("_"," ")
gmaps_data = HTTP.get(google_url)
parsed_gmaps_data = JSON.parse(gmaps_data)
results = parsed_gmaps_data.fetch("results")
results2 = results.fetch(0)
geometry = results2.fetch("geometry")
location = geometry.fetch("location")
lat = location.fetch("lat")
lng = location.fetch("lng")

weather_key = ENV.fetch("PIRATE_WEATHER_KEY")
weather_url = "https://api.pirateweather.net/forecast/#{weather_key}/#{lat},#{lng}"

weather_data = HTTP.get(weather_url)
parsed_weather_data = JSON.parse(weather_data)
currently = parsed_weather_data.fetch("currently")
current_temperature = currently.fetch("temperature")
hourly = parsed_weather_data.fetch("hourly")
next_hour_summary = hourly.fetch("summary")
hourly_data_array = hourly.fetch("data")
hourly_data_hash = hourly_data_array.at(0)
first_hourly_precip = hourly_data_hash.fetch("precipProbability")

twelvehour_data_hash = hourly_data_array[1..12]


pp "The current temperature in #{user_location} is #{current_temperature} degrees Fahrenheit."
pp "The forecast for the next hour in #{user_location} is #{next_hour_summary}."
pp "The precipitation probability for the next hour in #{user_location} is #{(first_hourly_precip*100).round}%."

yesrainy = false
precipprob_array = []  
preciptime_array = []

twelvehour_data_hash.each do |hourly|
  precipprob = hourly.fetch("precipProbability")
  precipprob_array &amp;lt;&amp;lt; precipprob  

  if precipprob &amp;gt; 0.1
    yesrainy = true
    precip_time = Time.at(hourly.fetch("time"))
    seconds_from_now = precip_time - Time.now
    hours_from_now = seconds_from_now / 60 / 60
    pp "In #{hours_from_now.round} hours, there is a #{(precipprob*100).round}% chance of precipitation."
  else
    precip_time = Time.at(hourly.fetch("time"))
    seconds_from_now = precip_time - Time.now
    preciptime_array &amp;lt;&amp;lt; hours_from_now = (seconds_from_now / 60 / 60).round
  end
end


if yesrainy
  pp "You might want an umbrella today!"
else
  pp "You probably won't need an umbrella today."
end

x_axis_labels = (1..12).to_a
if precipprob_array.all? { |value| ((value &amp;lt; 0.1) == true) }
data = precipprob_array.map.with_index { |value, index| [x_axis_labels[index], 0] };
  y_axis_labels = (0..50).step(5).to_a.reverse
  chart = AsciiCharts::Cartesian.new(data, title: "Hourly Precipitation Probability Chart for #{user_location}:", x_axis_labels: x_axis_labels)
  puts chart.draw
else
  data = precipprob_array.map.with_index { |value, index| [x_axis_labels[index], value * 100] };
  chart = AsciiCharts::Cartesian.new(data, title: "Hourly Precipitation Probability Chart for #{user_location}:", x_axis_labels: x_axis_labels)
  puts chart.draw
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Flying through Intro to Ruby until I hit a wall</title>
      <dc:creator>armstrca</dc:creator>
      <pubDate>Mon, 31 Jul 2023 15:01:55 +0000</pubDate>
      <link>https://dev.to/armstrca/flying-through-intro-to-ruby-until-i-hit-a-wall-3267</link>
      <guid>https://dev.to/armstrca/flying-through-intro-to-ruby-until-i-hit-a-wall-3267</guid>
      <description>&lt;p&gt;I did a significant chunk of the Codecademy Intro to Ruby course before Tech Prep started, and as such much of the Instructure Intro to Ruby course came pretty quickly to me. Until FizzBuzz.&lt;/p&gt;

&lt;p&gt;I spent much longer on FizzBuzz than I'd care to admit, but I was very reluctant to ask questions about it because I felt like I wanted to push through and figure out the problems myself so that I understood both the problem and the solution better. Eventually, though, I caved a little bit and went to the Ask GPT for some help, strictly specifying that I wanted help about how to &lt;em&gt;figure out the solution&lt;/em&gt; rather than just be given the solution itself. &lt;br&gt;
As I recall (I should've written this closer to when I actually did FizzBuzz), it turned out, happily, that my code was overcomplicated, and that I mostly just needed to rearrange my conditionals so that numbers that qualified for FizzBuzz rather than just Fizz or Buzz would actually be properly generated. I'm very interested to see if there might be an even more simple/elegant solution, but I'm happy with this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = 0

while x &amp;lt; 30
    x = x + 1
    if (x % 3 == 0) &amp;amp;&amp;amp; (x % 5 == 0)
        pp "FizzBuzz"
    elsif x % 3 == 0
        pp "Fizz"
    elsif x % 5 == 0
        pp "Buzz"
    else
        pp x
    end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, the last exercise of that lesson, "Multiples", also gave me some trouble. It was easy enough to get the right outputs when the inputs were non-zero, but it took a while to figure out what to do with 0. My solution feels a little cheap/brute force to me, though, and I wonder if there's a better way to deal with a 0 input that makes more use of the concepts emphasized in that lesson.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;n = [3, 10, 15].sample
if n == 0
    10.times do
        pp n
    end
else
    n.step(n*10, n) do |n|
    pp n
    end
end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Unearthing ancient HTML memories</title>
      <dc:creator>armstrca</dc:creator>
      <pubDate>Mon, 31 Jul 2023 14:41:28 +0000</pubDate>
      <link>https://dev.to/armstrca/unearthing-ancient-html-memories-opf</link>
      <guid>https://dev.to/armstrca/unearthing-ancient-html-memories-opf</guid>
      <description>&lt;p&gt;For the hello world &amp;amp; link-in-bio projects, I was kinda pleasantly surprised how much HTML I still remembered from the oooold days of customizing my Myspace page &amp;amp; stuff. The CSS was completely new to me, though. I appreciated how much more easy it is to make formatting uniform with CSS as opposed to just HTML. &lt;/p&gt;

&lt;p&gt;Looking back at my link-in-bio code, I feel pretty solid on understanding the HTML parts of it, as well as most of the CSS. I'm less solid on some of the "bonus" modifications I made to the visual aspects of the site after having completed the core of the assignment. I understand what the code is doing and saying, but I don't feel like I've &lt;em&gt;learned&lt;/em&gt; it because I just copied &amp;amp; pasted from the supplemental sites at the bottom of the assignment. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    body {
      background-color: #e5e5f7;
      opacity: 0.8;
      background-image:  repeating-radial-gradient( circle at 0 0, transparent 0, #e5e5f7 75px), repeating-linear-gradient( #ccffff55, #ccffff );
      background-origin: content-box;
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-size: cover;
      display: flex;
      justify-content: center;
      font-family: Tahoma, sans-serif;
      height: 100vh;
      margin: 0;
      padding: 0;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I understand all of that, but I had no idea "repeating-radial-gradient" was a possible object in CSS. Additionally, the 100vh height aspect was, as I recall, another bonus aspect from when I later tried to tailor the site so that it would display well on both desktop and mobile, as seen here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    @media only screen and (max-width: 1200px) {
      body {
        overflow: hidden;
      }

      .items {
        max-width: 55%;
        max-height: fit-content;
        transform: scale(1.5);
        transform-origin: top; 
        overflow: hidden;
        padding-left: 20px;
        padding-right: 20px;
      }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In these instances I'm not worried about my ability to understand what's going on, it's just that they're using tools that I haven't learned yet, and as such I wouldn't feel confident in a subsequent circumstance coming up with the same kind of solution myself.&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
  </channel>
</rss>
