Skip to content

Instantly share code, notes, and snippets.

@skyclo
Last active January 22, 2021 02:38
Show Gist options
  • Save skyclo/fc1c96ef1d06e75c6a6bf7ced348535f to your computer and use it in GitHub Desktop.
Save skyclo/fc1c96ef1d06e75c6a6bf7ced348535f to your computer and use it in GitHub Desktop.
Ideoxan Data Structures
// course.js
// Found in each course and defines metadata
const fs = require('fs')
const courseIndex = [ // Replace with a for-loop to index lessons
{
name: "Grab name from folder name (format: '001-Chapter-Title-Name')",
lessons: {
// Load from lesson.js
}
},
{
name: "Grab name from folder name (format: '001-Chapter-Title-Name')",
lessons: {
// Load from lesson.js
}
}
]
module.exports = {
name: "Course Name",
summary: "A short summary (150 chars. max) can be included that is featured on course cards",
description: "This is a very long description (1000 chars. max) that is displayed on expanded course cards. \nIt can break down the topics available in the course and provide a broader view on the course as a whole.",
bannerImage: "",
tags: [
"course",
"tags",
"help",
"classify and refine",
"courses"
],
environment: {
on: "ubuntu-latest", // OS for container
with: [ // Tools/CLIs/Apps that come installed by default
"nodejs-14",
"git-latest",
],
init: "echo Hello!", // Bash commands exec'd at startup (can also be bash file read from FS)
vars: {
"NODE_ENV": "development",
"SOME_OTHER_ENV_VAR": "some value"
}
},
content: courseIndex
}
}
// Lesson.js
// Found in each lesson and defines metadata, checks, etc
const fs = require('fs')
module.exports = {
name: "Lesson Name",
quiz: false, // True = yes a quiz, or False = no used editor
guide: fs.readFile('./guide.md'), // Markdown file that guides the user
files: [
{
name: "file1",
extension: "txt",
content: fs.readFile('./content/file1.txt') // Fs Readfile or Escaped string
},
{
name: "aHTMLFile",
extension: "html",
content: "<!DOCTYPE html>\n<h1>Hello, World!</h1>\n<p>This is a sample HTML file that loads into the editor</p>"
}
],
tasks: [
{
instructions: "Click on the button\nThen copy and paste the results into the terminal. Press enter.", // Escaped markdown string
completedByDefault: false,
checks: [
{
source: "out", // out = stdout, err = stderr, in = stdin, file = file from editor
type: "equal", // equal, not equal, greater/lesser than
value: "Hello, World!" // escaped string, number, object, or function (ex: isNull(), isString(), isNumber(), etc.)
}
],
}
]
}
|- src
\|- apps
\|- www
\| app.js
|- routes
|- static
\|- scripts
|- styles
|- images
|- fonts
|- views
\|- components
\|- ...
\|- pages
\|- ...
|- editor
\| app.js
|- routes
|- static
\|- scripts
|- styles
|- images
|- fonts
|- views
\|- components
\|- ...
\|- pages
\|- ...
|- utils
|- courses
\|- ...
|- bin
\| launcher.sh
| launcher.bat
| index.js
| config.json
| config.default.json
| .env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment