Skip to content

Instantly share code, notes, and snippets.

View stacietaylorcima's full-sized avatar

Stacie Taylor stacietaylorcima

View GitHub Profile
@stacietaylorcima
stacietaylorcima / player-js-analysis.md
Created October 13, 2017 01:09 — forked from R-V-S/player-js-analysis.md
player.js analysis
  1. This file declares a class, Player, instantiates it, and assigns it to a global player variable.
  2. The Player class contains four methods:
    • constructor()
    • playPause()
    • skipTo()
    • setVolume()
  3. The constructor() method sets initial values for the currentlyPlaying, playState, volume, and soundObject properties.
    • currentlyPlaying is set to the first item in album.songs.
    • The initial playState is "stopped".
  • The volume is set to the number 80.
@stacietaylorcima
stacietaylorcima / Bloc Checkpoint 1: Intro To Ruby Message Assignment.md
Last active January 5, 2018 01:49
This checkpoint instructs the student to "in just a few sentences, the message should describe a toaster (the kitchen appliance) in the terminology of a programming method" & "look at a specific block of code and tell your mentor what you think will be printed both from the method body and at the end of the program."

Per the body of this Bloc checkpoint, here are the two requested message assignments.

Note: this does not include the actual assignments listed under the Assignement tab. I will include those details in my final Submission.


Toaster Function

If I were to write a method that executes the functionality of an actual toaster, it might read something like this:

@stacietaylorcima
stacietaylorcima / Intro to Ruby.md
Last active January 10, 2018 03:06
Includes basic language details, classes, and activity notes.

Ruby: Introduction

Objectives

  • Define the String, Symbol, and Integer data types in Ruby.
  • Understand how to use variables.
  • Demonstrate how to perform math operations using Ruby Arithmetic operators.
  • Understand how to define methods.
  • Understand how to pass arguments.
  • Understand how to return a value from a method.
  • Understand how to comment code.
@stacietaylorcima
stacietaylorcima / RS Testing.md
Last active January 8, 2018 23:03
How to read RSpec tests & Test Driven Development.

Reading RSpec:

There are flexible and dynamic ways to test code using test frameworks. One of the most popular frameworks in the Ruby on Rails community is RSpec.

  • Important concept: a spec is running the code and testing to find out what happens.
  • RSpec runs the code with particular conditions and with particular arguments.
  • It sets expectations for the outcome of this test, and the test passes if those expectations are met.
  • It's unreasonbale to think a programmer could manually test the code as their programm grows because that would mean testing every method anytime any little thing changes.
  • Testing frameworks like RSpec automate the process of testing the code based on expectations set by the programmer.
@stacietaylorcima
stacietaylorcima / Ruby: Debugging Code.md
Last active January 8, 2018 23:02
Ruby: Understand how to read errors and handle them.

Ruby: Debugging Code

Objectives

  • Understand how to debug syntax errors.
  • Understand the concept of error handling.
  • Raise exceptions.
  • Properly format code.

@stacietaylorcima
stacietaylorcima / Ruby: Conditionals & Logic.md
Last active January 8, 2018 23:01
Give your programs the ability to make decisions by using control structures.

Ruby: Conditionals & Logic

Objectives

  • Apply conditional expressions and logic operators.
  • Demonstrate how to use short circuit evaluation.
  • Apply comparator operators to establish order relationships between the objects.
Concept Description
@stacietaylorcima
stacietaylorcima / Ruby: Arrays.md
Last active January 10, 2018 02:24
Use Array objects to store/retrieve information.

Ruby: Arrays

Concept Description
Array An object that represents a collection of objects
Access To access an element at a particular index, pass the index inside square brackets like array_name[0]. Use negative numbers to retrieve elements from the right to the left starting at -1
Insertion To add an element to an existing Array object using methods like push, <<, unshift, insert
Removal To remove elements from an Array object using methods like pop, shift, clear, delete
Sorting We can sort a collection by calling the sort method on an Array object

Ruby: Classes 2

Concept Description
Class methods Behaviors that the class needs to implement that should not be direct responsibilities of the instances it creates. In a BankAccount class, this could be a method that calculates the average balance across all BankAccount objects
Constants Variables that contain data that will not change and is shared amongst the instances of a class.
self self refers to that which the method was called on. If used in a method signature/header before the method name, it makes the method a class method. If used inside an instance method, it refers to the instance the method was called on
Inheritance Refers to the concept of extending a class by defining a subclass. The subclass inherits the attributes and behaviors of the parent class while keeping the ability to either override parent methods or create their own
super super Can be used inside of a subclass method overriding a parent method. It will use the implementatio
@stacietaylorcima
stacietaylorcima / Ruby: Loops.md
Last active November 29, 2022 13:14
Learn to use loops to iterate over Array objects and execute a block of code multiple times.

Ruby: Loops

Concept Description
Iteration To traverse or visit every element in an Array object
each The each method can be called on an Array object to iterate over the elements it contains
each_with_index Allows for an additional variable to be used in the pipe operators that will represent the index of the current element
map Can be used to iterate over every element in an Array while applying a method to each instance
Loop constructs A loop construct allows for iteration of an object for a given number of times or while a condition is met

Ruby: Hashes

Concept Description
Hash A unordered data structure that allows for storage of key and value pairs
Access We can access the value of a given key by passing the key to the hash like hash_name[:key]
Iteration We can use a for in loop to iterate over the key/value pairs in a hash
Hash arguments We can use hashes to pass arguments to a method call

Objectives: