Skip to content

Instantly share code, notes, and snippets.

View EliseFitz15's full-sized avatar

Elise Fitzgerald EliseFitz15

View GitHub Profile
@EliseFitz15
EliseFitz15 / deaf_grandma
Last active August 29, 2015 14:17
Deaf Grandma
# Deaf Grandma
puts "What did you say?" # Grandma asks
bye = 0
while bye < 1
you = gets.chomp
if you != you.upcase
puts "HUH?! SPEAK UP SONNY!"
elsif you == "BYE"
bye += 1
puts "ok bye"
@EliseFitz15
EliseFitz15 / git-cheat-sheet.md
Last active September 13, 2018 12:24
git-cheat-sheet

Intro to Git

What is Git?

  • Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency

What is GitHub?

  • GitHub is a web-based Git repository hosting service, which offers all of the revision control and source code management (SCM) functionality of Git.

Initializing a Project with Git

Make sure you are in the projects root directory! You can run ls to make sure.

@EliseFitz15
EliseFitz15 / tdd-unit-testing-notes.md
Last active November 8, 2015 17:54
unit-testing-clinic

Clinic overview

In this clinic, we will go over:

  • TDD workflow
  • Setting up rspec in your projects
  • Build classes with TDD
  • Resource for good practices for writing rspec tests

##TDD workflow

  • Write tests - get a failing test suite
  • Let failing tests guide our code development
@EliseFitz15
EliseFitz15 / factory_girl.md
Last active April 2, 2020 17:10
factory_girl_sinatra.md

#Factory Girl Clinic

FactoryGirl is a gem that helps you with testing. It basically allows you to create "factories" that crank out objects to your database for you to test. Once FactoryGirl is set up, instead of needing to type this:

let(:pokemon) { Pokemon.new(name: "Onyx", ability: "Rock Smash", poketype: "Earth", strength: 50, age: 2, pokemaster: pokemaster) }

I can type something like this:

@EliseFitz15
EliseFitz15 / sc_6_practice.md
Last active December 17, 2015 13:26
SC-6-practice.md

Practice Rails MVC and Nested Routing

Create a Rails application that allows users to view books. The application must satisfy the following criteria:

  • A book has to have a title, author, and isbn code. It can optionally have a description and a genre.
  • Visiting the /books path should contain a list of books.
  • Visiting the /books/new path should display a form for adding a new book.
  • If a book is saved I'm redirected to to /books and should new the book name I've added, if it is not I'm left on the /books/new page and displayed an error.
  • Visiting the /books/5 path should show the book details for a book with ID = 5.
  • Visiting the root path should display a list of all books.
@EliseFitz15
EliseFitz15 / sc_7_practice.md
Created September 21, 2015 19:19
SC_7_practice.md

SC 7 Practice Example

You have been tasked with creating a system that manages used cellphone sales. Create a Rails application that manages cellphones in a used phone store. Write acceptance tests that guide development of the application to satisfy the following user stories:

###User Story As a used cellphone salesperson I want to record a cellphone manufacturer So that I can keep track of the types of cellphones sold in my store

Acceptance Criteria:

  • I must specify a manufacturer name and country.
@EliseFitz15
EliseFitz15 / action-mailer.md
Last active April 2, 2020 17:10
Action-Mailer-Clinic

Setting up ActionMailer in Rails

Action Mailer allows you to send emails from your application using mailer classes and views. Mailers work very similarly to controllers.

They inherit from ActionMailer::Base and live in app/mailers, and they have associated views that appear in app/views.

We are going to set up an e-mail to be delivered when a review is created for an item on our review site. To do this in a test driven way, we will start with the test.

###Start with a test & configuring our test environment

  • Let's look at this test - we check that the review content is displayed on the page and that we've successfully queued up an email to send.
@EliseFitz15
EliseFitz15 / sorting-algorithms.md
Created October 14, 2015 16:50
sorting-algorithms.rm

#Sorting Algorithms

Our computers spend a great deal of time sorting data that make it easier for us to consume in human-readable formats. As web developers, our tools can often make it easy to overlook the value of grasping concepts like sorting and the the algorithms behind their implementations.

Algorithm efficiency is a broad topic in Computer Science and listed below are a few more good resources to learn more, but today we'll go over some of the common, simpler sorting implementations.

###Selection Sort

  • Defines a sorted and unsorted portion
  • First pass finds the "smallest" in the list, assuming the first is the minimum until it finds it
@EliseFitz15
EliseFitz15 / setting-up-rspec.md
Last active November 12, 2015 17:21
setting-uprspec-in-sinatra

#Setting Up RSpec

  • gem install rspec
  • In the project root set up the following file structure:
    • spec/lib/class_spec.rb
    • lib/class.rb goes in lib
  • Configure RSpec for color tests. In the root folder touch .rspec and insert "--color"
  • To reference our classes, tests files need this at the top require_relative '../../lib/class.rb'
  • To run the test type rspec spec from the root directory
@EliseFitz15
EliseFitz15 / Heroku-Deploy-with-Sinatra.md
Last active July 27, 2017 11:54
sinatra-deployment.md

Deploy a Sinatra App with Heroku

##What does this mean? Your web application - out there on the Internets for all to see! We are leaving your local development environment and heading into staging and production.

We develop our apps in many different "environments" and so far we have discussed and worked with our test environment and development environment.

To follow Agile Development Methodologies we aim to build out some functionality through testing locally, then do a release (i.e. deploy the app) and test it out in production. Once it's up we check to make sure it's running the way we expect - through QA-ing (quality assurance testing). In this stage we may also get feedback from clients or other teams. Next, we make changes and updates to those features, re-releasing the next iteration to test. Then, once those features are finished, we begin with the next set of functionality.