Skip to content

Commit

Permalink
Merge branch 'code-differently:main' into DavidSmith_Lesson12_Leetcod…
Browse files Browse the repository at this point in the history
…e3062
  • Loading branch information
dxsmith244 authored Oct 24, 2024
2 parents d7025aa + 32f5984 commit a518807
Show file tree
Hide file tree
Showing 49 changed files with 7,892 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/check_lesson_13_java_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check Lesson 13 Java Pull Request

on:
pull_request:
branches: [ "main" ]
paths:
- "lesson_13/maps_java/**"

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Build Lesson 13 with Java
working-directory: ./lesson_13/maps_java
run: ./gradlew check
28 changes: 28 additions & 0 deletions .github/workflows/check_lesson_13_ts_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check Lesson 13 TS Pull Request

on:
pull_request:
branches: [ "main" ]
paths:
- "lesson_13/maps_ts/**"

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Build Lesson 13 with Node.js
working-directory: ./lesson_13/maps_ts
run: |
npm ci
npm run check
12 changes: 12 additions & 0 deletions .github/workflows/check_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
- "lesson_11/arrays_ts/**"
- "lesson_12/structs_java/**"
- "lesson_12/structs_ts/**"
- "lesson_13/maps_java/**"
- "lesson_13/maps_ts/**"

jobs:
build:
Expand Down Expand Up @@ -105,3 +107,13 @@ jobs:
run: |
npm ci
npm run compile
- name: Build Lesson 13 with Java
working-directory: ./lesson_13/maps_java
run: ./gradlew assemble

- name: Build Lesson 13 with Node.js
working-directory: ./lesson_13/maps_ts
run: |
npm ci
npm run compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.codedifferently.lesson9.dataprovider;

import java.util.Map;
import org.springframework.stereotype.Service;

@Service
public class DavidSmithProvider extends DataProvider {
public String getProviderName() {
return "davidsmith";
}

public Map<String, Class> getColumnTypeByName() {
return Map.of(
"column1", Float.class,
"column2", Long.class,
"column3", Short.class,
"column4", Double.class,
"column5", Boolean.class,
"column6", String.class,
"column7", Integer.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main.java.com.codedifferently.lesson9.dataprovider;

import com.codedifferently.lesson9.dataprovider.DataProvider;
import java.util.Map;
import org.springframework.stereotype.Service;

@Service
public class ShawnDunsmoreProvider extends DataProvider {
public String getProviderName() {
return "shawmdunsmore";
}

public Map<String, Class> getColumnTypeByName() {
return Map.of(
"column1", Float.class,
"column2", Integer.class,
"column3", Float.class,
"column4", Integer.class,
"column5", String.class,
"column6", Integer.class,
"column7", Boolean.class);
}
}
92 changes: 92 additions & 0 deletions lesson_09/types/types_app/src/main/resources/data/davidsmith.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[
{
"column1": "2.4856768E38",
"column2": "6348194688465711104",
"column3": "7857",
"column4": "9.45255774450901E307",
"column5": "false",
"column6": "d7mgwz1ter3v",
"column7": "1441278966"
},
{
"column1": "4.0458309E37",
"column2": "475565836519605120",
"column3": "32745",
"column4": "1.2832704698365005E308",
"column5": "false",
"column6": "znmecj6v",
"column7": "113077411"
},
{
"column1": "6.88325E36",
"column2": "1605489098004667392",
"column3": "3736",
"column4": "5.805517690396217E307",
"column5": "false",
"column6": "lm6cweq0h",
"column7": "262984225"
},
{
"column1": "5.6297574E36",
"column2": "1042305323669988608",
"column3": "9421",
"column4": "4.4593927475096523E307",
"column5": "true",
"column6": "2rxwqco47",
"column7": "1283217146"
},
{
"column1": "1.3651107E38",
"column2": "2693239424534015488",
"column3": "22023",
"column4": "1.4079937081264981E308",
"column5": "false",
"column6": "pwu96a7n",
"column7": "771709699"
},
{
"column1": "1.8253724E38",
"column2": "4001908518756238848",
"column3": "25719",
"column4": "3.8526406262057017E307",
"column5": "false",
"column6": "gc6yufq1a9o",
"column7": "1098995223"
},
{
"column1": "4.3599036E35",
"column2": "2464793638457769984",
"column3": "27246",
"column4": "1.1952813310702996E308",
"column5": "true",
"column6": "gej6pimrvo58",
"column7": "1083541075"
},
{
"column1": "2.0973243E38",
"column2": "6316064103344864256",
"column3": "13153",
"column4": "3.232035544098492E307",
"column5": "false",
"column6": "xr5pydw9vie",
"column7": "535584121"
},
{
"column1": "5.106034E37",
"column2": "7391061472444326912",
"column3": "17670",
"column4": "2.6990741028748347E307",
"column5": "true",
"column6": "wz6hrv0jeos7",
"column7": "840264099"
},
{
"column1": "2.7015147E38",
"column2": "9150685000976729088",
"column3": "31742",
"column4": "3.6277639883903186E307",
"column5": "true",
"column6": "zta2ny9c6k",
"column7": "1545745617"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[
{
"column1": "2.5975503E38",
"column2": "5664226295930521600",
"column3": "1.9268648586794186E307",
"column4": "13164",
"column5": "ejq4a75",
"column6": "1898846002",
"column7": "false"
},
{
"column1": "2.624149E38",
"column2": "2667905418562562560",
"column3": "9.647265260343374E307",
"column4": "21831",
"column5": "onxzs7",
"column6": "187799466",
"column7": "true"
},
{
"column1": "1.3378175E37",
"column2": "5574344195759352832",
"column3": "1.0553221728595063E308",
"column4": "9593",
"column5": "3k2usm5dt",
"column6": "1440856592",
"column7": "true"
},
{
"column1": "2.1907175E38",
"column2": "6993138911564431360",
"column3": "1.6856102170434321E308",
"column4": "31096",
"column5": "r9sg3ivy",
"column6": "1893363745",
"column7": "false"
},
{
"column1": "1.9505218E38",
"column2": "9025951922004683776",
"column3": "6.396469959388043E307",
"column4": "10920",
"column5": "glwno1z2",
"column6": "226102071",
"column7": "true"
},
{
"column1": "1.6333101E38",
"column2": "5098983408897986560",
"column3": "1.3629475836701135E308",
"column4": "24686",
"column5": "15djl",
"column6": "1455504852",
"column7": "true"
},
{
"column1": "3.5340154E37",
"column2": "6233740675969122304",
"column3": "6.505875808945395E307",
"column4": "17388",
"column5": "bedz8g",
"column6": "472238337",
"column7": "true"
},
{
"column1": "1.6295155E37",
"column2": "7780669253529218048",
"column3": "1.39665841270448E308",
"column4": "2850",
"column5": "842g9bri6ej",
"column6": "1605076333",
"column7": "true"
},
{
"column1": "2.0464422E38",
"column2": "3416033937088187392",
"column3": "7.700196024395798E307",
"column4": "14940",
"column5": "wgcumkqn",
"column6": "1374923365",
"column7": "true"
},
{
"column1": "2.0378536E38",
"column2": "7666386382444016640",
"column3": "9.594346982668915E307",
"column4": "7992",
"column5": "1ysgj",
"column6": "1476248924",
"column7": "false"
}
]
45 changes: 45 additions & 0 deletions lesson_10/libraries/src/loaders/amiyah_jones.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import csv from 'csv-parser';
import fs from 'fs';
import { Credit, MediaItem } from '../models/index.js';
import { Loader } from './loader.js';

export class AmiyahJonesLoader implements Loader {
getLoaderName(): string {
return 'amiyahjones';
}

async loadData(): Promise<MediaItem[]> {
const credits = await this.loadCredits();
const mediaItems = await this.loadMediaItems();

console.log(
`Loaded ${credits.length} credits and ${mediaItems.length} media items`,
);

return [...mediaItems.values()];
}

async loadMediaItems(): Promise<MediaItem[]> {
const allMedia = [];
const readable = fs
.createReadStream('data/media_items.csv', 'utf-8')
.pipe(csv());
for await (const row of readable) {
const { id, type, title, year } = row;
allMedia.push(new MediaItem(id, title, type, year, []));
}
return allMedia;
}

async loadCredits(): Promise<Credit[]> {
const credits = [];
const readable = fs
.createReadStream('data/credits.csv', 'utf-8')
.pipe(csv());
for await (const row of readable) {
const { media_item_id, role, name } = row;
credits.push(new Credit(media_item_id, name, role));
}
return credits;
}
}
Loading

0 comments on commit a518807

Please sign in to comment.