├── .gitignore ├── Lecture02 └── html │ ├── cblogo big.png │ ├── forms.html │ ├── index2.html │ └── tables.html ├── Lecture03 ├── av │ ├── index.html │ ├── sampleaudio.mp3 │ └── samplevideo.mp4 └── jsintro │ ├── index.html │ └── script.js ├── Lecture05 └── CSS │ ├── bootstrap.html │ ├── index.html │ ├── inheritance.css │ ├── inheritance.html │ ├── interpolators.css │ ├── interpolators.html │ └── style.css ├── Lecture06 └── html2 and CSS │ ├── iframe.html │ ├── iframe2.html │ ├── iframe3.html │ ├── index2.html │ ├── index_css.html │ └── style.css ├── Lecture07 └── Javascript │ ├── arrays.js │ ├── classes.js │ ├── index.html │ ├── scopes.js │ ├── string.js │ └── this.js ├── Lecture08 └── TodoList │ ├── domtraversal.html │ ├── events.html │ ├── events.js │ ├── form.html │ ├── index.html │ └── todolist.js ├── Lecture09 ├── AdvancedJS │ ├── closure.js │ ├── constructors.js │ ├── hoisting.js │ ├── index.html │ ├── moreclosures.js │ ├── objects.js │ └── script2.js └── TodoList │ ├── css │ ├── bootstrap-grid.css │ ├── bootstrap-grid.css.map │ ├── bootstrap-grid.min.css │ ├── bootstrap-grid.min.css.map │ ├── bootstrap-reboot.css │ ├── bootstrap-reboot.css.map │ ├── bootstrap-reboot.min.css │ ├── bootstrap-reboot.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ ├── custom.css │ ├── font-awesome.css │ └── font-awesome.min.css │ ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 │ ├── index.html │ └── js │ ├── bootstrap.js │ ├── bootstrap.min.js │ └── todolist.js ├── Lecture10 └── AdvancedJS │ ├── asyncFunctions.js │ ├── asyncFunctions2.js │ ├── asyncFunctions3.js │ ├── asyncFunctions4.js │ ├── classPrototypes.js │ ├── closures.js │ ├── constructors.js │ ├── es5classes.js │ ├── functionscopes.js │ ├── index.html │ ├── objectCreate.js │ └── prototypes.js ├── Lecture11 └── jQuery │ ├── css │ ├── bootstrap-grid.css │ ├── bootstrap-grid.css.map │ ├── bootstrap-grid.min.css │ ├── bootstrap-grid.min.css.map │ ├── bootstrap-reboot.css │ ├── bootstrap-reboot.css.map │ ├── bootstrap-reboot.min.css │ ├── bootstrap-reboot.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ ├── custom.css │ ├── font-awesome.css │ └── font-awesome.min.css │ ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 │ ├── index.html │ ├── js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery.js │ ├── todolist.js │ └── todolistjquery.js │ ├── script.js │ └── todolist.html ├── Lecture12 ├── NodeIntro │ ├── data.js │ ├── hello.js │ ├── index.html │ ├── moduleprivates │ │ ├── main.js │ │ └── module.js │ └── modulescopes │ │ ├── file1.js │ │ ├── file2.js │ │ └── file3.js └── file.js ├── Lecture13 └── MoreAboutNode │ ├── exec.js │ ├── fileops.js │ └── fizzbuzz │ ├── fizzbuzz.js │ ├── input │ └── output ├── Lecture14 └── ExpressIntro │ ├── package-lock.json │ ├── package.json │ ├── public_static │ ├── index.html │ ├── jquery.js │ ├── other.html │ ├── todos.html │ └── todos.js │ └── server.js ├── Lecture15 ├── Middlewares │ ├── old-server.js │ ├── package-lock.json │ ├── package.json │ └── server.js └── Routers │ ├── package-lock.json │ ├── package.json │ ├── routes │ ├── students.js │ └── teachers.js │ └── server.js ├── Lecture16 ├── AsyncAwaitPromises │ ├── async.js │ ├── await.js │ ├── promise-example-2.js │ └── promise-example.js ├── MysqlExample │ ├── package-lock.json │ ├── package.json │ └── trymysql.js └── TodoDB │ ├── db.js │ ├── package-lock.json │ ├── package.json │ ├── public_static │ ├── index.html │ ├── jquery.js │ └── todo.js │ └── server.js ├── Lecture17 └── Sockets │ ├── package-lock.json │ ├── package.json │ ├── public_static │ ├── client.js │ ├── index.html │ └── jquery.js │ └── server.js ├── Lecture18 └── MongoDB │ ├── package-lock.json │ ├── package.json │ └── trymongo.js ├── Lecture19 ├── Authentication │ ├── package-lock.json │ ├── package.json │ ├── passport.js │ ├── private │ │ └── index.html │ ├── public │ │ ├── index.html │ │ └── login.html │ ├── server.js │ └── users.js ├── Handlebars │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── style.css │ ├── server.js │ └── views │ │ ├── students.hbs │ │ └── user.hbs ├── assignment.md └── sequelize-example.js └── Lecture20 ├── Testing ├── .nyc_output │ └── ac0c5e39b7f5a2bbd8c1b289c49b139a.json ├── calcfare.js ├── coverage │ ├── lcov-report │ │ ├── base.css │ │ ├── calcfare.js.html │ │ ├── index.html │ │ ├── prettify.css │ │ ├── prettify.js │ │ ├── sort-arrow-sprite.png │ │ └── sorter.js │ └── lcov.info ├── package-lock.json ├── package.json └── test │ └── calcFareTest.js └── heroku-deploy ├── .gitignore ├── db.js ├── package-lock.json ├── package.json └── server.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | build/ 3 | node_modules/ 4 | 5 | -------------------------------------------------------------------------------- /Lecture02/html/cblogo big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture02/html/cblogo big.png -------------------------------------------------------------------------------- /Lecture02/html/forms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | check here
17 | here 18 | here 19 | or here
20 |
21 | 22 | 23 | 24 | 25 |
26 |
27 | 28 | 29 |

eadable content of a page when looking at its layout. 30 | The point of using

31 | 32 | 33 | -------------------------------------------------------------------------------- /Lecture02/html/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | title 6 | 7 | 8 |

heading 1

9 |

heading 2

10 |

heading 3

11 |

heading 4

12 |
heading 5
13 |
heading 6
14 | 15 | this is not a heading 16 | 17 | 18 |

eadable 19 | 22 |

eadable 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).

23 |

eadable   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).

24 |

 

25 | 26 | 27 | 28 | 34 | 35 |
    36 |
  1. item
  2. 37 |
  3. item
  4. 38 |
  5. item
  6. 39 |
  7. item
  8. 40 |
  9. item
  10. 41 |
42 | 43 |
44 |
List Title
45 |
List Desc
46 |
47 | 48 | 49 | this is line is seprated by   space
50 | this is not seprated 51 |
 52 |     public static void main(){
 53 |         system.out.print("Rishabh Khanna");
 54 |     }
 55 | 
56 | 57 | 58 | 59 | 60 | desktop this is not in a 61 | 62 | CB 63 |
64 | public static void main(){ 65 | system.out.print("Rishabh Khanna"); 66 | } 67 | 68 |
69 |
70 | bold

71 | italics

72 | strike

73 | 74 | 75 | emphaisis

76 | strong

77 | underline 78 |

79 | mark 80 |

81 | this is quote

82 | 83 | this is sub and this is sup

84 | 16o8

85 | 86 | this is CB logo 87 | 88 | 89 |
90 | eadable content of a page when looking at its layout. 91 | 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). 92 |
93 |
94 | eadable content of a page when looking at its layout. 95 | 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). 96 |
97 |
98 | eadable content of a page when looking at its layout. 99 | 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). 100 |
101 | 102 |
103 | eadable content of a page when looking at its layout. 104 | 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). 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
abcd
abcd
123 |
124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /Lecture02/html/tables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tables 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
abcd
abd
abcd
27 |
28 | 29 | -------------------------------------------------------------------------------- /Lecture03/av/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 11 |
12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Lecture03/av/sampleaudio.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture03/av/sampleaudio.mp3 -------------------------------------------------------------------------------- /Lecture03/av/samplevideo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture03/av/samplevideo.mp4 -------------------------------------------------------------------------------- /Lecture03/jsintro/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 |
    13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Lecture03/jsintro/script.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/06/17. 3 | */ 4 | 5 | window.onload = function () { 6 | 7 | var num = document.getElementById('num') 8 | var run = document.getElementById('run') 9 | var list = document.getElementById('list') 10 | 11 | run.onclick = function () { 12 | var start = (new Date()).getTime(); 13 | list.innerHTML = ""; 14 | var listString = ""; 15 | var N = parseInt(num.value); 16 | 17 | for (var i = 1; i <= N; i++) { 18 | // var li = document.createElement('li'); 19 | // li.innerText = i 20 | // list.append(li); 21 | listString += "
  • " + i + "
  • " 22 | } 23 | list.innerHTML = listString; 24 | 25 | console.log((new Date()).getTime() - start) 26 | } 27 | 28 | }; -------------------------------------------------------------------------------- /Lecture05/CSS/bootstrap.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 |
    13 |
    14 |

    15 | 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. 16 |

    17 |

    18 | 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. 19 |

    20 |

    21 | 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. 22 |

    23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
    31 | 32 |
    33 | 34 | -------------------------------------------------------------------------------- /Lecture05/CSS/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 |
    11 | 12 |
    13 | 14 | 15 | -------------------------------------------------------------------------------- /Lecture05/CSS/inheritance.css: -------------------------------------------------------------------------------- 1 | 2 | #one { 3 | background-color: lightseagreen !important; 4 | } 5 | .box { 6 | background-color: aqua !important; 7 | } 8 | 9 | div { 10 | height: 40px; 11 | width: 40px; 12 | margin: 40px; 13 | background-color: blueviolet; 14 | } -------------------------------------------------------------------------------- /Lecture05/CSS/inheritance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 | 15 |
    16 | 17 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Lecture05/CSS/interpolators.css: -------------------------------------------------------------------------------- 1 | 2 | .box { 3 | display: block; 4 | width: 60px; 5 | height: 60px; 6 | margin: 20px; 7 | background-color: #fc4f4f; 8 | box-shadow: #888 2px 2px 5px; 9 | /*animation-name: bounce;*/ 10 | /*animation-iteration-count: 100;*/ 11 | /*animation-duration: 2s;*/ 12 | /*top: 30px;*/ 13 | 14 | } 15 | .box:hover { 16 | position: relative; 17 | bottom: 3px; 18 | right: 3px; 19 | box-shadow: #888 6px 6px 5px; 20 | 21 | } 22 | .box:active { 23 | position: relative; 24 | bottom: -2px; 25 | right: -2px; 26 | box-shadow: #888 1px 1px 5px; 27 | 28 | } 29 | 30 | #one { 31 | animation-timing-function: ease; 32 | } 33 | #two { 34 | animation-timing-function: linear; 35 | } 36 | #three { 37 | animation-timing-function: ease-in; 38 | } 39 | #four { 40 | animation-timing-function: ease-out; 41 | } 42 | #five { 43 | animation-timing-function: ease-in-out; 44 | } 45 | #six { 46 | } 47 | 48 | @keyframes bounce { 49 | 0% { 50 | margin-left: 30px; 51 | } 52 | 50% { 53 | margin-left: 200px; 54 | margin-top: 100px; 55 | background-color: blue; 56 | } 57 | 100% { 58 | margin-left: 30px; 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /Lecture05/CSS/interpolators.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    13 |
    14 |
    15 |
    16 |
    17 | 18 | 19 | -------------------------------------------------------------------------------- /Lecture05/CSS/style.css: -------------------------------------------------------------------------------- 1 | #div1 { 2 | margin: 30px; 3 | background-color: red; 4 | width: 100px; 5 | height: 100px; 6 | transition: width 1s; 7 | 8 | /*transform: translate(30px, 40px);*/ 9 | /*transform: rotate(0.1rad);*/ 10 | /*transform: skewY(20deg);*/ 11 | /*transform: scale(2,2);*/ 12 | /*transform: matrix(1,0,0!* x90 *!,1,50,50!* px *!);*/ 13 | /*transform: rotateX(45deg);*/ 14 | } 15 | 16 | @keyframes godown { 17 | 0% { 18 | height: 100px; 19 | } 20 | 25% { 21 | transform: rotate(30deg); 22 | height: 200px; 23 | } 24 | 50% { 25 | height: 100px; 26 | } 27 | 75% { 28 | height: 200px; 29 | } 30 | } 31 | 32 | #div1:hover { 33 | background-color: blue; 34 | width: 130px; 35 | height: 200px; 36 | /*transition: width 1s, background-color 3s;*/ 37 | animation: godown 2s; 38 | } 39 | 40 | 41 | col-lg-6 { 42 | max-width: 100%; 43 | } 44 | 45 | 46 | @media (min-width: 576px) { 47 | col-lg-6 { 48 | max-width: 100%; 49 | } 50 | } 51 | 52 | @media (min-width: 768px) { 53 | col-lg-6 { 54 | max-width: 50%; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Lecture06/html2 and CSS/iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Iframe 6 | 7 | 8 | 9 |
    10 | 11 | 12 | -------------------------------------------------------------------------------- /Lecture06/html2 and CSS/iframe2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ifram2 6 | 7 | 8 | CodingBlocks 9 |
    10 | 11 | 12 | -------------------------------------------------------------------------------- /Lecture06/html2 and CSS/iframe3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Lecture06/html2 and CSS/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Html2 6 | 7 | 8 |
    9 | 10 | Pandora 11 | Elixir 12 | LauchPad 13 | Crux 14 | 15 |
    16 | 17 | codignblocks in first page 18 | 19 | -------------------------------------------------------------------------------- /Lecture06/html2 and CSS/index_css.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CSS 6 | 7 | 8 | 9 | 10 |

    11 | It is a long established fact that a reader will be distracted 12 | by the readable content of a page when looking at its layout. 13 | 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. 14 | Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour 15 | an the like). 16 |

    17 |

    It is a long established fact that a reader will be distracted 18 | by the readable content of a page when looking at its layout. 19 | 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. 20 | Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour 21 | an the like).

    22 | 23 |
      24 |
    1. item 1
    2. 25 |
    3. item 2
    4. 26 |
    5. item 3
    6. 27 |
    7. item 4
    8. 28 |
    29 | 30 | 37 | 38 |
    39 |

    This is a para just below div

    40 |

    This is para NOT just below div

    41 | 48 |
      49 |
    1. item 1
    2. 50 |
    3. item 2
    4. 51 |
    5. item 3
    6. 52 |
    7. item 4
    8. 53 |
    54 |
    55 | 56 |

    This is adjacent to div

    57 |

    this is also adjacent but not immediate

    58 | 59 | 60 | -------------------------------------------------------------------------------- /Lecture06/html2 and CSS/style.css: -------------------------------------------------------------------------------- 1 | /*p{*/ 2 | /*!*color: #fc4c4f;*!*/ 3 | /*!*font-size: large;*!*/ 4 | /*}*/ 5 | 6 | /*li{*/ 7 | /*font-size: 30px;*/ 8 | /*color: gold;*/ 9 | 10 | /*}*/ 11 | /*.odd{*/ 12 | /*color: cornflowerblue;*/ 13 | /*}*/ 14 | /*#even{*/ 15 | /*color: brown;*/ 16 | /*}*/ 17 | 18 | /**{*/ 19 | /*color: chartreuse;*/ 20 | /*}*/ 21 | /*div + p{*/ 22 | /*font-size: 30px;*/ 23 | /*}*/ 24 | .tag{ 25 | color: darkred; 26 | } 27 | 28 | [contenteditable="true"]{ 29 | color: chartreuse; 30 | } 31 | 32 | p{ 33 | color: gold; 34 | } 35 | 36 | p{ 37 | padding: 20px 50px 30px 70px; 38 | border: dashed; 39 | } 40 | /*.odd{*/ 41 | /*color: chartreuse;*/ 42 | /*}*/ 43 | /*.even{*/ 44 | /*color: gold;*/ 45 | /*}*/ 46 | -------------------------------------------------------------------------------- /Lecture07/Javascript/arrays.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 20/06/17. 3 | */ 4 | 5 | 6 | var arr = [1,2,3,4, "Asd"]; 7 | var arr2 = new Array(1,2, "As"); 8 | var arr3 = [1,2,3,4,5,6,7,8,9]; 9 | var arr4 = [1,2,3,4,5,6,7,8,9]; 10 | var arr5 = [1,'a', true, {a:10}, [3,4]]; 11 | var obj1 = {a:10, b:11, c:12}; 12 | 13 | console.log(arr); 14 | console.log(arr2); 15 | console.log([1,2] == [1,2]); 16 | console.log(arr3.slice(-5, -2)); 17 | console.log(arr3); 18 | console.log(arr3.splice(4,2, 10,12,13,14)); 19 | console.log(arr3); 20 | console.log(arr4.indexOf(5)); 21 | console.log(arr4.concat('a')); 22 | console.log(arr4.concat('a', 'b')); 23 | console.log(arr4.concat(arr2)); 24 | console.log(arr4.concat(arr3, arr2)); 25 | console.log(arr4.concat([arr3, arr2])); 26 | console.log(arr4.join('-')); 27 | console.log(arr4.join([1,2])); 28 | console.log('------------normal for loop'); 29 | for (var i = 0; i < arr5.length; i++) { 30 | console.log(arr5[i]); 31 | } 32 | console.log('------------for-of loop'); 33 | for (var i of arr5) { 34 | console.log(i); 35 | } 36 | console.log('-------------for-in loop'); 37 | for (var i in arr5) { 38 | console.log(i); 39 | } 40 | console.log('-------------for-in loop'); 41 | for (var i in obj1) { 42 | console.log(i + ":" + obj1[i]); 43 | } 44 | // console.log('------------for-of loop'); 45 | // for (var i of obj1) { 46 | // console.log(i); 47 | // } 48 | console.log('--------- forEach'); 49 | var k = arr4.forEach(function (item, index, arr) { 50 | // console.log(index + ":" + item); 51 | // console.log(arr); 52 | arr[index] = item + 1; 53 | }); 54 | console.log(arr4); 55 | console.log(k); //undefined 56 | 57 | console.log('-------------- map'); 58 | var l = arr4.map(Math.sqrt); 59 | console.log(arr4); 60 | console.log(l); 61 | 62 | console.log('------------- reduce'); 63 | var r = arr4.reduce(function (acc, item, index, arr) { 64 | console.log(index); 65 | },10); 66 | console.log(r); 67 | 68 | var sum = arr4.reduce((a,i) => a+i); 69 | 70 | console.log('-----filter'); 71 | var f = arr4.filter(function (item, index, array) { 72 | return item % 2; 73 | }); 74 | 75 | console.log(f); 76 | 77 | 78 | var onlynums = arr5.filter((i) => typeof i == 'string'); 79 | console.log(onlynums); 80 | 81 | var fun = function (a, b) { 82 | return a + b 83 | } 84 | 85 | fun = (a,b) => a+b; 86 | 87 | fun = "not so funny"; -------------------------------------------------------------------------------- /Lecture07/Javascript/classes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 20/06/17. 3 | */ 4 | 5 | function Person (name = "NAME", address = "ADDR") { 6 | this.name = name; 7 | this.address = address; 8 | } 9 | 10 | let p = new Person("Arnav", "Janakpuri"); 11 | let p2 = new Person("Shyam", "Rohini"); 12 | let p3 = new Person(); 13 | 14 | console.log(p); -------------------------------------------------------------------------------- /Lecture07/Javascript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lecture07/Javascript/scopes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 20/06/17. 3 | */ 4 | 5 | 6 | var a = 10; 7 | let aa = 10; 8 | const myconst = [1,2]; 9 | myconst.push(3); 10 | console.log(myconst); 11 | 12 | function myfun () { 13 | var b = 20; 14 | console.log(a); 15 | console.log(b); 16 | console.log(aa); 17 | let ab = 'outside'; 18 | var ac = 'outside'; 19 | const m = 10; 20 | if (true) { 21 | var c = 45; 22 | console.log(m); 23 | let ab = 'inside'; 24 | var ac = 'inside'; 25 | console.log(c); 26 | console.log(ab); 27 | const m = 12; 28 | console.log(m); 29 | } 30 | console.log(ab); 31 | console.log(ac); 32 | } 33 | 34 | // var myVar = 'some value'; 35 | // 36 | // function redeclare() { 37 | // var myVar = 'wow'; 38 | // let myVar = myVar + ' that was not there'; //errors 39 | // console.log(myVar); 40 | // } 41 | // 42 | // 43 | myfun(); 44 | // 45 | // redeclare(); -------------------------------------------------------------------------------- /Lecture07/Javascript/string.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 20/06/17. 3 | */ 4 | 5 | console.log('Hello'); 6 | 7 | var integer = 10; 8 | var myfloat = 10.1; 9 | var mystring = "This is a string! Some more text is here too"; 10 | var mybool = false; 11 | 12 | var myobj = { 13 | key1: "value1", 14 | key2: 10, 15 | key3: true 16 | 17 | }; 18 | 19 | var myarr = ["asdsa", 12, {a:10}, true]; 20 | function findAllIndexesOf(str, char) { 21 | var idx = -2; 22 | var pos = []; 23 | while(idx != -1) { 24 | idx = str.indexOf(char, idx); 25 | if (idx != -1) pos.push(idx) 26 | else break; 27 | idx++; 28 | } 29 | console.log(pos); 30 | } 31 | console.log(mystring.concat("Another String")); 32 | console.log(mystring.split(" ")); 33 | console.log(mystring.substr(3 //start 34 | , 5//length 35 | )); 36 | console.log(mystring.substring(4 //start 37 | , 8 //end 38 | )); 39 | console.log(mystring.charAt(8)); 40 | console.log(mystring.indexOf("!")); 41 | console.log(mystring.indexOf("s", mystring.indexOf("s") + 1)); 42 | console.log(mystring.lastIndexOf("s", 55)); 43 | console.log(mystring.includes("his", 8)); 44 | console.log(" asdsad ".trim() + "asdas"); 45 | 46 | 47 | console.log(mystring); 48 | 49 | mystring = mystring.concat("Other stuff"); 50 | -------------------------------------------------------------------------------- /Lecture07/Javascript/this.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 20/06/17. 3 | */ 4 | 5 | var p = 'hello'; 6 | console.log(this); 7 | console.log(global.p); 8 | 9 | 10 | -------------------------------------------------------------------------------- /Lecture08/TodoList/domtraversal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 13 | 14 | 15 | 16 |
    17 |
    18 | hello 19 |
    20 | 21 |
    22 |
    23 | 24 |
    25 | 26 |
    27 | 28 |
    29 | 30 |
    31 |
    32 |
    33 | 34 |
    35 | 36 |
    37 | 38 |
    39 | 40 | 41 | -------------------------------------------------------------------------------- /Lecture08/TodoList/events.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 24 | 25 | 26 | 27 |
    28 |
    29 | 30 |
    31 |
    32 |
    33 | 34 |
    35 |
    36 |
    37 | 38 | 39 | -------------------------------------------------------------------------------- /Lecture08/TodoList/events.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 23/06/17. 3 | */ 4 | 5 | 6 | window.onload = function () { 7 | let myDiv = document.getElementById('mydiv'); 8 | console.log(myDiv); 9 | 10 | let div1 = document.getElementById('one') 11 | let div2 = document.getElementById('two') 12 | let div3 = document.getElementById('three') 13 | 14 | // myDiv.onclick = function () { 15 | // console.log('div has been clicked'); 16 | // } 17 | // myDiv.onclick = function () { 18 | // console.log('div-clicked'); 19 | // } 20 | // 21 | // myDiv.addEventListener('click', function () { 22 | // console.log('div has been clicked'); 23 | // }) 24 | // myDiv.addEventListener('mouseover', function () { 25 | // console.log('div has mouseover'); 26 | // }) 27 | // myDiv.addEventListener('mouseup', function () { 28 | // console.log('div mouseup'); 29 | // }) 30 | // myDiv.addEventListener('mousedown', function () { 31 | // console.log('div mousedown'); 32 | // }) 33 | 34 | function clicked(event) { 35 | console.log(event.target.id); 36 | } 37 | 38 | div1.addEventListener('click', (event) => { 39 | console.log('1 clicked'); 40 | console.log(event); 41 | }, true) 42 | div2.addEventListener('click', () => { 43 | console.log('2 clicked'); 44 | }) 45 | div3.addEventListener('click', () => { 46 | console.log('3 clicked'); 47 | }) 48 | 49 | }; -------------------------------------------------------------------------------- /Lecture08/TodoList/form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 |
    10 | ONE 11 |
    12 | TWO 13 | 14 |
    15 | 16 | 17 | -------------------------------------------------------------------------------- /Lecture08/TodoList/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Lecture08/TodoList/todolist.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 23/06/17. 3 | */ 4 | 5 | let todoItems = []; 6 | 7 | window.onload = function () { 8 | let newtodo = document.getElementById('newtodo'); 9 | let addtodo = document.getElementById('addtodo'); 10 | 11 | let todolist = document.getElementById('todolist'); 12 | 13 | refreshTodos(); 14 | 15 | addtodo.onclick = function () { 16 | addAndSave(newtodo.value); 17 | } 18 | }; 19 | 20 | function addItemToList(list, itemIndex, itemObj) { 21 | let todoItem = document.createElement('li'); 22 | todoItem.innerText = itemObj.task; 23 | todoItem.setAttribute('data-id', itemIndex); 24 | if (itemObj.done) { 25 | todoItem.style.textDecoration = 'line-through' 26 | } 27 | todoItem.addEventListener('click', doneSelf); 28 | list.appendChild(todoItem); 29 | } 30 | 31 | function doneSelf(event) { 32 | let idToDone = event.target.getAttribute('data-id'); 33 | console.log('Done = ' + idToDone); 34 | todoItems[idToDone].done = !todoItems[idToDone].done; 35 | saveTodos(); 36 | refreshTodos() 37 | } 38 | 39 | function deleteSelf(event) { 40 | let idToDel = event.target.getAttribute('data-id'); 41 | console.log('Delete = ' + idToDel); 42 | todoItems.splice(idToDel, 1); 43 | saveTodos(); 44 | refreshTodos() 45 | } 46 | 47 | function refreshTodos() { 48 | retrieveTodos(); 49 | setItemArrayToList(todolist, todoItems); 50 | 51 | } 52 | 53 | function saveTodos() { 54 | localStorage.setItem('todolist', JSON.stringify(todoItems)); 55 | } 56 | 57 | function setItemArrayToList(list, itemArray) { 58 | list.innerHTML = ''; 59 | for (index in itemArray) { 60 | addItemToList(list, index, itemArray[index]) 61 | } 62 | } 63 | 64 | function retrieveTodos () { 65 | let todosInStore = localStorage.getItem('todolist') 66 | if (todosInStore) { 67 | todoItems = JSON.parse(todosInStore); 68 | } 69 | } 70 | 71 | function addAndSave(itemText) { 72 | todoItems.push({ 73 | task: itemText, 74 | done: false 75 | }); 76 | saveTodos(); 77 | refreshTodos(); 78 | 79 | } 80 | 81 | -------------------------------------------------------------------------------- /Lecture09/AdvancedJS/closure.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 25/06/17. 3 | */ 4 | 5 | 6 | 7 | function createCounter(initVal, deltaVal) { 8 | 9 | return { 10 | getVal() { 11 | console.log(initVal); 12 | }, 13 | incVal() { 14 | initVal += deltaVal; 15 | }, 16 | decVal() { 17 | initVal -= deltaVal; 18 | } 19 | } 20 | } 21 | 22 | function printLoopGen(n) { 23 | var result = ''; 24 | 25 | for (var i = 0; i 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lecture09/AdvancedJS/moreclosures.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 25/06/17. 3 | */ 4 | 5 | 6 | 7 | function printLoopGen(n) { 8 | 9 | return function () { 10 | for (var i = 0; i < n ; i ++) { 11 | setTimeout(function () { 12 | console.log(i); 13 | }, 10) 14 | } 15 | } 16 | 17 | 18 | } -------------------------------------------------------------------------------- /Lecture09/AdvancedJS/objects.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 25/06/17. 3 | */ 4 | 5 | // Made in 'Declarative Environment Record' 6 | let obj = { 7 | k1: 'v1', 8 | k2: 2, 9 | k3: false 10 | }; 11 | let otherObj = {}; 12 | 13 | var a = 'some stuff'; 14 | 15 | obj.k4 = 'Some new stuff'; 16 | obj['a'] = 200; 17 | obj['spaced string'] = 'some value'; 18 | obj[''] = 10; 19 | obj[obj] = 'abc'; 20 | obj[otherObj] = 'def'; 21 | 22 | //delete obj.k2; 23 | 24 | var objA = {a:10}; 25 | 26 | var objB = Object.create(objA); 27 | objB.b = 20; 28 | 29 | var objC = Object.create(objB); 30 | objC.c = 30; 31 | 32 | var objD = Object.create(objC); 33 | objD.d = 40; 34 | 35 | -------------------------------------------------------------------------------- /Lecture09/AdvancedJS/script2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 25/06/17. 3 | */ 4 | 5 | 6 | -------------------------------------------------------------------------------- /Lecture09/TodoList/css/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */ 2 | html { 3 | font-family: sans-serif; 4 | line-height: 1.15; 5 | -ms-text-size-adjust: 100%; 6 | -webkit-text-size-adjust: 100%; 7 | } 8 | 9 | body { 10 | margin: 0; 11 | } 12 | 13 | article, 14 | aside, 15 | footer, 16 | header, 17 | nav, 18 | section { 19 | display: block; 20 | } 21 | 22 | h1 { 23 | font-size: 2em; 24 | margin: 0.67em 0; 25 | } 26 | 27 | figcaption, 28 | figure, 29 | main { 30 | display: block; 31 | } 32 | 33 | figure { 34 | margin: 1em 40px; 35 | } 36 | 37 | hr { 38 | -webkit-box-sizing: content-box; 39 | box-sizing: content-box; 40 | height: 0; 41 | overflow: visible; 42 | } 43 | 44 | pre { 45 | font-family: monospace, monospace; 46 | font-size: 1em; 47 | } 48 | 49 | a { 50 | background-color: transparent; 51 | -webkit-text-decoration-skip: objects; 52 | } 53 | 54 | a:active, 55 | a:hover { 56 | outline-width: 0; 57 | } 58 | 59 | abbr[title] { 60 | border-bottom: none; 61 | text-decoration: underline; 62 | text-decoration: underline dotted; 63 | } 64 | 65 | b, 66 | strong { 67 | font-weight: inherit; 68 | } 69 | 70 | b, 71 | strong { 72 | font-weight: bolder; 73 | } 74 | 75 | code, 76 | kbd, 77 | samp { 78 | font-family: monospace, monospace; 79 | font-size: 1em; 80 | } 81 | 82 | dfn { 83 | font-style: italic; 84 | } 85 | 86 | mark { 87 | background-color: #ff0; 88 | color: #000; 89 | } 90 | 91 | small { 92 | font-size: 80%; 93 | } 94 | 95 | sub, 96 | sup { 97 | font-size: 75%; 98 | line-height: 0; 99 | position: relative; 100 | vertical-align: baseline; 101 | } 102 | 103 | sub { 104 | bottom: -0.25em; 105 | } 106 | 107 | sup { 108 | top: -0.5em; 109 | } 110 | 111 | audio, 112 | video { 113 | display: inline-block; 114 | } 115 | 116 | audio:not([controls]) { 117 | display: none; 118 | height: 0; 119 | } 120 | 121 | img { 122 | border-style: none; 123 | } 124 | 125 | svg:not(:root) { 126 | overflow: hidden; 127 | } 128 | 129 | button, 130 | input, 131 | optgroup, 132 | select, 133 | textarea { 134 | font-family: sans-serif; 135 | font-size: 100%; 136 | line-height: 1.15; 137 | margin: 0; 138 | } 139 | 140 | button, 141 | input { 142 | overflow: visible; 143 | } 144 | 145 | button, 146 | select { 147 | text-transform: none; 148 | } 149 | 150 | button, 151 | html [type="button"], 152 | [type="reset"], 153 | [type="submit"] { 154 | -webkit-appearance: button; 155 | } 156 | 157 | button::-moz-focus-inner, 158 | [type="button"]::-moz-focus-inner, 159 | [type="reset"]::-moz-focus-inner, 160 | [type="submit"]::-moz-focus-inner { 161 | border-style: none; 162 | padding: 0; 163 | } 164 | 165 | button:-moz-focusring, 166 | [type="button"]:-moz-focusring, 167 | [type="reset"]:-moz-focusring, 168 | [type="submit"]:-moz-focusring { 169 | outline: 1px dotted ButtonText; 170 | } 171 | 172 | fieldset { 173 | border: 1px solid #c0c0c0; 174 | margin: 0 2px; 175 | padding: 0.35em 0.625em 0.75em; 176 | } 177 | 178 | legend { 179 | -webkit-box-sizing: border-box; 180 | box-sizing: border-box; 181 | color: inherit; 182 | display: table; 183 | max-width: 100%; 184 | padding: 0; 185 | white-space: normal; 186 | } 187 | 188 | progress { 189 | display: inline-block; 190 | vertical-align: baseline; 191 | } 192 | 193 | textarea { 194 | overflow: auto; 195 | } 196 | 197 | [type="checkbox"], 198 | [type="radio"] { 199 | -webkit-box-sizing: border-box; 200 | box-sizing: border-box; 201 | padding: 0; 202 | } 203 | 204 | [type="number"]::-webkit-inner-spin-button, 205 | [type="number"]::-webkit-outer-spin-button { 206 | height: auto; 207 | } 208 | 209 | [type="search"] { 210 | -webkit-appearance: textfield; 211 | outline-offset: -2px; 212 | } 213 | 214 | [type="search"]::-webkit-search-cancel-button, 215 | [type="search"]::-webkit-search-decoration { 216 | -webkit-appearance: none; 217 | } 218 | 219 | ::-webkit-file-upload-button { 220 | -webkit-appearance: button; 221 | font: inherit; 222 | } 223 | 224 | details, 225 | menu { 226 | display: block; 227 | } 228 | 229 | summary { 230 | display: list-item; 231 | } 232 | 233 | canvas { 234 | display: inline-block; 235 | } 236 | 237 | template { 238 | display: none; 239 | } 240 | 241 | [hidden] { 242 | display: none; 243 | } 244 | 245 | html { 246 | -webkit-box-sizing: border-box; 247 | box-sizing: border-box; 248 | } 249 | 250 | *, 251 | *::before, 252 | *::after { 253 | -webkit-box-sizing: inherit; 254 | box-sizing: inherit; 255 | } 256 | 257 | @-ms-viewport { 258 | width: device-width; 259 | } 260 | 261 | html { 262 | -ms-overflow-style: scrollbar; 263 | -webkit-tap-highlight-color: transparent; 264 | } 265 | 266 | body { 267 | font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 268 | font-size: 1rem; 269 | font-weight: normal; 270 | line-height: 1.5; 271 | color: #292b2c; 272 | background-color: #fff; 273 | } 274 | 275 | [tabindex="-1"]:focus { 276 | outline: none !important; 277 | } 278 | 279 | h1, h2, h3, h4, h5, h6 { 280 | margin-top: 0; 281 | margin-bottom: .5rem; 282 | } 283 | 284 | p { 285 | margin-top: 0; 286 | margin-bottom: 1rem; 287 | } 288 | 289 | abbr[title], 290 | abbr[data-original-title] { 291 | cursor: help; 292 | } 293 | 294 | address { 295 | margin-bottom: 1rem; 296 | font-style: normal; 297 | line-height: inherit; 298 | } 299 | 300 | ol, 301 | ul, 302 | dl { 303 | margin-top: 0; 304 | margin-bottom: 1rem; 305 | } 306 | 307 | ol ol, 308 | ul ul, 309 | ol ul, 310 | ul ol { 311 | margin-bottom: 0; 312 | } 313 | 314 | dt { 315 | font-weight: bold; 316 | } 317 | 318 | dd { 319 | margin-bottom: .5rem; 320 | margin-left: 0; 321 | } 322 | 323 | blockquote { 324 | margin: 0 0 1rem; 325 | } 326 | 327 | a { 328 | color: #0275d8; 329 | text-decoration: none; 330 | } 331 | 332 | a:focus, a:hover { 333 | color: #014c8c; 334 | text-decoration: underline; 335 | } 336 | 337 | a:not([href]):not([tabindex]) { 338 | color: inherit; 339 | text-decoration: none; 340 | } 341 | 342 | a:not([href]):not([tabindex]):focus, a:not([href]):not([tabindex]):hover { 343 | color: inherit; 344 | text-decoration: none; 345 | } 346 | 347 | a:not([href]):not([tabindex]):focus { 348 | outline: 0; 349 | } 350 | 351 | pre { 352 | margin-top: 0; 353 | margin-bottom: 1rem; 354 | overflow: auto; 355 | } 356 | 357 | figure { 358 | margin: 0 0 1rem; 359 | } 360 | 361 | img { 362 | vertical-align: middle; 363 | } 364 | 365 | [role="button"] { 366 | cursor: pointer; 367 | } 368 | 369 | a, 370 | area, 371 | button, 372 | [role="button"], 373 | input, 374 | label, 375 | select, 376 | summary, 377 | textarea { 378 | -ms-touch-action: manipulation; 379 | touch-action: manipulation; 380 | } 381 | 382 | table { 383 | border-collapse: collapse; 384 | background-color: transparent; 385 | } 386 | 387 | caption { 388 | padding-top: 0.75rem; 389 | padding-bottom: 0.75rem; 390 | color: #636c72; 391 | text-align: left; 392 | caption-side: bottom; 393 | } 394 | 395 | th { 396 | text-align: left; 397 | } 398 | 399 | label { 400 | display: inline-block; 401 | margin-bottom: .5rem; 402 | } 403 | 404 | button:focus { 405 | outline: 1px dotted; 406 | outline: 5px auto -webkit-focus-ring-color; 407 | } 408 | 409 | input, 410 | button, 411 | select, 412 | textarea { 413 | line-height: inherit; 414 | } 415 | 416 | input[type="radio"]:disabled, 417 | input[type="checkbox"]:disabled { 418 | cursor: not-allowed; 419 | } 420 | 421 | input[type="date"], 422 | input[type="time"], 423 | input[type="datetime-local"], 424 | input[type="month"] { 425 | -webkit-appearance: listbox; 426 | } 427 | 428 | textarea { 429 | resize: vertical; 430 | } 431 | 432 | fieldset { 433 | min-width: 0; 434 | padding: 0; 435 | margin: 0; 436 | border: 0; 437 | } 438 | 439 | legend { 440 | display: block; 441 | width: 100%; 442 | padding: 0; 443 | margin-bottom: .5rem; 444 | font-size: 1.5rem; 445 | line-height: inherit; 446 | } 447 | 448 | input[type="search"] { 449 | -webkit-appearance: none; 450 | } 451 | 452 | output { 453 | display: inline-block; 454 | } 455 | 456 | [hidden] { 457 | display: none !important; 458 | } 459 | /*# sourceMappingURL=bootstrap-reboot.css.map */ -------------------------------------------------------------------------------- /Lecture09/TodoList/css/bootstrap-reboot.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../scss/_normalize.scss","bootstrap-reboot.css","../../scss/_reboot.scss","../../scss/_variables.scss","../../scss/mixins/_hover.scss"],"names":[],"mappings":"AAAA,4EAA4E;AAY5E;EACE,wBAAuB;EACvB,kBAAiB;EACjB,2BAA0B;EAC1B,+BAA8B;CAC/B;;AASD;EACE,UAAS;CACV;;AAMD;;;;;;EAME,eAAc;CACf;;AAOD;EACE,eAAc;EACd,iBAAgB;CACjB;;AAUD;;;EAGE,eAAc;CACf;;AAMD;EACE,iBAAgB;CACjB;;AAOD;EACE,gCAAuB;UAAvB,wBAAuB;EACvB,UAAS;EACT,kBAAiB;CAClB;;AAOD;EACE,kCAAiC;EACjC,eAAc;CACf;;AAUD;EACE,8BAA6B;EAC7B,sCAAqC;CACtC;;AAOD;;EAEE,iBAAgB;CACjB;;AAOD;EACE,oBAAmB;EACnB,2BAA0B;EAC1B,kCAAiC;CAClC;;AAMD;;EAEE,qBAAoB;CACrB;;AAMD;;EAEE,oBAAmB;CACpB;;AAOD;;;EAGE,kCAAiC;EACjC,eAAc;CACf;;AAMD;EACE,mBAAkB;CACnB;;AAMD;EACE,uBAAsB;EACtB,YAAW;CACZ;;AAMD;EACE,eAAc;CACf;;AAOD;;EAEE,eAAc;EACd,eAAc;EACd,mBAAkB;EAClB,yBAAwB;CACzB;;AAED;EACE,gBAAe;CAChB;;AAED;EACE,YAAW;CACZ;;AASD;;EAEE,sBAAqB;CACtB;;AAMD;EACE,cAAa;EACb,UAAS;CACV;;AAMD;EACE,mBAAkB;CACnB;;AAMD;EACE,iBAAgB;CACjB;;AAUD;;;;;EAKE,wBAAuB;EACvB,gBAAe;EACf,kBAAiB;EACjB,UAAS;CACV;;AAOD;;EAEE,kBAAiB;CAClB;;AAOD;;EAEE,qBAAoB;CACrB;;AAQD;;;;EAIE,2BAA0B;CAC3B;;AAMD;;;;EAIE,mBAAkB;EAClB,WAAU;CACX;;AAMD;;;;EAIE,+BAA8B;CAC/B;;AAMD;EACE,0BAAyB;EACzB,cAAa;EACb,+BAA8B;CAC/B;;AASD;EACE,+BAAsB;UAAtB,uBAAsB;EACtB,eAAc;EACd,eAAc;EACd,gBAAe;EACf,WAAU;EACV,oBAAmB;CACpB;;AAOD;EACE,sBAAqB;EACrB,yBAAwB;CACzB;;AAMD;EACE,eAAc;CACf;;ACtKD;;ED+KE,+BAAsB;UAAtB,uBAAsB;EACtB,WAAU;CACX;;AC3KD;;EDmLE,aAAY;CACb;;AC/KD;EDuLE,8BAA6B;EAC7B,qBAAoB;CACrB;;ACpLD;;ED4LE,yBAAwB;CACzB;;AAOD;EACE,2BAA0B;EAC1B,cAAa;CACd;;AAUD;;EAEE,eAAc;CACf;;AAMD;EACE,mBAAkB;CACnB;;AASD;EACE,sBAAqB;CACtB;;AAMD;EACE,cAAa;CACd;;ACpND;ED8NE,cAAa;CACd;;AEvbD;EACE,+BAAsB;UAAtB,uBAAsB;CACvB;;AAED;;;EAGE,4BAAmB;UAAnB,oBAAmB;CACpB;;AAmBC;EAAgB,oBAAmB;CD6MpC;;ACrMD;EAYE,8BAA6B;EAG7B,yCAA0C;CAC3C;;AAED;EACE,mHC2K4H;ED1K5H,gBC+KmB;ED9KnB,oBCmLyB;EDlLzB,iBCsLoB;EDpLpB,eC0BiC;EDxBjC,uBCYW;CDXZ;;AD0LD;EClLE,yBAAwB;CACzB;;AAWD;EACE,cAAa;EACb,qBAAoB;CACrB;;AAMD;EACE,cAAa;EACb,oBAAmB;CACpB;;AAGD;;EAGE,aAAY;CACb;;AAED;EACE,oBAAmB;EACnB,mBAAkB;EAClB,qBAAoB;CACrB;;AAED;;;EAGE,cAAa;EACb,oBAAmB;CACpB;;AAED;;;;EAIE,iBAAgB;CACjB;;AAED;EACE,kBCgHqB;CD/GtB;;AAED;EACE,qBAAoB;EACpB,eAAc;CACf;;AAED;EACE,iBAAgB;CACjB;;AAOD;EACE,eC/Dc;EDgEd,sBC8B0B;CDxB3B;;AEtJG;EFmJA,eC4B4C;ED3B5C,2BC4B6B;CC7K5B;;AF2JL;EACE,eAAc;EACd,sBAAqB;CAUtB;;AE1KG;EFmKA,eAAc;EACd,sBAAqB;CEjKpB;;AF2JL;EAUI,WAAU;CACX;;AAQH;EAEE,cAAa;EAEb,oBAAmB;EAEnB,eAAc;CACf;;AAOD;EAGE,iBAAgB;CACjB;;AAOD;EAGE,uBAAsB;CAGvB;;ADmID;ECzHE,gBAAe;CAChB;;AAaD;;;;;;;;;EASE,+BAA0B;MAA1B,2BAA0B;CAC3B;;AAOD;EAEE,0BAAyB;EAEzB,8BCoEyC;CDnE1C;;AAED;EACE,qBC6DoC;ED5DpC,wBC4DoC;ED3DpC,eC3KiC;ED4KjC,iBAAgB;EAChB,qBAAoB;CACrB;;AAED;EAEE,iBAAgB;CACjB;;AAOD;EAEE,sBAAqB;EACrB,qBAAoB;CACrB;;AAMD;EACE,oBAAmB;EACnB,2CAA0C;CAC3C;;AAED;;;;EAME,qBAAoB;CACrB;;AAED;;EAMI,oBC4IwC;CD3IzC;;AAIH;;;;EASE,4BAA2B;CAC5B;;AAED;EAEE,iBAAgB;CACjB;;AAED;EAME,aAAY;EAEZ,WAAU;EACV,UAAS;EACT,UAAS;CACV;;AAED;EAEE,eAAc;EACd,YAAW;EACX,WAAU;EACV,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;CACrB;;AAED;EAKE,yBAAwB;CACzB;;AAGD;EACE,sBAAqB;CAItB;;ADkED;EC9DE,yBAAwB;CACzB","file":"bootstrap-reboot.css","sourcesContent":[null,"/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */\nhtml {\n font-family: sans-serif;\n line-height: 1.15;\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n}\n\nbody {\n margin: 0;\n}\n\narticle,\naside,\nfooter,\nheader,\nnav,\nsection {\n display: block;\n}\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\nfigcaption,\nfigure,\nmain {\n display: block;\n}\n\nfigure {\n margin: 1em 40px;\n}\n\nhr {\n box-sizing: content-box;\n height: 0;\n overflow: visible;\n}\n\npre {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\na {\n background-color: transparent;\n -webkit-text-decoration-skip: objects;\n}\n\na:active,\na:hover {\n outline-width: 0;\n}\n\nabbr[title] {\n border-bottom: none;\n text-decoration: underline;\n text-decoration: underline dotted;\n}\n\nb,\nstrong {\n font-weight: inherit;\n}\n\nb,\nstrong {\n font-weight: bolder;\n}\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\ndfn {\n font-style: italic;\n}\n\nmark {\n background-color: #ff0;\n color: #000;\n}\n\nsmall {\n font-size: 80%;\n}\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\naudio,\nvideo {\n display: inline-block;\n}\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\nimg {\n border-style: none;\n}\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: sans-serif;\n font-size: 100%;\n line-height: 1.15;\n margin: 0;\n}\n\nbutton,\ninput {\n overflow: visible;\n}\n\nbutton,\nselect {\n text-transform: none;\n}\n\nbutton,\nhtml [type=\"button\"],\n[type=\"reset\"],\n[type=\"submit\"] {\n -webkit-appearance: button;\n}\n\nbutton::-moz-focus-inner,\n[type=\"button\"]::-moz-focus-inner,\n[type=\"reset\"]::-moz-focus-inner,\n[type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\nbutton:-moz-focusring,\n[type=\"button\"]:-moz-focusring,\n[type=\"reset\"]:-moz-focusring,\n[type=\"submit\"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\nlegend {\n box-sizing: border-box;\n color: inherit;\n display: table;\n max-width: 100%;\n padding: 0;\n white-space: normal;\n}\n\nprogress {\n display: inline-block;\n vertical-align: baseline;\n}\n\ntextarea {\n overflow: auto;\n}\n\n[type=\"checkbox\"],\n[type=\"radio\"] {\n box-sizing: border-box;\n padding: 0;\n}\n\n[type=\"number\"]::-webkit-inner-spin-button,\n[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n[type=\"search\"] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n\n[type=\"search\"]::-webkit-search-cancel-button,\n[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n\ndetails,\nmenu {\n display: block;\n}\n\nsummary {\n display: list-item;\n}\n\ncanvas {\n display: inline-block;\n}\n\ntemplate {\n display: none;\n}\n\n[hidden] {\n display: none;\n}\n\nhtml {\n box-sizing: border-box;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: inherit;\n}\n\n@-ms-viewport {\n width: device-width;\n}\n\nhtml {\n -ms-overflow-style: scrollbar;\n -webkit-tap-highlight-color: transparent;\n}\n\nbody {\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n font-size: 1rem;\n font-weight: normal;\n line-height: 1.5;\n color: #292b2c;\n background-color: #fff;\n}\n\n[tabindex=\"-1\"]:focus {\n outline: none !important;\n}\n\nh1, h2, h3, h4, h5, h6 {\n margin-top: 0;\n margin-bottom: .5rem;\n}\n\np {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nabbr[title],\nabbr[data-original-title] {\n cursor: help;\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: bold;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0;\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\na {\n color: #0275d8;\n text-decoration: none;\n}\n\na:focus, a:hover {\n color: #014c8c;\n text-decoration: underline;\n}\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n}\n\na:not([href]):not([tabindex]):focus, a:not([href]):not([tabindex]):hover {\n color: inherit;\n text-decoration: none;\n}\n\na:not([href]):not([tabindex]):focus {\n outline: 0;\n}\n\npre {\n margin-top: 0;\n margin-bottom: 1rem;\n overflow: auto;\n}\n\nfigure {\n margin: 0 0 1rem;\n}\n\nimg {\n vertical-align: middle;\n}\n\n[role=\"button\"] {\n cursor: pointer;\n}\n\na,\narea,\nbutton,\n[role=\"button\"],\ninput,\nlabel,\nselect,\nsummary,\ntextarea {\n touch-action: manipulation;\n}\n\ntable {\n border-collapse: collapse;\n background-color: transparent;\n}\n\ncaption {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n color: #636c72;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n text-align: left;\n}\n\nlabel {\n display: inline-block;\n margin-bottom: .5rem;\n}\n\nbutton:focus {\n outline: 1px dotted;\n outline: 5px auto -webkit-focus-ring-color;\n}\n\ninput,\nbutton,\nselect,\ntextarea {\n line-height: inherit;\n}\n\ninput[type=\"radio\"]:disabled,\ninput[type=\"checkbox\"]:disabled {\n cursor: not-allowed;\n}\n\ninput[type=\"date\"],\ninput[type=\"time\"],\ninput[type=\"datetime-local\"],\ninput[type=\"month\"] {\n -webkit-appearance: listbox;\n}\n\ntextarea {\n resize: vertical;\n}\n\nfieldset {\n min-width: 0;\n padding: 0;\n margin: 0;\n border: 0;\n}\n\nlegend {\n display: block;\n width: 100%;\n padding: 0;\n margin-bottom: .5rem;\n font-size: 1.5rem;\n line-height: inherit;\n}\n\ninput[type=\"search\"] {\n -webkit-appearance: none;\n}\n\noutput {\n display: inline-block;\n}\n\n[hidden] {\n display: none !important;\n}\n\n/*# sourceMappingURL=bootstrap-reboot.css.map */",null,null,null]} -------------------------------------------------------------------------------- /Lecture09/TodoList/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}html{-webkit-box-sizing:border-box;box-sizing:border-box}*,::after,::before{-webkit-box-sizing:inherit;box-sizing:inherit}@-ms-viewport{width:device-width}html{-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}body{font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:1rem;font-weight:400;line-height:1.5;color:#292b2c;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{cursor:help}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}a{color:#0275d8;text-decoration:none}a:focus,a:hover{color:#014c8c;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle}[role=button]{cursor:pointer}[role=button],a,area,button,input,label,select,summary,textarea{-ms-touch-action:manipulation;touch-action:manipulation}table{border-collapse:collapse;background-color:transparent}caption{padding-top:.75rem;padding-bottom:.75rem;color:#636c72;text-align:left;caption-side:bottom}th{text-align:left}label{display:inline-block;margin-bottom:.5rem}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,select,textarea{line-height:inherit}input[type=checkbox]:disabled,input[type=radio]:disabled{cursor:not-allowed}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{-webkit-appearance:listbox}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit}input[type=search]{-webkit-appearance:none}output{display:inline-block}[hidden]{display:none!important}/*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /Lecture09/TodoList/css/bootstrap-reboot.min.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../scss/_normalize.scss","bootstrap-reboot.css","../../scss/_reboot.scss","../../scss/_variables.scss","../../scss/mixins/_hover.scss"],"names":[],"mappings":"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"} -------------------------------------------------------------------------------- /Lecture09/TodoList/css/custom.css: -------------------------------------------------------------------------------- 1 | #todolist-container { 2 | padding: 20px; 3 | } 4 | 5 | .todo-done { 6 | text-decoration: line-through; 7 | color: #999; 8 | } 9 | 10 | .delete { 11 | color: #d9534f; 12 | } 13 | 14 | .icn-move { 15 | color: #0275d8; 16 | } 17 | 18 | #list-todos > li:first-child > .fa-chevron-up { 19 | visibility: hidden; 20 | pointer-events: none; 21 | } 22 | 23 | #list-todos > li:last-child > .fa-chevron-down { 24 | visibility: hidden; 25 | pointer-events: none; 26 | } -------------------------------------------------------------------------------- /Lecture09/TodoList/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture09/TodoList/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /Lecture09/TodoList/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture09/TodoList/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /Lecture09/TodoList/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture09/TodoList/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /Lecture09/TodoList/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture09/TodoList/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /Lecture09/TodoList/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture09/TodoList/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /Lecture09/TodoList/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TodoList 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
    16 |
    17 |
    18 |

    Todo List

    19 |
    20 |
    21 |
    22 | 23 |
    24 |
    25 |
    26 | 27 |
    28 |
    29 | 32 |
    33 |
    34 | 37 |
    38 |
    39 |
    40 |
    41 |
      42 |
    • Sample Item
    • 43 |
    • Sample Item
    • 44 |
    45 |
    46 |
    47 |
    48 | 49 | 50 | -------------------------------------------------------------------------------- /Lecture09/TodoList/js/todolist.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 25/06/17. 3 | */ 4 | 5 | let todoList = []; 6 | let todoListElement = null; 7 | /* 8 | { task: 'task to do' 9 | done: false 10 | */ 11 | window.onload = function () { 12 | 13 | let btnAdd = document.getElementById('btn-add-todo'); 14 | let btnClean = document.getElementById('btn-clear-done'); 15 | let inputNewTodo = document.getElementById('input-new-todo'); 16 | todoListElement = document.getElementById('list-todos'); 17 | 18 | showTodos(todoListElement); 19 | 20 | btnAdd.addEventListener('click', function (ev) { 21 | addTodo(inputNewTodo.value); 22 | showTodos(); 23 | inputNewTodo.value = ''; 24 | }); 25 | 26 | btnClean.addEventListener('click', deleteDone); 27 | 28 | }; 29 | 30 | function retrieveTodos() { 31 | let savedTodos = localStorage.getItem('todos'); 32 | if (savedTodos) { 33 | todoList = JSON.parse(savedTodos); 34 | } 35 | } 36 | 37 | function saveTodos() { 38 | localStorage.setItem("todos", JSON.stringify(todoList)) 39 | } 40 | 41 | function showTodos() { 42 | if (!todoListElement) { 43 | return; 44 | } 45 | retrieveTodos(); 46 | todoListElement.innerHTML = ""; 47 | for (i in todoList) { 48 | todoListElement.appendChild( 49 | createTodoListItem(i, todoList[i].task, todoList[i].done) 50 | ) 51 | } 52 | } 53 | 54 | function setTodoAsDone(ev) { 55 | let todoId = ev.target.parentElement.getAttribute('data-id') 56 | todoList[todoId].done = ev.target.checked; 57 | saveTodos(); 58 | showTodos(); 59 | } 60 | 61 | function deleteTodo(ev) { 62 | let todoId = ev.target.parentElement.getAttribute('data-id'); 63 | todoList.splice(todoId,1); 64 | saveTodos(); 65 | showTodos(); 66 | } 67 | 68 | function moveTaskUp(ev) { 69 | let todoId = ev.target.parentElement.getAttribute('data-id'); 70 | todoId = parseInt(todoId); 71 | todoList.splice((todoId-1),0,todoList.splice(todoId,1)[0]); 72 | saveTodos(); 73 | showTodos(); 74 | } 75 | 76 | function moveTaskDown(ev) { 77 | let todoId = ev.target.parentElement.getAttribute('data-id'); 78 | todoId = parseInt(todoId); 79 | todoList.splice((todoId+1),0,todoList.splice(todoId,1)[0]); 80 | saveTodos(); 81 | showTodos(); 82 | } 83 | 84 | function deleteDone() { 85 | todoList = todoList.filter(function (item, index, array) { 86 | return !item.done; 87 | }); 88 | saveTodos(); 89 | showTodos(); 90 | } 91 | 92 | function createTodoListItem(id, task, done) { 93 | let todoListItem = document.createElement('li'); 94 | todoListItem.className = 'list-group-item'; 95 | todoListItem.setAttribute('data-id', id); 96 | 97 | let todoDoneCheckbox = document.createElement('input'); 98 | todoDoneCheckbox.setAttribute('type', 'checkbox'); 99 | todoDoneCheckbox.className = 'col-1'; 100 | todoDoneCheckbox.addEventListener('change', setTodoAsDone); 101 | 102 | let taskSpan = document.createElement('span'); 103 | taskSpan.innerText = task; 104 | taskSpan.className = 'col-8'; 105 | 106 | let taskDeleteButton = document.createElement('i'); 107 | taskDeleteButton.className = 'fa fa-remove col-1 delete'; 108 | taskDeleteButton.addEventListener('click', deleteTodo); 109 | 110 | let moveUpButton = document.createElement('i'); 111 | moveUpButton.className = 'fa fa-chevron-up col-1 icn-move'; 112 | moveUpButton.addEventListener('click', moveTaskUp); 113 | 114 | let moveDownButton = document.createElement('i'); 115 | moveDownButton.className = 'fa fa-chevron-down col-1 icn-move'; 116 | moveDownButton.addEventListener('click', moveTaskDown); 117 | 118 | if (done) { 119 | taskSpan.className += ' todo-done'; 120 | todoDoneCheckbox.setAttribute('checked', 'true'); 121 | } 122 | 123 | todoListItem.appendChild(todoDoneCheckbox); 124 | todoListItem.appendChild(taskSpan); 125 | todoListItem.appendChild(taskDeleteButton); 126 | todoListItem.appendChild(moveUpButton); 127 | todoListItem.appendChild(moveDownButton); 128 | 129 | return todoListItem; 130 | 131 | } 132 | 133 | function addTodo(taskText) { 134 | let newTodo = { 135 | task: taskText, 136 | done: false 137 | }; 138 | todoList.push(newTodo); 139 | saveTodos(); 140 | } -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/asyncFunctions.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | function doSomething(done) { 6 | var a = 10; 7 | console.log("doing"); 8 | // we are doing something 9 | done(function (reallyAfterDone) { 10 | var a =11; 11 | console.log("after done"); 12 | reallyAfterDone(function () { 13 | console.log("yes we are sure" + a); 14 | done() 15 | }); 16 | }); 17 | } 18 | 19 | doSomething(function (afterDone) { 20 | var b = 20; 21 | console.log("done"); 22 | afterDone(function (areYouSure) { 23 | console.log("really done now" + b); 24 | areYouSure() 25 | }); 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/asyncFunctions2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | 6 | function sayHello() { 7 | console.log('hello'); 8 | } 9 | 10 | // var timeOutId = setTimeout(sayHello, 8000); 11 | 12 | // var interValId = setInterval(sayHello, 1000); 13 | 14 | 15 | function createSecondLooper(n) { 16 | 17 | return function () { 18 | 19 | for (var j = 0; j < n; j++) { 20 | 21 | console.log(j); 22 | 23 | setTimeout(function () { 24 | console.log(j); 25 | }, j * 100) 26 | 27 | } 28 | } 29 | } 30 | 31 | var looper10 = createSecondLooper(10); 32 | looper10(); -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/asyncFunctions3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | 6 | 7 | var id = setInterval(function () { 8 | console.log('running'); 9 | }, 10); 10 | 11 | setTimeout(function () { 12 | clearInterval(id) 13 | }, 200); 14 | 15 | 16 | 17 | 18 | console.log('a'); 19 | 20 | -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/asyncFunctions4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | function downloadFile(url, downloaded) { 6 | //we are downloading here 7 | setTimeout(function () { 8 | downloaded('some file data') 9 | }, 3000) 10 | } 11 | 12 | function compressFile(data, type, compressed) { 13 | setTimeout(function () { 14 | compressed('compressed data') 15 | }, 2000) 16 | } 17 | 18 | function saveFile(data, fileLocation, saved) { 19 | setTimeout(function () { 20 | saved(true) 21 | }, 3000) 22 | } 23 | 24 | downloadFile('google.com/file', function (data) { 25 | compressFile(fileData, 'zip', function (data) { 26 | saveFile(compressedData, 'C:/myfile.txt', function () { 27 | console.log('Download complete'); 28 | }) 29 | }) 30 | }); 31 | console.log('Download started'); 32 | 33 | -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/classPrototypes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | function Shape (edges, faces) { 6 | this.edges = edges 7 | this.faces = faces 8 | var a = 10; 9 | } 10 | function gefs () { 11 | return this.edges + this.faces; 12 | } 13 | Shape.prototype.getEdgeFaceSum = gefs 14 | 15 | var cube = new Shape(12,6); 16 | var square = new Shape(4,1); 17 | 18 | var triangle = Object.create(Shape.prototype) -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/closures.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | function genCounter(initVal, deltaVal) { 6 | 7 | 8 | return { 9 | getVal() { 10 | return initVal; 11 | }, 12 | incrVal () { 13 | initVal += deltaVal; 14 | }, 15 | decrVal () { 16 | initVal -= deltaVal; 17 | } 18 | } 19 | } 20 | 21 | var counter = genCounter(10,3); 22 | 23 | counter.getVal(); 24 | counter.incrVal(); 25 | counter.incrVal(); 26 | counter.getVal(); 27 | counter.decrVal(); 28 | counter.getVal(); -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/constructors.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | function Fruit(name, origin) { 6 | this.name = name; 7 | this.origin = origin; 8 | // do not return non-primitive values from here 9 | } 10 | 11 | var mango = new Fruit("dussheri", "lucknow"); 12 | 13 | var apple = Fruit("apple", "shimla"); 14 | 15 | -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/es5classes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | function Person(firstName, lastName) { 6 | //like public function 7 | this.getName = function () { 8 | return this.firstName + " " + this.lastName 9 | } 10 | 11 | this.getFullName = function () { 12 | return this.getName() + "(" + getInitials() + ")" 13 | } 14 | 15 | // like private variables 16 | var firstInitial = firstName.charAt(0); 17 | var lastInitial = lastName.charAt(0); 18 | 19 | 20 | // like private function 21 | var getInitials = function () { 22 | return firstInitial + "." + lastInitial + "." 23 | } 24 | 25 | //like public variables 26 | this.firstName = firstName; 27 | this.lastName = lastName; 28 | 29 | } 30 | 31 | var p = new Person("John", "Doe") -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/functionscopes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | 6 | function myFun () { 7 | var a = 10; 8 | } 9 | 10 | myFun(); 11 | 12 | console.log(a); 13 | -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/objectCreate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | var obj = Object.create(Object.prototype, { 6 | key: { 7 | writable: true, 8 | configurable: true, 9 | value: 'some value' 10 | }, 11 | anotherKey: { 12 | configurable: true, 13 | get: function () { 14 | return "You can't change this" 15 | } 16 | } 17 | }); 18 | 19 | var o = {p:1, q: 2}; 20 | 21 | Object.defineProperty(o, 'z', { 22 | writable: false, 23 | configurable: true, 24 | enumerable: false, 25 | value: "You can't change this" 26 | }) -------------------------------------------------------------------------------- /Lecture10/AdvancedJS/prototypes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 27/06/17. 3 | */ 4 | 5 | var oneObj = { 6 | key: 'value' 7 | } 8 | 9 | var otherObj = Object.create(oneObj); 10 | otherObj.otherKey = 12345; 11 | 12 | var anotherObj = Object.create(otherObj); 13 | anotherObj.someBool = false; 14 | 15 | function aFun () { 16 | console.log(this.someBool); 17 | } 18 | anotherObj.someFun = aFun 19 | 20 | /* 21 | otherObj 22 | Object { otherKey: 12345 } 23 | otherObj.key = 'askhdbaskhd' 24 | "askhdbaskhd" 25 | anotherObj.key 26 | "askhdbaskhd" 27 | anotherObj 28 | Object { someBool: false } 29 | anotherObj.key 30 | "askhdbaskhd" 31 | delete otherObj.key 32 | true 33 | otherObj 34 | Object { otherKey: 12345 } 35 | otherObj.key 36 | "value" 37 | anotherObj.key 38 | "value" 39 | anotherObj 40 | Object { someBool: false } 41 | delete anotherObj.key 42 | true 43 | anotherObj.key 44 | "value" 45 | */ 46 | -------------------------------------------------------------------------------- /Lecture11/jQuery/css/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */ 2 | html { 3 | font-family: sans-serif; 4 | line-height: 1.15; 5 | -ms-text-size-adjust: 100%; 6 | -webkit-text-size-adjust: 100%; 7 | } 8 | 9 | body { 10 | margin: 0; 11 | } 12 | 13 | article, 14 | aside, 15 | footer, 16 | header, 17 | nav, 18 | section { 19 | display: block; 20 | } 21 | 22 | h1 { 23 | font-size: 2em; 24 | margin: 0.67em 0; 25 | } 26 | 27 | figcaption, 28 | figure, 29 | main { 30 | display: block; 31 | } 32 | 33 | figure { 34 | margin: 1em 40px; 35 | } 36 | 37 | hr { 38 | -webkit-box-sizing: content-box; 39 | box-sizing: content-box; 40 | height: 0; 41 | overflow: visible; 42 | } 43 | 44 | pre { 45 | font-family: monospace, monospace; 46 | font-size: 1em; 47 | } 48 | 49 | a { 50 | background-color: transparent; 51 | -webkit-text-decoration-skip: objects; 52 | } 53 | 54 | a:active, 55 | a:hover { 56 | outline-width: 0; 57 | } 58 | 59 | abbr[title] { 60 | border-bottom: none; 61 | text-decoration: underline; 62 | text-decoration: underline dotted; 63 | } 64 | 65 | b, 66 | strong { 67 | font-weight: inherit; 68 | } 69 | 70 | b, 71 | strong { 72 | font-weight: bolder; 73 | } 74 | 75 | code, 76 | kbd, 77 | samp { 78 | font-family: monospace, monospace; 79 | font-size: 1em; 80 | } 81 | 82 | dfn { 83 | font-style: italic; 84 | } 85 | 86 | mark { 87 | background-color: #ff0; 88 | color: #000; 89 | } 90 | 91 | small { 92 | font-size: 80%; 93 | } 94 | 95 | sub, 96 | sup { 97 | font-size: 75%; 98 | line-height: 0; 99 | position: relative; 100 | vertical-align: baseline; 101 | } 102 | 103 | sub { 104 | bottom: -0.25em; 105 | } 106 | 107 | sup { 108 | top: -0.5em; 109 | } 110 | 111 | audio, 112 | video { 113 | display: inline-block; 114 | } 115 | 116 | audio:not([controls]) { 117 | display: none; 118 | height: 0; 119 | } 120 | 121 | img { 122 | border-style: none; 123 | } 124 | 125 | svg:not(:root) { 126 | overflow: hidden; 127 | } 128 | 129 | button, 130 | input, 131 | optgroup, 132 | select, 133 | textarea { 134 | font-family: sans-serif; 135 | font-size: 100%; 136 | line-height: 1.15; 137 | margin: 0; 138 | } 139 | 140 | button, 141 | input { 142 | overflow: visible; 143 | } 144 | 145 | button, 146 | select { 147 | text-transform: none; 148 | } 149 | 150 | button, 151 | html [type="button"], 152 | [type="reset"], 153 | [type="submit"] { 154 | -webkit-appearance: button; 155 | } 156 | 157 | button::-moz-focus-inner, 158 | [type="button"]::-moz-focus-inner, 159 | [type="reset"]::-moz-focus-inner, 160 | [type="submit"]::-moz-focus-inner { 161 | border-style: none; 162 | padding: 0; 163 | } 164 | 165 | button:-moz-focusring, 166 | [type="button"]:-moz-focusring, 167 | [type="reset"]:-moz-focusring, 168 | [type="submit"]:-moz-focusring { 169 | outline: 1px dotted ButtonText; 170 | } 171 | 172 | fieldset { 173 | border: 1px solid #c0c0c0; 174 | margin: 0 2px; 175 | padding: 0.35em 0.625em 0.75em; 176 | } 177 | 178 | legend { 179 | -webkit-box-sizing: border-box; 180 | box-sizing: border-box; 181 | color: inherit; 182 | display: table; 183 | max-width: 100%; 184 | padding: 0; 185 | white-space: normal; 186 | } 187 | 188 | progress { 189 | display: inline-block; 190 | vertical-align: baseline; 191 | } 192 | 193 | textarea { 194 | overflow: auto; 195 | } 196 | 197 | [type="checkbox"], 198 | [type="radio"] { 199 | -webkit-box-sizing: border-box; 200 | box-sizing: border-box; 201 | padding: 0; 202 | } 203 | 204 | [type="number"]::-webkit-inner-spin-button, 205 | [type="number"]::-webkit-outer-spin-button { 206 | height: auto; 207 | } 208 | 209 | [type="search"] { 210 | -webkit-appearance: textfield; 211 | outline-offset: -2px; 212 | } 213 | 214 | [type="search"]::-webkit-search-cancel-button, 215 | [type="search"]::-webkit-search-decoration { 216 | -webkit-appearance: none; 217 | } 218 | 219 | ::-webkit-file-upload-button { 220 | -webkit-appearance: button; 221 | font: inherit; 222 | } 223 | 224 | details, 225 | menu { 226 | display: block; 227 | } 228 | 229 | summary { 230 | display: list-item; 231 | } 232 | 233 | canvas { 234 | display: inline-block; 235 | } 236 | 237 | template { 238 | display: none; 239 | } 240 | 241 | [hidden] { 242 | display: none; 243 | } 244 | 245 | html { 246 | -webkit-box-sizing: border-box; 247 | box-sizing: border-box; 248 | } 249 | 250 | *, 251 | *::before, 252 | *::after { 253 | -webkit-box-sizing: inherit; 254 | box-sizing: inherit; 255 | } 256 | 257 | @-ms-viewport { 258 | width: device-width; 259 | } 260 | 261 | html { 262 | -ms-overflow-style: scrollbar; 263 | -webkit-tap-highlight-color: transparent; 264 | } 265 | 266 | body { 267 | font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 268 | font-size: 1rem; 269 | font-weight: normal; 270 | line-height: 1.5; 271 | color: #292b2c; 272 | background-color: #fff; 273 | } 274 | 275 | [tabindex="-1"]:focus { 276 | outline: none !important; 277 | } 278 | 279 | h1, h2, h3, h4, h5, h6 { 280 | margin-top: 0; 281 | margin-bottom: .5rem; 282 | } 283 | 284 | p { 285 | margin-top: 0; 286 | margin-bottom: 1rem; 287 | } 288 | 289 | abbr[title], 290 | abbr[data-original-title] { 291 | cursor: help; 292 | } 293 | 294 | address { 295 | margin-bottom: 1rem; 296 | font-style: normal; 297 | line-height: inherit; 298 | } 299 | 300 | ol, 301 | ul, 302 | dl { 303 | margin-top: 0; 304 | margin-bottom: 1rem; 305 | } 306 | 307 | ol ol, 308 | ul ul, 309 | ol ul, 310 | ul ol { 311 | margin-bottom: 0; 312 | } 313 | 314 | dt { 315 | font-weight: bold; 316 | } 317 | 318 | dd { 319 | margin-bottom: .5rem; 320 | margin-left: 0; 321 | } 322 | 323 | blockquote { 324 | margin: 0 0 1rem; 325 | } 326 | 327 | a { 328 | color: #0275d8; 329 | text-decoration: none; 330 | } 331 | 332 | a:focus, a:hover { 333 | color: #014c8c; 334 | text-decoration: underline; 335 | } 336 | 337 | a:not([href]):not([tabindex]) { 338 | color: inherit; 339 | text-decoration: none; 340 | } 341 | 342 | a:not([href]):not([tabindex]):focus, a:not([href]):not([tabindex]):hover { 343 | color: inherit; 344 | text-decoration: none; 345 | } 346 | 347 | a:not([href]):not([tabindex]):focus { 348 | outline: 0; 349 | } 350 | 351 | pre { 352 | margin-top: 0; 353 | margin-bottom: 1rem; 354 | overflow: auto; 355 | } 356 | 357 | figure { 358 | margin: 0 0 1rem; 359 | } 360 | 361 | img { 362 | vertical-align: middle; 363 | } 364 | 365 | [role="button"] { 366 | cursor: pointer; 367 | } 368 | 369 | a, 370 | area, 371 | button, 372 | [role="button"], 373 | input, 374 | label, 375 | select, 376 | summary, 377 | textarea { 378 | -ms-touch-action: manipulation; 379 | touch-action: manipulation; 380 | } 381 | 382 | table { 383 | border-collapse: collapse; 384 | background-color: transparent; 385 | } 386 | 387 | caption { 388 | padding-top: 0.75rem; 389 | padding-bottom: 0.75rem; 390 | color: #636c72; 391 | text-align: left; 392 | caption-side: bottom; 393 | } 394 | 395 | th { 396 | text-align: left; 397 | } 398 | 399 | label { 400 | display: inline-block; 401 | margin-bottom: .5rem; 402 | } 403 | 404 | button:focus { 405 | outline: 1px dotted; 406 | outline: 5px auto -webkit-focus-ring-color; 407 | } 408 | 409 | input, 410 | button, 411 | select, 412 | textarea { 413 | line-height: inherit; 414 | } 415 | 416 | input[type="radio"]:disabled, 417 | input[type="checkbox"]:disabled { 418 | cursor: not-allowed; 419 | } 420 | 421 | input[type="date"], 422 | input[type="time"], 423 | input[type="datetime-local"], 424 | input[type="month"] { 425 | -webkit-appearance: listbox; 426 | } 427 | 428 | textarea { 429 | resize: vertical; 430 | } 431 | 432 | fieldset { 433 | min-width: 0; 434 | padding: 0; 435 | margin: 0; 436 | border: 0; 437 | } 438 | 439 | legend { 440 | display: block; 441 | width: 100%; 442 | padding: 0; 443 | margin-bottom: .5rem; 444 | font-size: 1.5rem; 445 | line-height: inherit; 446 | } 447 | 448 | input[type="search"] { 449 | -webkit-appearance: none; 450 | } 451 | 452 | output { 453 | display: inline-block; 454 | } 455 | 456 | [hidden] { 457 | display: none !important; 458 | } 459 | /*# sourceMappingURL=bootstrap-reboot.css.map */ -------------------------------------------------------------------------------- /Lecture11/jQuery/css/bootstrap-reboot.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../scss/_normalize.scss","bootstrap-reboot.css","../../scss/_reboot.scss","../../scss/_variables.scss","../../scss/mixins/_hover.scss"],"names":[],"mappings":"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","file":"bootstrap-reboot.css","sourcesContent":[null,"/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */\nhtml {\n font-family: sans-serif;\n line-height: 1.15;\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n}\n\nbody {\n margin: 0;\n}\n\narticle,\naside,\nfooter,\nheader,\nnav,\nsection {\n display: block;\n}\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\nfigcaption,\nfigure,\nmain {\n display: block;\n}\n\nfigure {\n margin: 1em 40px;\n}\n\nhr {\n box-sizing: content-box;\n height: 0;\n overflow: visible;\n}\n\npre {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\na {\n background-color: transparent;\n -webkit-text-decoration-skip: objects;\n}\n\na:active,\na:hover {\n outline-width: 0;\n}\n\nabbr[title] {\n border-bottom: none;\n text-decoration: underline;\n text-decoration: underline dotted;\n}\n\nb,\nstrong {\n font-weight: inherit;\n}\n\nb,\nstrong {\n font-weight: bolder;\n}\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\ndfn {\n font-style: italic;\n}\n\nmark {\n background-color: #ff0;\n color: #000;\n}\n\nsmall {\n font-size: 80%;\n}\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\naudio,\nvideo {\n display: inline-block;\n}\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\nimg {\n border-style: none;\n}\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: sans-serif;\n font-size: 100%;\n line-height: 1.15;\n margin: 0;\n}\n\nbutton,\ninput {\n overflow: visible;\n}\n\nbutton,\nselect {\n text-transform: none;\n}\n\nbutton,\nhtml [type=\"button\"],\n[type=\"reset\"],\n[type=\"submit\"] {\n -webkit-appearance: button;\n}\n\nbutton::-moz-focus-inner,\n[type=\"button\"]::-moz-focus-inner,\n[type=\"reset\"]::-moz-focus-inner,\n[type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\nbutton:-moz-focusring,\n[type=\"button\"]:-moz-focusring,\n[type=\"reset\"]:-moz-focusring,\n[type=\"submit\"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\nlegend {\n box-sizing: border-box;\n color: inherit;\n display: table;\n max-width: 100%;\n padding: 0;\n white-space: normal;\n}\n\nprogress {\n display: inline-block;\n vertical-align: baseline;\n}\n\ntextarea {\n overflow: auto;\n}\n\n[type=\"checkbox\"],\n[type=\"radio\"] {\n box-sizing: border-box;\n padding: 0;\n}\n\n[type=\"number\"]::-webkit-inner-spin-button,\n[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n[type=\"search\"] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n\n[type=\"search\"]::-webkit-search-cancel-button,\n[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n\ndetails,\nmenu {\n display: block;\n}\n\nsummary {\n display: list-item;\n}\n\ncanvas {\n display: inline-block;\n}\n\ntemplate {\n display: none;\n}\n\n[hidden] {\n display: none;\n}\n\nhtml {\n box-sizing: border-box;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: inherit;\n}\n\n@-ms-viewport {\n width: device-width;\n}\n\nhtml {\n -ms-overflow-style: scrollbar;\n -webkit-tap-highlight-color: transparent;\n}\n\nbody {\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n font-size: 1rem;\n font-weight: normal;\n line-height: 1.5;\n color: #292b2c;\n background-color: #fff;\n}\n\n[tabindex=\"-1\"]:focus {\n outline: none !important;\n}\n\nh1, h2, h3, h4, h5, h6 {\n margin-top: 0;\n margin-bottom: .5rem;\n}\n\np {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nabbr[title],\nabbr[data-original-title] {\n cursor: help;\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: bold;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0;\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\na {\n color: #0275d8;\n text-decoration: none;\n}\n\na:focus, a:hover {\n color: #014c8c;\n text-decoration: underline;\n}\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n}\n\na:not([href]):not([tabindex]):focus, a:not([href]):not([tabindex]):hover {\n color: inherit;\n text-decoration: none;\n}\n\na:not([href]):not([tabindex]):focus {\n outline: 0;\n}\n\npre {\n margin-top: 0;\n margin-bottom: 1rem;\n overflow: auto;\n}\n\nfigure {\n margin: 0 0 1rem;\n}\n\nimg {\n vertical-align: middle;\n}\n\n[role=\"button\"] {\n cursor: pointer;\n}\n\na,\narea,\nbutton,\n[role=\"button\"],\ninput,\nlabel,\nselect,\nsummary,\ntextarea {\n touch-action: manipulation;\n}\n\ntable {\n border-collapse: collapse;\n background-color: transparent;\n}\n\ncaption {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n color: #636c72;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n text-align: left;\n}\n\nlabel {\n display: inline-block;\n margin-bottom: .5rem;\n}\n\nbutton:focus {\n outline: 1px dotted;\n outline: 5px auto -webkit-focus-ring-color;\n}\n\ninput,\nbutton,\nselect,\ntextarea {\n line-height: inherit;\n}\n\ninput[type=\"radio\"]:disabled,\ninput[type=\"checkbox\"]:disabled {\n cursor: not-allowed;\n}\n\ninput[type=\"date\"],\ninput[type=\"time\"],\ninput[type=\"datetime-local\"],\ninput[type=\"month\"] {\n -webkit-appearance: listbox;\n}\n\ntextarea {\n resize: vertical;\n}\n\nfieldset {\n min-width: 0;\n padding: 0;\n margin: 0;\n border: 0;\n}\n\nlegend {\n display: block;\n width: 100%;\n padding: 0;\n margin-bottom: .5rem;\n font-size: 1.5rem;\n line-height: inherit;\n}\n\ninput[type=\"search\"] {\n -webkit-appearance: none;\n}\n\noutput {\n display: inline-block;\n}\n\n[hidden] {\n display: none !important;\n}\n\n/*# sourceMappingURL=bootstrap-reboot.css.map */",null,null,null]} -------------------------------------------------------------------------------- /Lecture11/jQuery/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}html{-webkit-box-sizing:border-box;box-sizing:border-box}*,::after,::before{-webkit-box-sizing:inherit;box-sizing:inherit}@-ms-viewport{width:device-width}html{-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}body{font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:1rem;font-weight:400;line-height:1.5;color:#292b2c;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{cursor:help}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}a{color:#0275d8;text-decoration:none}a:focus,a:hover{color:#014c8c;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle}[role=button]{cursor:pointer}[role=button],a,area,button,input,label,select,summary,textarea{-ms-touch-action:manipulation;touch-action:manipulation}table{border-collapse:collapse;background-color:transparent}caption{padding-top:.75rem;padding-bottom:.75rem;color:#636c72;text-align:left;caption-side:bottom}th{text-align:left}label{display:inline-block;margin-bottom:.5rem}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,select,textarea{line-height:inherit}input[type=checkbox]:disabled,input[type=radio]:disabled{cursor:not-allowed}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{-webkit-appearance:listbox}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit}input[type=search]{-webkit-appearance:none}output{display:inline-block}[hidden]{display:none!important}/*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /Lecture11/jQuery/css/bootstrap-reboot.min.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../scss/_normalize.scss","bootstrap-reboot.css","../../scss/_reboot.scss","../../scss/_variables.scss","../../scss/mixins/_hover.scss"],"names":[],"mappings":"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"} -------------------------------------------------------------------------------- /Lecture11/jQuery/css/custom.css: -------------------------------------------------------------------------------- 1 | #todolist-container { 2 | padding: 20px; 3 | } 4 | 5 | .todo-done { 6 | text-decoration: line-through; 7 | color: #999; 8 | } 9 | 10 | .delete { 11 | color: #d9534f; 12 | } 13 | 14 | .icn-move { 15 | color: #0275d8; 16 | } 17 | 18 | #list-todos > li:first-child > .fa-chevron-up { 19 | visibility: hidden; 20 | pointer-events: none; 21 | } 22 | 23 | #list-todos > li:last-child > .fa-chevron-down { 24 | visibility: hidden; 25 | pointer-events: none; 26 | } -------------------------------------------------------------------------------- /Lecture11/jQuery/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture11/jQuery/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /Lecture11/jQuery/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture11/jQuery/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /Lecture11/jQuery/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture11/jQuery/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /Lecture11/jQuery/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture11/jQuery/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /Lecture11/jQuery/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture11/jQuery/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /Lecture11/jQuery/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 |
    12 | Some text 13 |
    14 | Some more text 15 |
    16 |
    17 | 18 | 19 | -------------------------------------------------------------------------------- /Lecture11/jQuery/js/todolist.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 25/06/17. 3 | */ 4 | 5 | let todoList = []; 6 | let todoListElement = null; 7 | /* 8 | { task: 'task to do' 9 | done: false 10 | */ 11 | window.onload = function () { 12 | 13 | let btnAdd = document.getElementById('btn-add-todo'); 14 | let btnClean = document.getElementById('btn-clear-done'); 15 | let inputNewTodo = document.getElementById('input-new-todo'); 16 | todoListElement = document.getElementById('list-todos'); 17 | 18 | showTodos(todoListElement); 19 | 20 | btnAdd.addEventListener('click', function (ev) { 21 | addTodo(inputNewTodo.value); 22 | showTodos(); 23 | inputNewTodo.value = ''; 24 | }); 25 | 26 | btnClean.addEventListener('click', deleteDone); 27 | 28 | }; 29 | 30 | function retrieveTodos() { 31 | let savedTodos = localStorage.getItem('todos'); 32 | if (savedTodos) { 33 | todoList = JSON.parse(savedTodos); 34 | } 35 | } 36 | 37 | function saveTodos() { 38 | localStorage.setItem("todos", JSON.stringify(todoList)) 39 | } 40 | 41 | function showTodos() { 42 | if (!todoListElement) { 43 | return; 44 | } 45 | retrieveTodos(); 46 | todoListElement.innerHTML = ""; 47 | for (i in todoList) { 48 | todoListElement.appendChild( 49 | createTodoListItem(i, todoList[i].task, todoList[i].done) 50 | ) 51 | } 52 | } 53 | 54 | function setTodoAsDone(ev) { 55 | let todoId = ev.target.parentElement.getAttribute('data-id') 56 | todoList[todoId].done = ev.target.checked; 57 | saveTodos(); 58 | showTodos(); 59 | } 60 | 61 | function deleteTodo(ev) { 62 | let todoId = ev.target.parentElement.getAttribute('data-id'); 63 | todoList.splice(todoId,1); 64 | saveTodos(); 65 | showTodos(); 66 | } 67 | 68 | function moveTaskUp(ev) { 69 | let todoId = ev.target.parentElement.getAttribute('data-id'); 70 | todoId = parseInt(todoId); 71 | todoList.splice((todoId-1),0,todoList.splice(todoId,1)[0]); 72 | saveTodos(); 73 | showTodos(); 74 | } 75 | 76 | function moveTaskDown(ev) { 77 | let todoId = ev.target.parentElement.getAttribute('data-id'); 78 | todoId = parseInt(todoId); 79 | todoList.splice((todoId+1),0,todoList.splice(todoId,1)[0]); 80 | saveTodos(); 81 | showTodos(); 82 | } 83 | 84 | function deleteDone() { 85 | todoList = todoList.filter(function (item, index, array) { 86 | return !item.done; 87 | }); 88 | saveTodos(); 89 | showTodos(); 90 | } 91 | 92 | function createTodoListItem(id, task, done) { 93 | let todoListItem = document.createElement('li'); 94 | todoListItem.className = 'list-group-item'; 95 | todoListItem.setAttribute('data-id', id); 96 | 97 | let todoDoneCheckbox = document.createElement('input'); 98 | todoDoneCheckbox.setAttribute('type', 'checkbox'); 99 | todoDoneCheckbox.className = 'col-1'; 100 | todoDoneCheckbox.addEventListener('change', setTodoAsDone); 101 | 102 | let taskSpan = document.createElement('span'); 103 | taskSpan.innerText = task; 104 | taskSpan.className = 'col-8'; 105 | 106 | let taskDeleteButton = document.createElement('i'); 107 | taskDeleteButton.className = 'fa fa-remove col-1 delete'; 108 | taskDeleteButton.addEventListener('click', deleteTodo); 109 | 110 | let moveUpButton = document.createElement('i'); 111 | moveUpButton.className = 'fa fa-chevron-up col-1 icn-move'; 112 | moveUpButton.addEventListener('click', moveTaskUp); 113 | 114 | let moveDownButton = document.createElement('i'); 115 | moveDownButton.className = 'fa fa-chevron-down col-1 icn-move'; 116 | moveDownButton.addEventListener('click', moveTaskDown); 117 | 118 | if (done) { 119 | taskSpan.className += ' todo-done'; 120 | todoDoneCheckbox.setAttribute('checked', 'true'); 121 | } 122 | 123 | todoListItem.appendChild(todoDoneCheckbox); 124 | todoListItem.appendChild(taskSpan); 125 | todoListItem.appendChild(taskDeleteButton); 126 | todoListItem.appendChild(moveUpButton); 127 | todoListItem.appendChild(moveDownButton); 128 | 129 | return todoListItem; 130 | 131 | } 132 | 133 | function addTodo(taskText) { 134 | let newTodo = { 135 | task: taskText, 136 | done: false 137 | }; 138 | todoList.push(newTodo); 139 | saveTodos(); 140 | } -------------------------------------------------------------------------------- /Lecture11/jQuery/js/todolistjquery.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 30/06/17. 3 | */ 4 | 5 | let todos = []; 6 | let todoListElement; 7 | 8 | function Todo(task, done) { 9 | this.task = task; 10 | this.done = !!done; 11 | } 12 | 13 | $(function () { 14 | 15 | let btnAdd = $('#btn-add-todo'); 16 | let btnClean = $('#btn-clear-done'); 17 | let inputNewTodo = $('#input-new-todo'); 18 | todoListElement = $('#list-todos'); 19 | 20 | refreshTodos(true); 21 | 22 | btnAdd.click(function () { 23 | addTodo(inputNewTodo.val()) 24 | }) 25 | 26 | }); 27 | 28 | function refreshTodos(firstPageLoad = false) { 29 | if (!firstPageLoad) { 30 | saveTodos(); 31 | } 32 | if (!todoListElement) { 33 | return; 34 | } 35 | retrieveTodos(); 36 | todoListElement.empty(); 37 | for (i in todos) { 38 | let todoItem = createTodoListItem(i); 39 | todoListElement.append(todoItem) 40 | } 41 | 42 | } 43 | 44 | function deleteTodo(ev) { 45 | let todoId = $(ev.target).parent().attr('data-id'); 46 | todos.splice(todoId,1); 47 | refreshTodos(); 48 | } 49 | 50 | function moveTodoUp(ev) { 51 | let todoId = +($(ev.target).parent().attr('data-id')); 52 | todos.splice((todoId-1),0,todos.splice(todoId,1)[0]); 53 | refreshTodos(); 54 | } 55 | 56 | 57 | function moveTodoDown(ev) { 58 | let todoId = +($(ev.target).parent().attr('data-id')); 59 | todos.splice((todoId+1),0,todos.splice(todoId,1)[0]); 60 | refreshTodos(); 61 | } 62 | function createTodoListItem (i) { 63 | 64 | let todoItem =$(`
  • `); 65 | todoItem.append($('').attr('checked', todos[i].done)); 66 | todoItem.append($(`${todos[i].task}`)); 67 | 68 | todoItem.append($('') 69 | .click(deleteTodo)); 70 | 71 | todoItem.append($('') 72 | .click(moveTodoUp)); 73 | 74 | todoItem.append($('') 75 | .click(moveTodoDown)); 76 | return todoItem 77 | 78 | 79 | } 80 | 81 | function retrieveTodos() { 82 | let savedTodos = localStorage.getItem('todos'); 83 | if (savedTodos) { 84 | todos = JSON.parse(savedTodos); 85 | } 86 | } 87 | 88 | function saveTodos() { 89 | localStorage.setItem("todos", JSON.stringify(todos)) 90 | } 91 | 92 | function addTodo (todoTask) { 93 | todos.push(new Todo(todoTask, false)); 94 | refreshTodos(); 95 | } -------------------------------------------------------------------------------- /Lecture11/jQuery/script.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 30/06/17. 3 | */ 4 | 5 | 6 | $(function () { 7 | 8 | let div2 = $('#div2') 9 | let div1 = $('#div1'); 10 | //console.log(div2.text()); 11 | div2.text('Some Other Replacement Text') 12 | console.log(div1.html()); 13 | 14 | div1.css('color', 'red') 15 | console.log(div1.attr('class')); 16 | div1.attr('id', 'divx'); 17 | 18 | 19 | 20 | 21 | }); -------------------------------------------------------------------------------- /Lecture11/jQuery/todolist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TodoList 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
    17 |
    18 |
    19 |

    Todo List

    20 |
    21 |
    22 |
    23 | 24 |
    25 |
    26 |
    27 | 28 |
    29 |
    30 | 33 |
    34 |
    35 | 38 |
    39 |
    40 |
    41 |
    42 |
      43 |
    • Sample Item
    • 44 |
    • Sample Item
    • 45 |
    46 |
    47 |
    48 |
    49 | 50 | 51 | -------------------------------------------------------------------------------- /Lecture12/NodeIntro/data.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 02/07/17. 3 | */ 4 | 5 | var obj = { 6 | a: 10 7 | } 8 | 9 | setTimeout(function () { 10 | obj.a = false 11 | }, 1000); 12 | 13 | setInterval(function () { 14 | console.log(obj.a); 15 | }, 2000) 16 | 17 | console.log("data is being read"); 18 | 19 | module.exports = obj -------------------------------------------------------------------------------- /Lecture12/NodeIntro/hello.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 02/07/17. 3 | */ 4 | 5 | var data = require('./data'); 6 | 7 | setTimeout(function () { 8 | console.log(data.a); 9 | }, 200) 10 | setTimeout(function () { 11 | console.log(data.a); 12 | data.a = 22; 13 | }, 1500) 14 | 15 | -------------------------------------------------------------------------------- /Lecture12/NodeIntro/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Lecture12/NodeIntro/moduleprivates/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 02/07/17. 3 | */ 4 | 5 | const mod = require('./module') 6 | 7 | console.log(mod.pubVar); 8 | 9 | mod.pubFun(); 10 | 11 | //not possible 12 | //mod.privFun(); 13 | //console.log(mod.privVar); 14 | 15 | console.log(mod.privAccess); 16 | mod.privAccessFun(); -------------------------------------------------------------------------------- /Lecture12/NodeIntro/moduleprivates/module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 02/07/17. 3 | */ 4 | 5 | let privVar = 'something really private' 6 | 7 | let privFun = function () { 8 | console.log('doing some private work here'); 9 | } 10 | 11 | module.exports = { 12 | pubVar: 'some public information here', 13 | pubFun: function () { 14 | console.log('doing public work here'); 15 | }, 16 | privAccess: privVar, 17 | privAccessFun: function () { 18 | privFun(); 19 | } 20 | } -------------------------------------------------------------------------------- /Lecture12/NodeIntro/modulescopes/file1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 02/07/17. 3 | */ 4 | var f2 = require('./file2') 5 | 6 | var a = 10; 7 | this.a= 20; 8 | global.a = 30; 9 | 10 | console.log(f2); 11 | 12 | setTimeout(function () { 13 | console.log(f2); 14 | }, 2000) 15 | 16 | -------------------------------------------------------------------------------- /Lecture12/NodeIntro/modulescopes/file2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 02/07/17. 3 | */ 4 | 5 | this.a = 'variable'; 6 | 7 | console.log(this == module.exports) 8 | 9 | var arrowFun = () => { 10 | console.log(this); 11 | } 12 | 13 | setTimeout(() => { 14 | // 15 | }, 1000) 16 | 17 | module.exports = { 18 | a: this.a 19 | } -------------------------------------------------------------------------------- /Lecture12/NodeIntro/modulescopes/file3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 02/07/17. 3 | */ 4 | 5 | 6 | var arr = [1,2]; 7 | 8 | function changeArr(a) { 9 | a[0] = 10; 10 | } 11 | console.log(arr); 12 | changeArr(arr) 13 | console.log(arr); 14 | 15 | 16 | var i = 10; 17 | 18 | // eval is evil 19 | function changeInt(x) { 20 | eval(`${x} = 20;`) 21 | } 22 | console.log(i); 23 | changeInt('i') 24 | console.log(i); -------------------------------------------------------------------------------- /Lecture12/file.js: -------------------------------------------------------------------------------- 1 | console.log('hello') 2 | -------------------------------------------------------------------------------- /Lecture13/MoreAboutNode/exec.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 04/07/17. 3 | */ 4 | -------------------------------------------------------------------------------- /Lecture13/MoreAboutNode/fileops.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 04/07/17. 3 | */ 4 | const path = require('path'); 5 | const fs = require('fs'); 6 | 7 | 8 | console.log('Directory is == '); 9 | console.log(__dirname); 10 | 11 | console.log(path.join(__dirname, '..', '..')); 12 | console.log(path.join(__dirname, '/subdir')) 13 | 14 | fs.readdir(__dirname, function (err, files) { 15 | if (err) throw err 16 | console.log(files); 17 | }) -------------------------------------------------------------------------------- /Lecture13/MoreAboutNode/fizzbuzz/fizzbuzz.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 04/07/17. 3 | */ 4 | 5 | const fs = require('fs'); 6 | const path = require('path') 7 | 8 | const inputFile = path.join(__dirname, 'input') 9 | const outputFile = path.join(__dirname, 'output') 10 | 11 | function getFizzBuzzForNum (num) { 12 | let res = ''; 13 | num = parseInt(num); 14 | if (num % 3 == 0) res += 'fizz' 15 | 16 | if (num % 5 == 0) res += 'buzz' 17 | 18 | if (res === '') res += num; 19 | 20 | return res 21 | } 22 | 23 | function resultReducer(accum, currVal) { 24 | return accum + '\n' + currVal; 25 | } 26 | 27 | fs.readFile(inputFile, (err, data) => { 28 | if (err) throw err; 29 | 30 | let fileData = data.toString(); 31 | let fileDataVals = fileData.split(/\r?\n/); 32 | let fizzBuzzVals = fileDataVals.map(getFizzBuzzForNum); 33 | let resString = fizzBuzzVals.reduce(resultReducer); 34 | 35 | fs.writeFile(outputFile, resString, function (err) { 36 | if (err) throw err; 37 | 38 | console.log('All done!'); 39 | }) 40 | }) 41 | 42 | 43 | -------------------------------------------------------------------------------- /Lecture13/MoreAboutNode/fizzbuzz/input: -------------------------------------------------------------------------------- 1 | 12 2 | 23 3 | 6 4 | 12 5 | 2 6 | 24 7 | 124 8 | 468 9 | 13 10 | -------------------------------------------------------------------------------- /Lecture13/MoreAboutNode/fizzbuzz/output: -------------------------------------------------------------------------------- 1 | fizz 2 | 23 3 | fizz 4 | fizz 5 | 2 6 | fizz 7 | 124 8 | fizz 9 | 13 10 | NaN -------------------------------------------------------------------------------- /Lecture14/ExpressIntro/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "expressintro", 3 | "version": "0.0.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.3", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", 10 | "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", 11 | "requires": { 12 | "mime-types": "2.1.15", 13 | "negotiator": "0.6.1" 14 | } 15 | }, 16 | "array-flatten": { 17 | "version": "1.1.1", 18 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 19 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 20 | }, 21 | "content-disposition": { 22 | "version": "0.5.2", 23 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", 24 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" 25 | }, 26 | "content-type": { 27 | "version": "1.0.2", 28 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz", 29 | "integrity": "sha1-t9ETrueo3Se9IRM8TcJSnfFyHu0=" 30 | }, 31 | "cookie": { 32 | "version": "0.3.1", 33 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 34 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 35 | }, 36 | "cookie-signature": { 37 | "version": "1.0.6", 38 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 39 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 40 | }, 41 | "debug": { 42 | "version": "2.6.7", 43 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.7.tgz", 44 | "integrity": "sha1-krrR9tBbu2u6Isyoi80OyJTChh4=", 45 | "requires": { 46 | "ms": "2.0.0" 47 | } 48 | }, 49 | "depd": { 50 | "version": "1.1.0", 51 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz", 52 | "integrity": "sha1-4b2Cxqq2ztlluXuIsX7T5SjKGMM=" 53 | }, 54 | "destroy": { 55 | "version": "1.0.4", 56 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 57 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 58 | }, 59 | "ee-first": { 60 | "version": "1.1.1", 61 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 62 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 63 | }, 64 | "encodeurl": { 65 | "version": "1.0.1", 66 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", 67 | "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=" 68 | }, 69 | "escape-html": { 70 | "version": "1.0.3", 71 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 72 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 73 | }, 74 | "etag": { 75 | "version": "1.8.0", 76 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.0.tgz", 77 | "integrity": "sha1-b2Ma7zNtbEY2K1F2QETOIWvjwFE=" 78 | }, 79 | "express": { 80 | "version": "4.15.3", 81 | "resolved": "https://registry.npmjs.org/express/-/express-4.15.3.tgz", 82 | "integrity": "sha1-urZdDwOqgMNYQIly/HAPkWlEtmI=", 83 | "requires": { 84 | "accepts": "1.3.3", 85 | "array-flatten": "1.1.1", 86 | "content-disposition": "0.5.2", 87 | "content-type": "1.0.2", 88 | "cookie": "0.3.1", 89 | "cookie-signature": "1.0.6", 90 | "debug": "2.6.7", 91 | "depd": "1.1.0", 92 | "encodeurl": "1.0.1", 93 | "escape-html": "1.0.3", 94 | "etag": "1.8.0", 95 | "finalhandler": "1.0.3", 96 | "fresh": "0.5.0", 97 | "merge-descriptors": "1.0.1", 98 | "methods": "1.1.2", 99 | "on-finished": "2.3.0", 100 | "parseurl": "1.3.1", 101 | "path-to-regexp": "0.1.7", 102 | "proxy-addr": "1.1.4", 103 | "qs": "6.4.0", 104 | "range-parser": "1.2.0", 105 | "send": "0.15.3", 106 | "serve-static": "1.12.3", 107 | "setprototypeof": "1.0.3", 108 | "statuses": "1.3.1", 109 | "type-is": "1.6.15", 110 | "utils-merge": "1.0.0", 111 | "vary": "1.1.1" 112 | } 113 | }, 114 | "finalhandler": { 115 | "version": "1.0.3", 116 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.3.tgz", 117 | "integrity": "sha1-70fneVDpmXgOhgIqVg4yF+DQzIk=", 118 | "requires": { 119 | "debug": "2.6.7", 120 | "encodeurl": "1.0.1", 121 | "escape-html": "1.0.3", 122 | "on-finished": "2.3.0", 123 | "parseurl": "1.3.1", 124 | "statuses": "1.3.1", 125 | "unpipe": "1.0.0" 126 | } 127 | }, 128 | "forwarded": { 129 | "version": "0.1.0", 130 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz", 131 | "integrity": "sha1-Ge+YdMSuHCl7zweP3mOgm2aoQ2M=" 132 | }, 133 | "fresh": { 134 | "version": "0.5.0", 135 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", 136 | "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=" 137 | }, 138 | "http-errors": { 139 | "version": "1.6.1", 140 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.1.tgz", 141 | "integrity": "sha1-X4uO2YrKVFZWv1cplzh/kEpyIlc=", 142 | "requires": { 143 | "depd": "1.1.0", 144 | "inherits": "2.0.3", 145 | "setprototypeof": "1.0.3", 146 | "statuses": "1.3.1" 147 | } 148 | }, 149 | "inherits": { 150 | "version": "2.0.3", 151 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 152 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 153 | }, 154 | "ipaddr.js": { 155 | "version": "1.3.0", 156 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.3.0.tgz", 157 | "integrity": "sha1-HgOlL9rYOou7KyXL9JmLTP/NPew=" 158 | }, 159 | "media-typer": { 160 | "version": "0.3.0", 161 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 162 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 163 | }, 164 | "merge-descriptors": { 165 | "version": "1.0.1", 166 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 167 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 168 | }, 169 | "methods": { 170 | "version": "1.1.2", 171 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 172 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 173 | }, 174 | "mime": { 175 | "version": "1.3.4", 176 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", 177 | "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" 178 | }, 179 | "mime-db": { 180 | "version": "1.27.0", 181 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", 182 | "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=" 183 | }, 184 | "mime-types": { 185 | "version": "2.1.15", 186 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", 187 | "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", 188 | "requires": { 189 | "mime-db": "1.27.0" 190 | } 191 | }, 192 | "ms": { 193 | "version": "2.0.0", 194 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 195 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 196 | }, 197 | "negotiator": { 198 | "version": "0.6.1", 199 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", 200 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" 201 | }, 202 | "on-finished": { 203 | "version": "2.3.0", 204 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 205 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 206 | "requires": { 207 | "ee-first": "1.1.1" 208 | } 209 | }, 210 | "parseurl": { 211 | "version": "1.3.1", 212 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.1.tgz", 213 | "integrity": "sha1-yKuMkiO6NIiKpkopeyiFO+wY2lY=" 214 | }, 215 | "path-to-regexp": { 216 | "version": "0.1.7", 217 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 218 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 219 | }, 220 | "proxy-addr": { 221 | "version": "1.1.4", 222 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.4.tgz", 223 | "integrity": "sha1-J+VF9pYKRKYn2bREZ+NcG2tM4vM=", 224 | "requires": { 225 | "forwarded": "0.1.0", 226 | "ipaddr.js": "1.3.0" 227 | } 228 | }, 229 | "qs": { 230 | "version": "6.4.0", 231 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", 232 | "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" 233 | }, 234 | "range-parser": { 235 | "version": "1.2.0", 236 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", 237 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" 238 | }, 239 | "send": { 240 | "version": "0.15.3", 241 | "resolved": "https://registry.npmjs.org/send/-/send-0.15.3.tgz", 242 | "integrity": "sha1-UBP5+ZAj31DRvZiSwZ4979HVMwk=", 243 | "requires": { 244 | "debug": "2.6.7", 245 | "depd": "1.1.0", 246 | "destroy": "1.0.4", 247 | "encodeurl": "1.0.1", 248 | "escape-html": "1.0.3", 249 | "etag": "1.8.0", 250 | "fresh": "0.5.0", 251 | "http-errors": "1.6.1", 252 | "mime": "1.3.4", 253 | "ms": "2.0.0", 254 | "on-finished": "2.3.0", 255 | "range-parser": "1.2.0", 256 | "statuses": "1.3.1" 257 | } 258 | }, 259 | "serve-static": { 260 | "version": "1.12.3", 261 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.3.tgz", 262 | "integrity": "sha1-n0uhni8wMMVH+K+ZEHg47DjVseI=", 263 | "requires": { 264 | "encodeurl": "1.0.1", 265 | "escape-html": "1.0.3", 266 | "parseurl": "1.3.1", 267 | "send": "0.15.3" 268 | } 269 | }, 270 | "setprototypeof": { 271 | "version": "1.0.3", 272 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", 273 | "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" 274 | }, 275 | "statuses": { 276 | "version": "1.3.1", 277 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", 278 | "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" 279 | }, 280 | "type-is": { 281 | "version": "1.6.15", 282 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", 283 | "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", 284 | "requires": { 285 | "media-typer": "0.3.0", 286 | "mime-types": "2.1.15" 287 | } 288 | }, 289 | "unpipe": { 290 | "version": "1.0.0", 291 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 292 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 293 | }, 294 | "utils-merge": { 295 | "version": "1.0.0", 296 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", 297 | "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=" 298 | }, 299 | "vary": { 300 | "version": "1.1.1", 301 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.1.tgz", 302 | "integrity": "sha1-Z1Neu2lMHVIldFeYRmUyP1h+jTc=" 303 | } 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /Lecture14/ExpressIntro/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "expressintro", 3 | "version": "0.0.1", 4 | "description": "An example express server ", 5 | "main": "server.js ", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.15.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Lecture14/ExpressIntro/public_static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | This is a sample file 9 | 10 | -------------------------------------------------------------------------------- /Lecture14/ExpressIntro/public_static/other.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Other 6 | 7 | 8 | This is some other file 9 | 10 | Hello 11 | 12 | -------------------------------------------------------------------------------- /Lecture14/ExpressIntro/public_static/todos.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Todos 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Lecture14/ExpressIntro/public_static/todos.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 07/07/17. 3 | */ 4 | 5 | 6 | $(function () { 7 | 8 | $('#addtodo').click(function () { 9 | 10 | let newtodo = $('#newtodo').val(); 11 | let todolist = $('#todolist'); 12 | 13 | $.get('/addtodo?task=' + newtodo, function (data) { 14 | todolist.empty(); 15 | for (task of data) { 16 | todolist.append(`
  • ${task}
  • `) 17 | } 18 | }) 19 | 20 | }) 21 | 22 | }) -------------------------------------------------------------------------------- /Lecture14/ExpressIntro/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 07/07/17. 3 | */ 4 | const express = require('express') 5 | const path = require('path') 6 | 7 | const app = express(); 8 | 9 | todos = []; 10 | 11 | app.get('/', function (req, res, next) { 12 | res.send("Hello") 13 | }) 14 | 15 | app.get('/greet', function (req, res, next) { 16 | console.log(req.query); 17 | 18 | let name = req.query.name; 19 | res.send("Greetings to " + name) 20 | }) 21 | 22 | app.get('/addtodo', function (req, res, next) { 23 | todos.push(req.query.task) 24 | 25 | res.send(todos) 26 | 27 | }) 28 | 29 | app.use('/public', express.static(path.join(__dirname, 'public_static'))) 30 | 31 | app.listen(8000) -------------------------------------------------------------------------------- /Lecture15/Middlewares/old-server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 09/07/17. 3 | */ 4 | const express = require('express'); 5 | 6 | const app = express(); 7 | 8 | function m1(req, res, next) { 9 | console.log('Middleware 1'); 10 | next(); 11 | } 12 | function m2(req, res, next) { 13 | console.log('Middleware 2'); 14 | next(); 15 | } 16 | function m3(req, res, next) { 17 | console.log('Middleware 3'); 18 | } 19 | 20 | //app.use(m1) 21 | app.use(m2) 22 | 23 | app.get('/', (req, res, next) => { 24 | console.log("Going to send hello"); 25 | res.body = "Hello"; 26 | res.send(res.body) 27 | next(); 28 | }) 29 | 30 | app.use(m3) 31 | 32 | 33 | app.listen(3456, function () { 34 | console.log("Server started on http://localhost:3456"); 35 | }); -------------------------------------------------------------------------------- /Lecture15/Middlewares/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exp-mddlwr", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.3", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", 10 | "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", 11 | "requires": { 12 | "mime-types": "2.1.15", 13 | "negotiator": "0.6.1" 14 | } 15 | }, 16 | "array-flatten": { 17 | "version": "1.1.1", 18 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 19 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 20 | }, 21 | "content-disposition": { 22 | "version": "0.5.2", 23 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", 24 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" 25 | }, 26 | "content-type": { 27 | "version": "1.0.2", 28 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz", 29 | "integrity": "sha1-t9ETrueo3Se9IRM8TcJSnfFyHu0=" 30 | }, 31 | "cookie": { 32 | "version": "0.3.1", 33 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 34 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 35 | }, 36 | "cookie-signature": { 37 | "version": "1.0.6", 38 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 39 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 40 | }, 41 | "debug": { 42 | "version": "2.6.7", 43 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.7.tgz", 44 | "integrity": "sha1-krrR9tBbu2u6Isyoi80OyJTChh4=", 45 | "requires": { 46 | "ms": "2.0.0" 47 | } 48 | }, 49 | "depd": { 50 | "version": "1.1.0", 51 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz", 52 | "integrity": "sha1-4b2Cxqq2ztlluXuIsX7T5SjKGMM=" 53 | }, 54 | "destroy": { 55 | "version": "1.0.4", 56 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 57 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 58 | }, 59 | "ee-first": { 60 | "version": "1.1.1", 61 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 62 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 63 | }, 64 | "encodeurl": { 65 | "version": "1.0.1", 66 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", 67 | "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=" 68 | }, 69 | "escape-html": { 70 | "version": "1.0.3", 71 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 72 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 73 | }, 74 | "etag": { 75 | "version": "1.8.0", 76 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.0.tgz", 77 | "integrity": "sha1-b2Ma7zNtbEY2K1F2QETOIWvjwFE=" 78 | }, 79 | "express": { 80 | "version": "4.15.3", 81 | "resolved": "https://registry.npmjs.org/express/-/express-4.15.3.tgz", 82 | "integrity": "sha1-urZdDwOqgMNYQIly/HAPkWlEtmI=", 83 | "requires": { 84 | "accepts": "1.3.3", 85 | "array-flatten": "1.1.1", 86 | "content-disposition": "0.5.2", 87 | "content-type": "1.0.2", 88 | "cookie": "0.3.1", 89 | "cookie-signature": "1.0.6", 90 | "debug": "2.6.7", 91 | "depd": "1.1.0", 92 | "encodeurl": "1.0.1", 93 | "escape-html": "1.0.3", 94 | "etag": "1.8.0", 95 | "finalhandler": "1.0.3", 96 | "fresh": "0.5.0", 97 | "merge-descriptors": "1.0.1", 98 | "methods": "1.1.2", 99 | "on-finished": "2.3.0", 100 | "parseurl": "1.3.1", 101 | "path-to-regexp": "0.1.7", 102 | "proxy-addr": "1.1.4", 103 | "qs": "6.4.0", 104 | "range-parser": "1.2.0", 105 | "send": "0.15.3", 106 | "serve-static": "1.12.3", 107 | "setprototypeof": "1.0.3", 108 | "statuses": "1.3.1", 109 | "type-is": "1.6.15", 110 | "utils-merge": "1.0.0", 111 | "vary": "1.1.1" 112 | } 113 | }, 114 | "finalhandler": { 115 | "version": "1.0.3", 116 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.3.tgz", 117 | "integrity": "sha1-70fneVDpmXgOhgIqVg4yF+DQzIk=", 118 | "requires": { 119 | "debug": "2.6.7", 120 | "encodeurl": "1.0.1", 121 | "escape-html": "1.0.3", 122 | "on-finished": "2.3.0", 123 | "parseurl": "1.3.1", 124 | "statuses": "1.3.1", 125 | "unpipe": "1.0.0" 126 | } 127 | }, 128 | "forwarded": { 129 | "version": "0.1.0", 130 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz", 131 | "integrity": "sha1-Ge+YdMSuHCl7zweP3mOgm2aoQ2M=" 132 | }, 133 | "fresh": { 134 | "version": "0.5.0", 135 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", 136 | "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=" 137 | }, 138 | "http-errors": { 139 | "version": "1.6.1", 140 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.1.tgz", 141 | "integrity": "sha1-X4uO2YrKVFZWv1cplzh/kEpyIlc=", 142 | "requires": { 143 | "depd": "1.1.0", 144 | "inherits": "2.0.3", 145 | "setprototypeof": "1.0.3", 146 | "statuses": "1.3.1" 147 | } 148 | }, 149 | "inherits": { 150 | "version": "2.0.3", 151 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 152 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 153 | }, 154 | "ipaddr.js": { 155 | "version": "1.3.0", 156 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.3.0.tgz", 157 | "integrity": "sha1-HgOlL9rYOou7KyXL9JmLTP/NPew=" 158 | }, 159 | "media-typer": { 160 | "version": "0.3.0", 161 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 162 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 163 | }, 164 | "merge-descriptors": { 165 | "version": "1.0.1", 166 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 167 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 168 | }, 169 | "methods": { 170 | "version": "1.1.2", 171 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 172 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 173 | }, 174 | "mime": { 175 | "version": "1.3.4", 176 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", 177 | "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" 178 | }, 179 | "mime-db": { 180 | "version": "1.27.0", 181 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", 182 | "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=" 183 | }, 184 | "mime-types": { 185 | "version": "2.1.15", 186 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", 187 | "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", 188 | "requires": { 189 | "mime-db": "1.27.0" 190 | } 191 | }, 192 | "ms": { 193 | "version": "2.0.0", 194 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 195 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 196 | }, 197 | "negotiator": { 198 | "version": "0.6.1", 199 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", 200 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" 201 | }, 202 | "on-finished": { 203 | "version": "2.3.0", 204 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 205 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 206 | "requires": { 207 | "ee-first": "1.1.1" 208 | } 209 | }, 210 | "parseurl": { 211 | "version": "1.3.1", 212 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.1.tgz", 213 | "integrity": "sha1-yKuMkiO6NIiKpkopeyiFO+wY2lY=" 214 | }, 215 | "path-to-regexp": { 216 | "version": "0.1.7", 217 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 218 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 219 | }, 220 | "proxy-addr": { 221 | "version": "1.1.4", 222 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.4.tgz", 223 | "integrity": "sha1-J+VF9pYKRKYn2bREZ+NcG2tM4vM=", 224 | "requires": { 225 | "forwarded": "0.1.0", 226 | "ipaddr.js": "1.3.0" 227 | } 228 | }, 229 | "qs": { 230 | "version": "6.4.0", 231 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", 232 | "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" 233 | }, 234 | "range-parser": { 235 | "version": "1.2.0", 236 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", 237 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" 238 | }, 239 | "send": { 240 | "version": "0.15.3", 241 | "resolved": "https://registry.npmjs.org/send/-/send-0.15.3.tgz", 242 | "integrity": "sha1-UBP5+ZAj31DRvZiSwZ4979HVMwk=", 243 | "requires": { 244 | "debug": "2.6.7", 245 | "depd": "1.1.0", 246 | "destroy": "1.0.4", 247 | "encodeurl": "1.0.1", 248 | "escape-html": "1.0.3", 249 | "etag": "1.8.0", 250 | "fresh": "0.5.0", 251 | "http-errors": "1.6.1", 252 | "mime": "1.3.4", 253 | "ms": "2.0.0", 254 | "on-finished": "2.3.0", 255 | "range-parser": "1.2.0", 256 | "statuses": "1.3.1" 257 | } 258 | }, 259 | "serve-static": { 260 | "version": "1.12.3", 261 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.3.tgz", 262 | "integrity": "sha1-n0uhni8wMMVH+K+ZEHg47DjVseI=", 263 | "requires": { 264 | "encodeurl": "1.0.1", 265 | "escape-html": "1.0.3", 266 | "parseurl": "1.3.1", 267 | "send": "0.15.3" 268 | } 269 | }, 270 | "setprototypeof": { 271 | "version": "1.0.3", 272 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", 273 | "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" 274 | }, 275 | "statuses": { 276 | "version": "1.3.1", 277 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", 278 | "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" 279 | }, 280 | "type-is": { 281 | "version": "1.6.15", 282 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", 283 | "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", 284 | "requires": { 285 | "media-typer": "0.3.0", 286 | "mime-types": "2.1.15" 287 | } 288 | }, 289 | "unpipe": { 290 | "version": "1.0.0", 291 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 292 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 293 | }, 294 | "utils-merge": { 295 | "version": "1.0.0", 296 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", 297 | "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=" 298 | }, 299 | "vary": { 300 | "version": "1.1.1", 301 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.1.tgz", 302 | "integrity": "sha1-Z1Neu2lMHVIldFeYRmUyP1h+jTc=" 303 | } 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /Lecture15/Middlewares/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exp-mddlwr", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.15.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Lecture15/Middlewares/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 09/07/17. 3 | */ 4 | const express = require('express'); 5 | 6 | const app = express(); 7 | 8 | app.use((req, res, next) => { 9 | console.log("global middleware"); next(); 10 | }) 11 | 12 | app.use('/info', (req, res, next) => { 13 | console.log("info path middleware"); next(); 14 | }) 15 | 16 | app.get('/', (req, res) => { 17 | res.send("Hello") 18 | }) 19 | app.get('/info', (req, res, next) => { 20 | res.send("Here you have some info") 21 | //next(); 22 | }) 23 | app.get('/info', (req, res) => { 24 | console.log("Information"); 25 | }) 26 | app.all('/info/1', (req, res) => { 27 | res.send("Information about 1") 28 | }) 29 | app.use((req, res, next) => { 30 | res.send("Nothing to be found here"); 31 | }) 32 | 33 | app.listen(2345, function () { 34 | console.log("Server started on http://localhost:2345"); 35 | }); 36 | -------------------------------------------------------------------------------- /Lecture15/Routers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exp-routers", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "body-parser": "^1.17.2", 13 | "express": "^4.15.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Lecture15/Routers/routes/students.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 09/07/17. 3 | */ 4 | const route = require('express').Router(); 5 | 6 | let students = [ 7 | {name:"Abhinav", age: 15}, 8 | {name:"Raghav", age: 16}, 9 | {name:"Kushal", age: 18}, 10 | ] 11 | 12 | route.get('/', (req, res) => { 13 | res.send(students) 14 | }) 15 | 16 | 17 | route.get('/:id', (req, res, next) => { 18 | if (isNaN(parseInt(req.params.id))) { 19 | next() 20 | } 21 | res.send(students[req.params.id - 1]) 22 | }) 23 | 24 | route.post('/new', (req, res) => { 25 | students.push({ 26 | name: req.body.name, 27 | age: req.body.age 28 | }) 29 | res.redirect(req.baseUrl) 30 | }) 31 | 32 | 33 | // route.get('/redir', (req, res) => { 34 | // res.redirect(req.baseUrl) 35 | // }) 36 | 37 | 38 | module.exports = route -------------------------------------------------------------------------------- /Lecture15/Routers/routes/teachers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 09/07/17. 3 | */ 4 | const route = require('express').Router(); 5 | 6 | let teachers = [ 7 | {name:"Ram", age: 25}, 8 | {name:"Shyam", age: 28}, 9 | {name:"Bhargav", age: 32}, 10 | ] 11 | 12 | route.get('/', (req, res) => { 13 | res.send(teachers) 14 | }) 15 | 16 | route.get('/:id', (req, res) => { 17 | res.send(teachers[req.params.id - 1]) 18 | }) 19 | 20 | module.exports = route -------------------------------------------------------------------------------- /Lecture15/Routers/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 09/07/17. 3 | */ 4 | const express = require('express'); 5 | const bp = require('body-parser'); 6 | 7 | const routes = { 8 | students: require('./routes/students'), 9 | teachers: require('./routes/teachers') 10 | } 11 | 12 | const app = express(); 13 | 14 | app.use(bp.json()) 15 | app.use(bp.urlencoded({extended: true})) 16 | 17 | app.use('/students', routes.students) 18 | app.use('/teachers', routes.teachers) 19 | 20 | 21 | app.listen(5678, function () { 22 | console.log("Server started on http://localhost:5678"); 23 | }); -------------------------------------------------------------------------------- /Lecture16/AsyncAwaitPromises/async.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | 5 | 6 | async function sayHello() { 7 | return "hello" 8 | } 9 | 10 | // 11 | // function sayHello2() { 12 | // return new Promise(function (resolve, reject) { 13 | // resolve(sayHello()) 14 | // }) 15 | // } 16 | 17 | 18 | let h = sayHello() 19 | 20 | // do some tasks here 21 | 22 | h.then((data) => { 23 | console.log(data); 24 | }) -------------------------------------------------------------------------------- /Lecture16/AsyncAwaitPromises/await.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | 5 | function asyncHello() { 6 | return new Promise (function (resolve, reject) { 7 | 8 | setTimeout(resolve, 1000, "Hello") 9 | }) 10 | } 11 | 12 | // asyncHello().then((data) => { 13 | // console.log(data); 14 | // }) 15 | 16 | async function readFileAsync () { 17 | return readFileSync() 18 | } 19 | 20 | async function getHello () { 21 | let h = await readFileAsync(); 22 | console.log(h); 23 | } 24 | 25 | getHello(); -------------------------------------------------------------------------------- /Lecture16/AsyncAwaitPromises/promise-example-2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | 5 | let s = new Promise(function (resolve, reject) { 6 | 7 | setTimeout(resolve, 1000) 8 | }) 9 | 10 | setTimeout(function () { 11 | s.then(function () { 12 | console.log("Task done"); 13 | }) 14 | }, 2000) -------------------------------------------------------------------------------- /Lecture16/AsyncAwaitPromises/promise-example.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | 5 | function longTask () { 6 | //for example this takes 10 seconds 7 | } 8 | 9 | 10 | let p = new Promise(function (resolve, reject) { 11 | 12 | try { 13 | longTask() 14 | resolve(); 15 | 16 | } catch (e) { 17 | reject(); 18 | 19 | } 20 | 21 | }) 22 | 23 | p.then(function () { 24 | console.log("Long Task was done"); 25 | }) 26 | 27 | p.catch(function () { 28 | console.log("Long task did not work"); 29 | }) 30 | 31 | 32 | -------------------------------------------------------------------------------- /Lecture16/MysqlExample/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mysqlexample", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "ansicolors": { 8 | "version": "0.2.1", 9 | "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.2.1.tgz", 10 | "integrity": "sha1-vgiVmQl7dKXJxKhKDNvNtivYeu8=" 11 | }, 12 | "cardinal": { 13 | "version": "1.0.0", 14 | "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-1.0.0.tgz", 15 | "integrity": "sha1-UOIcGwqjdyn5N33vGWtanOyTLuk=", 16 | "requires": { 17 | "ansicolors": "0.2.1", 18 | "redeyed": "1.0.1" 19 | } 20 | }, 21 | "core-util-is": { 22 | "version": "1.0.2", 23 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 24 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 25 | }, 26 | "denque": { 27 | "version": "1.1.1", 28 | "resolved": "https://registry.npmjs.org/denque/-/denque-1.1.1.tgz", 29 | "integrity": "sha1-ECKcK4juwb0V/4LF/eNW5762254=" 30 | }, 31 | "esprima": { 32 | "version": "3.0.0", 33 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.0.0.tgz", 34 | "integrity": "sha1-U88kes2ncxPlUcOqLnM0LT+099k=" 35 | }, 36 | "generate-function": { 37 | "version": "2.0.0", 38 | "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", 39 | "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" 40 | }, 41 | "iconv-lite": { 42 | "version": "0.4.18", 43 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", 44 | "integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA==" 45 | }, 46 | "inherits": { 47 | "version": "2.0.3", 48 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 49 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 50 | }, 51 | "isarray": { 52 | "version": "1.0.0", 53 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 54 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 55 | }, 56 | "long": { 57 | "version": "3.2.0", 58 | "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", 59 | "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" 60 | }, 61 | "lru-cache": { 62 | "version": "4.1.1", 63 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", 64 | "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", 65 | "requires": { 66 | "pseudomap": "1.0.2", 67 | "yallist": "2.1.2" 68 | } 69 | }, 70 | "mysql2": { 71 | "version": "1.3.5", 72 | "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-1.3.5.tgz", 73 | "integrity": "sha1-rmoJkiij3Ln5RUZ2B2/pOT1wrv4=", 74 | "requires": { 75 | "cardinal": "1.0.0", 76 | "denque": "1.1.1", 77 | "generate-function": "2.0.0", 78 | "iconv-lite": "0.4.18", 79 | "long": "3.2.0", 80 | "lru-cache": "4.1.1", 81 | "named-placeholders": "1.1.1", 82 | "object-assign": "4.1.1", 83 | "readable-stream": "2.2.11", 84 | "safe-buffer": "5.1.1", 85 | "seq-queue": "0.0.5", 86 | "sqlstring": "2.2.0" 87 | } 88 | }, 89 | "named-placeholders": { 90 | "version": "1.1.1", 91 | "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.1.tgz", 92 | "integrity": "sha1-O3oNJiA910s6nfTJz7gnsvuQfmQ=", 93 | "requires": { 94 | "lru-cache": "2.5.0" 95 | }, 96 | "dependencies": { 97 | "lru-cache": { 98 | "version": "2.5.0", 99 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz", 100 | "integrity": "sha1-2COIrpyWC+y+oMc7uet5tsbOmus=" 101 | } 102 | } 103 | }, 104 | "object-assign": { 105 | "version": "4.1.1", 106 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 107 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 108 | }, 109 | "process-nextick-args": { 110 | "version": "1.0.7", 111 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", 112 | "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" 113 | }, 114 | "pseudomap": { 115 | "version": "1.0.2", 116 | "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", 117 | "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" 118 | }, 119 | "readable-stream": { 120 | "version": "2.2.11", 121 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.11.tgz", 122 | "integrity": "sha512-h+8+r3MKEhkiVrwdKL8aWs1oc1VvBu33ueshOvS26RsZQ3Amhx/oO3TKe4lApSV9ueY6as8EAh7mtuFjdlhg9Q==", 123 | "requires": { 124 | "core-util-is": "1.0.2", 125 | "inherits": "2.0.3", 126 | "isarray": "1.0.0", 127 | "process-nextick-args": "1.0.7", 128 | "safe-buffer": "5.0.1", 129 | "string_decoder": "1.0.3", 130 | "util-deprecate": "1.0.2" 131 | }, 132 | "dependencies": { 133 | "safe-buffer": { 134 | "version": "5.0.1", 135 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", 136 | "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=" 137 | } 138 | } 139 | }, 140 | "redeyed": { 141 | "version": "1.0.1", 142 | "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-1.0.1.tgz", 143 | "integrity": "sha1-6WwZO0DAgWsArshCaY5hGF5VSYo=", 144 | "requires": { 145 | "esprima": "3.0.0" 146 | } 147 | }, 148 | "safe-buffer": { 149 | "version": "5.1.1", 150 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 151 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" 152 | }, 153 | "seq-queue": { 154 | "version": "0.0.5", 155 | "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", 156 | "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=" 157 | }, 158 | "sqlstring": { 159 | "version": "2.2.0", 160 | "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.2.0.tgz", 161 | "integrity": "sha1-wxNcTqirzX5+50GklmqJHYak8ZE=" 162 | }, 163 | "string_decoder": { 164 | "version": "1.0.3", 165 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", 166 | "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", 167 | "requires": { 168 | "safe-buffer": "5.1.1" 169 | } 170 | }, 171 | "util-deprecate": { 172 | "version": "1.0.2", 173 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 174 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 175 | }, 176 | "yallist": { 177 | "version": "2.1.2", 178 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", 179 | "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" 180 | } 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /Lecture16/MysqlExample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mysqlexample", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "mysql2": "^1.3.5" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Lecture16/MysqlExample/trymysql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | const mysql = require('mysql2'); 5 | 6 | const connection = mysql.createConnection({ 7 | host: 'localhost', 8 | database: 'somedatabase', 9 | user: 'someuser', 10 | password: 'somepass' 11 | }) 12 | 13 | // connection.query( 14 | // 'SELECT * FROM courses', 15 | // function (err, results, fields) { 16 | // 17 | // if (err) throw err; 18 | // 19 | // console.log("Results = "); 20 | // console.log(results); 21 | // console.log("Fields = "); 22 | // console.log(fields); 23 | // } 24 | // ) 25 | connection.query( 26 | "INSERT INTO courses(id, name) VALUES(1, 'Crux')", 27 | function (err, results, fields) { 28 | if (err) throw err; 29 | 30 | console.log("Results = "); 31 | console.log(results); 32 | console.log("Fields = "); 33 | console.log(fields); 34 | 35 | } 36 | 37 | ) -------------------------------------------------------------------------------- /Lecture16/TodoDB/db.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | const Sequelize = require('sequelize'); 5 | 6 | const db = new Sequelize({ 7 | host: 'localhost', 8 | username: 'someuser', 9 | database: 'somedatabase', 10 | password: 'somepass', 11 | dialect: 'mysql' 12 | }) 13 | 14 | 15 | const Todos = db.define('todos', { 16 | id: { 17 | type: Sequelize.DataTypes.INTEGER, 18 | primaryKey: true, 19 | autoIncrement: true 20 | }, 21 | task: Sequelize.DataTypes.STRING, 22 | done: Sequelize.DataTypes.BOOLEAN 23 | }) 24 | 25 | db.sync({alter: true}).then(function () { 26 | console.log("Database is ready"); 27 | }) 28 | 29 | function addTodo(task) { 30 | return Todos.create({ 31 | task: task, 32 | done: false 33 | }) 34 | } 35 | 36 | function getTodos () { 37 | return Todos.findAll() 38 | } 39 | 40 | module.exports = { 41 | addTodo, getTodos 42 | } -------------------------------------------------------------------------------- /Lecture16/TodoDB/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tododb", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "dependencies": { 7 | "body-parser": "^1.17.2", 8 | "express": "^4.15.3", 9 | "mysql2": "^1.3.5", 10 | "sequelize": "^4.3.0" 11 | }, 12 | "devDependencies": {}, 13 | "scripts": { 14 | "test": "echo \"Error: no test specified\" && exit 1" 15 | }, 16 | "author": "", 17 | "license": "ISC" 18 | } 19 | -------------------------------------------------------------------------------- /Lecture16/TodoDB/public_static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Lecture16/TodoDB/public_static/todo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | 5 | $(function () { 6 | 7 | let newtodoel = $('#newtodo') 8 | let addtodobtn = $('#addtodo') 9 | let todolist = $('#todolist') 10 | 11 | function refreshTodos() { 12 | todolist.empty(); 13 | $.get('/todos', 14 | function (data) { 15 | for (todo of data) { 16 | todolist.append($(` 17 |
  • 18 | ${todo.task} 19 | done = ${todo.done} 20 |
  • ` 21 | )) 22 | } 23 | } 24 | ) 25 | } 26 | 27 | refreshTodos(); 28 | 29 | addtodobtn.click(function () { 30 | 31 | $.post('/todos', 32 | {task: newtodoel.val()}, 33 | function (data) { 34 | if (data.success) { 35 | refreshTodos(); 36 | } 37 | } 38 | ) 39 | 40 | }) 41 | 42 | 43 | 44 | }) 45 | -------------------------------------------------------------------------------- /Lecture16/TodoDB/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 11/07/17. 3 | */ 4 | const express = require('express'); 5 | const bp = require('body-parser'); 6 | const db = require('./db') 7 | 8 | const app = express(); 9 | 10 | app.use('/', express.static(__dirname + "/public_static")); 11 | 12 | app.use(bp.urlencoded({extended: true})) 13 | app.use(bp.json()) 14 | 15 | //Return list of all todos 16 | app.get('/todos', (req, res) => { 17 | db.getTodos().then(function (todos) { 18 | res.send(todos) 19 | }).catch(function (err) { 20 | res.send({error: "Could not retrieve todos"}) 21 | }) 22 | }) 23 | 24 | //Add a new todo 25 | app.post('/todos', (req, res) => { 26 | db.addTodo(req.query.task).then(function () { 27 | 28 | res.send({success: true}) 29 | 30 | }).catch(function (err) { 31 | 32 | }) 33 | }) 34 | 35 | app.listen(7890, function () { 36 | console.log("Server started on http://localhost:7890"); 37 | }); -------------------------------------------------------------------------------- /Lecture17/Sockets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sockets-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.15.3", 13 | "socket.io": "^2.0.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Lecture17/Sockets/public_static/client.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 14/07/17. 3 | */ 4 | 5 | let socket = io(); 6 | 7 | $(function () { 8 | 9 | let newmsg = $('#newmsg') 10 | let sendmsgbtn = $('#sendmsg') 11 | let msglist = $('#msglist') 12 | let loginbtn = $('#login') 13 | let username = $('#username') 14 | let loginframe = $('#login-container') 15 | let chatframe = $('#chat-container') 16 | 17 | if (sessionStorage.getItem('username')) { 18 | socket.emit('login', sessionStorage.getItem('username')) 19 | } 20 | 21 | loginbtn.click(function () { 22 | socket.emit('login', username.val()) 23 | }) 24 | 25 | socket.on('logged_in', (data) => { 26 | chatframe.show(); 27 | loginframe.hide(); 28 | console.log('logged_in'); 29 | for (let chat of data.chats) { 30 | msglist.append($(`
  • ${chat}
  • `)) 31 | } 32 | sessionStorage.setItem('username', data.username) 33 | }) 34 | 35 | sendmsgbtn.click(function () { 36 | socket.emit('new_message', newmsg.val()) 37 | }) 38 | 39 | socket.on('recv_message', (data) => { 40 | console.log('msg recvd'); 41 | msglist.append($(`
  • ${data}
  • `)) 42 | }) 43 | 44 | socket.on('disconnect', () => { 45 | chatframe.hide(); 46 | loginframe.show(); 47 | msglist.empty(); 48 | }) 49 | 50 | }) -------------------------------------------------------------------------------- /Lecture17/Sockets/public_static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Chatbox 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 |
    18 | 19 | 20 |
    21 | 22 |
    23 |

    Chats

    24 | 26 | 27 |
    28 | 29 | 30 | 31 | 32 |
    33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Lecture17/Sockets/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 14/07/17. 3 | */ 4 | const express = require('express'); 5 | const http = require('http'); 6 | const socketio = require('socket.io'); 7 | 8 | const app = express(); 9 | const server = http.Server(app); 10 | const io = socketio(server); 11 | 12 | let users = {} 13 | let chats = [] 14 | 15 | app.use('/', express.static(__dirname + "/public_static")) 16 | app.get('/hello', (r,s) => s.send("hello")) 17 | 18 | io.on('connection', (socket) => { 19 | console.log("New client connected"); 20 | 21 | socket.on('login', (username) => { 22 | console.log('User logged in : ' + socket.id); 23 | users[socket.id] = username 24 | socket.join(username) 25 | socket.emit('logged_in', {username, chats}) 26 | }) 27 | 28 | 29 | socket.on('new_message', (data) => { 30 | if (data.charAt(0) === '@') { 31 | let sendTo = data.substr(1).split(' ')[0] 32 | let chat = users[socket.id] + ": " + data 33 | 34 | io.to(sendTo).emit('recv_message', chat) 35 | 36 | } else { 37 | 38 | let chat = users[socket.id] + ": " + data 39 | chats.push(chat) 40 | console.log('msg received'); 41 | io.emit('recv_message', chat) 42 | 43 | } 44 | 45 | }) 46 | 47 | }) 48 | 49 | 50 | server.listen(3245, function () { 51 | console.log("Server started on http://localhost:3245"); 52 | }); -------------------------------------------------------------------------------- /Lecture18/MongoDB/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "trymongodb", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "bson": { 8 | "version": "1.0.4", 9 | "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.4.tgz", 10 | "integrity": "sha1-k8ENOeqltYQVy8QFLz5T5WKwtyw=" 11 | }, 12 | "buffer-shims": { 13 | "version": "1.0.0", 14 | "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", 15 | "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=" 16 | }, 17 | "core-util-is": { 18 | "version": "1.0.2", 19 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 20 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 21 | }, 22 | "es6-promise": { 23 | "version": "3.2.1", 24 | "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz", 25 | "integrity": "sha1-7FYjOGgDKQkgcXDDlEjiREndH8Q=" 26 | }, 27 | "inherits": { 28 | "version": "2.0.3", 29 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 30 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 31 | }, 32 | "isarray": { 33 | "version": "1.0.0", 34 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 35 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 36 | }, 37 | "mongodb": { 38 | "version": "2.2.30", 39 | "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.30.tgz", 40 | "integrity": "sha1-jM2AH2dsgXIEDC8rR+lgKg1WNKs=", 41 | "requires": { 42 | "es6-promise": "3.2.1", 43 | "mongodb-core": "2.1.14", 44 | "readable-stream": "2.2.7" 45 | } 46 | }, 47 | "mongodb-core": { 48 | "version": "2.1.14", 49 | "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.14.tgz", 50 | "integrity": "sha1-E8uidkImtb49GJkq8Mljzl6g8P0=", 51 | "requires": { 52 | "bson": "1.0.4", 53 | "require_optional": "1.0.1" 54 | } 55 | }, 56 | "process-nextick-args": { 57 | "version": "1.0.7", 58 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", 59 | "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" 60 | }, 61 | "readable-stream": { 62 | "version": "2.2.7", 63 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.7.tgz", 64 | "integrity": "sha1-BwV6y+JGeyIELTb5jFrVBwVOlbE=", 65 | "requires": { 66 | "buffer-shims": "1.0.0", 67 | "core-util-is": "1.0.2", 68 | "inherits": "2.0.3", 69 | "isarray": "1.0.0", 70 | "process-nextick-args": "1.0.7", 71 | "string_decoder": "1.0.3", 72 | "util-deprecate": "1.0.2" 73 | } 74 | }, 75 | "require_optional": { 76 | "version": "1.0.1", 77 | "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", 78 | "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", 79 | "requires": { 80 | "resolve-from": "2.0.0", 81 | "semver": "5.3.0" 82 | } 83 | }, 84 | "resolve-from": { 85 | "version": "2.0.0", 86 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", 87 | "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" 88 | }, 89 | "safe-buffer": { 90 | "version": "5.1.1", 91 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 92 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" 93 | }, 94 | "semver": { 95 | "version": "5.3.0", 96 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", 97 | "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" 98 | }, 99 | "string_decoder": { 100 | "version": "1.0.3", 101 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", 102 | "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", 103 | "requires": { 104 | "safe-buffer": "5.1.1" 105 | } 106 | }, 107 | "util-deprecate": { 108 | "version": "1.0.2", 109 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 110 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Lecture18/MongoDB/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "trymongodb", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "mongodb": "^2.2.30" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Lecture18/MongoDB/trymongo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 16/07/17. 3 | */ 4 | const MongoClient = require('mongodb').MongoClient; 5 | 6 | let mongoUrl = "mongodb://localhost:27017/elixir" 7 | 8 | MongoClient.connect(mongoUrl, function (err, db) { 9 | if (err) throw err; 10 | 11 | console.log("Connected to mongodb"); 12 | insertUser(db) 13 | 14 | //db.close(); 15 | 16 | }) 17 | 18 | async function insertUser(db) { 19 | const users = db.collection('users') 20 | 21 | users.insertOne({ 22 | name: 'John Doe', 23 | age: 20, 24 | country: 'Wonderland' 25 | }).then(function (result) { 26 | console.log(result); 27 | return result; 28 | }).catch(function (err) { 29 | throw err; 30 | }) 31 | } -------------------------------------------------------------------------------- /Lecture19/Authentication/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "authentication", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "dependencies": { 7 | "body-parser": "^1.17.2", 8 | "cookie-parser": "^1.4.3", 9 | "express": "^4.15.3", 10 | "express-session": "^1.15.4", 11 | "passport": "^0.3.2", 12 | "passport-local": "^1.0.0" 13 | }, 14 | "devDependencies": {}, 15 | "scripts": { 16 | "test": "echo \"Error: no test specified\" && exit 1" 17 | }, 18 | "author": "", 19 | "license": "ISC" 20 | } 21 | -------------------------------------------------------------------------------- /Lecture19/Authentication/passport.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 21/07/17. 3 | */ 4 | const passport = require('passport'); 5 | const LocalStrategy = require('passport-local').Strategy; 6 | const users = require('./users') 7 | 8 | passport.serializeUser(function (user, done) { 9 | console.log('serialize'); 10 | done(null, user.id) 11 | }); 12 | 13 | passport.deserializeUser(function (userId, done) { 14 | console.log('deserialize'); 15 | done(null, users[userId]) 16 | }); 17 | 18 | 19 | const localStrategy = new LocalStrategy( 20 | function (username, password, done) { 21 | console.log('local strategy'); 22 | for (let i in users) { 23 | if (users[i].username == username) { 24 | if (users[i].password == password) { 25 | users[i].id = i; 26 | done(null, users[i]) 27 | } else { 28 | done(null, false, {message: 'Wrong password'}) 29 | } 30 | } 31 | } 32 | done(null, false, {message: 'User not found'}) 33 | }); 34 | 35 | passport.use(localStrategy); 36 | 37 | module.exports = passport; -------------------------------------------------------------------------------- /Lecture19/Authentication/private/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Private 6 | 7 | 8 |

    This should be visible to only logged in users

    9 | 10 | -------------------------------------------------------------------------------- /Lecture19/Authentication/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello 6 | 7 | 8 |

    This should be visible to everyone

    9 | 10 | -------------------------------------------------------------------------------- /Lecture19/Authentication/public/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Login 6 | 7 | 8 | 9 |
    10 | 11 |
    12 | 13 |
    14 | 15 |
    16 | 17 | 18 | -------------------------------------------------------------------------------- /Lecture19/Authentication/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 21/07/17. 3 | */ 4 | const express = require('express'); 5 | const path = require('path'); 6 | const session = require('express-session') 7 | const cp = require('cookie-parser'); 8 | const bp = require('body-parser'); 9 | const passport = require('./passport.js') 10 | 11 | const app = express(); 12 | 13 | 14 | app.use(cp('somesecret')); 15 | app.use(session({ 16 | secret: 'somesecret', 17 | resave: false, 18 | saveUninitialized: true 19 | })); 20 | app.use(bp.urlencoded({extended: true})) 21 | app.use(bp.json()) 22 | 23 | app.use(passport.initialize()); 24 | app.use(passport.session()); 25 | 26 | app.use((r,s,n) => { 27 | console.log(r.user); n(); 28 | }) 29 | 30 | function checkLoggedIn(req, res, next) { 31 | console.log('check logged in'); 32 | if (req.user) { 33 | next(); 34 | } else { 35 | res.status(404).send('Unauthorised') 36 | } 37 | } 38 | 39 | 40 | app.use('/public', express.static(path.join(__dirname, "public"))) 41 | app.use('/private', checkLoggedIn, express.static(path.join(__dirname, "private"))) 42 | 43 | app.post('/login', passport.authenticate('local', { 44 | failureRedirect: '/public', 45 | successRedirect: '/private' 46 | }), 47 | ); 48 | 49 | app.listen(1234, function () { 50 | console.log("Server started on http://localhost:1234"); 51 | }); -------------------------------------------------------------------------------- /Lecture19/Authentication/users.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 21/07/17. 3 | */ 4 | 5 | 6 | module.exports = [ 7 | {username: 'one', password: 'pass'}, 8 | {username: 'two', password: 'secret'}, 9 | ] 10 | 11 | -------------------------------------------------------------------------------- /Lecture19/Handlebars/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hbs-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.15.3", 13 | "hbs": "^4.0.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Lecture19/Handlebars/public/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | color: red 3 | } 4 | 5 | .bigtext { 6 | font-size: 14pt; 7 | } -------------------------------------------------------------------------------- /Lecture19/Handlebars/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 21/07/17. 3 | */ 4 | const express = require('express'); 5 | 6 | const app = express(); 7 | 8 | let students = [ 9 | {name: 'Anirban', attendance: 50}, 10 | {name: 'Divyank', attendance: 20}, 11 | {name: 'Sakshi', attendance: 80}, 12 | {name: 'Rahul', attendance: 75}, 13 | ]; 14 | 15 | app.set('view engine', 'hbs'); 16 | //app.set('views', 'myviews') //to use different folder for views 17 | 18 | app.get('/user', (req, res) => { 19 | 20 | res.render('user', { 21 | username: 'championswimmer', 22 | name: 'Arnav Gupta' 23 | }) 24 | }); 25 | 26 | app.get('/students', (req, res) => { 27 | res.render('students', { 28 | students: students 29 | }) 30 | }); 31 | 32 | app.use('/', express.static(__dirname + '/public')); 33 | 34 | 35 | app.listen(3456, function () { 36 | console.log("Server started on http://localhost:3456"); 37 | }); -------------------------------------------------------------------------------- /Lecture19/Handlebars/views/students.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Lecture19/Handlebars/views/user.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | User 6 | 7 | 8 | 9 | Username : {{username}} 10 |
    11 | Name : {{name}} 12 | 13 | -------------------------------------------------------------------------------- /Lecture19/assignment.md: -------------------------------------------------------------------------------- 1 | # Assignment Lecture 19 2 | ## Shopping Cart (with user authentication) 3 | 4 | ### Pages - 5 | - `/` : Shopping Product list 6 | - `/signup` : Register new user 7 | - `/login` : Login 8 | - `/cart` : Cart of user (redirect to `/login` if not logged in) 9 | 10 | 11 | ### Products - 12 | - Should have 13 | - Name 14 | - Photo 15 | - Price 16 | - Available Quantity 17 | 18 | - When user adds product to cart, available quantity to decrease 19 | - When avlbl qty < 1, don't allow adding to cart. 20 | 21 | ### Cart Products - 22 | Should have userId, so that we can find products in a user's cart by using `cartProduct.findOne({where: {userId: req.user.id}})` 23 | 24 | -------------------------------------------------------------------------------- /Lecture19/sequelize-example.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by championswimmer on 21/07/17. 3 | */ 4 | 5 | const Product = db.define('product', { 6 | id: { 7 | primaryKey: true, 8 | type: Sequelize.DataTypes.Integer 9 | }, 10 | name: Sequelize.DataTypes.STRING, 11 | }) 12 | 13 | const User = db.define('user', { 14 | name: {}, 15 | id: {} 16 | }); 17 | 18 | 19 | const UserProduct = db.define('userproduct', { 20 | id: {} 21 | }) 22 | 23 | UserProduct.belongsTo(User); 24 | UserProduct.belongsTo(Product); 25 | User.hasMany(UserProduct); 26 | Product.hasMany(UserProduct); 27 | 28 | 29 | UserProduct.find({ 30 | where: { 31 | userId: 4 32 | }, 33 | includes: [User, Product] 34 | }).then(function(userProducts) { 35 | for (let up of userProducts) { 36 | let user = up.user; 37 | let product = up.product; 38 | } 39 | }) 40 | -------------------------------------------------------------------------------- /Lecture20/Testing/.nyc_output/ac0c5e39b7f5a2bbd8c1b289c49b139a.json: -------------------------------------------------------------------------------- 1 | {"/Users/championswimmer/CodingBlocks/Courses/Elixir/2017Summer/Lecture20/Testing/calcfare.js":{"path":"/Users/championswimmer/CodingBlocks/Courses/Elixir/2017Summer/Lecture20/Testing/calcfare.js","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":3,"column":58}},"1":{"start":{"line":3,"column":2},"end":{"line":3,"column":58}},"2":{"start":{"line":5,"column":0},"end":{"line":6,"column":70}},"3":{"start":{"line":6,"column":2},"end":{"line":6,"column":70}},"4":{"start":{"line":8,"column":0},"end":{"line":15,"column":1}},"5":{"start":{"line":9,"column":2},"end":{"line":11,"column":3}},"6":{"start":{"line":13,"column":2},"end":{"line":13,"column":27}},"7":{"start":{"line":14,"column":2},"end":{"line":14,"column":29}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}},"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":58}},"line":3},"1":{"name":"(anonymous_1)","decl":{"start":{"line":5,"column":11},"end":{"line":5,"column":12}},"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":70}},"line":6}},"branchMap":{"0":{"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":37}},"type":"cond-expr","locations":[{"start":{"line":6,"column":20},"end":{"line":6,"column":32}},{"start":{"line":6,"column":36},"end":{"line":6,"column":37}}],"line":6},"1":{"loc":{"start":{"line":6,"column":42},"end":{"line":6,"column":69}},"type":"cond-expr","locations":[{"start":{"line":6,"column":56},"end":{"line":6,"column":64}},{"start":{"line":6,"column":68},"end":{"line":6,"column":69}}],"line":6},"2":{"loc":{"start":{"line":8,"column":0},"end":{"line":15,"column":1}},"type":"if","locations":[{"start":{"line":8,"column":0},"end":{"line":15,"column":1}},{"start":{"line":8,"column":0},"end":{"line":15,"column":1}}],"line":8}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":0,"7":0},"f":{"0":1,"1":1},"b":{"0":[0,1],"1":[0,1],"2":[1,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"d4c509fb347e29b80133c5004d5e7ec1dd37071c","contentHash":"e2b6c336256bc81c1e612619fdcb5faf_11.0.3"}} -------------------------------------------------------------------------------- /Lecture20/Testing/calcfare.js: -------------------------------------------------------------------------------- 1 | 2 | getFare = (km, min) => 3 | Math.max(25, (25 + 8*(km -2))) + Math.max(0, (min - 15)) 4 | 5 | getFare2 = (km, min) => 6 | 25 + ((km > 2) ? (8 * (km - 2)) : 0) + ((min > 15) ? (min - 15) : 0) 7 | 8 | if (typeof module != 'undefined' && module) { 9 | module.exports = { 10 | getFare, getFare2 11 | } 12 | } else { 13 | window.getFare = getFare; 14 | window.getFare2 = getFare2; 15 | } -------------------------------------------------------------------------------- /Lecture20/Testing/coverage/lcov-report/base.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin:0; padding: 0; 3 | height: 100%; 4 | } 5 | body { 6 | font-family: Helvetica Neue, Helvetica, Arial; 7 | font-size: 14px; 8 | color:#333; 9 | } 10 | .small { font-size: 12px; } 11 | *, *:after, *:before { 12 | -webkit-box-sizing:border-box; 13 | -moz-box-sizing:border-box; 14 | box-sizing:border-box; 15 | } 16 | h1 { font-size: 20px; margin: 0;} 17 | h2 { font-size: 14px; } 18 | pre { 19 | font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; 20 | margin: 0; 21 | padding: 0; 22 | -moz-tab-size: 2; 23 | -o-tab-size: 2; 24 | tab-size: 2; 25 | } 26 | a { color:#0074D9; text-decoration:none; } 27 | a:hover { text-decoration:underline; } 28 | .strong { font-weight: bold; } 29 | .space-top1 { padding: 10px 0 0 0; } 30 | .pad2y { padding: 20px 0; } 31 | .pad1y { padding: 10px 0; } 32 | .pad2x { padding: 0 20px; } 33 | .pad2 { padding: 20px; } 34 | .pad1 { padding: 10px; } 35 | .space-left2 { padding-left:55px; } 36 | .space-right2 { padding-right:20px; } 37 | .center { text-align:center; } 38 | .clearfix { display:block; } 39 | .clearfix:after { 40 | content:''; 41 | display:block; 42 | height:0; 43 | clear:both; 44 | visibility:hidden; 45 | } 46 | .fl { float: left; } 47 | @media only screen and (max-width:640px) { 48 | .col3 { width:100%; max-width:100%; } 49 | .hide-mobile { display:none!important; } 50 | } 51 | 52 | .quiet { 53 | color: #7f7f7f; 54 | color: rgba(0,0,0,0.5); 55 | } 56 | .quiet a { opacity: 0.7; } 57 | 58 | .fraction { 59 | font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; 60 | font-size: 10px; 61 | color: #555; 62 | background: #E8E8E8; 63 | padding: 4px 5px; 64 | border-radius: 3px; 65 | vertical-align: middle; 66 | } 67 | 68 | div.path a:link, div.path a:visited { color: #333; } 69 | table.coverage { 70 | border-collapse: collapse; 71 | margin: 10px 0 0 0; 72 | padding: 0; 73 | } 74 | 75 | table.coverage td { 76 | margin: 0; 77 | padding: 0; 78 | vertical-align: top; 79 | } 80 | table.coverage td.line-count { 81 | text-align: right; 82 | padding: 0 5px 0 20px; 83 | } 84 | table.coverage td.line-coverage { 85 | text-align: right; 86 | padding-right: 10px; 87 | min-width:20px; 88 | } 89 | 90 | table.coverage td span.cline-any { 91 | display: inline-block; 92 | padding: 0 5px; 93 | width: 100%; 94 | } 95 | .missing-if-branch { 96 | display: inline-block; 97 | margin-right: 5px; 98 | border-radius: 3px; 99 | position: relative; 100 | padding: 0 4px; 101 | background: #333; 102 | color: yellow; 103 | } 104 | 105 | .skip-if-branch { 106 | display: none; 107 | margin-right: 10px; 108 | position: relative; 109 | padding: 0 4px; 110 | background: #ccc; 111 | color: white; 112 | } 113 | .missing-if-branch .typ, .skip-if-branch .typ { 114 | color: inherit !important; 115 | } 116 | .coverage-summary { 117 | border-collapse: collapse; 118 | width: 100%; 119 | } 120 | .coverage-summary tr { border-bottom: 1px solid #bbb; } 121 | .keyline-all { border: 1px solid #ddd; } 122 | .coverage-summary td, .coverage-summary th { padding: 10px; } 123 | .coverage-summary tbody { border: 1px solid #bbb; } 124 | .coverage-summary td { border-right: 1px solid #bbb; } 125 | .coverage-summary td:last-child { border-right: none; } 126 | .coverage-summary th { 127 | text-align: left; 128 | font-weight: normal; 129 | white-space: nowrap; 130 | } 131 | .coverage-summary th.file { border-right: none !important; } 132 | .coverage-summary th.pct { } 133 | .coverage-summary th.pic, 134 | .coverage-summary th.abs, 135 | .coverage-summary td.pct, 136 | .coverage-summary td.abs { text-align: right; } 137 | .coverage-summary td.file { white-space: nowrap; } 138 | .coverage-summary td.pic { min-width: 120px !important; } 139 | .coverage-summary tfoot td { } 140 | 141 | .coverage-summary .sorter { 142 | height: 10px; 143 | width: 7px; 144 | display: inline-block; 145 | margin-left: 0.5em; 146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; 147 | } 148 | .coverage-summary .sorted .sorter { 149 | background-position: 0 -20px; 150 | } 151 | .coverage-summary .sorted-desc .sorter { 152 | background-position: 0 -10px; 153 | } 154 | .status-line { height: 10px; } 155 | /* dark red */ 156 | .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } 157 | .low .chart { border:1px solid #C21F39 } 158 | /* medium red */ 159 | .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } 160 | /* light red */ 161 | .low, .cline-no { background:#FCE1E5 } 162 | /* light green */ 163 | .high, .cline-yes { background:rgb(230,245,208) } 164 | /* medium green */ 165 | .cstat-yes { background:rgb(161,215,106) } 166 | /* dark green */ 167 | .status-line.high, .high .cover-fill { background:rgb(77,146,33) } 168 | .high .chart { border:1px solid rgb(77,146,33) } 169 | 170 | 171 | .medium .chart { border:1px solid #666; } 172 | .medium .cover-fill { background: #666; } 173 | 174 | .cbranch-no { background: yellow !important; color: #111; } 175 | 176 | .cstat-skip { background: #ddd; color: #111; } 177 | .fstat-skip { background: #ddd; color: #111 !important; } 178 | .cbranch-skip { background: #ddd !important; color: #111; } 179 | 180 | span.cline-neutral { background: #eaeaea; } 181 | .medium { background: #eaeaea; } 182 | 183 | .cover-fill, .cover-empty { 184 | display:inline-block; 185 | height: 12px; 186 | } 187 | .chart { 188 | line-height: 0; 189 | } 190 | .cover-empty { 191 | background: white; 192 | } 193 | .cover-full { 194 | border-right: none !important; 195 | } 196 | pre.prettyprint { 197 | border: none !important; 198 | padding: 0 !important; 199 | margin: 0 !important; 200 | } 201 | .com { color: #999 !important; } 202 | .ignore-none { color: #999; font-weight: normal; } 203 | 204 | .wrapper { 205 | min-height: 100%; 206 | height: auto !important; 207 | height: 100%; 208 | margin: 0 auto -48px; 209 | } 210 | .footer, .push { 211 | height: 48px; 212 | } 213 | -------------------------------------------------------------------------------- /Lecture20/Testing/coverage/lcov-report/calcfare.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for calcfare.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
    17 |
    18 |

    19 | All files calcfare.js 20 |

    21 |
    22 |
    23 | 75% 24 | Statements 25 | 6/8 26 |
    27 |
    28 | 50% 29 | Branches 30 | 3/6 31 |
    32 |
    33 | 100% 34 | Functions 35 | 2/2 36 |
    37 |
    38 | 75% 39 | Lines 40 | 6/8 41 |
    42 |
    43 |
    44 |
    45 |
    
     46 | 
     89 | 
    1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15  61 | 1x 62 | 1x 63 |   64 | 1x 65 | 1x 66 |   67 | 1x 68 | 1x 69 |   70 |   71 |   72 |   73 |   74 |  
     
     75 | getFare = (km, min) =>
     76 |   Math.max(25, (25 + 8*(km -2))) + Math.max(0, (min - 15))
     77 |  
     78 | getFare2 = (km, min) =>
     79 |   25 + ((km > 2) ? (8 * (km - 2)) : 0) + ((min > 15) ? (min - 15) : 0)
     80 |  
     81 | Eif (typeof module != null) {
     82 |   module.exports = {
     83 |     getFare, getFare2
     84 |   }
     85 | } else {
     86 |   window.getFare = getFare;
     87 |   window.getFare2 = getFare2;
     88 | }
    90 |
    91 |
    92 | 96 | 97 | 98 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /Lecture20/Testing/coverage/lcov-report/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for All files 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
    17 |
    18 |

    19 | All files 20 |

    21 |
    22 |
    23 | 75% 24 | Statements 25 | 6/8 26 |
    27 |
    28 | 50% 29 | Branches 30 | 3/6 31 |
    32 |
    33 | 100% 34 | Functions 35 | 2/2 36 |
    37 |
    38 | 75% 39 | Lines 40 | 6/8 41 |
    42 |
    43 |
    44 |
    45 |
    46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
    FileStatementsBranchesFunctionsLines
    calcfare.js
    75%6/850%3/6100%2/275%6/8
    76 |
    77 |
    78 | 82 | 83 | 84 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /Lecture20/Testing/coverage/lcov-report/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /Lecture20/Testing/coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coding-blocks-archives/WebNode_2017_Summer_Pitampura/2d4bcbed4758ef108d24810107807bbba5c8507f/Lecture20/Testing/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /Lecture20/Testing/coverage/lcov-report/sorter.js: -------------------------------------------------------------------------------- 1 | var addSorting = (function () { 2 | "use strict"; 3 | var cols, 4 | currentSort = { 5 | index: 0, 6 | desc: false 7 | }; 8 | 9 | // returns the summary table element 10 | function getTable() { return document.querySelector('.coverage-summary'); } 11 | // returns the thead element of the summary table 12 | function getTableHeader() { return getTable().querySelector('thead tr'); } 13 | // returns the tbody element of the summary table 14 | function getTableBody() { return getTable().querySelector('tbody'); } 15 | // returns the th element for nth column 16 | function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } 17 | 18 | // loads all columns 19 | function loadColumns() { 20 | var colNodes = getTableHeader().querySelectorAll('th'), 21 | colNode, 22 | cols = [], 23 | col, 24 | i; 25 | 26 | for (i = 0; i < colNodes.length; i += 1) { 27 | colNode = colNodes[i]; 28 | col = { 29 | key: colNode.getAttribute('data-col'), 30 | sortable: !colNode.getAttribute('data-nosort'), 31 | type: colNode.getAttribute('data-type') || 'string' 32 | }; 33 | cols.push(col); 34 | if (col.sortable) { 35 | col.defaultDescSort = col.type === 'number'; 36 | colNode.innerHTML = colNode.innerHTML + ''; 37 | } 38 | } 39 | return cols; 40 | } 41 | // attaches a data attribute to every tr element with an object 42 | // of data values keyed by column name 43 | function loadRowData(tableRow) { 44 | var tableCols = tableRow.querySelectorAll('td'), 45 | colNode, 46 | col, 47 | data = {}, 48 | i, 49 | val; 50 | for (i = 0; i < tableCols.length; i += 1) { 51 | colNode = tableCols[i]; 52 | col = cols[i]; 53 | val = colNode.getAttribute('data-value'); 54 | if (col.type === 'number') { 55 | val = Number(val); 56 | } 57 | data[col.key] = val; 58 | } 59 | return data; 60 | } 61 | // loads all row data 62 | function loadData() { 63 | var rows = getTableBody().querySelectorAll('tr'), 64 | i; 65 | 66 | for (i = 0; i < rows.length; i += 1) { 67 | rows[i].data = loadRowData(rows[i]); 68 | } 69 | } 70 | // sorts the table using the data for the ith column 71 | function sortByIndex(index, desc) { 72 | var key = cols[index].key, 73 | sorter = function (a, b) { 74 | a = a.data[key]; 75 | b = b.data[key]; 76 | return a < b ? -1 : a > b ? 1 : 0; 77 | }, 78 | finalSorter = sorter, 79 | tableBody = document.querySelector('.coverage-summary tbody'), 80 | rowNodes = tableBody.querySelectorAll('tr'), 81 | rows = [], 82 | i; 83 | 84 | if (desc) { 85 | finalSorter = function (a, b) { 86 | return -1 * sorter(a, b); 87 | }; 88 | } 89 | 90 | for (i = 0; i < rowNodes.length; i += 1) { 91 | rows.push(rowNodes[i]); 92 | tableBody.removeChild(rowNodes[i]); 93 | } 94 | 95 | rows.sort(finalSorter); 96 | 97 | for (i = 0; i < rows.length; i += 1) { 98 | tableBody.appendChild(rows[i]); 99 | } 100 | } 101 | // removes sort indicators for current column being sorted 102 | function removeSortIndicators() { 103 | var col = getNthColumn(currentSort.index), 104 | cls = col.className; 105 | 106 | cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); 107 | col.className = cls; 108 | } 109 | // adds sort indicators for current column being sorted 110 | function addSortIndicators() { 111 | getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; 112 | } 113 | // adds event listeners for all sorter widgets 114 | function enableUI() { 115 | var i, 116 | el, 117 | ithSorter = function ithSorter(i) { 118 | var col = cols[i]; 119 | 120 | return function () { 121 | var desc = col.defaultDescSort; 122 | 123 | if (currentSort.index === i) { 124 | desc = !currentSort.desc; 125 | } 126 | sortByIndex(i, desc); 127 | removeSortIndicators(); 128 | currentSort.index = i; 129 | currentSort.desc = desc; 130 | addSortIndicators(); 131 | }; 132 | }; 133 | for (i =0 ; i < cols.length; i += 1) { 134 | if (cols[i].sortable) { 135 | // add the click event handler on the th so users 136 | // dont have to click on those tiny arrows 137 | el = getNthColumn(i).querySelector('.sorter').parentElement; 138 | if (el.addEventListener) { 139 | el.addEventListener('click', ithSorter(i)); 140 | } else { 141 | el.attachEvent('onclick', ithSorter(i)); 142 | } 143 | } 144 | } 145 | } 146 | // adds sorting functionality to the UI 147 | return function () { 148 | if (!getTable()) { 149 | return; 150 | } 151 | cols = loadColumns(); 152 | loadData(cols); 153 | addSortIndicators(); 154 | enableUI(); 155 | }; 156 | })(); 157 | 158 | window.addEventListener('load', addSorting); 159 | -------------------------------------------------------------------------------- /Lecture20/Testing/coverage/lcov.info: -------------------------------------------------------------------------------- 1 | TN: 2 | SF:/Users/championswimmer/CodingBlocks/Courses/Elixir/2017Summer/Lecture20/Testing/calcfare.js 3 | FN:2,(anonymous_0) 4 | FN:5,(anonymous_1) 5 | FNF:2 6 | FNH:2 7 | FNDA:1,(anonymous_0) 8 | FNDA:1,(anonymous_1) 9 | DA:2,1 10 | DA:3,1 11 | DA:5,1 12 | DA:6,1 13 | DA:8,1 14 | DA:9,1 15 | DA:13,0 16 | DA:14,0 17 | LF:8 18 | LH:6 19 | BRDA:6,0,0,0 20 | BRDA:6,0,1,1 21 | BRDA:6,1,0,0 22 | BRDA:6,1,1,1 23 | BRDA:8,2,0,1 24 | BRDA:8,2,1,0 25 | BRF:6 26 | BRH:3 27 | end_of_record 28 | -------------------------------------------------------------------------------- /Lecture20/Testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-testing", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "calcfare.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "node_modules/.bin/_mocha", 11 | "cover": "node_modules/.bin/nyc --reporter lcov node_modules/.bin/_mocha" 12 | }, 13 | "author": "", 14 | "license": "ISC", 15 | "devDependencies": { 16 | "chai": "^4.1.0", 17 | "mocha": "^3.4.2", 18 | "nyc": "^11.0.3" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Lecture20/Testing/test/calcFareTest.js: -------------------------------------------------------------------------------- 1 | const chai = require('chai') 2 | , expect = chai.expect 3 | const calcfare = require('../calcfare') 4 | , getFare = calcfare.getFare 5 | , getFare2 = calcfare.getFare2 6 | 7 | describe('calc fare test', () => { 8 | it('getFare', () => { 9 | expect(getFare(2,0)).to.equal(25) 10 | }) 11 | 12 | it('getFare2', () => { 13 | expect(getFare2(2,0)).to.equal(25) 14 | 15 | }) 16 | }) 17 | -------------------------------------------------------------------------------- /Lecture20/heroku-deploy/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### JetBrains template 3 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 4 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 5 | 6 | # User-specific stuff: 7 | .idea/**/workspace.xml 8 | .idea/**/tasks.xml 9 | .idea/dictionaries 10 | 11 | # Sensitive or high-churn files: 12 | .idea/**/dataSources/ 13 | .idea/**/dataSources.ids 14 | .idea/**/dataSources.xml 15 | .idea/**/dataSources.local.xml 16 | .idea/**/sqlDataSources.xml 17 | .idea/**/dynamic.xml 18 | .idea/**/uiDesigner.xml 19 | 20 | # Gradle: 21 | .idea/**/gradle.xml 22 | .idea/**/libraries 23 | 24 | # Mongo Explorer plugin: 25 | .idea/**/mongoSettings.xml 26 | 27 | ## File-based project format: 28 | *.iws 29 | 30 | ## Plugin-specific files: 31 | 32 | # IntelliJ 33 | /out/ 34 | 35 | # mpeltonen/sbt-idea plugin 36 | .idea_modules/ 37 | 38 | # JIRA plugin 39 | atlassian-ide-plugin.xml 40 | 41 | # Crashlytics plugin (for Android Studio and IntelliJ) 42 | com_crashlytics_export_strings.xml 43 | crashlytics.properties 44 | crashlytics-build.properties 45 | fabric.properties 46 | ### Node template 47 | # Logs 48 | logs 49 | *.log 50 | npm-debug.log* 51 | yarn-debug.log* 52 | yarn-error.log* 53 | 54 | # Runtime data 55 | pids 56 | *.pid 57 | *.seed 58 | *.pid.lock 59 | 60 | # Directory for instrumented libs generated by jscoverage/JSCover 61 | lib-cov 62 | 63 | # Coverage directory used by tools like istanbul 64 | coverage 65 | 66 | # nyc test coverage 67 | .nyc_output 68 | 69 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 70 | .grunt 71 | 72 | # Bower dependency directory (https://bower.io/) 73 | bower_components 74 | 75 | # node-waf configuration 76 | .lock-wscript 77 | 78 | # Compiled binary addons (http://nodejs.org/api/addons.html) 79 | build/Release 80 | 81 | # Dependency directories 82 | node_modules/ 83 | jspm_packages/ 84 | 85 | # Typescript v1 declaration files 86 | typings/ 87 | 88 | # Optional npm cache directory 89 | .npm 90 | 91 | # Optional eslint cache 92 | .eslintcache 93 | 94 | # Optional REPL history 95 | .node_repl_history 96 | 97 | # Output of 'npm pack' 98 | *.tgz 99 | 100 | # Yarn Integrity file 101 | .yarn-integrity 102 | 103 | # dotenv environment variables file 104 | .env 105 | 106 | 107 | -------------------------------------------------------------------------------- /Lecture20/heroku-deploy/db.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | 3 | process.env.DATABASE_URL = 4 | process.env.DATABASE_URL || `${dialect}://${user}:${pass}@${host}:@${port}/${database}` 5 | 6 | // postgres://user:pass@domain:port/dbname 7 | const db = new Sequelize(process.env.DATABASE_URL); 8 | 9 | const Product = db.define('product', { 10 | id: {type: Sequelize.DataTypes.INTEGER, primaryKey: true, autoIncrement: true}, 11 | name: Sequelize.DataTypes.STRING, 12 | price: Sequelize.DataTypes.FLOAT 13 | }); 14 | 15 | const User = db.define('user', { 16 | id: {type: Sequelize.DataTypes.INTEGER, primaryKey: true, autoIncrement: true}, 17 | name: Sequelize.DataTypes.STRING, 18 | email: Sequelize.DataTypes.STRING 19 | }); 20 | 21 | const UserProduct = db.define('cart', { 22 | id: {type: Sequelize.DataTypes.INTEGER, primaryKey: true, autoIncrement: true}, 23 | }); 24 | 25 | User.belongsTo(UserProduct) 26 | UserProduct.hasMany(User) 27 | 28 | Product.belongsTo(UserProduct) 29 | UserProduct.hasMany(Product) 30 | 31 | Product.find({ 32 | where: { 33 | '$userproduct.user.email$': 'a@cb.lk' 34 | }, 35 | attributes: ['id', 'price', 'name'], 36 | includes: [{model: UserProduct, includes:[User]}] 37 | }).then((products) => { 38 | 39 | }) 40 | -------------------------------------------------------------------------------- /Lecture20/heroku-deploy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "heroku-deploy", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js", 9 | "dev": "PORT=1337 node server.js" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "express": "^4.15.3", 15 | "sequelize": "^4.4.2" 16 | }, 17 | "engines": { 18 | "node": "8", 19 | "npm": "5" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Lecture20/heroku-deploy/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const app = express(); 4 | 5 | app.get('/', (r,s) => s.send('hello')); 6 | 7 | process.env.PORT = process.env.PORT || 1337; 8 | 9 | app.listen(process.env.PORT, function () { 10 | console.log(`Server started on http://localhost:${process.env.PORT}`); 11 | }); --------------------------------------------------------------------------------