Skip to content

Commit

Permalink
-update
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoonz committed Aug 9, 2021
1 parent 9556494 commit 69a617b
Show file tree
Hide file tree
Showing 75 changed files with 4,824 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,72 @@
{"expireTime":9007200883265493000,"key":"transformer-remark-markdown-ast-c7b1026572e530f0f2579941ece0833d--","val":{"type":"root","children":[{"type":"heading","depth":1,"children":[{"type":"text","value":"Audio","position":{"start":{"line":2,"column":3,"offset":3},"end":{"line":2,"column":8,"offset":8},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":8,"offset":8},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Dynamic Time Warping Triggered Guitar Effects Project:","position":{"start":{"line":4,"column":3,"offset":12},"end":{"line":4,"column":57,"offset":66},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":10},"end":{"line":4,"column":57,"offset":66},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"DTW Algorithm:","position":{"start":{"line":6,"column":3,"offset":70},"end":{"line":6,"column":17,"offset":84},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":68},"end":{"line":6,"column":17,"offset":84},"indent":[]}},{"type":"html","value":"<iframe src=\"https://onedrive.live.com/embed?cid=D21009FDD967A241&amp;resid=D21009FDD967A241%21634692&amp;authkey=AHfsGpj1Un3UNuE&amp;em=2&amp;wdAr=1.7777777777777777\" width=\"962px\" height=\"565px\" frameborder=\"0\">This is an embedded <a target=\"_blank\" href=\"https://office.com\">Microsoft Office</a> presentation, powered by <a target=\"_blank\" href=\"https://office.com/webapps\">Office</a>.</iframe>","position":{"start":{"line":8,"column":1,"offset":86},"end":{"line":8,"column":398,"offset":483},"indent":[]}},{"type":"thematicBreak","position":{"start":{"line":10,"column":1,"offset":485},"end":{"line":10,"column":4,"offset":488},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Project:","position":{"start":{"line":12,"column":3,"offset":492},"end":{"line":12,"column":11,"offset":500},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":490},"end":{"line":12,"column":11,"offset":500},"indent":[]}},{"type":"html","value":"<iframe src=\"https://onedrive.live.com/embed?resid=D21009FDD967A241%21608188&amp;authkey=%21AL1vMFzOuqvFbUY&amp;em=2&amp;wdAr=1.7777777777777777\" width=\"962px\" height=\"565px\" frameborder=\"0\">This is an embedded <a target=\"_blank\" href=\"https://office.com\">Microsoft Office</a> presentation, powered by <a target=\"_blank\" href=\"https://office.com/webapps\">Office</a>.</iframe>","position":{"start":{"line":14,"column":1,"offset":502},"end":{"line":14,"column":376,"offset":877},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":15,"column":1,"offset":878}}}}
{
"expireTime": 9007200883265493000,
"key": "transformer-remark-markdown-ast-c7b1026572e530f0f2579941ece0833d--",
"val": {
"type": "root",
"children": [
{
"type": "heading",
"depth": 1,
"children": [
{
"type": "text",
"value": "Audio",
"position": { "start": { "line": 2, "column": 3, "offset": 3 }, "end": { "line": 2, "column": 8, "offset": 8 }, "indent": [] }
}
],
"position": { "start": { "line": 2, "column": 1, "offset": 1 }, "end": { "line": 2, "column": 8, "offset": 8 }, "indent": [] }
},
{
"type": "heading",
"depth": 1,
"children": [
{
"type": "text",
"value": "Dynamic Time Warping Triggered Guitar Effects Project:",
"position": { "start": { "line": 4, "column": 3, "offset": 12 }, "end": { "line": 4, "column": 57, "offset": 66 }, "indent": [] }
}
],
"position": { "start": { "line": 4, "column": 1, "offset": 10 }, "end": { "line": 4, "column": 57, "offset": 66 }, "indent": [] }
},
{
"type": "heading",
"depth": 1,
"children": [
{
"type": "text",
"value": "DTW Algorithm:",
"position": { "start": { "line": 6, "column": 3, "offset": 70 }, "end": { "line": 6, "column": 17, "offset": 84 }, "indent": [] }
}
],
"position": { "start": { "line": 6, "column": 1, "offset": 68 }, "end": { "line": 6, "column": 17, "offset": 84 }, "indent": [] }
},
{
"type": "html",
"value": "<iframe src=\"https://onedrive.live.com/embed?cid=D21009FDD967A241&amp;resid=D21009FDD967A241%21634692&amp;authkey=AHfsGpj1Un3UNuE&amp;em=2&amp;wdAr=1.7777777777777777\" width=\"962px\" height=\"565px\" frameborder=\"0\">This is an embedded <a target=\"_blank\" href=\"https://office.com\">Microsoft Office</a> presentation, powered by <a target=\"_blank\" href=\"https://office.com/webapps\">Office</a>.</iframe>",
"position": { "start": { "line": 8, "column": 1, "offset": 86 }, "end": { "line": 8, "column": 398, "offset": 483 }, "indent": [] }
},
{
"type": "thematicBreak",
"position": { "start": { "line": 10, "column": 1, "offset": 485 }, "end": { "line": 10, "column": 4, "offset": 488 }, "indent": [] }
},
{
"type": "heading",
"depth": 1,
"children": [
{
"type": "text",
"value": "Project:",
"position": { "start": { "line": 12, "column": 3, "offset": 492 }, "end": { "line": 12, "column": 11, "offset": 500 }, "indent": [] }
}
],
"position": { "start": { "line": 12, "column": 1, "offset": 490 }, "end": { "line": 12, "column": 11, "offset": 500 }, "indent": [] }
},
{
"type": "html",
"value": "<iframe src=\"https://onedrive.live.com/embed?resid=D21009FDD967A241%21608188&amp;authkey=%21AL1vMFzOuqvFbUY&amp;em=2&amp;wdAr=1.7777777777777777\" width=\"962px\" height=\"565px\" frameborder=\"0\">This is an embedded <a target=\"_blank\" href=\"https://office.com\">Microsoft Office</a> presentation, powered by <a target=\"_blank\" href=\"https://office.com/webapps\">Office</a>.</iframe>",
"position": { "start": { "line": 14, "column": 1, "offset": 502 }, "end": { "line": 14, "column": 376, "offset": 877 }, "indent": [] }
}
],
"position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 15, "column": 1, "offset": 878 } }
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{"expireTime":9007200883265493000,"key":"transformer-remark-markdown-html-61186fe15297bf7e688ce4fb0ccbcc7e--","val":"<div class=\"note\">\n <strong>Note:</strong> \n This is the demo content for demonstration purpose only. The primary function of this content is to show you what this theme can do. There is a more detailed explanation in the <strong>Getting Started</strong> section.\n</div>\n<p><strong>This is a paragraph</strong>. Pellentesque habitant morbi <em>tristique senectus et netus et malesuada</em> fames ac turpis egestas. Vestibulum <a href=\"https://www.stackbit.com/\">this is link</a>, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit <mark>amet est et sapien ullamcorper</mark> pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi.</p>\n<h2>This is an H2</h2>\n<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero.</p>\n<h3>This is an H3</h3>\n<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero.</p>\n<h4>This is an H4</h4>\n<p>Quisque facilisis erat a dui. Nam malesuada ornare dolor. Cras gravida, diam sit amet rhoncus ornare, erat elit consectetuer erat, id egestas pede nibh eget odio. Proin tincidunt, velit vel porta elementum, magna diam molestie sapien, non aliquet massa pede eu diam. Aliquam iaculis.</p>\n<h2>Quoting</h2>\n<blockquote>\n<p>“How well we communicate is determined not by how well we say things, but how well we are understood.” ― Andrew Grove</p>\n</blockquote>\n<blockquote>\n<p>“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live” ― John Woods</p>\n</blockquote>\n<hr />\n<h2>Unordered Lists</h2>\n<ul>\n<li>Donec non tortor in arcu mollis feugiat</li>\n<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>\n<li>Donec id eros eget quam aliquam gravida</li>\n<li>Vivamus convallis urna id felis</li>\n<li>Nulla porta tempus sapien</li>\n</ul>\n<h2>Ordered Lists</h2>\n<ol>\n<li>Donec non tortor in arcu mollis feugiat</li>\n<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>\n<li>Donec id eros eget quam aliquam gravida</li>\n<li>Vivamus convallis urna id felis</li>\n<li>Nulla porta tempus sapien</li>\n</ol>\n<h2>Code Blocks</h2>\n<p>Blocks of code are either fenced by <code>lines with three back-ticks</code>, or are indented with four spaces.</p>\n<pre><code class=\"language-css\">&#x3C;!-- Some example CSS code -- > body {\n color: red;\n}\n</code></pre>\n<pre><code class=\"language-javascript\">if (condition) {\n code to run if condition is true code to run if condition is true code to run if condition is true code to run if condition is true\n} else {\n run some other code instead\n}\n</code></pre>\n<h2>Tables</h2>\n<div class=\"responsive-table\">\n <table>\n <caption>Table with thead, tfoot, and tbody</caption>\n <thead>\n <tr>\n <th>Header content 1</th>\n <th>Header content 2</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Body content 1</td>\n <td>Body content 2</td>\n </tr>\n </tbody>\n <tfoot>\n <tr>\n <td>Footer content 1</td>\n <td>Footer content 2</td>\n </tr>\n </tfoot>\n </table>\n</div>\n<h2>Callouts</h2>\n<div class=\"important\">\n <strong>Important:</strong> \n This is an \"Important\" callout block of text. \n This block indicates a warning or caution.\n Use it for an important message. \n</div>\n<div class=\"note\">\n <strong>Note:</strong> \n This is an \"Note\" callout block of text. \n This block signifies a general note.\n</div>"}
{
"expireTime": 9007200883265493000,
"key": "transformer-remark-markdown-html-61186fe15297bf7e688ce4fb0ccbcc7e--",
"val": "<div class=\"note\">\n <strong>Note:</strong> \n This is the demo content for demonstration purpose only. The primary function of this content is to show you what this theme can do. There is a more detailed explanation in the <strong>Getting Started</strong> section.\n</div>\n<p><strong>This is a paragraph</strong>. Pellentesque habitant morbi <em>tristique senectus et netus et malesuada</em> fames ac turpis egestas. Vestibulum <a href=\"https://www.stackbit.com/\">this is link</a>, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit <mark>amet est et sapien ullamcorper</mark> pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi.</p>\n<h2>This is an H2</h2>\n<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero.</p>\n<h3>This is an H3</h3>\n<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero.</p>\n<h4>This is an H4</h4>\n<p>Quisque facilisis erat a dui. Nam malesuada ornare dolor. Cras gravida, diam sit amet rhoncus ornare, erat elit consectetuer erat, id egestas pede nibh eget odio. Proin tincidunt, velit vel porta elementum, magna diam molestie sapien, non aliquet massa pede eu diam. Aliquam iaculis.</p>\n<h2>Quoting</h2>\n<blockquote>\n<p>“How well we communicate is determined not by how well we say things, but how well we are understood.” ― Andrew Grove</p>\n</blockquote>\n<blockquote>\n<p>“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live” ― John Woods</p>\n</blockquote>\n<hr />\n<h2>Unordered Lists</h2>\n<ul>\n<li>Donec non tortor in arcu mollis feugiat</li>\n<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>\n<li>Donec id eros eget quam aliquam gravida</li>\n<li>Vivamus convallis urna id felis</li>\n<li>Nulla porta tempus sapien</li>\n</ul>\n<h2>Ordered Lists</h2>\n<ol>\n<li>Donec non tortor in arcu mollis feugiat</li>\n<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>\n<li>Donec id eros eget quam aliquam gravida</li>\n<li>Vivamus convallis urna id felis</li>\n<li>Nulla porta tempus sapien</li>\n</ol>\n<h2>Code Blocks</h2>\n<p>Blocks of code are either fenced by <code>lines with three back-ticks</code>, or are indented with four spaces.</p>\n<pre><code class=\"language-css\">&#x3C;!-- Some example CSS code -- > body {\n color: red;\n}\n</code></pre>\n<pre><code class=\"language-javascript\">if (condition) {\n code to run if condition is true code to run if condition is true code to run if condition is true code to run if condition is true\n} else {\n run some other code instead\n}\n</code></pre>\n<h2>Tables</h2>\n<div class=\"responsive-table\">\n <table>\n <caption>Table with thead, tfoot, and tbody</caption>\n <thead>\n <tr>\n <th>Header content 1</th>\n <th>Header content 2</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Body content 1</td>\n <td>Body content 2</td>\n </tr>\n </tbody>\n <tfoot>\n <tr>\n <td>Footer content 1</td>\n <td>Footer content 2</td>\n </tr>\n </tfoot>\n </table>\n</div>\n<h2>Callouts</h2>\n<div class=\"important\">\n <strong>Important:</strong> \n This is an \"Important\" callout block of text. \n This block indicates a warning or caution.\n Use it for an important message. \n</div>\n<div class=\"note\">\n <strong>Note:</strong> \n This is an \"Note\" callout block of text. \n This block signifies a general note.\n</div>"
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"expireTime":9007200883265493000,"key":"transformer-remark-markdown-html-984d26b8b46c00624c97da7cc621650e--","val":""}
{ "expireTime": 9007200883265493000, "key": "transformer-remark-markdown-html-984d26b8b46c00624c97da7cc621650e--", "val": "" }

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



node_modules/




Expand Down
Binary file added notes/NODE/0011-node-repl/globals.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions notes/NODE/0011-node-repl/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: How to use the Node.js REPL
description: "REPL stands for Read-Evaluate-Print-Loop, and it's a great way to explore the Node.js features in a quick way"
---

The `node` command is the one we use to run our Node.js scripts:

```bash
node script.js
```

If we omit the filename, we use it in REPL mode:

```bash
node
```

> Note: REPL also known as Read Evaluate Print Loop is a programming language environment(Basically a console window) that takes single expression as user input and returns the result back to the console after execution.
If you try it now in your terminal, this is what happens:

```bash
❯ node
>
```

the command stays in idle mode and waits for us to enter something.

> Tip: if you are unsure how to open your terminal, google "How to open terminal on \<your-operating-system\>".
The REPL is waiting for us to enter some JavaScript code, to be more precise.

Start simple and enter

```console
> console.log('test')
test
undefined
>
```

The first value, `test`, is the output we told the console to print, then we get undefined which is the return value of running `console.log()`.

We can now enter a new line of JavaScript.

## Use the tab to autocomplete

The cool thing about the REPL is that it's interactive.

As you write your code, if you press the `tab` key the REPL will try to autocomplete what you wrote to match a variable you already defined or a predefined one.

## Exploring JavaScript objects

Try entering the name of a JavaScript class, like `Number`, add a dot and press `tab`.

The REPL will print all the properties and methods you can access on that class:

![Pressing tab reveals object properties](tab.png)

## Explore global objects

You can inspect the globals you have access to by typing `global.` and pressing `tab`:

![Globals](globals.png)

## The \_ special variable

If after some code you type `_`, that is going to print the result of the last operation.

## Dot commands

The REPL has some special commands, all starting with a dot `.`. They are

- `.help`: shows the dot commands help
- `.editor`: enables editor mode, to write multiline JavaScript code with ease. Once you are in this mode, enter ctrl-D to run the code you wrote.
- `.break`: when inputting a multi-line expression, entering the .break command will abort further input. Same as pressing ctrl-C.
- `.clear`: resets the REPL context to an empty object and clears any multi-line expression currently being input.
- `.load`: loads a JavaScript file, relative to the current working directory
- `.save`: saves all you entered in the REPL session to a file (specify the filename)
- `.exit`: exits the repl (same as pressing ctrl-C two times)

The REPL knows when you are typing a multi-line statement without the need to invoke `.editor`.

For example if you start typing an iteration like this:

```js
[1, 2, 3].forEach(num => {
```
and you press `enter`, the REPL will go to a new line that starts with 3 dots, indicating you can now continue to work on that block.
```js
... console.log(num)
... })
```

If you type `.break` at the end of a line, the multiline mode will stop and the statement will not be executed.
Binary file added notes/NODE/0011-node-repl/tab.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 69a617b

@vercel
Copy link

@vercel vercel bot commented on 69a617b Aug 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.