Skip to content

Commit 281673e

Browse files
committed
improve content testing videoId field
1 parent dc251cc commit 281673e

File tree

13 files changed

+20
-14
lines changed

13 files changed

+20
-14
lines changed

content-testing/schemas.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ const baseVideosSchema = strictObject({
2121
title: string().required(),
2222
description: string().required(),
2323

24-
videoId: youtubeIdValidator.when(['parts'], (parts, schema) => {
24+
videoId: youtubeIdValidator.when('parts', ([parts], schema) => {
2525
// videoId required if the `parts` array is missing or empty
26-
return parts && parts.length > 0 ? schema : schema.required();
26+
return parts && parts.length > 0
27+
? schema.test(
28+
'videoId and parts conflict',
29+
'Top-level "videoId" should not be defined if "parts" exist',
30+
(value) => !value
31+
)
32+
: schema.required();
2733
}),
2834

2935
nebulaSlug: nonUrlStringValidator,

content/videos/challenges/100-neuroevolution-flappy-bird/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Neuroevolution Flappy Bird",
33
"description": "In this challenge, I use my JavaScript neural network library and a genetic algorithm to train an agent to play Flappy Bird.",
44
"videoNumber": "100",
5-
"videoId": "c6y21FkaUqw",
5+
"videoId": "",
66
"date": "2018-04-16",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["neural network", "reinforcement learning", "genetic algorithms", "evolution", "Flappy Bird game"],

content/videos/challenges/130-drawing-with-fourier-transform-and-epicycles/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Drawing with Fourier Transform and Epicycles",
33
"description": "In this coding challenge, I implement the Discrete Fourier Transform algorithm in JavaScript and render a drawing using epicycles derived from the transform.",
44
"videoNumber": "130",
5-
"videoId": "MY4luNgGfms",
5+
"videoId": "",
66
"date": "2019-01-24",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["Fourier transform square wave", "discrete Fourier transform", "epicycles drawing"],

content/videos/challenges/35-traveling-salesperson/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Traveling Salesperson",
33
"description": "In Part 1 of this multi-part coding challenge, I introduce the classic computer science problem of the Traveling Salesperson (TSP) and discuss the pitfalls with a brute force solution. In Part 2, I discuss Lexicographic Ordering and demonstrate one algorithm to iterate over all the permutations of an array. In Part 3, I apply this algorithm to a brute-force solution of the TSP problem. Every single route permutation is checked one by one. In Part 4, I attempt to create a solution to the TSP problem with a genetic algorithm, and then I add a “crossover” algorithm in Part 5.",
44
"videoNumber": "35",
5-
"videoId": "BAejnwN4Ccw",
5+
"videoId": "",
66
"date": "2016-08-24",
77
"languages": ["p5.js"],
88
"topics": [

content/videos/challenges/62-plinko-with-matterjs/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Plinko with Matter.js",
33
"description": "I love all things random and chance so why not make a Plink simulation with the matter.js physics engine and p5.js!",
44
"videoNumber": "62",
5-
"videoId": "KakpnfDv_f0",
5+
"videoId": "",
66
"date": "2017-03-10",
77
"languages": ["JavaScript", "p5.js", "Matter.js"],
88
"topics": ["collision detection", "matter.js", "physics engine", "Plinko game"],

content/videos/challenges/64-kinematics/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Kinematics",
33
"description": "In this multi-part coding challenge, I demonstrate how to implement kinematics in Processing (Java).",
44
"videoNumber": "64",
5-
"videoId": "xXjRlEr7AGk",
5+
"videoId": "",
66
"date": "2017-03-16",
77
"languages": ["Processing"],
88
"topics": ["forward kinematics", "inverse kinematics", "tentacle animation", "linked lists", "array"],

content/videos/challenges/65-binary-tree/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Binary Tree",
33
"description": "This multi-part coding challenge is part of the first week of my course: \"Intelligence and Learning.\" Here I attempt to implement a classic data structure: The Binary Search Tree.",
44
"videoNumber": "65",
5-
"videoId": "ZNH0MuQ51m4",
5+
"videoId": "",
66
"date": "2017-03-21",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["tree", "binary search", "data structure", "intelligence and learning"],

content/videos/challenges/68-breadth-first-search/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Breadth-First Search",
33
"description": "In this two part challenge, I implement the Breadth-First Search algorithm in JavaScript. My demo application is \"6 Degrees of Kevin Bacon\" (finding the closest relationship between Kevin Bacon and another actor).",
44
"videoNumber": "68",
5-
"videoId": "piBq7VD0ZSo",
5+
"videoId": "",
66
"date": "2017-03-30",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["breadth-first search algorithm", "Six Degrees of Kevin Bacon"],

content/videos/challenges/69-evolutionary-steering-behaviors/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Evolutionary Steering Behaviors",
33
"description": "In this multi-part coding challenge, I create a system where autonomous steering agents evolve the behavior of eating food and avoiding poison.",
44
"videoNumber": "69",
5-
"videoId": "flxOkx0yLrY",
5+
"videoId": "",
66
"date": "2017-04-18",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["genetic algorithms", "steering behaviors", "seek function", "autonomous agent", "evolution"],

content/videos/challenges/72-frogger/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Frogger",
33
"description": "In this multi-part challenge, I create a simplified version of the classic Atari video game Frogger in Processing (Java).",
44
"videoNumber": "72",
5-
"videoId": "giXV6xErw0Y",
5+
"videoId": "",
66
"date": "2017-06-14",
77
"languages": ["Processing"],
88
"topics": ["game mechanics", "Atari Frogger game", "inheritance"],

content/videos/challenges/81-circle-morphing/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Circle Morphing",
33
"description": "In this multi-part challenge, I implement two possible solutions to Golan Levin's Circle Morphing challenge.",
44
"videoNumber": "81",
5-
"videoId": "u2D4sxh3MTs",
5+
"videoId": "",
66
"date": "2017-11-01",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["Golan Levin", "interpolation", "circle morphing", "polar coordinates"],

content/videos/challenges/94-2048/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "2048 Sliding Puzzle Game",
33
"description": "In this multi-part coding challenge, I code the sliding puzzle game 2048 in JavaScript using canvas and p5.js.",
44
"videoNumber": "94",
5-
"videoId": "JSn-DJU8qf0",
5+
"videoId": "",
66
"date": "2018-02-26",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["2048 game", "sliding puzzle game"],

content/videos/challenges/98-quadtree/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "Quadtree",
33
"description": "In this multi-part coding challenge, I implement a Quadtree data structure in JavaScript and visualize it with p5.js.",
44
"videoNumber": "98",
5-
"videoId": "OJxEcs0w_kE",
5+
"videoId": "",
66
"date": "2018-03-26",
77
"languages": ["JavaScript", "p5.js"],
88
"topics": ["quadtree data structure", "quadtree collision detection"],

0 commit comments

Comments
 (0)