Skip to content

Instantly share code, notes, and snippets.

View RaynZayd's full-sized avatar

Rayn Zayd RaynZayd

View GitHub Profile
@RaynZayd
RaynZayd / Training Days JavaScript Project.js
Created October 24, 2020 11:32
Training days is a service program that sends you a message for the event you signed up for and the days you have left to train. In this project I made Training Days more maintainable and less error-prone by fixing variable scopes.
/*
Training days is a service program that sends you a message for the event you signed up for and the days you have left to train.
In this project I made Training Days more maintainable and less error-prone by fixing variable scopes.
*/
// The scope of `random` is too loose
//const random = Math.floor(Math.random() * 3);//defined with global scope
@RaynZayd
RaynZayd / Sleep Debt Calculator JavaScript Project.js
Last active October 24, 2020 11:32
This project calculates if you’re getting enough sleep each week using a sleep debt calculator. The program determines actual and ideal hours of sleep for each night of the last week. It also calculates, in hours, how far you are from your weekly sleep goal.
/*Sleep Debt Calculator*/
/*This project calculates if you’re getting enough sleep each week using a sleep debt calculator.
The program determines actual and ideal hours of sleep for each night of the last week.
It also calculates, in hours, how far you are from your weekly sleep goal.*/
//Determins how many hours of sleep you got each night of the week.
const getSleepHours = day => {
if(day === 'monday'){
@RaynZayd
RaynZayd / Rock, Paper, or Scissors JavaScript.js
Created October 23, 2020 12:36
Game code is broken down into four parts: 1. Get user’s choice. 2. Get computer’s choice. 3. Compare two choices and determine the winner. 4. Start the program and display the results
/*
Game code is broken down into four parts:
1. Get user’s choice.
2. Get computer’s choice.
3. Compare two choices and determine the winner.
4. Start the program and display the results
*/
//Const arrow function
/*The user should be able to choose ‘rock’, ‘paper’, or ‘scissors’ when the game starts*/
const getUserChoice = userInput => {
@RaynZayd
RaynZayd / Race Day JavaScript Project.js
Last active February 12, 2023 23:42
A program that will register runners for a race and give them instructions on the race day
/*A program that will register runners for a race and give them instructions on the race day.
A timeline of the registration:
How the registration works...
There are adult runners 18+ and youth runners -18 years of age.
They can register early or late.
Runners are assigned a race number and start time based on their age and registration.
Race number:
Early adults receive a race number at or above 1000.
@RaynZayd
RaynZayd / Magic Eight Ball JavaScript Project.js
Created October 22, 2020 09:27
In this project I built a Magic Eight Ball using control flow in JavaScript. A user's able to input a question, then the program will output a random fortune.
/*In this project I built a Magic Eight Ball using control flow in JavaScript.
A user's able to input a question, then the program will output a random fortune.*/
var userName = 'Rayn';
userName ? console.log(`Hello ${userName}!`):console.log('Hello!');
let userQuestion = 'Am I beautiful';
console.log(`${userName} asked... ${userQuestion} ?`);
let randomNumber = Math.floor(Math.random()*8);
let eightBall = '';
switch(randomNumber){
@RaynZayd
RaynZayd / Dog Years JavaScript Project.js
Created October 22, 2020 09:24
Dogs mature at a faster rate than human beings. We often say a dog’s age can be calculated in “dog years” to account for their growth compared to a human of the same age. In some ways we could say, time moves quickly for dogs — 8 years in a human’s life equates to 45 years in a dog’s life. How old would you be if you were a dog? Here’s how you c…
/*Dogs mature at a faster rate than human beings. We often say a dog’s age can be calculated in “dog years” to account for their growth compared to a human of the same age. In some ways we could say, time moves quickly for dogs — 8 years in a human’s life equates to 45 years in a dog’s life. How old would you be if you were a dog?
Here’s how you convert your age from “human years” to “dog years”:
The first two years of a dog’s life count as 10.5 dog years each.
Each year following equates to 4 dog years.
With my knowledge of math operators and variables, I'll use JavaScript to convert my human age into dog years.*/
//My age in human years
@RaynZayd
RaynZayd / Kelvin Weather JavaScript Project.js
Last active October 22, 2020 09:24
Kelvin Weather Project Deep in a mountain-side meteorology lab, a mad scientist Kelvin mastered weather prediction. Recently, Kelvin began publishing his weather forecasts on his website. However there’s a problem: All of his forecasts describe the temperature in Kelvin. With the knowledge of JavaScript, I'll convert Kelvin to Celsius, then to F…
/*JAVASCRIPT SYNTAX
Kelvin Weather Project
Deep in a mountain-side meteorology lab, a mad scientist Kelvin mastered weather prediction.
Recently, Kelvin began publishing his weather forecasts on his website. However there’s a problem: All of his forecasts describe the temperature in Kelvin.
With the knowledge of JavaScript, I'll convert Kelvin to Celsius, then to Fahrenheit.
Accomplishments:
1.Used console.log and string interpolation to log the temperature in fahrenheit to the console.
@RaynZayd
RaynZayd / Daily Buzz Bash Directory.sh
Last active October 22, 2020 09:25
Daily Buzz In this project, I used the commands I learned to navigate through files and directories of Daily Buzz, a national newspaper.
SETDEV ENVIRONMENT
Daily Buzz
In this project, I used the commands I learned to navigate through files and directories of Daily Buzz, a national newspaper.
Tasks completed:
1.Printed the working directory.
2.Listed all files and directories in the current working directory
3.With one command, I changed directories to the national/politics/ directory.
4.Listed all files and directories in the working politics/ directory.
@RaynZayd
RaynZayd / Bicycle World Bash Project.sh
Last active October 22, 2020 09:26
BWelcome to Bicycle World Bash Project, the premier text-based bicycle shop! This shop is only accessible to programmers like you, who are familiar with the command line. In this project, I used the commands I learned to navigate and edit a filesystem. The filesystem is shown below. Main directory is bicycle-world-ii.
Bicycle World
Welcome to Bicycle World, the premier text-based bicycle shop! This shop is only accessible to programmers like you, who are familiar with the command line.
In this project, I used the commands I learned to navigate and edit the filesystem.
The filesystem is shown below. Main directory is bicycle-world-ii.
bicycle-world-ii
|—— brands.txt
|—— freight/
@RaynZayd
RaynZayd / HelloWorld.java
Created May 29, 2019 09:30
Prints "Hello World" to the screen.
/*
* The print Hello World app
*/
/**
*
* @author raynz_000
*/
public class HelloWorld extends javax.swing.JFrame {