diff --git a/Lesson 1/code/exercises/exercise1.html b/Lesson 1/code/exercises/exercise1.html index 453e9fa..6cb0987 100644 --- a/Lesson 1/code/exercises/exercise1.html +++ b/Lesson 1/code/exercises/exercise1.html @@ -4,11 +4,19 @@ Exercise 1 - - -

Check Variables: x = ?, y = ?, z = ?

-

Test: x = ?, y = ?, z = ?

-

Check Variables: x = ?, y = ?, z = ?

+ + +

Guess and click game

+
    +
  1. Click "Check Variables": x = ?, y = ?, z = ?
  2. +
  3. Click "Test": x = ?, y = ?, z = ?
  4. +
  5. Click "Check Variables": x = ?, y = ?, z = ?
  6. +
@@ -17,10 +25,11 @@ var x = 4; y = 10; - function checkVariables() { + function checkVariables() { alert('x: ' + x); //x = ?? alert('y: ' + y); //y = ?? alert('z: ' + z); //z = ?? + } function test() { @@ -33,6 +42,7 @@ alert('z: ' + z); //z = ?? } + + + + +
+

Odd number validation

+ +
+ +
+

Even number validation

+ +
+ +
+ +
+ + + diff --git a/Lesson 4 - DOM/code/readme.txt b/Lesson 4 - DOM/code/exercise1/readme.txt similarity index 100% rename from Lesson 4 - DOM/code/readme.txt rename to Lesson 4 - DOM/code/exercise1/readme.txt diff --git a/Lesson 4 - DOM/code/homework/.jshintrc b/Lesson 4 - DOM/code/homework/.jshintrc new file mode 100644 index 0000000..6144a3a --- /dev/null +++ b/Lesson 4 - DOM/code/homework/.jshintrc @@ -0,0 +1,70 @@ +// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension + +{ + + // Predefined globals whom JSHint will ignore. + "browser" : true, // Standard browser globals e.g. `window`, `document`. + + "node" : true, + "rhino" : false, + "couch" : false, + "wsh" : false, // Windows Scripting Host. + + + "predef" : [ // Custom globals. + "describe", + "it", + "expect", + "jasmine", + "Calc", + "beforeEach", + "afterEach" + ], + + + // Development. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "devel" : true, // Allow developments statements e.g. `console.log();`. + + + // ECMAScript 5. + "es5" : true, // Allow ECMAScript 5 syntax. + "strict" : false, // Require `use strict` pragma in every file. + "globalstrict" : true, // Allow global "use strict" (also enables 'strict'). + + + // The Good Parts. + "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.). + "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "curly" : true, // Require {} for every new block or scope. + "eqeqeq" : true, // Require triple equals i.e. `===`. + "eqnull" : false, // Tolerate use of `== null`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : true, // Prohipit variable use before definition. + "loopfunc" : false, // Allow functions to be defined within loops. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "regexp" : true, // Prohibit `.` and `[^...]` in regular expressions. + "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. + "scripturl" : true, // Tolerate script-targeted URLs. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "undef" : true, // Require all non-global variables be declared before they are used. + + + // Personal styling preferences. + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noempty" : true, // Prohibit use of empty blocks. + "nonew" : true, // Prohibit use of constructors for side-effects. + "nomen" : true, // Prohibit use of initial or trailing underbars in names. + "onevar" : true, // Allow only one `var` statement per function. + "plusplus" : false, // Prohibit use of `++` & `--`. + "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "trailing" : true, // Prohibit trailing whitespaces. + "white" : false, // Check against strict whitespace and indentation rules. + "indent" : 4 // Specify indentation spacing +} diff --git a/Lesson 4 - DOM/code/homework/app.css b/Lesson 4 - DOM/code/homework/app.css new file mode 100644 index 0000000..b7f0356 --- /dev/null +++ b/Lesson 4 - DOM/code/homework/app.css @@ -0,0 +1,21 @@ +body { + margin: 0; + padding: 0; + background: #828281; +} + +.playArea { + width: 800px; + height: 600px; + background: #020101; + border: 10px solid #334343; + margin: 30px auto 0; + box-shadow: 5px 5px 10px #445474; +} + +.ship { + width: 64px; + height: 64px; + background-image: url("http://pixeljoint.com/files/icons/spaceship1_final.png"); + position: absolute; +} \ No newline at end of file diff --git a/Lesson 4 - DOM/code/homework/app.js b/Lesson 4 - DOM/code/homework/app.js new file mode 100644 index 0000000..dad024e --- /dev/null +++ b/Lesson 4 - DOM/code/homework/app.js @@ -0,0 +1,119 @@ +window.addEventListener('DOMContentLoaded', function () { + + //Create area and ship as `div` in `document` node + var playArea = {}, // ?? + ship = {}; // ?? + + var key = { + right: false, + left: false, + up: false, + down: false + }; + + var shipWidth = ship.offsetWidth, + shipHeight = ship.offsetHeight, + shipPos = { + x: 0, + y: 0 + }, + shipSpeed = 4; + + // Add player area and ship element at the end of `document.body` element + + // ?? + // ?? + + // Add CSS classes accordingly ( player -> player, playArea -> playArea) + + // ?? + // ?? + + //move mechanics + shipPos.x = (playArea.offsetWidth / 2 + playArea.offsetLeft) - (ship.offsetWidth / 2); + shipPos.y = (playArea.offsetHeight + playArea.offsetTop) - (ship.offsetHeight * 2); + + playArea.leftBoundary = playArea.offsetLeft + 10; + playArea.rightBoundary = (playArea.offsetLeft + playArea.offsetWidth - 10) - ship.offsetWidth; + + playArea.topBoundary = playArea.offsetTop + 10; + playArea.bottomBoundary = (playArea.offsetTop + playArea.offsetHeight - 10) - ship.offsetHeight; + + //keys support + function keyDown(e) { + if (e.keyCode === 39) { + key.right = true; + } else if (e.keyCode === 37) { + key.left = true; + } + if (e.keyCode === 38) { + key.up = true; + } else if (e.keyCode === 40) { + key.down = true; + } + } + + function keyUp(e) { + if (e.keyCode === 39) { + key.right = false; + } else if (e.keyCode === 37) { + key.left = false; + } + if (e.keyCode === 38) { + key.up = false; + } else if (e.keyCode === 40) { + key.down = false; + } + } + + // main + function moveShip() { + if (key.right === true) { + shipPos.x += shipSpeed; + } else if (key.left === true) { + shipPos.x -= shipSpeed; + } + if (key.up === true) { + shipPos.y -= shipSpeed; + } else if (key.down === true) { + shipPos.y += shipSpeed; + } + if (shipPos.x < playArea.leftBoundary) { + shipPos.x = playArea.leftBoundary; + } + if (shipPos.x > playArea.rightBoundary) { + shipPos.x = playArea.rightBoundary; + } + if (shipPos.y < playArea.topBoundary) { + shipPos.y = playArea.topBoundary; + } + if (shipPos.y > playArea.bottomBoundary) { + shipPos.y = playArea.bottomBoundary; + } + + //setting right style for positioning skip + ship.style.left = shipPos.x + 'px'; + ship.style.top = shipPos.y + 'px'; + } + + // add event listeners observers for both `keydown` and `keyup` events + // using 'keydown' and 'keyup' functions provided above + + // ?? + // ?? + + // Main game loop + function loop() { + moveShip(); + setTimeout(loop, 1000 / 60); + } + + loop(); + +}); + +// Resources +// https://developer.mozilla.org/pl/docs/Web/API/Document/createElement +// https://developer.mozilla.org/pl/docs/Web/API/Element/appendChild +// https://developer.mozilla.org/pl/docs/Web/API/Element/classList +// https://developer.mozilla.org/pl/docs/Web/API/Element/addEventListener \ No newline at end of file diff --git a/Lesson 4 - DOM/code/homework/index.html b/Lesson 4 - DOM/code/homework/index.html new file mode 100644 index 0000000..e7b5287 --- /dev/null +++ b/Lesson 4 - DOM/code/homework/index.html @@ -0,0 +1,19 @@ + + + + + + + Game + + + + + + + + + + + + \ No newline at end of file diff --git a/Lesson 4 - DOM/code/index.html b/Lesson 4 - DOM/code/index.html deleted file mode 100644 index e5e93d4..0000000 --- a/Lesson 4 - DOM/code/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - BMI - - - - - - - -
-

Select your weight

- Waga 50kg. -
-
-

Select your height

- Wzrost 120cm. -
- -

Your BMI is: 0

- - diff --git a/Lesson 4 - DOM/presentation/index.html b/Lesson 4 - DOM/presentation/index.html index 632f7a3..387e3e1 100644 --- a/Lesson 4 - DOM/presentation/index.html +++ b/Lesson 4 - DOM/presentation/index.html @@ -44,9 +44,9 @@

Web Appliations

DOM

-

Tadeusz Makuch -
tadeusz.makuch@gmail.com

-

Materials: https://github.com/sosnowski/Kurs_UAM (winter2016)

+

Piotr Leszczyński
piotr@leszczynski.it

+

Rafał Warzycha
rafal.warzycha@gmail.com

+

Materials: https://github.com/leszczynski-it/Kurs_UL

diff --git a/Lesson 6 - Developer tools/presentation/index.html b/Lesson 6 - Developer tools/presentation/index.html index b5596d9..1902eba 100644 --- a/Lesson 6 - Developer tools/presentation/index.html +++ b/Lesson 6 - Developer tools/presentation/index.html @@ -44,7 +44,7 @@

Web Appliations

Developer tools

-

Materials: https://github.com/sosnowski/Kurs_UAM

+

Materials: https://github.com/leszczynski-it/Kurs_UL

@@ -79,6 +79,7 @@

Using JSHint


Editor plugin

(for Brackets: https://github.com/cfjedimaster/brackets-jshint)

+

(for Visual Studio Code: F1 => Install Extension => jshint)

@@ -277,10 +278,7 @@

Homework

  • Add jshint for gulp and set up jshint to allow == and != operators (add proper file to project)
  • Add gulp (and its required libraries) to concatenate previously created text files into build/result.txt file
  • Upload the project to github and add node_modules folder to ignore file (.gitignore)
  • -
  • Send the link to the your repo at tadeusz.makuch@gmail.com
  • - -

    Deadline for submiting solutions - December 1st 17:00

    diff --git a/Lesson 7 - Angular/presentation/index.html b/Lesson 7 - Angular/presentation/index.html index f67e2b8..91202fc 100644 --- a/Lesson 7 - Angular/presentation/index.html +++ b/Lesson 7 - Angular/presentation/index.html @@ -44,7 +44,7 @@

    Web Appliations

    Angular JS

    -

    Materials: https://github.com/sosnowski/Kurs_UAM

    +

    Materials: https://github.com/leszczynski-it/Kurs_UL

    diff --git a/Lesson 9 - Promises and Ajax/code/http/server.js b/Lesson 9 - Promises and Ajax/code/http/server.js index 5db6cc5..a92e4ac 100644 --- a/Lesson 9 - Promises and Ajax/code/http/server.js +++ b/Lesson 9 - Promises and Ajax/code/http/server.js @@ -38,7 +38,7 @@ app.get('/elements', function (req, res) { res.json(savedData); }); -app.get('/elements/:id', function (req, res) { +app.post('/elements/:id', function (req, res) { var element; savedData.forEach(function (record) { console.log(req.params.id); diff --git a/Lesson 9 - Promises and Ajax/presentation/index.html b/Lesson 9 - Promises and Ajax/presentation/index.html index cf478ce..2da5114 100644 --- a/Lesson 9 - Promises and Ajax/presentation/index.html +++ b/Lesson 9 - Promises and Ajax/presentation/index.html @@ -41,6 +41,17 @@
    +
    +

    Plan

    +
      +
    • 26 april 2016 - Lesson 9 - Promises and Ajax
    • +
    • 10 may 2016 - Lesson 10 - WebSockets
    • +
    • 17 may 2016 - Lesson 11 - Unit Testing
    • +
    • 24 may 2016 - Lesson 12 - Mobile app development
    • +
    • 31 may 2016 - Lesson 13 - TBA
    • +
    • 7 june 2016 - Project deadline
    • +
    +

    Asynchronous JavaScript

    diff --git a/README.md b/README.md index f28e894..9b07174 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ -Kurs_UAM +Kurs_UL ======== Materials for the university JS course +Based on https://github.com/sosnowski/Kurs_UAM + +Homework from lessons 1,2,3,4,5,6 need to be sent to gihub.com till 29.03.2016 - 16:40. + +* all homeworks with Result: :white_check_mark: - :five: +* 1 homework missing or with :no_entry_sign: - :four: +* 2 homeworks missing or with :no_entry_sign: - :three: +* 3 or more homeworks missing or with :no_entry_sign: - you need to take test. :(