Skip to content

Instantly share code, notes, and snippets.

View rpdecks's full-sized avatar

Robert Phillips rpdecks

View GitHub Profile
@rpdecks
rpdecks / gist:263b3c56b6be531c18d8e92ed091c79b
Created April 6, 2020 01:33
artist_name= for Collaborating Objects Lab
def artist_name=(name)
self.artist = Artist.find_or_create_by_name(name)
artist.add_song(self) #why not self.add_song(self)??
end
def files
# I think I will need to create an array of file names here of the files whose data I want to import
@files = []
Dir.entries(path).select do |file|
if !File.directory?(file) && file.end_with?(".mp3")
# why does if need to check file.directory?
@files << file
end
end
end
#why does this work? explain syntax and logic
def best_tipper
best_tipped_meal = meals.max do |meal_a, meal_b|
meal_a.tip <=> meal_b.tip
end
best_tipped_meal.customer
end
class Ingredient
@@all = []
attr_reader :name
def initialize(name)
@name = name
@@all << self
end
def pass_student(student, test)
found_test = BoatingTest.all.find { |bt| bt.test_name == test && bt.student == student}
binding.pry
if found_test && found_test.test_status != "pass"
found_test.test_status = "pass"
elsif !found_test
found_test = BoatingTest.new(student, test, "pass", self)
end
found_test
end
@rpdecks
rpdecks / gist:1567a0be929118190a02cc02cea7aaa1
Created April 14, 2020 17:43
trouble seeding menu.drinks... when I pry after seeding... finding cafe.menu.drinks array empty
Menu.destroy_all
Drink.destroy_all
Ingredient.destroy_all
DrinkIngredient.destroy_all
Shop.destroy_all
# =============================Ingredient seeds=============================
i1 = Ingredient.create(name: "milk")
@rpdecks
rpdecks / MapContainer.js
Last active June 18, 2020 00:50
Mapbox MapContainer
import React from 'react'
import ReactMapGL, { Marker, Popup } from 'react-map-gl';
import '../App.css';
const mapMarkers = (userData, setSelectedAppointments, setPopupState) => {
const nurses = mapNurses(userData.nurses, setSelectedAppointments, setPopupState) || [];
const patients = mapPatients(userData.patients, setSelectedAppointments, setPopupState) || [];
return nurses.concat(patients) || null;
}
Get hype. The next 2-3 weeks of your life are all about your final project. This is the capstone project that you’ll be showing off to demonstrate all the things that you’ve learned over the last few months. This is awesome. Before we dive into what your project is going to be about, we need to establish some ground rules.
Behavioral Expectations
You will show up by 9:00 and leave no sooner than 6:00
You will actively participate in stand-ups, retros, and check-ins
You will complete your MVP by the date it is due
You will adhere to the project decisions made by leads/project managers
You will communicate issues with your project manager
You will be courteous to your classmates, and work together to solve problems
You will have properly researched and debugged before escalating to your project leads.
Get hype. The next 2-3 weeks of your life are all about your final project. This is the capstone project that you’ll be showing off to demonstrate all the things that you’ve learned over the last few months. This is awesome. Before we dive into what your project is going to be about, we need to establish some ground rules.
Behavioral Expectations
You will show up by 9:00 and leave no sooner than 6:00
You will actively participate in stand-ups, retros, and check-ins
You will complete your MVP by the date it is due
You will adhere to the project decisions made by leads/project managers
You will communicate issues with your project manager
You will be courteous to your classmates, and work together to solve problems
You will have properly researched and debugged before escalating to your project leads.
@rpdecks
rpdecks / Redux level up
Created June 18, 2020 20:38
Redux level up
@033020 Hey everyone, here are those Flatiron Redux resources (this is going to be long :persevere:):
To prepare for Redux, please read the following pages in the official documentation:
- https://redux.js.org/introduction/motivation
- https://redux.js.org/faq/general#general-when-to-learn
- https://redux.js.org/faq/organizingstate#organizing-state-only-redux-state
- Just the first one about state.
- https://redux.js.org/faq/performance#performance-scaling
- Just the first one about scaling.
If you're really itching to get started, you can follow the tutorial series by the master himself, Dan Abramov, linked in the Learning Resources section of the docs:
- Getting Started with Redux - Video Series: https://egghead.io/series/getting-started-with-redux