├── .gitignore ├── README.md ├── package.json ├── src ├── SURVEY.md ├── javascripting │ ├── accessing-array-values.js │ ├── array-filtering.js │ ├── arrays.js │ ├── for-loop.js │ ├── function-arguments.js │ ├── functions.js │ ├── if-statement.js │ ├── introduction.js │ ├── looping-through-arrays.js │ ├── number-to-string.js │ ├── numbers.js │ ├── object-keys.js │ ├── object-properties.js │ ├── objects.js │ ├── revising-strings.js │ ├── rounding-numbers.js │ ├── scope.js │ ├── string-length.js │ ├── strings.js │ └── variables.js ├── learnyouhtml │ ├── attributes.html │ ├── blocks.html │ ├── forms.html │ ├── headings.html │ ├── index.html │ ├── inline-tags.html │ ├── links-and-references.html │ ├── lists.html │ ├── styles-and-scripts.html │ ├── tables.html │ └── tags.html └── learnyounode │ ├── baby-steps.js │ ├── filtered-ls.js │ ├── hello-world.js │ ├── http-client.js │ ├── http-collect.js │ ├── http-file-server.js │ ├── http-json-api-server.js │ ├── http-uppercaserer.js │ ├── juggling-async.js │ ├── make-it-modular.js │ ├── my-first-async-io.js │ ├── my-first-io.js │ ├── mymodule.js │ └── time-server.js └── test └── basic.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # Compiled binary addons (https://nodejs.org/api/addons.html) 26 | build/Release 27 | 28 | # Dependency directories 29 | node_modules/ 30 | jspm_packages/ 31 | 32 | # Optional npm cache directory 33 | .npm 34 | 35 | # Optional eslint cache 36 | .eslintcache 37 | 38 | # Optional REPL history 39 | .node_repl_history 40 | 41 | # Output of 'npm pack' 42 | *.tgz 43 | 44 | # Yarn Integrity file 45 | .yarn-integrity 46 | 47 | # dotenv environment variables file 48 | .env 49 | .env.test 50 | 51 | # parcel-bundler cache (https://parceljs.org/) 52 | .cache 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CS 253 Assignment 0 – Web Programming Adventure ✈️ 2 | 3 | Assignment instructions: https://web.stanford.edu/class/cs253/assign0 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "assign0", 3 | "description": "assign0", 4 | "version": "1.0.0", 5 | "author": { 6 | "name": "Feross Aboukhadijeh", 7 | "email": "feross@feross.org", 8 | "url": "https://feross.org" 9 | }, 10 | "bugs": { 11 | "url": "https://github.com/stanford-web-security/discussion/issues" 12 | }, 13 | "dependencies": {}, 14 | "devDependencies": { 15 | "snazzy": "^9.0.0", 16 | "standard": "^16.0.3", 17 | "tap-spec": "^5.0.0", 18 | "tape": "^5.3.1" 19 | }, 20 | "homepage": "https://cs253.stanford.edu", 21 | "keywords": [], 22 | "license": "MIT", 23 | "main": "server/index.js", 24 | "private": true, 25 | "repository": { 26 | "type": "git", 27 | "url": "git://github.com/stanford-web-security/assign0.git" 28 | }, 29 | "scripts": { 30 | "lint": "standard | snazzy", 31 | "lint-fix": "standard --fix | snazzy", 32 | "test": "npm run lint && tape test/*.js | tap-spec" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/SURVEY.md: -------------------------------------------------------------------------------- 1 | # Assignment 0 Survey Questions 2 | 3 | ## Roughly how long did you spend on this assignment? 4 | 5 | TODO: Replace this with your response 6 | 7 | ## What was your favorite part of this assignment and why? 8 | 9 | TODO: Replace this with your response 10 | 11 | ## What was your least favorite part of this assignment and why? 12 | 13 | TODO: Replace this with your response 14 | 15 | ## Any other feedback for this assignment? (optional) 16 | -------------------------------------------------------------------------------- /src/javascripting/accessing-array-values.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/array-filtering.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/arrays.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/for-loop.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/function-arguments.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/functions.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/if-statement.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/introduction.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/looping-through-arrays.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/number-to-string.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/numbers.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/object-keys.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/object-properties.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/objects.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/revising-strings.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/rounding-numbers.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/scope.js: -------------------------------------------------------------------------------- 1 | // The following comment disables lint errors for unused variables since your 2 | // solution to this exercise should have unused variables in it :) 3 | 4 | /* eslint-disable no-unused-vars */ 5 | 6 | // TODO: Replace this with your solution. 7 | -------------------------------------------------------------------------------- /src/javascripting/string-length.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/strings.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/javascripting/variables.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/attributes.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/blocks.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/forms.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/headings.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/inline-tags.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/links-and-references.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/lists.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/styles-and-scripts.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/tables.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyouhtml/tags.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/learnyounode/baby-steps.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/filtered-ls.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/hello-world.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/http-client.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/http-collect.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/http-file-server.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/http-json-api-server.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/http-uppercaserer.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/juggling-async.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/make-it-modular.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/my-first-async-io.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/my-first-io.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/mymodule.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /src/learnyounode/time-server.js: -------------------------------------------------------------------------------- 1 | // TODO: Replace this with your solution. 2 | -------------------------------------------------------------------------------- /test/basic.js: -------------------------------------------------------------------------------- 1 | const test = require('tape') 2 | const { existsSync, readFileSync } = require('fs') 3 | const { join, relative } = require('path') 4 | 5 | const ROOT_PATH = join(__dirname, '..') 6 | const SRC_PATH = join(ROOT_PATH, 'src') 7 | 8 | test('Check that src/ looks reasonable', t => { 9 | const paths = [ 10 | 'learnyouhtml', 11 | 'javascripting', 12 | 'learnyounode' 13 | ] 14 | 15 | paths 16 | .map(path => join(SRC_PATH, path)) 17 | .forEach(path => assertExists(t, path)) 18 | 19 | t.end() 20 | }) 21 | 22 | test('Check that src/learnyouhtml looks reasonable', t => { 23 | const paths = [ 24 | 'index.html', 25 | 'tags.html', 26 | 'attributes.html', 27 | 'inline-tags.html', 28 | 'headings.html', 29 | 'lists.html', 30 | 'tables.html', 31 | 'blocks.html', 32 | 'links-and-references.html', 33 | 'forms.html', 34 | 'styles-and-scripts.html' 35 | ] 36 | 37 | paths 38 | .map(path => join(SRC_PATH, 'learnyouhtml', path)) 39 | .forEach(path => { 40 | assertExists(t, path) 41 | assertNoTodo(t, path) 42 | }) 43 | 44 | t.end() 45 | }) 46 | 47 | test('Check that src/javascripting looks reasonable', t => { 48 | const paths = [ 49 | 'introduction.js', 50 | 'variables.js', 51 | 'strings.js', 52 | 'string-length.js', 53 | 'revising-strings.js', 54 | 'numbers.js', 55 | 'rounding-numbers.js', 56 | 'number-to-string.js', 57 | 'if-statement.js', 58 | 'for-loop.js', 59 | 'arrays.js', 60 | 'array-filtering.js', 61 | 'accessing-array-values.js', 62 | 'looping-through-arrays.js', 63 | 'objects.js', 64 | 'object-properties.js', 65 | 'object-keys.js', 66 | 'functions.js', 67 | 'function-arguments.js', 68 | 'scope.js' 69 | ] 70 | 71 | paths 72 | .map(path => join(SRC_PATH, 'javascripting', path)) 73 | .forEach(path => { 74 | assertExists(t, path) 75 | assertNoTodo(t, path) 76 | }) 77 | 78 | t.end() 79 | }) 80 | 81 | test('Check that src/learnyounode looks reasonable', t => { 82 | const paths = [ 83 | 'hello-world.js', 84 | 'baby-steps.js', 85 | 'my-first-io.js', 86 | 'my-first-async-io.js', 87 | 'filtered-ls.js', 88 | 'make-it-modular.js', 89 | 'mymodule.js', 90 | 'http-client.js', 91 | 'http-collect.js', 92 | 'juggling-async.js', 93 | 'time-server.js', 94 | 'http-file-server.js', 95 | 'http-uppercaserer.js', 96 | 'http-json-api-server.js' 97 | ] 98 | 99 | paths 100 | .map(path => join(SRC_PATH, 'learnyounode', path)) 101 | .forEach(path => { 102 | assertExists(t, path) 103 | assertNoTodo(t, path) 104 | }) 105 | 106 | t.end() 107 | }) 108 | 109 | function assertExists (t, path) { 110 | const relPath = relative(ROOT_PATH, path) 111 | t.ok(existsSync(path), `ensure ${relPath} exists`) 112 | } 113 | 114 | function assertNoTodo (t, path) { 115 | const relPath = relative(ROOT_PATH, path) 116 | t.ok( 117 | !readFileSync(path, 'utf8').includes('TODO'), 118 | `ensure ${relPath} does not contain the string "TODO"` 119 | ) 120 | } 121 | --------------------------------------------------------------------------------