Skip to content

Instantly share code, notes, and snippets.

View RahimGuerfi's full-sized avatar
:atom:
Making an impact.

Abderrahim Guerfi RahimGuerfi

:atom:
Making an impact.
View GitHub Profile
@RahimGuerfi
RahimGuerfi / solution.txt
Created January 14, 2024 12:56
Junior Full-Stack Developer challenge
Solution written in PHP:
class CSVProcessor {
private $data = [];
public function readCSV($filename) {
$handle = fopen($filename, 'r');
if ($handle !== false) {
while (($row = fgetcsv($handle)) !== false) {
$id = $row[0];
@RahimGuerfi
RahimGuerfi / Droid.java
Created June 13, 2022 23:14
Build A Droid We’ve set up a robot workshop to build some droids. All that’s missing are the instructions on how to create the robots and what they’ll do. Can we write a Java class to help? We’ll need to define the state and behavior of the droids using instance fields and methods. Let’s get to work!
public class Droid {
private String name;
private int batteryLevel;
public Droid(String droidName) {
this.name = droidName;
this.batteryLevel = 100;
}
public String toString() {
@RahimGuerfi
RahimGuerfi / Codecademy_JavascriptChallange.js
Created October 14, 2021 22:31
Codecademy - JavaScript Practice: Arrays, Loops, Objects, Iterators
/*
Write a function groceries() that takes an array of object literals of grocery items.
The function should return a string with each item separated by a comma except the last two items should be separated by the word 'and'.
Make sure spaces (' ') are inserted where they are appropriate.
groceries( [{item: 'Carrots'}, {item: 'Hummus'}, {item: 'Pesto'}, {item: 'Rigatoni'}] );
// returns 'Carrots, Hummus, Pesto and Rigatoni'
groceries( [{item: 'Bread'}, {item: 'Butter'}] );
// returns 'Bread and Butter'
@RahimGuerfi
RahimGuerfi / Team_Stats.js
Last active October 13, 2021 20:40
Codecademy - Team Stats Project
const team = {
_players: [{
firstName: 'Pablo',
lastName: 'Sanchez',
age: 11
},
{
firstName: 'Emilio',
lastName: 'Rodriguez',
age: 12
@RahimGuerfi
RahimGuerfi / Training_Days.js
Created October 13, 2021 16:27
Codecademy - Training Days Project
const name = 'Nala';
const getRandEvent = () => {
const random = Math.floor(Math.random() * 3);
if (random === 0) {
return 'Marathon';
} else if (random === 1) {
return 'Triathlon';
} else if (random === 2) {
@RahimGuerfi
RahimGuerfi / Meal_Maker.js
Last active October 13, 2021 20:40
Codecademy - Meal Maker Project
const menu = {
_courses: {
appetizers: [],
mains: [],
desserts: [],
},
get courses() {
//return Object.entries(this._courses);
return {
appetizers: this.appetizers,