From 87426d0d5aab4c3d747355b6354c0d7a50d06aa4 Mon Sep 17 00:00:00 2001 From: James Tansiri Date: Wed, 18 Dec 2024 11:10:08 +0700 Subject: [PATCH] feat: add content contribution guide --- eleventy.config.js | 7 +- public/css/tailwind.css | 5 + .../1.1-mermaid-graphs/files/main.md | 6 + .../1.1-mermaid-graphs/index.md | 29 +++ .../1.2-collapsible/files/content.md | 40 +++++ .../1.2-collapsible/index.md | 62 +++++++ .../1.3-extension-examples/files/content.md | 129 ++++++++++++++ .../1.3-extension-examples/index.md | 165 ++++++++++++++++++ .../2.1-test-case-version-1/files/main.py | 1 + .../2.1-test-case-version-1/files/tests.py | 1 + .../2.1-test-case-version-1/index.md | 40 +++++ .../2.2-test-case-version-2/files/main.py | 5 + .../2.2-test-case-version-2/files/tests.py | 36 ++++ .../2.2-test-case-version-2/index.md | 68 ++++++++ .../3.1-test-code-execution/files/closable | 0 .../files/content-read-only.txt | 4 + .../3.1-test-code-execution/files/content.txt | 4 + .../3.1-test-code-execution/files/index.js | 1 + .../3.1-test-code-execution/files/index.ts | 1 + .../3.1-test-code-execution/files/main.py | 1 + .../3.1-test-code-execution/files/tests.js | 1 + .../3.1-test-code-execution/files/tests.py | 1 + .../3.1-test-code-execution/files/tests.ts | 1 + .../3.1-test-code-execution/index.md | 151 ++++++++++++++++ .../3.2-test-ts-code-execution/files/index.ts | 0 .../3.2-test-ts-code-execution/index.md | 44 +++++ .../4.1-basic-sql-lesson/files/main.py | 20 +++ .../4.1-basic-sql-lesson/files/query.sql | 3 + .../4.1-basic-sql-lesson/files/tests.py | 4 + .../4.1-basic-sql-lesson/index.md | 48 +++++ .../files/main.py | 20 +++ .../files/query.sql | 6 + .../files/tests.py | 4 + .../index.md | 47 +++++ .../content-development-guide.11tydata.js | 5 + .../content-contribution-guide/index.md | 8 + src/index.njk | 2 +- 37 files changed, 967 insertions(+), 3 deletions(-) create mode 100644 src/courses/content-contribution-guide/1.1-mermaid-graphs/files/main.md create mode 100644 src/courses/content-contribution-guide/1.1-mermaid-graphs/index.md create mode 100644 src/courses/content-contribution-guide/1.2-collapsible/files/content.md create mode 100644 src/courses/content-contribution-guide/1.2-collapsible/index.md create mode 100644 src/courses/content-contribution-guide/1.3-extension-examples/files/content.md create mode 100644 src/courses/content-contribution-guide/1.3-extension-examples/index.md create mode 100644 src/courses/content-contribution-guide/2.1-test-case-version-1/files/main.py create mode 100644 src/courses/content-contribution-guide/2.1-test-case-version-1/files/tests.py create mode 100644 src/courses/content-contribution-guide/2.1-test-case-version-1/index.md create mode 100644 src/courses/content-contribution-guide/2.2-test-case-version-2/files/main.py create mode 100644 src/courses/content-contribution-guide/2.2-test-case-version-2/files/tests.py create mode 100644 src/courses/content-contribution-guide/2.2-test-case-version-2/index.md create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/closable create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/content-read-only.txt create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/content.txt create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/index.js create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/index.ts create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/main.py create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.js create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.py create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.ts create mode 100644 src/courses/content-contribution-guide/3.1-test-code-execution/index.md create mode 100644 src/courses/content-contribution-guide/3.2-test-ts-code-execution/files/index.ts create mode 100644 src/courses/content-contribution-guide/3.2-test-ts-code-execution/index.md create mode 100644 src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/main.py create mode 100644 src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/query.sql create mode 100644 src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/tests.py create mode 100644 src/courses/content-contribution-guide/4.1-basic-sql-lesson/index.md create mode 100644 src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/main.py create mode 100644 src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/query.sql create mode 100644 src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/tests.py create mode 100644 src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/index.md create mode 100644 src/courses/content-contribution-guide/content-development-guide.11tydata.js create mode 100644 src/courses/content-contribution-guide/index.md diff --git a/eleventy.config.js b/eleventy.config.js index 01c124a..0b53bda 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -21,10 +21,14 @@ const customCollections = require("./eleventy.config.collection.js"); module.exports = function (eleventyConfig) { // eleventyConfig.addPlugin(pluginSyntaxHighlight); // const highlighter = eleventyConfig.markdownHighlighter; + eleventyConfig.ignores.add("./src/courses/*/*/files/**/*"); eleventyConfig.addMarkdownHighlighter((str, language) => { if (language === "mermaid") { return `
${str}
`; } + if (language === "") { + language = "plaintext"; + } return hljs.highlight(str, { language }).value; // return highlighter(str, language); }); @@ -50,8 +54,7 @@ module.exports = function (eleventyConfig) { "./node_modules/alpinejs/dist/cdn.min.js": "/js/alpine.js", "./node_modules/@alpinejs/intersect/dist/cdn.min.js": "/js/alpine.intersect.js", - "./node_modules/@alpinejs/persist/dist/cdn.min.js": - "/js/alpine.persist.js", + "./node_modules/@alpinejs/persist/dist/cdn.min.js": "/js/alpine.persist.js", "./node_modules/hotkeys-js/dist/hotkeys.js": "/js/hotkeys.js", "./node_modules/mermaid/dist/mermaid.js": "/js/mermaid.js", "./node_modules/typed.js/dist/typed.umd.js": "/js/typed.umd.js", diff --git a/public/css/tailwind.css b/public/css/tailwind.css index 74b6e7f..89d1f98 100644 --- a/public/css/tailwind.css +++ b/public/css/tailwind.css @@ -1962,6 +1962,11 @@ h4 { padding-right: 0.5rem; } +.px-3 { + padding-left: 0.75rem; + padding-right: 0.75rem; +} + .px-4 { padding-left: 1rem; padding-right: 1rem; diff --git a/src/courses/content-contribution-guide/1.1-mermaid-graphs/files/main.md b/src/courses/content-contribution-guide/1.1-mermaid-graphs/files/main.md new file mode 100644 index 0000000..54af6b9 --- /dev/null +++ b/src/courses/content-contribution-guide/1.1-mermaid-graphs/files/main.md @@ -0,0 +1,6 @@ +Mermaid with HTML + +```mermaid +flowchart TB + A["google"] -->|Get money| B["Do
Something"] +``` \ No newline at end of file diff --git a/src/courses/content-contribution-guide/1.1-mermaid-graphs/index.md b/src/courses/content-contribution-guide/1.1-mermaid-graphs/index.md new file mode 100644 index 0000000..0c0aeb8 --- /dev/null +++ b/src/courses/content-contribution-guide/1.1-mermaid-graphs/index.md @@ -0,0 +1,29 @@ +--- +lesson_name: Mermaid Graphs +code_editor: True +code_execution: False +adding_file_allowed: False +section: Markdown Examples +file_groups: + - common: false + files: + - file_name: main.md + file_type: plaintext + id: 469 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: main.md + id: 1 + name: markdown + +--- +Mermaid with HTML + +```mermaid +flowchart TB + A["google"] -->|Get money| B["Do
Something"] +``` \ No newline at end of file diff --git a/src/courses/content-contribution-guide/1.2-collapsible/files/content.md b/src/courses/content-contribution-guide/1.2-collapsible/files/content.md new file mode 100644 index 0000000..9bc90f9 --- /dev/null +++ b/src/courses/content-contribution-guide/1.2-collapsible/files/content.md @@ -0,0 +1,40 @@ +### Collapsible content + +```markdown +#### With content hidden + +
Toggle me!Peek a boo!
+ +#### With content showing + +
+Shopping list + +* Vegetables +* Fruits +* Fish +
+``` + +#### With content hidden + +
Toggle me!Peek a boo!
+ +#### With content showing + +
+Solution +
print("This is amazing!")
+
+
+ + +#### With content showing + +
+ + +* Vegetables +* Fruits +* Fish +
\ No newline at end of file diff --git a/src/courses/content-contribution-guide/1.2-collapsible/index.md b/src/courses/content-contribution-guide/1.2-collapsible/index.md new file mode 100644 index 0000000..4054ced --- /dev/null +++ b/src/courses/content-contribution-guide/1.2-collapsible/index.md @@ -0,0 +1,62 @@ +--- +lesson_name: Collapsible +code_editor: True +code_execution: False +adding_file_allowed: False +file_groups: + - common: false + files: + - file_name: content.md + file_type: auto-detect + id: 473 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: content.md + id: 1 + name: Markdown + +--- +### Collapsible content + +```markdown +#### With content hidden + +
Toggle me!Peek a boo!
+ +#### With content showing + +
+Shopping list + +* Vegetables +* Fruits +* Fish +
+``` + +#### With content hidden + +
Toggle me!Peek a boo!
+ +#### With content showing + +
+Solution +
print("This is amazing!")
+
+
+ + +#### With content showing + +
+ + +* Vegetables +* Fruits +* Fish +
\ No newline at end of file diff --git a/src/courses/content-contribution-guide/1.3-extension-examples/files/content.md b/src/courses/content-contribution-guide/1.3-extension-examples/files/content.md new file mode 100644 index 0000000..3937b32 --- /dev/null +++ b/src/courses/content-contribution-guide/1.3-extension-examples/files/content.md @@ -0,0 +1,129 @@ +# Keys + +++ctrl+alt+delete++ + +# Emoji + +:smile: :heart: :thumbsup: + +# Details + +/// details | Some summary +attrs: {class: border border-red-500 px-3 cursor-pointer mb-4} +type: warning + +Some content +/// + +#### Opening as default + +/// details | Some summary +attrs: {class: border border-red-500 px-3 cursor-pointer mb-4} +open: True +type: warning + +Something +/// + +# Alerts + +
+This is the content + +```python +print("OKAY") +``` + +
+ +
+This is the content + +```python +print("OKAY") +``` + +
+ +
+This is the content + +```python +print("OKAY") +``` + +
+ +# Code blocks {.mt-4} + +Paragraph. + +``` +a fenced block +``` + +Another paragraph. + +> ``` +> a fenced block +> ``` + +> with blank lines + +```` +### Code blocks inside list + +- + ``` + a fenced block + ``` + +Definition +: + ``` + a fenced block + ``` + +### Code block with line numbers + +#### With class + + +# Mermaid + +```mermaid +pie title NETFLIX + "Time spent looking for movie" : 90 + "Time spent watching it" : 10 +```` + +```mermaid +sequenceDiagram + participant web as Web Browser + participant blog as Blog Service + participant account as Account Service + participant mail as Mail Service + participant db as Storage + + Note over web,db: The user must be logged in to submit blog posts + web->>+account: Logs in using credentials + account->>db: Query stored accounts + db->>account: Respond with query result + + alt Credentials not found + account->>web: Invalid credentials + else Credentials found + account->>-web: Successfully logged in + + Note over web,db: When the user is authenticated, they can now submit new posts + web->>+blog: Submit new post + blog->>db: Store post data + + par Notifications + blog--)mail: Send mail to blog subscribers + blog--)db: Store in-site notifications + and Response + blog-->>-web: Successfully posted + end + end +``` diff --git a/src/courses/content-contribution-guide/1.3-extension-examples/index.md b/src/courses/content-contribution-guide/1.3-extension-examples/index.md new file mode 100644 index 0000000..c6aa2a0 --- /dev/null +++ b/src/courses/content-contribution-guide/1.3-extension-examples/index.md @@ -0,0 +1,165 @@ +--- +lesson_name: Extension examples +code_editor: True +code_execution: False +adding_file_allowed: True +file_groups: + - common: false + files: + - file_name: content.md + file_type: auto-detect + id: 488 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: content.md + id: 1 + name: Markdown +--- + +# Keys + +++ctrl+alt+delete++ + +# Emoji + +:smile: :heart: :thumbsup: + +# Details + +/// details | Some summary +attrs: {class: border border-red-500 px-3 cursor-pointer mb-4} +type: warning + +Some content +/// + +#### Opening as default + +/// details | Some summary +attrs: {class: border border-red-500 px-3 cursor-pointer mb-4} +open: True +type: warning + +Something +/// + +# Alerts + +
+This is the content + +```python +print("OKAY") +``` + +
+ +
+This is the content + +```python +print("OKAY") +``` + +
+ +
+This is the content + +```python +print("OKAY") +``` + +
+ +# Code blocks {.mt-4} + +Paragraph. + +``` +a fenced block +``` + +Another paragraph. + +> ``` +> a fenced block +> ``` + +> with blank lines + +``` +### Code blocks inside list + +- +``` + +a fenced block + +``` + +Definition +: +``` + +a fenced block + +``` + + +``` + +============================================================ +T Tp Sp D Dp S D7 T + +--- + +A F#m Bm E C#m D E7 A +A# Gm Cm F Dm D# F7 A# +B♭ Gm Cm F Dm E♭m F7 B♭ + +```` + +# Mermaid + +```mermaid +pie title NETFLIX + "Time spent looking for movie" : 90 + "Time spent watching it" : 10 +``` + +```mermaid +sequenceDiagram + participant web as Web Browser + participant blog as Blog Service + participant account as Account Service + participant mail as Mail Service + participant db as Storage + + Note over web,db: The user must be logged in to submit blog posts + web->>+account: Logs in using credentials + account->>db: Query stored accounts + db->>account: Respond with query result + + alt Credentials not found + account->>web: Invalid credentials + else Credentials found + account->>-web: Successfully logged in + + Note over web,db: When the user is authenticated, they can now submit new posts + web->>+blog: Submit new post + blog->>db: Store post data + + par Notifications + blog--)mail: Send mail to blog subscribers + blog--)db: Store in-site notifications + and Response + blog-->>-web: Successfully posted + end + end +``` +```` diff --git a/src/courses/content-contribution-guide/2.1-test-case-version-1/files/main.py b/src/courses/content-contribution-guide/2.1-test-case-version-1/files/main.py new file mode 100644 index 0000000..4eb0df3 --- /dev/null +++ b/src/courses/content-contribution-guide/2.1-test-case-version-1/files/main.py @@ -0,0 +1 @@ +print("OKAY") \ No newline at end of file diff --git a/src/courses/content-contribution-guide/2.1-test-case-version-1/files/tests.py b/src/courses/content-contribution-guide/2.1-test-case-version-1/files/tests.py new file mode 100644 index 0000000..088a010 --- /dev/null +++ b/src/courses/content-contribution-guide/2.1-test-case-version-1/files/tests.py @@ -0,0 +1 @@ +print("from test") \ No newline at end of file diff --git a/src/courses/content-contribution-guide/2.1-test-case-version-1/index.md b/src/courses/content-contribution-guide/2.1-test-case-version-1/index.md new file mode 100644 index 0000000..d2cc0ee --- /dev/null +++ b/src/courses/content-contribution-guide/2.1-test-case-version-1/index.md @@ -0,0 +1,40 @@ +--- +lesson_name: Test case version 1 +code_editor: True +code_execution: True +adding_file_allowed: False +section: Exercises and Tests +file_groups: + - common: false + files: + - file_name: main.py + file_type: python + id: 482 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: main.py + - file_name: tests.py + file_type: python + id: 483 + is_closable: false + is_edit_focus: false + is_editable: true + is_hidden: true + is_main: false + is_test_file: true + source: tests.py + id: 1 + name: Python + +--- +This is the first version of the test without dynamic check + +--- + +### Exercise + +- Run the code \ No newline at end of file diff --git a/src/courses/content-contribution-guide/2.2-test-case-version-2/files/main.py b/src/courses/content-contribution-guide/2.2-test-case-version-2/files/main.py new file mode 100644 index 0000000..3132f69 --- /dev/null +++ b/src/courses/content-contribution-guide/2.2-test-case-version-2/files/main.py @@ -0,0 +1,5 @@ +def convert_to_title(sentence): + return "Hello World!" + return sentence.title() + +print(convert_to_title("This is going to be awesome!")) \ No newline at end of file diff --git a/src/courses/content-contribution-guide/2.2-test-case-version-2/files/tests.py b/src/courses/content-contribution-guide/2.2-test-case-version-2/files/tests.py new file mode 100644 index 0000000..c363abe --- /dev/null +++ b/src/courses/content-contribution-guide/2.2-test-case-version-2/files/tests.py @@ -0,0 +1,36 @@ +import sys +import re +import json + +from unittest.mock import patch + +patched_print = patch('builtins.print') +patched_print.start() + +try: + import main +except Exception: + pass + +def test_convert_to_title(sentence): + return sentence.title() + +inputs = [ + ("hello world!",), + ("the cat in the hat.",), + ("i love coding.",), + ("this is a test sentence.",), + ("the quick brown fox.",), +] + +results = {} + +for index, test_args in enumerate(inputs): + try: + expected_result = test_convert_to_title(*test_args) + assert main.convert_to_title(*test_args) == expected_result + results[index + 1] = True + except Exception: + results[index + 1] = False + +sys.stdout.write(json.dumps(results)) \ No newline at end of file diff --git a/src/courses/content-contribution-guide/2.2-test-case-version-2/index.md b/src/courses/content-contribution-guide/2.2-test-case-version-2/index.md new file mode 100644 index 0000000..b4bf95d --- /dev/null +++ b/src/courses/content-contribution-guide/2.2-test-case-version-2/index.md @@ -0,0 +1,68 @@ +--- +lesson_name: Test case version 2 +code_editor: True +code_execution: True +adding_file_allowed: True +file_groups: + - common: false + files: + - file_name: tests.py + file_type: python + id: 315 + is_closable: false + is_edit_focus: false + is_editable: false + is_hidden: true + is_main: false + is_test_file: true + source: tests.py + - file_name: main.py + file_type: python + id: 314 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: main.py + id: 1 + name: Python + +--- +#### Test case version 2 + +To implement test cases version 2, each test case is a list item with an integer as an id. + +For example, this is the code that populates the test cases in this lesson: + +```html + +``` + +Which generates below list + + + +To implement a test script, in the main file group, create a file with the value "is test file" checked. The script should write a JSON oject to the output with the indexes being the number of the test id, and the value being boolean type as the test result. For example: + +```json +{ + 1: true, + 2: false, +} +``` + +To see the test file for this lesson, see the file `test.py` in the code editor. \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/closable b/src/courses/content-contribution-guide/3.1-test-code-execution/files/closable new file mode 100644 index 0000000..e69de29 diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/content-read-only.txt b/src/courses/content-contribution-guide/3.1-test-code-execution/files/content-read-only.txt new file mode 100644 index 0000000..d0eb1d3 --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/content-read-only.txt @@ -0,0 +1,4 @@ +{ + "name": "James", + "age": 50 +} \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/content.txt b/src/courses/content-contribution-guide/3.1-test-code-execution/files/content.txt new file mode 100644 index 0000000..d0eb1d3 --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/content.txt @@ -0,0 +1,4 @@ +{ + "name": "James", + "age": 50 +} \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/index.js b/src/courses/content-contribution-guide/3.1-test-code-execution/files/index.js new file mode 100644 index 0000000..54107c4 --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/index.js @@ -0,0 +1 @@ +console.log("index"); \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/index.ts b/src/courses/content-contribution-guide/3.1-test-code-execution/files/index.ts new file mode 100644 index 0000000..b863ab2 --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/index.ts @@ -0,0 +1 @@ +console.log("index.ts"); \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/main.py b/src/courses/content-contribution-guide/3.1-test-code-execution/files/main.py new file mode 100644 index 0000000..6488190 --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/main.py @@ -0,0 +1 @@ +print("This is from main") \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.js b/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.js new file mode 100644 index 0000000..25cbb4f --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.js @@ -0,0 +1 @@ +console.log("tests"); \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.py b/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.py new file mode 100644 index 0000000..2f84140 --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.py @@ -0,0 +1 @@ +print("From tests") \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.ts b/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.ts new file mode 100644 index 0000000..729024b --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/files/tests.ts @@ -0,0 +1 @@ +console.log("tests.ts"); \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.1-test-code-execution/index.md b/src/courses/content-contribution-guide/3.1-test-code-execution/index.md new file mode 100644 index 0000000..fc827ec --- /dev/null +++ b/src/courses/content-contribution-guide/3.1-test-code-execution/index.md @@ -0,0 +1,151 @@ +--- +lesson_name: Test Code Execution +code_editor: True +code_execution: True +adding_file_allowed: True +section: Code Execution +file_groups: + - common: false + files: + - file_name: main.py + file_type: python + id: 424 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: main.py + - file_name: tests.py + file_type: python + id: 428 + is_closable: false + is_edit_focus: false + is_editable: false + is_hidden: true + is_main: false + is_test_file: true + source: tests.py + id: 1 + name: Python + - common: false + files: + - file_name: index.js + file_type: javascript + id: 425 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: index.js + - file_name: tests.js + file_type: javascript + id: 429 + is_closable: false + is_edit_focus: false + is_editable: false + is_hidden: true + is_main: false + is_test_file: true + source: tests.js + id: 2 + name: Javascript + - common: true + files: + - file_name: content.txt + file_type: plaintext + id: 480 + is_closable: false + is_edit_focus: false + is_editable: true + is_hidden: false + is_main: false + is_test_file: false + source: content.txt + - file_name: closable + file_type: plaintext + id: 487 + is_closable: true + is_edit_focus: false + is_editable: true + is_hidden: true + is_main: false + is_test_file: false + source: closable + - file_name: content-read-only.txt + file_type: plaintext + id: 427 + is_closable: false + is_edit_focus: false + is_editable: false + is_hidden: false + is_main: false + is_test_file: false + source: content-read-only.txt + id: 3 + name: Text + - common: false + files: + - file_name: index.ts + file_type: typescript + id: 426 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: index.ts + - file_name: tests.ts + file_type: typescript + id: 430 + is_closable: false + is_edit_focus: false + is_editable: false + is_hidden: true + is_main: false + is_test_file: true + source: tests.ts + id: 4 + name: TypeScript + - common: false + files: + - file_name: main.py + file_type: python + id: 481 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: main.py + id: 5 + name: Python - No test file + +--- +### This is a space to test execute the code + + + +What is Lorem Ipsum? +Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. + +Why do we use it? +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). + + +Where does it come from? +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +Where can I get some? +There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc. \ No newline at end of file diff --git a/src/courses/content-contribution-guide/3.2-test-ts-code-execution/files/index.ts b/src/courses/content-contribution-guide/3.2-test-ts-code-execution/files/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/courses/content-contribution-guide/3.2-test-ts-code-execution/index.md b/src/courses/content-contribution-guide/3.2-test-ts-code-execution/index.md new file mode 100644 index 0000000..7d46d0f --- /dev/null +++ b/src/courses/content-contribution-guide/3.2-test-ts-code-execution/index.md @@ -0,0 +1,44 @@ +--- +lesson_name: Test TS Code Execution +code_editor: True +code_execution: True +adding_file_allowed: False +file_groups: + - common: false + files: + - file_name: index.ts + file_type: typescript + id: 465 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: index.ts + id: 1 + name: TypeScript + +--- +### This is a space to test execute the code + + + +What is Lorem Ipsum? +Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. + +Why do we use it? +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). + + +Where does it come from? +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +Where can I get some? +There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc. \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/main.py b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/main.py new file mode 100644 index 0000000..c7cf66c --- /dev/null +++ b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/main.py @@ -0,0 +1,20 @@ +import sqlite3 +import os +from faker import Faker +from prettytable import from_db_cursor, MARKDOWN + +fake = Faker() +Faker.seed(0) + +con = sqlite3.connect("tutorial.db") +cur = con.cursor() + +cur.execute("CREATE TABLE movie(title, year, score)") + +query = open('query.sql', 'r').read() +res = cur.execute(query) +con.commit() + +cur.execute("SELECT title, year, score FROM movie") +table = from_db_cursor(cur) +print(table) \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/query.sql b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/query.sql new file mode 100644 index 0000000..f1b99c2 --- /dev/null +++ b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/query.sql @@ -0,0 +1,3 @@ +INSERT INTO movie VALUES + ('Monty Python and the Holy Grail', 1975, 8.2), + ('And Now for Something Completely Different', 1971, 7.5) \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/tests.py b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/tests.py new file mode 100644 index 0000000..e4766fb --- /dev/null +++ b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/files/tests.py @@ -0,0 +1,4 @@ +import sys +import json + +sys.stdout.write(json.dumps({1: False})) \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.1-basic-sql-lesson/index.md b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/index.md new file mode 100644 index 0000000..a987b99 --- /dev/null +++ b/src/courses/content-contribution-guide/4.1-basic-sql-lesson/index.md @@ -0,0 +1,48 @@ +--- +lesson_name: Basic SQL Lesson +code_editor: True +code_execution: True +adding_file_allowed: False +section: SQL +file_groups: + - common: false + files: + - file_name: query.sql + file_type: sql + id: 462 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: false + is_test_file: false + source: query.sql + - file_name: main.py + file_type: python + id: 463 + is_closable: false + is_edit_focus: false + is_editable: false + is_hidden: false + is_main: true + is_test_file: false + source: main.py + - file_name: tests.py + file_type: python + id: 464 + is_closable: false + is_edit_focus: false + is_editable: false + is_hidden: true + is_main: false + is_test_file: true + source: tests.py + id: 1 + name: Python + +--- +### + + \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/main.py b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/main.py new file mode 100644 index 0000000..a1e537d --- /dev/null +++ b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/main.py @@ -0,0 +1,20 @@ +import sqlite3 +import os +from faker import Faker +from prettytable import from_db_cursor, MARKDOWN + +fake = Faker() +Faker.seed(0) + +con = sqlite3.connect("tutorial.db") +cur = con.cursor() + +cur.execute("CREATE TABLE movie(title, year, score)") + +query = open('query.sql', 'r').read() +res = cur.executescript(query) +con.commit() + +cur.execute("SELECT title, year, score FROM movie") +table = from_db_cursor(cur) +print(table) \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/query.sql b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/query.sql new file mode 100644 index 0000000..c816a98 --- /dev/null +++ b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/query.sql @@ -0,0 +1,6 @@ +INSERT INTO movie VALUES + ('Monty Python and the Holy Grail', 1975, 8.2), + ('And Now for Something Completely Different', 1971, 7.5); +INSERT INTO movie VALUES + ('Monty Python and the Holy Grail', 1975, 8.2), + ('And Now for Something Completely Different', 1971, 7.5); \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/tests.py b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/tests.py new file mode 100644 index 0000000..e4766fb --- /dev/null +++ b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/files/tests.py @@ -0,0 +1,4 @@ +import sys +import json + +sys.stdout.write(json.dumps({1: False})) \ No newline at end of file diff --git a/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/index.md b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/index.md new file mode 100644 index 0000000..c3c15ce --- /dev/null +++ b/src/courses/content-contribution-guide/4.2-execute-multiple-sql-commands/index.md @@ -0,0 +1,47 @@ +--- +lesson_name: Execute Multiple SQL Commands +code_editor: True +code_execution: True +adding_file_allowed: False +file_groups: + - common: false + files: + - file_name: tests.py + file_type: python + id: 468 + is_closable: false + is_edit_focus: false + is_editable: true + is_hidden: true + is_main: false + is_test_file: true + source: tests.py + - file_name: query.sql + file_type: sql + id: 466 + is_closable: false + is_edit_focus: true + is_editable: true + is_hidden: false + is_main: false + is_test_file: false + source: query.sql + - file_name: main.py + file_type: python + id: 467 + is_closable: false + is_edit_focus: false + is_editable: true + is_hidden: false + is_main: true + is_test_file: false + source: main.py + id: 1 + name: Python + +--- +# Content + + \ No newline at end of file diff --git a/src/courses/content-contribution-guide/content-development-guide.11tydata.js b/src/courses/content-contribution-guide/content-development-guide.11tydata.js new file mode 100644 index 0000000..739fdaa --- /dev/null +++ b/src/courses/content-contribution-guide/content-development-guide.11tydata.js @@ -0,0 +1,5 @@ +module.exports = { + course_id: "content-contribution-guide", + course_name: "Content contribution guide", + course_slug: "content-contribution-guide", +}; diff --git a/src/courses/content-contribution-guide/index.md b/src/courses/content-contribution-guide/index.md new file mode 100644 index 0000000..0339782 --- /dev/null +++ b/src/courses/content-contribution-guide/index.md @@ -0,0 +1,8 @@ +--- +title: Content contribution guide +layout: layouts/course.njk +override:tags: true +tags: ["course"] +description: Contribute to the content of the courses by following the guidelines provided in this guide. +hidden: true +--- diff --git a/src/index.njk b/src/index.njk index eb8cf3a..1152ac1 100644 --- a/src/index.njk +++ b/src/index.njk @@ -25,7 +25,7 @@ eleventyNavigation:

All the courses on this website is free.

- {% for course in collections.course %} + {% for course in collections.course|filter("hidden", undefined) %}

{{ course.data.title }}

{{ course.data.description }}