<?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: John Leavell</title>
    <description>The latest articles on Forem by John Leavell (@jleavell).</description>
    <link>https://forem.com/jleavell</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%2F238138%2F44bfc506-686a-4779-9a33-56f5f34f8407.png</url>
      <title>Forem: John Leavell</title>
      <link>https://forem.com/jleavell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jleavell"/>
    <language>en</language>
    <item>
      <title>Ruby .sort and .sort! What's the difference??</title>
      <dc:creator>John Leavell</dc:creator>
      <pubDate>Tue, 18 Jul 2023 20:06:37 +0000</pubDate>
      <link>https://forem.com/jleavell/ruby-sort-and-sort-whats-the-difference-3gb5</link>
      <guid>https://forem.com/jleavell/ruby-sort-and-sort-whats-the-difference-3gb5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello friends,&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Today I learned something interesting and helpful.  If you didn't know, in Ruby there are &lt;strong&gt;Mutating&lt;/strong&gt; and &lt;strong&gt;Non-Mutating Methods&lt;/strong&gt;.  Today, let's focus on the &lt;code&gt;.sort&lt;/code&gt; and &lt;code&gt;.sort!&lt;/code&gt; methods&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mutating Method&lt;/strong&gt; &lt;code&gt;.sort!&lt;/code&gt;&lt;br&gt;
As you might expect, changes the value of an object.  When used on an array it sorts the elements in place, directly modifying the original array without creating a new one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Mutating .sort! method
fruits = ['banana', 'apple', 'orange', 'mango']
fruits.sort!
puts fruits # ['apple', 'banana', 'mango', 'orange'] (sorted in place)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how the original &lt;code&gt;fruits&lt;/code&gt; array is now sorted alphabetically in place without the need for creating a new array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Non-Mutating Method&lt;/strong&gt; .sort&lt;br&gt;
As you might expect, does not change the value of an object. When applied to an array, it returns a new array with the elements in ascending order, without modifying the original array. This ensures that the original order of elements remains unchanged.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Non-Mutating .sort method
numbers = [5,2,8,3,1,7]
sorted_numbers = numbers.sort
puts sorted_numbers # [1,2,3,5,7,8
puts numbers # [5,2,8,3,1,7]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Knowing when to use &lt;code&gt;.sort&lt;/code&gt; and &lt;code&gt;.sort!&lt;/code&gt; is essential.  Use &lt;code&gt;.sort&lt;/code&gt; when you want a new sorted array while preserving the original array's order.  Choose &lt;code&gt;.sort!&lt;/code&gt; when you want to directly modify the original array.&lt;/p&gt;

&lt;p&gt;Remember, using the correct method can make your code more efficient and maintainable.&lt;/p&gt;

&lt;p&gt;I hope this helps!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ruby</category>
    </item>
    <item>
      <title>How to Setup Your GitHub Repository (Mac Version)</title>
      <dc:creator>John Leavell</dc:creator>
      <pubDate>Wed, 15 Mar 2023 00:57:17 +0000</pubDate>
      <link>https://forem.com/jleavell/how-to-setup-your-github-repository-mac-version-294d</link>
      <guid>https://forem.com/jleavell/how-to-setup-your-github-repository-mac-version-294d</guid>
      <description>&lt;p&gt;Hey there!&lt;/p&gt;

&lt;p&gt;So, I was setting up my laptop during my apprenticeship and ran into a bit of a snag. But don't worry, it's all good now. I mean, what's a tech setup without a few bumps in the road, right? Anyway, let me tell you a little bit about what happened...&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Setup Your GitHub Repository (Mac Version)
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Prerequisites:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;GitHub account&lt;/li&gt;
&lt;li&gt;Xcode command line tools&lt;/li&gt;
&lt;li&gt;Homebrew&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Installation Steps:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Install Xcode Command Line Tools
In the terminal, type:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcode-select --install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the instructions to install Xcode Command Line Tools.&lt;/p&gt;

&lt;p&gt;Note: This process can take some time.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Check Xcode Installation
&lt;/h3&gt;

&lt;p&gt;To check if Xcode Command Line Tools was installed correctly, type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcode-select -p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/Library/Developer/CommandLineTools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Install Homebrew
&lt;/h3&gt;

&lt;p&gt;Check if Homebrew is installed by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Homebrew is not installed, follow the script on the Homebrew &lt;a href="https://brew.sh/"&gt;website&lt;/a&gt; to start the installation process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts and enter your password when prompted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This process can take some time. So grab a coffee and come back.&lt;/p&gt;

&lt;p&gt;Check if Homebrew was installed correctly by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your system is ready to brew.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Configure Git
&lt;/h3&gt;

&lt;p&gt;Install Git and GitHub using Homebrew by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install github
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check if Git was installed correctly by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;output /usr/local/bin/git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, define your Git user by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Your name here"

git config --global user.email "your_email@email.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will be added to your .gitconfig file.&lt;/p&gt;

&lt;p&gt;GitHub recommends using HTTPS to push code to your repositories. To prevent Git from asking for your username and password every time you push a commit, you can cache your credentials by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global credential.helper osxkeychain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can use the SSH method.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. SSH Config for GitHub
&lt;/h3&gt;

&lt;p&gt;Generate a new SSH key by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa -C "your_email@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your SSH key to the ssh-agent by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eval "$(ssh-agent -s)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're running macOS Sierra 10.12.2 or later, you'll need to modify your &lt;code&gt;~/.ssh/config&lt;/code&gt; file to automatically load keys into the ssh-agent and store passphrases in your keychain.&lt;/p&gt;

&lt;p&gt;Check if your &lt;code&gt;~/.ssh/config&lt;/code&gt; file exists by typing:&lt;/p&gt;

&lt;p&gt;open &lt;code&gt;~/.ssh/config&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If it doesn't exist, create the file by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch ~/.ssh/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, modify the file to contain the following lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your SSH private key to the ssh-agent and store your passphrase in the keychain by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-add -K ~/.ssh/id_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, add your SSH key to your GitHub account.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Congratulations! You've now set up your GitHub repository on your Mac. Good luck with your projects!&lt;/p&gt;

</description>
      <category>github</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>First week in a Software development apprenticeship</title>
      <dc:creator>John Leavell</dc:creator>
      <pubDate>Sun, 12 Mar 2023 20:28:01 +0000</pubDate>
      <link>https://forem.com/jleavell/first-week-in-software-development-apprenticeship-3j9m</link>
      <guid>https://forem.com/jleavell/first-week-in-software-development-apprenticeship-3j9m</guid>
      <description>&lt;p&gt;Hello there, fellow developers!&lt;/p&gt;

&lt;p&gt;I just finished my first week at Discovery Partners Institute's Software Development Apprenticeship program, and I wanted to share my experience with you.&lt;/p&gt;

&lt;p&gt;Before we dive in, I want to clarify that this isn't a bootcamp.  Instead, it's an immersive learning program designed to teach individuals of all levels and backgrounds how to become a software developer.&lt;/p&gt;

&lt;p&gt;The first week of the program was mainly focused on orientation and administrative work, including introductions, icebreakers, and team-building exercises. However, we also had the opportunity to learn about foundational skills, essential habits and traits that are crucial in the professional workspace.&lt;/p&gt;

&lt;p&gt;One of the highlights of the first week was the module titled "Figuring out your why," which was an assignment designed to create a mission statement that clarifies your purpose or your why.  Your reason for choosing the path of a software developer. &lt;/p&gt;

&lt;p&gt;Throughout the week, we were provided with tons of resources and helpful information that will undoubtedly come in handy as we progress through the program.  We also had the opportunity to connect with industry professionals and experienced developers who were eager to share their knowledge and expertise with us.&lt;/p&gt;

&lt;p&gt;Overall, I had a fantastic experience during my first week at the Discovery Partners Institue Software Development Apprenticeship program.  I'm excited to continue learning and growing as a developer and can't wait to see what the rest of the program has in store for me.&lt;/p&gt;

&lt;p&gt;If you're interested in pursing a career in software development, I highly recommend checking out Discovery Partners Institute's Apprenticeship program.  Trust me, it's worth it!&lt;/p&gt;

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