<?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: Ben Perry</title>
    <description>The latest articles on DEV Community by Ben Perry (@bbperry).</description>
    <link>https://dev.to/bbperry</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%2F744957%2Ff65fffa6-b57c-46bb-b839-d60776dfb845.png</url>
      <title>DEV Community: Ben Perry</title>
      <link>https://dev.to/bbperry</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bbperry"/>
    <language>en</language>
    <item>
      <title>Rails Generators</title>
      <dc:creator>Ben Perry</dc:creator>
      <pubDate>Fri, 28 Jan 2022 18:12:59 +0000</pubDate>
      <link>https://dev.to/bbperry/rails-generators-478b</link>
      <guid>https://dev.to/bbperry/rails-generators-478b</guid>
      <description>&lt;p&gt;We are finishing up our Rails curriculum at Flatiron School this week and I wanted to make a post about different generators Rails offers us. Generator commands take simple tasks like creating boilerplate code for your backend project and produce multiple template files almost immediately. I'd like to go over the differences of a few that I've used on every project.&lt;/p&gt;

&lt;p&gt;To start, you can see a list of available generators with the simple command. Note: you can shorten these commands by typing &lt;code&gt;rails g&lt;/code&gt; instead of &lt;code&gt;rails generate&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails generate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K6nOIWy3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p54ew5jcftad4k8fp0z2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K6nOIWy3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p54ew5jcftad4k8fp0z2.png" alt="console output from rails generate" width="295" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are a few that I have been using the most. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Migration file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails generate migration Table_name column_1 column_2:boolean column_3:integer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With this command you can name your table and optionally input all your column names with data types and get that out of the way with 1 simple terminal command! Any column name not given a data type will default to string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Model and Migration file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails generate model Table_name column_1 column_2:boolean column_3:integer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command will create both a migration and a model file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Controller file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails generate controller Controller_name&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command will create a controller file for your model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Resource file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails generate model Table_name column_1 column_2:boolean column_3:integer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is a great generator that does a lot of work for you with one simple command. Thanks Rails! This produces a &lt;strong&gt;migration&lt;/strong&gt;, a &lt;strong&gt;model&lt;/strong&gt;, a &lt;strong&gt;controller&lt;/strong&gt;, a &lt;strong&gt;resources&lt;/strong&gt; method for all of the restful routing for your model, &lt;strong&gt;views&lt;/strong&gt; for the model, a &lt;strong&gt;serializer&lt;/strong&gt;, and some test files. Wow all that with one simple command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remove the files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails d resource Table_name&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you made a typo or a table that you don't want anymore you can easily remove all the files created with your generator with this command to make sure everything is cleaned up nicely. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>A short list of some helpful VS Code keyboard short cuts.</title>
      <dc:creator>Ben Perry</dc:creator>
      <pubDate>Mon, 10 Jan 2022 22:38:31 +0000</pubDate>
      <link>https://dev.to/bbperry/a-short-list-of-some-helpful-vs-code-keyboard-short-cuts-1ij5</link>
      <guid>https://dev.to/bbperry/a-short-list-of-some-helpful-vs-code-keyboard-short-cuts-1ij5</guid>
      <description>&lt;p&gt;I decided to write a quick post about helpful Visual Studio Code keyboard shortcuts. I learned some of these shortly after starting my journey into programming. Some of them I learned while doing some research for this blog post, which was my hope to motivate myself to learn more shortcuts. It's great how a little key binding can really boost your productivity and fun while coding. Many of these will be familiar, but they are techniques I wish I had known on day one!&lt;/p&gt;

&lt;h3&gt;
  
  
  Show Command Palette
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;P&lt;/code&gt; or &lt;code&gt;F1&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;P&lt;/code&gt; or &lt;code&gt;F1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command provides quick access to the Command Palette. Here you will have a list of all the default commands available and also for any extensions you have added. Try it out and stop reading here unless you want to see my favorites!&lt;/p&gt;

&lt;h3&gt;
  
  
  Toggle line comment
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;/&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;/&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;One of the first commands I learned that will automatically comment out (or uncomment) lines of code based on which file type you are editing. Select all lines you want comments toggled. It will also comment the line the cursor is on without selection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add selection to next Find match
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;D&lt;/code&gt; &lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;D&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I find myself using this one a lot! Select a feature that you want to find duplicates of. Each time the command is entered it will continue to add selection and cursor to the next match. Very useful for editing repeating code like variables all at once!&lt;/p&gt;

&lt;h3&gt;
  
  
  Select all occurrences of current selection
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;shift&lt;/code&gt; + &lt;code&gt;L&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;L&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Similar to above except it selects all matching occurrences all at once instead of one by one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Toggle Sidebar visibility
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;B&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Quick command if you want to hide your sidebar display and have a larger view of your editing area.&lt;/p&gt;

&lt;h3&gt;
  
  
  Zen Mode
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;K&lt;/code&gt; then &lt;code&gt;Z&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;K&lt;/code&gt; then &lt;code&gt;Z&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Remove distractions and only display your code in full screen. hitting &lt;code&gt;esc&lt;/code&gt; + &lt;code&gt;esc&lt;/code&gt; exits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quick Open, Go to File…
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;P&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;P&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Instead of searching through your file explorer this command opens up a search bar to quickly find the file your want to navigate to without having to use your mouse.&lt;/p&gt;

&lt;h3&gt;
  
  
  Navigate editor group history
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;macOS&lt;/strong&gt;: &lt;code&gt;control&lt;/code&gt; + &lt;code&gt;shift&lt;/code&gt; + &lt;code&gt;tab&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;ctrl&lt;/code&gt; + &lt;code&gt;shift&lt;/code&gt; + &lt;code&gt;tab&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Quickly navigate through files that you have tabs open for.&lt;/p&gt;

&lt;h3&gt;
  
  
  Access Keyboard Shortcuts
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: ⌘K ⌘S&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;K&lt;/code&gt; then &lt;code&gt;Ctrl&lt;/code&gt; + &lt;code&gt;S&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here you can see and search all the keyboard shortcuts, and also change or add new bindings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrap with Abbreviation
&lt;/h3&gt;

&lt;p&gt;Unbound by default&lt;/p&gt;

&lt;p&gt;This one is not bound by default but it seems like it could come in handy! In keyboard short cuts search &lt;code&gt;Emmet :Wrap with Abbreviation&lt;/code&gt;. I bound it to &lt;code&gt;⌥&lt;/code&gt; + &lt;code&gt;w&lt;/code&gt;. This will select the code block your cursor is on and you can wrap an HTML tag around the block, for example. Pretty neat!&lt;/p&gt;

&lt;h3&gt;
  
  
  Format File with Prettier extension
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;option&lt;/code&gt; + &lt;code&gt;shift&lt;/code&gt; + &lt;code&gt;F&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Alt&lt;/code&gt; + &lt;code&gt;F&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I find using the Prettier extension very useful for formatting JavaScript and making it easier to read (pretty, if you will). As a beginner its nice to focus on writing code that works without having to worry as much about formatting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add additional cursor
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac&lt;/strong&gt;: &lt;code&gt;option&lt;/code&gt; + &lt;code&gt;mouse click&lt;/code&gt;&lt;br&gt;
  &lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;Alt&lt;/code&gt; + &lt;code&gt;mouse click&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Adds as many additional cursors as you like to edit multiple lines at once!&lt;/p&gt;

&lt;h3&gt;
  
  
  PDFs for VSCode keyboard shortcuts
&lt;/h3&gt;

&lt;p&gt;This was just a short list of keyboard shortcuts that I have found handy. Here's are some links to some easy to read documents with more. Try some out, you might find a new favorite!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf"&gt;MacOS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf"&gt;Windows&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Publish a React App on GitHub</title>
      <dc:creator>Ben Perry</dc:creator>
      <pubDate>Fri, 10 Dec 2021 04:40:24 +0000</pubDate>
      <link>https://dev.to/bbperry/how-to-publish-a-react-app-on-github-1gdo</link>
      <guid>https://dev.to/bbperry/how-to-publish-a-react-app-on-github-1gdo</guid>
      <description>&lt;p&gt;Finishing up my second project at Flatiron School I wanted to host my app on GitHub, like I did my first project. That way I can share my projects with people that aren't developers... like my Mom. I quickly found out that deploying a React application (using create-react-app) on GitHub isn't as simple as a vanilla javascript repo. I was quite confused when I went to my link and all I could get to show was the README file. In this post I wanted to describe the process I took to get my link to actually show my app.&lt;/p&gt;

&lt;p&gt;The first thing I did was add a few lines to the package.json file. The homepage URL {with your own info} is in the top of the file and the next two are in "scripts"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"homepage": "https://{github username}.github.io/{your project name}"

"scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next run the following command in your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new "Build" folder in your projects directory.&lt;/p&gt;

&lt;p&gt;Followed by these commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save gh-pages
npm run deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I had to create a new branch called "gh-pages" and push my work to this branch.&lt;/p&gt;

&lt;p&gt;In your repository on github, navigate to settings&amp;gt;Pages.&lt;/p&gt;

&lt;p&gt;Here you will select your source to be:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Branch:gh-pages in the /root directory.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Save this and try your homepage link!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Working Collaboratively With Git</title>
      <dc:creator>Ben Perry</dc:creator>
      <pubDate>Fri, 19 Nov 2021 19:58:11 +0000</pubDate>
      <link>https://dev.to/bbperry/working-collaboratively-with-git-3a83</link>
      <guid>https://dev.to/bbperry/working-collaboratively-with-git-3a83</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NXQTLoVZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cy4xfdp043f6mma4fxv0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NXQTLoVZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cy4xfdp043f6mma4fxv0.png" alt="Image description" width="880" height="880"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During my 1st weeks in Flatiron School I began learning about &lt;strong&gt;Git&lt;/strong&gt; for the first time, ever! However, the majority of all the labs and assignments involved working alone. I found myself doing the same simple git commands to fork and clone a GitHub repository, and then push my changes when the assignment was complete. At the beginning of my 3rd week we had our first group project and realized that neither of us were very familiar with working on building a web app together without conflicting changes. This blogpost is written for beginner programmers that want to work collaboratively on a project! It assumes you already have git installed and know the basics of working solo.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add collaborators to your repository
&lt;/h3&gt;

&lt;p&gt;Create a repository on &lt;strong&gt;GitHub&lt;/strong&gt; and navigate to Settings/Manage access. Invite people you will be working on the project with.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a new branch name
&lt;/h3&gt;

&lt;p&gt;In the terminal, navigate to your projects folder. The following &lt;code&gt;commands&lt;/code&gt; will be entered into the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git branch new-branch-name&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Switch to your new branch to being work
&lt;/h3&gt;



&lt;p&gt;&lt;code&gt;git checkout new-branch-name&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Don't forget to make regular commits!
&lt;/h3&gt;

&lt;p&gt;Make regular commits to your branch to back up your work.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git add .&lt;br&gt;
git commit -m "describe changes"&lt;br&gt;
git push origin new-branch-name&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;At any point you can make sure you're in the desired branch with&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;git status&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Merge the branches when ready
&lt;/h3&gt;

&lt;p&gt;When you have completed the work on your branch, merge it into the main branch and push it to the remote repository.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout main&lt;br&gt;
git merge new-branch-name&lt;br&gt;
git push origin main&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Once each person has done this, the main branch should be up to date with your project! &lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>teamwork</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
