Skip to content

Instantly share code, notes, and snippets.

View Charlie-robin's full-sized avatar
🍩

Charlie Richardson Charlie-robin

🍩
View GitHub Profile
@Charlie-robin
Charlie-robin / import-export.md
Last active May 10, 2022 14:00
Importing and Exporting with JavaScript & React

Importing and Exporting with Javascript & React ⚡

There are generally two different types of imports & exports when working with JavaScript these are commonly used with React.js.

They are:

  • Default Imports and Exports.
  • Named Imports and Exports.

There are a couple of exceptions these more specifically to do with React.

Iterators Only!

You have some pure functions to write, your functions should take parameters and return a result!

Method Description
.map() creates a new array by performing a callback function on each array element
.filter() creates a new array with array elements that pass a certain condition
.reduce() takes all of the elements in an array and "reduces" them to a single value
@Charlie-robin
Charlie-robin / vending-machine.md
Last active June 24, 2022 11:15
Vending machine challenge

Vending Machine

Brief

Develop a Vending machine command line program.

The programe needs to:

  • Contain a number of products to buy
    • Each product has a name, category and price
  • Some example categories are: drink, crisps, chocolate bars and cereal bars.

Halfway Challenge - Marking Scheme

Note

There is a chance of getting 120/100 due to adding and extending the project.

There is no penalty for not attempting stage 4a & 4b.

Brief Stages (50%)

[
{
"date_created": "1997-11-02",
"nationality": "Afrikaans",
"greeting": "Hallo (hal-low)",
"origin_country": "South Africa",
"created_by": "Philip Vandeberg",
"id": 1
},
{

Full-stack-project

Overview

You’re going to build a full-stack web application!

This will solidify the concepts we’ve covered so far, built using these technologies:

  • Java
  • Spring
@Charlie-robin
Charlie-robin / movies.json
Last active August 25, 2022 08:42
Mock JSON data
[
{ "id": 0, "title": "The Shawshank Redemption", "year_released": "1994" },
{ "id": 1, "title": "The Godfather", "year_released": "1972" },
{ "id": 2, "title": "The Dark Knight", "year_released": "2008" },
{ "id": 3, "title": "The Godfather Part II", "year_released": "1974" },
{ "id": 4, "title": "12 Angry Men", "year_released": "1957" },
{ "id": 5, "title": "Schindler's List", "year_released": "1993" },
{ "id": 6, "title": "The Lord of the Rings: The Return of the King", "year_released": "2003" },
{ "id": 7, "title": "Pulp Fiction", "year_released": "1994" },
{ "id": 8, "title": "The Lord of the Rings: The Fellowship of the Ring", "year_released": "2001" },
@Charlie-robin
Charlie-robin / ratings.json
Last active August 25, 2022 08:42
Mock JSON data
[
{ "id": 0, "user_id": 0, "movie_id": 2, "rating": 2 },
{ "id": 1, "user_id": 0, "movie_id": 5, "rating": 3 },
{ "id": 2, "user_id": 1, "movie_id": 6, "rating": 0 },
{ "id": 3, "user_id": 1, "movie_id": 6, "rating": 4 },
{ "id": 4, "user_id": 2, "movie_id": 1, "rating": 9 },
{ "id": 5, "user_id": 2, "movie_id": 3, "rating": 4 },
{ "id": 6, "user_id": 3, "movie_id": 3, "rating": 5 },
{ "id": 7, "user_id": 3, "movie_id": 4, "rating": 3 },
{ "id": 8, "user_id": 4, "movie_id": 3, "rating": 8 },
@Charlie-robin
Charlie-robin / users.json
Last active August 25, 2022 08:41
Mock JSON data
[
{ "id": 0, "first_name": "Valentin", "last_name": "Abrahamson" },
{ "id": 1, "first_name": "Guillermo", "last_name": "Abrahamson" },
{ "id": 2, "first_name": "Fumiko", "last_name": "Babilon" },
{ "id": 3, "first_name": "Lavern", "last_name": "Baggott" },
{ "id": 4, "first_name": "Bryan", "last_name": "Brauer" },
{ "id": 5, "first_name": "Dania", "last_name": "Tietge" },
{ "id": 6, "first_name": "Kisha", "last_name": "Cordill" },
{ "id": 7, "first_name": "Lani", "last_name": "Shamel" },
{ "id": 8, "first_name": "Jimmie", "last_name": "Pehowic" },
@Charlie-robin
Charlie-robin / Main.java
Last active October 4, 2023 08:45
Basic snap logic
package org.example;
import java.util.*;
public class Main {
public static void main(String[] args) {
List<String> computersDeck = new ArrayList<>(List.of("a", "b", "c"));
List<String> playersDeck = new ArrayList<>(computersDeck);