Skip to content

Instantly share code, notes, and snippets.

View olozzalap's full-sized avatar
👨‍🌾

Eben Palazzolo olozzalap

👨‍🌾
View GitHub Profile
@olozzalap
olozzalap / numReviewsDecayingWeightFactor.js
Last active August 14, 2018 17:05
Number of Reviews decaying weight value to dynamically factor in number of reviews along with the average score and factor in an exponentially decaying weightDecelerationFactor
// averageScore: float
// numReviews: int
// weightDecelerationFactor: float (a higher weightDecelerationFactor represents lower marginal value per each additional review, a lower weightDecelerationFactor represents higher marginal value per each additional review)
function parseScoreWithNumReviewsTotalValue(averageScore, numReviews, weightDecelerationFactor) {
let nextReviewWeight = 1;
let totalNumReviewsWeightFactor = 1;
// Check to ensure weightDecelerationFactor is in bounds
if (weightDecelerationFactor <= 0.00 || weightDecelerationFactor >= 1.00) {
console.log("please provide a valid float value between 0 and 1 for the weightDecelerationFactor");
@olozzalap
olozzalap / associations_example.rb
Last active November 15, 2016 02:13
Eben Palazzolo Full-Stack Mentor Assessment
class Chef < ApplicationRecord
has_many :recipes
has_many :meals, through: :recipes
end
class Recipe < ApplicationRecord
belongs_to :chef
belongs_to :meal
end