├── chapter16
├── test.txt
├── process.js
├── file_util.js
├── hello_world.js
├── lib.js
├── use_lib.js
├── .gitignore
├── child_process.js
├── child.js
├── pie.js
├── spawn.js
├── hello.js
├── fork.js
├── stream.js
├── fetch.js
├── clone.js
├── AsyncRead.js
├── server.js
├── os.js
├── ReadSync.js
├── exec.js
├── event.js
├── fetch_data.js
├── hello.ts
├── process_api.js
├── buffer.js
└── path.js
├── backend
├── data.txt
├── .idea
│ ├── .gitignore
│ ├── misc.xml
│ ├── vcs.xml
│ ├── modules.xml
│ └── backend.iml
├── .DS_Store
├── config
│ ├── database.js
│ └── Config.js
├── views
│ ├── index.jade
│ ├── error.jade
│ └── layout.jade
├── public
│ └── stylesheets
│ │ └── style.css
├── controller
│ └── User.js
├── model
│ ├── user.js
│ ├── Review.js
│ └── Movie.js
├── routes
│ ├── movies.js
│ └── reviews.js
├── package.json
└── swagger.json
├── chapter13
├── hello.txt
├── another.txt
├── SyncRead.js
├── ReadFilePromise.js
├── FileRead.js
├── FetchDemo.html
├── PromiseChain.html
├── PromiseAsErrorHandling.html
├── ForAwait.html
├── Await.html
├── Event.html
└── Promise.html
├── chapter15
├── async.js
├── defer.js
├── animation.js
├── lib.js
├── worker.js
├── DomDemo.html
├── Global.html
├── PreSelected.html
├── fworker.js
├── LocalStorage.html
├── SessionStorage.html
├── Worker.html
├── LocalStorage2.html
├── ClosureLeak.html
├── DeattachedDOMLeak.html
├── Animation.html
└── ElementContent.html
├── chapter5
├── tempCodeRunnerFile.go
├── go_to_demo.go
├── ForIn.html
├── With.html
├── While.html
├── Statement.html
├── Declaration.html
├── Frequency.html
├── LabelledLoop.html
├── Yield.html
├── UseStrict.html
├── Break.html
├── Return.html
├── NestedArray.html
├── IfStatement.html
├── Conditional.html
└── Finally.html
├── hello_word.js
├── .DS_Store
├── chapter10
├── use_module.js
├── es6.js
├── my_module.js
├── UseModule.html
└── IIFE_Module.html
├── StaticType
├── fp
├── .DS_Store
├── pipe.fsx
├── compose.fsx
├── curry.fsx
├── Times.html
├── Abstraction.html
├── HOF.html
├── Flatten.html
├── MayBeProblem.html
├── Monoid.html
├── curry_with_ramda.html
├── Once.html
├── CustomCompose.html
├── Unary.html
├── Functor.html
├── Zip.html
├── MonadProblem.html
├── memonize.html
├── Predicate.html
├── Monad.html
└── GroupBy.html
├── react-redux-fourth-batch
├── src
│ ├── setting
│ │ ├── API.js
│ │ └── our_axios.js
│ ├── pages
│ │ ├── HomePage.js
│ │ └── LogoutPage.js
│ ├── util
│ │ └── Util.js
│ ├── features
│ │ ├── reviews
│ │ │ ├── Reivew.js
│ │ │ └── reviewApi.js
│ │ ├── counter
│ │ │ └── counterAPI.js
│ │ ├── auth
│ │ │ └── authApi.js
│ │ ├── movies
│ │ │ ├── Movie.css
│ │ │ ├── MovieList.js
│ │ │ └── movieApi.js
│ │ └── todos
│ │ │ ├── todoAPI.js
│ │ │ └── ToDoCount.js
│ ├── app
│ │ ├── hooks.js
│ │ └── store.js
│ ├── setupTests.js
│ ├── index.css
│ ├── reportWebVitals.js
│ ├── App.test.js
│ ├── services
│ │ └── authService.js
│ ├── routes
│ │ └── ProtectedRoute.js
│ └── App.css
├── public
│ ├── robots.txt
│ ├── favicon.ico
│ ├── logo192.png
│ ├── logo512.png
│ └── manifest.json
├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── inspectionProfiles
│ │ └── Project_Default.xml
│ ├── modules.xml
│ └── react-redux-fourth-batch.iml
└── .gitignore
├── redux-typescript-fourth-batch
├── src
│ ├── react-app-env.d.ts
│ ├── setting
│ │ └── API.ts
│ ├── pages
│ │ ├── HomePage.tsx
│ │ ├── LogoutPage.tsx
│ │ └── MoviePage.tsx
│ ├── features
│ │ ├── counter
│ │ │ └── counterAPI.ts
│ │ ├── movies
│ │ │ ├── Movie.css
│ │ │ ├── MovieListUI.tsx
│ │ │ └── movieApi.ts
│ │ ├── auth
│ │ │ └── authApi.ts
│ │ └── todo
│ │ │ └── todoApi.ts
│ ├── setupTests.ts
│ ├── app
│ │ └── hooks.ts
│ ├── index.css
│ ├── services
│ │ └── authService.ts
│ ├── App.test.tsx
│ ├── reportWebVitals.ts
│ ├── component
│ │ └── PrivateRoute.tsx
│ └── App.css
├── public
│ ├── robots.txt
│ ├── favicon.ico
│ ├── logo192.png
│ ├── logo512.png
│ └── manifest.json
├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── inspectionProfiles
│ │ └── Project_Default.xml
│ ├── modules.xml
│ └── redux-typescript-fourth-batch.iml
├── .gitignore
└── tsconfig.json
├── typescript
├── date_const.js
├── .DS_Store
├── unknown.ts
├── type_extend.js
├── compatiable.js
├── compatiable.ts
├── function_type_2.ts
├── interface_extend.js
├── function_type_2.js
├── definitely_assign.js
├── contract.ts
├── problem.js
├── infer_this.ts
├── structural_typing.js
├── union.js
├── infer_this.js
├── overload.js
├── rest.ts
├── date_const.ts
├── interface.js
├── definitely_assign.ts
├── gen_fun.js
├── function_type.js
├── hello.js
├── array.js
├── function.js
├── hello.ts
├── alias.js
├── type_extend.ts
├── interface_extend.ts
├── array.ts
├── assign.js
├── anno.js
├── call_sing.js
├── function.ts
├── interface.ts
├── union.ts
├── runtime_this.ts
├── init.ts
├── composite.js
├── null.js
├── overload.ts
├── unition_2.ts
├── constraint.js
├── construct_sing.js
├── null.ts
├── rest.js
├── anno.ts
├── constraint.ts
├── function_type.ts
├── unition_2.js
├── assign.ts
├── alias.ts
├── generic.ts
├── call_sing.ts
├── super.ts
├── construct_sing.ts
├── runtime_this.js
├── structural_typing.ts
├── gen_fun.ts
├── arrow.ts
├── generic.js
├── composite.ts
├── static.ts
├── arrow.js
└── static.js
├── chapter11
├── WeakMapSet.html
├── StringCompare.html
├── Garbage.html
├── Url.html
├── Intl.html
├── RegEmail.html
├── TypeArray.html
├── ConsoleError.html
├── Endian.html
├── Timer.html
├── Reg7.html
├── Reg5.html
├── ThreadDemo.java
├── JsonParse.html
└── JSON.html
├── react-frontend
├── public
│ ├── robots.txt
│ ├── cat.jpg
│ ├── favicon.ico
│ ├── logo192.png
│ ├── logo512.png
│ └── manifest.json
├── src
│ ├── components
│ │ ├── FancyBorder.css
│ │ ├── function_component
│ │ │ ├── Hello.js
│ │ │ ├── hook
│ │ │ │ ├── ContextHookDemo.js
│ │ │ │ ├── UseLayoutDemo.js
│ │ │ │ ├── UseRefDemo.js
│ │ │ │ └── UseIdDemo.js
│ │ │ └── Greeting.js
│ │ ├── ToDoItem.css
│ │ ├── FancyBorder.js
│ │ ├── tab
│ │ │ └── Tab.css
│ │ ├── ListDemo.js
│ │ ├── Avatar.js
│ │ ├── context
│ │ │ └── ThemeContext.js
│ │ ├── fragment
│ │ │ └── FragmentDemo.js
│ │ ├── render-property
│ │ │ ├── Cat.js
│ │ │ └── MouseTracker.js
│ │ ├── WelcomeDialog.js
│ │ ├── Post.js
│ │ ├── HelloWorld.js
│ │ ├── jsx
│ │ │ ├── RepeatDemo.js
│ │ │ └── DynamicComponent.js
│ │ ├── forward-ref
│ │ │ └── ForwardRefDemo.js
│ │ ├── error-boundary
│ │ │ └── BuggyComponent.js
│ │ ├── hoc
│ │ │ └── logProps.js
│ │ └── thrid_party
│ │ │ └── DatePicker.js
│ ├── OurMath.js
│ ├── pages
│ │ ├── About.js
│ │ ├── Home.js
│ │ ├── Login.js
│ │ ├── MovieDetails.js
│ │ ├── Users.js
│ │ ├── NotFoundPage.js
│ │ └── Movie.js
│ ├── setupTests.js
│ ├── App.test.js
│ ├── index.css
│ ├── routes
│ │ └── ProtectedRoute.js
│ ├── reportWebVitals.js
│ └── App.css
├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── inspectionProfiles
│ │ └── Project_Default.xml
│ ├── modules.xml
│ └── react-frontend.iml
└── .gitignore
├── hello.js
├── chapter3
├── exchange.py
├── DateTime.html
├── Untype.html
├── FloatingProblem.html
├── VariableDeclaration.html
├── Equality.html
├── Global.html
├── Boolean.html
├── ObjectDest.html
├── Destructuring.html
├── Arithmetic.html
├── Number.html
├── ObjectToPrimitive.html
├── Zero.html
├── NullUndefined.html
└── Mutable.html
├── hello.ts
├── chapter2
├── ASI.html
├── LexicalStructure.html
├── Identifier.html
└── Literal.html
├── chapter6
├── Assign.html
├── custom_loop.rb
├── Problem.html
├── Acces.html
├── ShorthandMethod.html
├── Spread.html
├── Literal.html
├── Extend.html
├── Mapping.html
├── Create.html
├── GetterSetter.html
├── Validation.html
├── ExtendLiteral.html
├── Seralization.html
├── Logger.html
├── Encapsulation.html
└── Object.html
├── chapter8
├── FunctionConstructor.html
├── Problem2.html
├── Destructuring.html
├── Arrorw.html
├── MultipleReturn.html
├── ObjectDestructuring.html
├── IIFE.html
├── Property.html
├── Namespace.html
├── RestParameter.html
├── multi_return.go
├── StackClousre.html
├── ArgumentPar.html
├── Optional.html
├── FunctionExpression.html
├── Bind.html
├── ClosureProblem.html
├── FunctionCall.html
├── Function.html
├── Scope.html
├── NestedFunc.html
├── OtherMethod.html
├── Closure.html
├── ParameterPass.html
├── FunctionProperty.html
├── Value.html
└── CallApply.html
├── chapter4
├── Conditional.html
├── Precedence.html
├── Unary.html
├── PropertyAccess.html
├── Operator.html
├── Comparison.html
├── Default.html
├── In.html
├── Not.html
├── Expression.html
├── Bitwise.html
└── Assignment.html
├── chapter7
├── SpareArray.html
├── AddDelete.html
├── Queue.html
├── CopyWithin.html
├── StringAsArray.html
├── UndefinedEmpty.html
├── Concat.html
├── Flat.html
├── IndexOf.html
├── ReadWrite.html
├── ArrToString.html
├── Slice.html
├── MultiDimensionalArray.html
├── Reduce.html
└── Filter.html
├── Comment.html
├── StaticType.cpp
├── Dynamic.html
├── chapter14
├── Template.html
├── Extensibility.html
└── Prototype.html
├── Pragmatic.html
└── chapter9
├── DuckTyping.html
├── Private.html
├── StaticType.java
├── ClassExpression.html
├── Class2.html
├── Class.html
└── Generator.html
/chapter16/test.txt:
--------------------------------------------------------------------------------
1 | Hello
--------------------------------------------------------------------------------
/backend/data.txt:
--------------------------------------------------------------------------------
1 | Downloaded file
--------------------------------------------------------------------------------
/chapter13/hello.txt:
--------------------------------------------------------------------------------
1 | another.txt
--------------------------------------------------------------------------------
/chapter13/another.txt:
--------------------------------------------------------------------------------
1 | This is final content
--------------------------------------------------------------------------------
/chapter15/async.js:
--------------------------------------------------------------------------------
1 | console.log("Async called");
--------------------------------------------------------------------------------
/chapter15/defer.js:
--------------------------------------------------------------------------------
1 | console.log("Defer called");
--------------------------------------------------------------------------------
/chapter5/tempCodeRunnerFile.go:
--------------------------------------------------------------------------------
1 | fmt.Println("End")
--------------------------------------------------------------------------------
/hello_word.js:
--------------------------------------------------------------------------------
1 | console.log("Hello World form Node.js");
--------------------------------------------------------------------------------
/chapter16/process.js:
--------------------------------------------------------------------------------
1 | console.log("Process argv ",process.argv);
--------------------------------------------------------------------------------
/backend/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /workspace.xml
3 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/.DS_Store
--------------------------------------------------------------------------------
/chapter10/use_module.js:
--------------------------------------------------------------------------------
1 | const myModule = require('./my_module');
2 | myModule.hello();
--------------------------------------------------------------------------------
/StaticType:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/StaticType
--------------------------------------------------------------------------------
/fp/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/fp/.DS_Store
--------------------------------------------------------------------------------
/chapter10/es6.js:
--------------------------------------------------------------------------------
1 | export function show()
2 | {
3 | console.log("Show from Module");
4 | }
5 |
--------------------------------------------------------------------------------
/react-redux-fourth-batch/src/setting/API.js:
--------------------------------------------------------------------------------
1 | export const API_URL = "http://localhost:3000/api/";
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/backend/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/backend/.DS_Store
--------------------------------------------------------------------------------
/chapter16/file_util.js:
--------------------------------------------------------------------------------
1 | console.log("Current Path ",__filename);
2 | console.log("Dir Path ",__dirname);
--------------------------------------------------------------------------------
/chapter16/hello_world.js:
--------------------------------------------------------------------------------
1 | console.log("Hello World from Node.js");
2 | //console.log("Window ",document);
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/src/setting/API.ts:
--------------------------------------------------------------------------------
1 | export const API_URL = "http://localhost:3000/api";
--------------------------------------------------------------------------------
/backend/config/database.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | db: 'mongodb://0.0.0.0:27017/react_fourth_batch'
3 | }
--------------------------------------------------------------------------------
/react-redux-fourth-batch/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/typescript/date_const.js:
--------------------------------------------------------------------------------
1 | function fn(ctor) {
2 | console.log("Ctor ", ctor);
3 | }
4 | fn(Date);
5 |
--------------------------------------------------------------------------------
/backend/views/index.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= title
5 | p Welcome to #{title}
6 |
--------------------------------------------------------------------------------
/chapter11/WeakMapSet.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/react-frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/react-frontend/src/components/FancyBorder.css:
--------------------------------------------------------------------------------
1 | .fancy-border
2 | {
3 | border: 1px solid darkgoldenrod;
4 | }
--------------------------------------------------------------------------------
/typescript/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/typescript/.DS_Store
--------------------------------------------------------------------------------
/hello.js:
--------------------------------------------------------------------------------
1 | var a = "Hello";
2 | console.log('Type of', typeof a);
3 | a = 20;
4 | console.log('Type of', typeof a);
5 |
--------------------------------------------------------------------------------
/typescript/unknown.ts:
--------------------------------------------------------------------------------
1 | function f1(a: any) {
2 | a.b(); // OK
3 | }
4 | function f2(a: unknown) {
5 | a.b();
6 | }
--------------------------------------------------------------------------------
/chapter3/exchange.py:
--------------------------------------------------------------------------------
1 | a = 10
2 | b = 20
3 | #temp = b
4 | #b = a
5 | #a = temp
6 | b , a = a , b
7 | print("a ",a, " B ",b)
--------------------------------------------------------------------------------
/hello.ts:
--------------------------------------------------------------------------------
1 | var a = "Hello";
2 | console.log('Type of', typeof a);
3 |
4 | //a = 20;
5 | console.log('Type of', typeof a);
--------------------------------------------------------------------------------
/fp/pipe.fsx:
--------------------------------------------------------------------------------
1 | let double x = x* 2;
2 | let tripple x = x * 3;
3 | let data = 2 |> double |>tripple;
4 | printfn "Data is %d " data
--------------------------------------------------------------------------------
/react-frontend/public/cat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/react-frontend/public/cat.jpg
--------------------------------------------------------------------------------
/react-frontend/src/OurMath.js:
--------------------------------------------------------------------------------
1 | export function add(a,b)
2 | {
3 | console.log('Add ',a, " ",b);
4 | return a + b;
5 | }
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/typescript/type_extend.js:
--------------------------------------------------------------------------------
1 | var bear = {
2 | name: 'Bear Name',
3 | honey: true
4 | };
5 | console.log('Bear ', bear);
6 |
--------------------------------------------------------------------------------
/backend/views/error.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
7 |
--------------------------------------------------------------------------------
/chapter16/lib.js:
--------------------------------------------------------------------------------
1 | console.log("Module initalized");
2 | const add =(x,y)=>
3 | {
4 | return x+y;
5 | };
6 | exports.add = add;
--------------------------------------------------------------------------------
/chapter16/use_lib.js:
--------------------------------------------------------------------------------
1 | const lib = require('./lib.js');
2 | const lib2 = require('./lib.js');
3 |
4 | console.log("Add ",lib.add(1,2));
--------------------------------------------------------------------------------
/fp/compose.fsx:
--------------------------------------------------------------------------------
1 | let plusTwo x = x + 2;
2 | let tripple x = x * 3;
3 | let func = plusTwo >> tripple;
4 | printfn "Data is %d " (func 2)
--------------------------------------------------------------------------------
/typescript/compatiable.js:
--------------------------------------------------------------------------------
1 | var k;
2 | k = "Hello";
3 | var str = 30;
4 | //k = str;
5 | str = k;
6 | console.log("str ", str);
7 |
--------------------------------------------------------------------------------
/react-frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/react-frontend/public/favicon.ico
--------------------------------------------------------------------------------
/react-frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/react-frontend/public/logo192.png
--------------------------------------------------------------------------------
/react-frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/react-frontend/public/logo512.png
--------------------------------------------------------------------------------
/react-frontend/src/pages/About.js:
--------------------------------------------------------------------------------
1 | export default function About(props)
2 | {
3 | return (
4 | About
5 |
)
6 | }
--------------------------------------------------------------------------------
/react-frontend/src/pages/Home.js:
--------------------------------------------------------------------------------
1 | export default function Home(props)
2 | {
3 | return (
4 | Home
5 |
);
6 | }
--------------------------------------------------------------------------------
/react-frontend/src/pages/Login.js:
--------------------------------------------------------------------------------
1 | export default function Login(props)
2 | {
3 | return
4 | Login
5 |
6 | }
--------------------------------------------------------------------------------
/typescript/compatiable.ts:
--------------------------------------------------------------------------------
1 | let k ;
2 | k = "Hello";
3 | let str :number = 30;
4 | //k = str;
5 |
6 | str = k;
7 | console.log("str ",str);
--------------------------------------------------------------------------------
/typescript/function_type_2.ts:
--------------------------------------------------------------------------------
1 | function doSomething(f: Function) {
2 | return f(1, 2, 3);
3 | }
4 | doSomething(()=>console.log('Hello'));
--------------------------------------------------------------------------------
/typescript/interface_extend.js:
--------------------------------------------------------------------------------
1 | var bear = {
2 | name: 'Bear Name',
3 | honey: 'honey'
4 | };
5 | console.log('Bear ', bear);
6 |
--------------------------------------------------------------------------------
/fp/curry.fsx:
--------------------------------------------------------------------------------
1 | let add x y = x + y
2 | let add2 = add 2
3 | printfn "Result %A " add2
4 |
5 | let result = add2 4
6 | printfn "Result %A" result
7 |
--------------------------------------------------------------------------------
/backend/config/Config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | config:{
3 | TOKEN_SECRET : "!^&!^#!722!@@(!" //should be store in env file,
4 | }
5 | }
--------------------------------------------------------------------------------
/chapter15/animation.js:
--------------------------------------------------------------------------------
1 | console.log("Animation loaded");
2 | setInterval(()=>{
3 | document.getElementById("time").innerText = new Date();
4 | },1000);
--------------------------------------------------------------------------------
/react-frontend/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 |
--------------------------------------------------------------------------------
/chapter15/lib.js:
--------------------------------------------------------------------------------
1 | console.log("Lib Dynamically loaded");
2 |
3 | function hello()
4 | {
5 | console.log('Hello invoked');
6 | console.log(data);
7 | }
--------------------------------------------------------------------------------
/react-redux-fourth-batch/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/react-redux-fourth-batch/public/favicon.ico
--------------------------------------------------------------------------------
/react-redux-fourth-batch/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/react-redux-fourth-batch/public/logo192.png
--------------------------------------------------------------------------------
/react-redux-fourth-batch/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/react-redux-fourth-batch/public/logo512.png
--------------------------------------------------------------------------------
/react-redux-fourth-batch/src/pages/HomePage.js:
--------------------------------------------------------------------------------
1 | export default function HomePage(props)
2 | {
3 | return (
4 | Home Page
5 |
)
6 | }
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/src/pages/HomePage.tsx:
--------------------------------------------------------------------------------
1 | export default function HomePage()
2 | {
3 | return (
4 | Home Page
5 |
)
6 | }
--------------------------------------------------------------------------------
/typescript/function_type_2.js:
--------------------------------------------------------------------------------
1 | function doSomething(f) {
2 | return f(1, 2, 3);
3 | }
4 | doSomething(function () { return console.log('Hello'); });
5 |
--------------------------------------------------------------------------------
/chapter16/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .idea
3 | .tscache
4 | .DS_Store
5 | node_modules/
6 | typings/
7 | coverage/
8 | test/typescript/axios.js*
9 | sauce_connect.log
--------------------------------------------------------------------------------
/react-redux-fourth-batch/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 |
--------------------------------------------------------------------------------
/typescript/definitely_assign.js:
--------------------------------------------------------------------------------
1 | var GoodGreeter = /** @class */ (function () {
2 | function GoodGreeter() {
3 | }
4 | return GoodGreeter;
5 | }());
6 |
--------------------------------------------------------------------------------
/chapter2/ASI.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/react-frontend/src/components/function_component/Hello.js:
--------------------------------------------------------------------------------
1 | export default function Hello(props) {
2 | return Function component Hello, {props.name}
;
3 | }
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 |
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/redux-typescript-fourth-batch/public/favicon.ico
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/redux-typescript-fourth-batch/public/logo192.png
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringJSReact4thBatch/HEAD/redux-typescript-fourth-batch/public/logo512.png
--------------------------------------------------------------------------------
/typescript/contract.ts:
--------------------------------------------------------------------------------
1 | interface Pingable {
2 | ping(): void;
3 | }
4 |
5 | class Sonar implements Pingable {
6 | ping() {
7 | console.log("ping!");
8 | }
9 | }
--------------------------------------------------------------------------------
/backend/views/layout.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | title= title
5 | link(rel='stylesheet', href='/stylesheets/style.css')
6 | body
7 | block content
8 |
--------------------------------------------------------------------------------
/chapter16/child_process.js:
--------------------------------------------------------------------------------
1 | const child_process = require("child_process");
2 | let listing = child_process.execSync("ls -l *.js",{encoding: "utf8"});
3 | console.log(listing);
--------------------------------------------------------------------------------
/chapter3/DateTime.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/backend/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | a {
7 | color: #00B7FF;
8 | }
9 |
--------------------------------------------------------------------------------
/react-redux-fourth-batch/src/util/Util.js:
--------------------------------------------------------------------------------
1 | export function nextId(initial)
2 | {
3 | let id = initial;
4 | return function()
5 | {
6 | return id++;
7 | }
8 | }
--------------------------------------------------------------------------------
/typescript/problem.js:
--------------------------------------------------------------------------------
1 | let str = "Hello";
2 | let result = str * 3;
3 | console.log("Result ",result);
4 |
5 | let obj = {
6 | name : "TK"
7 | };
8 | console.log("Obj ",obj.age);
--------------------------------------------------------------------------------
/chapter3/Untype.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/chapter6/Assign.html:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/typescript/infer_this.ts:
--------------------------------------------------------------------------------
1 | const user = {
2 | id: 123,
3 |
4 | //admin: false,
5 | becomeAdmin: function () {
6 | console.log(this.admin);
7 | },
8 | };
9 | user.becomeAdmin();
--------------------------------------------------------------------------------
/typescript/structural_typing.js:
--------------------------------------------------------------------------------
1 | var data = {
2 | name: "Something"
3 | };
4 | var another = {
5 | name: "Another"
6 | };
7 | data = another;
8 | console.log("Data ", data);
9 |
--------------------------------------------------------------------------------
/typescript/union.js:
--------------------------------------------------------------------------------
1 | var s = "pending";
2 | //s = "something";
3 | console.log("Status ", s);
4 | var data;
5 | data = "Hello";
6 | data = 200;
7 | console.log("Data ", data * 200);
8 |
--------------------------------------------------------------------------------
/chapter8/FunctionConstructor.html:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/chapter10/my_module.js:
--------------------------------------------------------------------------------
1 | console.log("Module initialized");
2 | const hello = ()=>console.log("Hello");
3 | function display()
4 | {
5 | console.log("Display");
6 | }
7 | exports.hello = hello;
--------------------------------------------------------------------------------
/typescript/infer_this.js:
--------------------------------------------------------------------------------
1 | var user = {
2 | id: 123,
3 | //admin: false,
4 | becomeAdmin: function () {
5 | console.log(this.admin);
6 | }
7 | };
8 | user.becomeAdmin();
9 |
--------------------------------------------------------------------------------
/chapter16/child.js:
--------------------------------------------------------------------------------
1 | process.on("message", message => {
2 | console.log("Child got message ",message);
3 | process.send({
4 | hypotenuse: Math.hypot(message.x,message.y)
5 | });
6 | });
--------------------------------------------------------------------------------
/chapter4/Conditional.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/chapter8/Problem2.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/typescript/overload.js:
--------------------------------------------------------------------------------
1 | function makeDate(m, d) {
2 | console.log("Date ");
3 | return new Date();
4 | }
5 | var d1 = makeDate(12345678);
6 | var d2 = makeDate(5, 5);
7 | var d3 = makeDate(1, 2);
8 |
--------------------------------------------------------------------------------
/typescript/rest.ts:
--------------------------------------------------------------------------------
1 | function multiply(n: number, ...m: number[]) {
2 | return m.map((x) => n * x);
3 | }
4 | // 'a' gets value [10, 20, 30, 40]
5 | const a = multiply(10, 1, 2, 3, 4);
6 | console.log('A ',a);
--------------------------------------------------------------------------------
/chapter2/LexicalStructure.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/typescript/date_const.ts:
--------------------------------------------------------------------------------
1 | interface CallOrConstruct {
2 | new (s: string): Date;
3 | (n?: number): number;
4 | }
5 | function fn(ctor:DateConstructor)
6 | {
7 | console.log("Ctor ",ctor);
8 | }
9 | fn(Date);
--------------------------------------------------------------------------------
/backend/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/chapter16/pie.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 |
3 | function printFile(filename, encoding="utf8")
4 | {
5 | fs.createReadStream(filename,encoding)
6 | .pipe(process.stdout);
7 | }
8 | printFile('./pie.js');
--------------------------------------------------------------------------------
/typescript/interface.js:
--------------------------------------------------------------------------------
1 | function printCoord(pt) {
2 | console.log("The coordinate's x value is " + pt.x);
3 | console.log("The coordinate's y value is " + pt.y);
4 | }
5 | printCoord({ x: 100, y: 100 });
6 |
--------------------------------------------------------------------------------
/chapter10/UseModule.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/chapter15/worker.js:
--------------------------------------------------------------------------------
1 |
2 | onmessage = (event)=>{
3 | console.log('Event in worker ',event.data);
4 | postMessage("Send back to server "+ (event.data+"").toUpperCase());
5 | };
6 | console.log('Worker.js loaded...');
--------------------------------------------------------------------------------
/chapter4/Precedence.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/chapter7/SpareArray.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/react-redux-fourth-batch/src/features/reviews/Reivew.js:
--------------------------------------------------------------------------------
1 | export default function Review({review})
2 | {
3 | return (
4 |
{review.review}
5 |
{review.rating}
6 |
)
7 | }
--------------------------------------------------------------------------------
/typescript/definitely_assign.ts:
--------------------------------------------------------------------------------
1 | class GoodGreeter {
2 | readonly name: string;
3 |
4 | constructor() {
5 | this.name = "hello";
6 | }
7 | err()
8 | {
9 | this.name = "Change";
10 | }
11 | }
--------------------------------------------------------------------------------
/backend/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/chapter6/custom_loop.rb:
--------------------------------------------------------------------------------
1 | def custom_while(condition)
2 | loop do
3 | break unless condition.()
4 | yield
5 | end
6 | end
7 |
8 | i = 0
9 | custom_while -> { i < 5 } do
10 | puts i
11 | i += 1
12 | end
--------------------------------------------------------------------------------
/chapter7/AddDelete.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/typescript/gen_fun.js:
--------------------------------------------------------------------------------
1 | function firstElement(arr) {
2 | return arr[0];
3 | }
4 | var ele = firstElement([1, 2, 3]);
5 | console.log('Ele ', ele);
6 | var str = firstElement(["helo", "how"]);
7 | console.log('Str ', str);
8 |
--------------------------------------------------------------------------------
/react-frontend/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/typescript/function_type.js:
--------------------------------------------------------------------------------
1 | var isEven = function (num) { return num % 2 == 0; };
2 | console.log("IsEven ", isEven(30));
3 | var something = function (fun) {
4 | return fun;
5 | };
6 | console.log(something(isEven)(300));
7 |
--------------------------------------------------------------------------------
/chapter16/spawn.js:
--------------------------------------------------------------------------------
1 | const { spawn } = require('child_process');
2 |
3 | const child = spawn('ls');
4 |
5 | process.stdin.pipe(child.stdin)
6 |
7 | child.stdout.on('data', (data) => {
8 | console.log(`child stdout:\n${data}`);
9 | });
--------------------------------------------------------------------------------
/chapter7/Queue.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/typescript/hello.js:
--------------------------------------------------------------------------------
1 | var num = 5;
2 | var result = num * 3;
3 | console.log("Result ", result);
4 | var obj = {
5 | name: "TK"
6 | };
7 | console.log("Obj ", obj.name);
8 | var str = "HelloWorld";
9 | console.log(str);
10 |
--------------------------------------------------------------------------------
/chapter8/Destructuring.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/fp/Times.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/react-redux-fourth-batch/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/typescript/array.js:
--------------------------------------------------------------------------------
1 | var arr = [10, 20, 30];
2 | console.log('Arr ', arr);
3 | var anotherArray = ["one", "two", 3];
4 | console.log('Another array ', anotherArray);
5 | var data = "str";
6 | data = data * 3;
7 | console.log("Data ", data);
8 |
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/typescript/function.js:
--------------------------------------------------------------------------------
1 | function greet(msg) {
2 | console.log("Hello ", msg);
3 | }
4 | greet("Jhon");
5 | greet("12");
6 | function add(x, y) {
7 | return x + y;
8 | }
9 | var str = add(1, 2), something;
10 | //str = "Hello";
11 |
--------------------------------------------------------------------------------
/chapter16/hello.js:
--------------------------------------------------------------------------------
1 | var a = 10;
2 | //a = "Hello";
3 | console.log("A ", a);
4 | var obj = {
5 | name: "TK",
6 | age: 37
7 | };
8 | //console.log("Obj ",obj.nmae);
9 | var b = "hello";
10 | var x = b * 1;
11 | console.log("X ", x);
12 |
--------------------------------------------------------------------------------
/typescript/hello.ts:
--------------------------------------------------------------------------------
1 | let num : number = 5;
2 | let result = num * 3;
3 | console.log("Result ",result);
4 |
5 | let obj = {
6 | name : "TK"
7 | };
8 | console.log("Obj ",obj.name);
9 | let str : string = "HelloWorld"
10 | console.log(str);
--------------------------------------------------------------------------------
/chapter5/go_to_demo.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func main() {
6 | i := 0
7 | loop:
8 | fmt.Println("hello")
9 | goto end
10 | i += 1
11 | if i < 10 {
12 | goto loop
13 | }
14 | end:
15 | fmt.Println("End")
16 | }
17 |
--------------------------------------------------------------------------------
/chapter7/CopyWithin.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/chapter8/Arrorw.html:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/typescript/alias.js:
--------------------------------------------------------------------------------
1 | // Exactly the same as the earlier example
2 | function printCoord(pt) {
3 | console.log("The coordinate's x value is " + pt.x);
4 | console.log("The coordinate's y value is " + pt.y);
5 | }
6 | printCoord({ x: 100, y: 100 });
7 |
--------------------------------------------------------------------------------
/react-frontend/src/pages/MovieDetails.js:
--------------------------------------------------------------------------------
1 | import {useParams} from "react-router-dom";
2 | export default function MovieDetails(props)
3 | {
4 | let params = useParams();
5 |
6 | return (
7 | Movie Details {params.movieId}
8 |
)
9 | }
--------------------------------------------------------------------------------
/typescript/type_extend.ts:
--------------------------------------------------------------------------------
1 | type Animal ={
2 | name: string
3 | }
4 |
5 | type Bear = Animal & {
6 | honey: boolean
7 | }
8 |
9 | const bear : Bear = {
10 | name : 'Bear Name',
11 | honey :true
12 | }
13 | console.log('Bear ',bear);
14 |
--------------------------------------------------------------------------------
/chapter11/StringCompare.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
--------------------------------------------------------------------------------
/chapter7/StringAsArray.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/typescript/interface_extend.ts:
--------------------------------------------------------------------------------
1 | interface Animal {
2 | name: string
3 | }
4 |
5 | interface Bear extends Animal {
6 | honey: boolean
7 | }
8 |
9 | const bear = {
10 | name : 'Bear Name',
11 | honey :'honey'
12 | }
13 | console.log('Bear ',bear);
14 |
--------------------------------------------------------------------------------
/typescript/array.ts:
--------------------------------------------------------------------------------
1 | let arr : Array = [10,20,30];
2 | console.log('Arr ',arr);
3 |
4 | let anotherArray : Array = ["one","two",3];
5 | console.log('Another array ',anotherArray);
6 |
7 | let data : any = "str";
8 | data = data * 3;
9 | console.log("Data ",data);
--------------------------------------------------------------------------------
/typescript/assign.js:
--------------------------------------------------------------------------------
1 | var f1 = function () {
2 | return true;
3 | };
4 | var f2 = function () { return true; };
5 | var f3 = function () {
6 | return true;
7 | };
8 | console.log('F1 ', f1());
9 | console.log('F2 ', f2());
10 | console.log('F3 ', f3());
11 |
--------------------------------------------------------------------------------
/chapter13/SyncRead.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | console.log("Before read");
4 | try {
5 | const data = fs.readFileSync('hello.txt', 'utf8');
6 | console.log("File Data",data);
7 | } catch (err) {
8 | console.error(err);
9 | }
10 | console.log("After read");
--------------------------------------------------------------------------------
/chapter15/DomDemo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
10 |
12 |
--------------------------------------------------------------------------------
/chapter15/Global.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/chapter8/MultipleReturn.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/react-frontend/src/components/ToDoItem.css:
--------------------------------------------------------------------------------
1 | .to-do-item-container
2 | {
3 | min-width: 250px;
4 | }
5 | .to-do-item
6 | {
7 | width: 200px;
8 | padding: 15px;
9 | border-radius: 10px;
10 | border: 1px solid lightgray;
11 | margin-bottom: 10px;
12 | }
--------------------------------------------------------------------------------
/react-redux-fourth-batch/src/features/counter/counterAPI.js:
--------------------------------------------------------------------------------
1 | // A mock function to mimic making an async request for data
2 | export function fetchCount(amount = 1) {
3 | return new Promise((resolve) =>
4 | setTimeout(() => resolve({ data: amount }), 500)
5 | );
6 | }
7 |
--------------------------------------------------------------------------------
/typescript/anno.js:
--------------------------------------------------------------------------------
1 | var names = ["Alice", "Bob", "Eve"];
2 | names.forEach(function (s) {
3 | console.log(s.toUpperCase());
4 | });
5 | function display(obj) {
6 | console.log('Obj ', obj);
7 | }
8 | display({ name: "TK", age: 38 });
9 | display({ name: "TK" });
10 |
--------------------------------------------------------------------------------
/chapter16/fork.js:
--------------------------------------------------------------------------------
1 | const child_process = require("child_process");
2 |
3 | let child = child_process.fork(`${__dirname}/child.js`);
4 | child.send({x: 4, y: 3});
5 | child.on("message", message => {
6 | console.log("Parent got message ",message);
7 | child.disconnect();
8 | });
--------------------------------------------------------------------------------
/react-frontend/src/pages/Users.js:
--------------------------------------------------------------------------------
1 | import {useSearchParams} from "react-router-dom";
2 |
3 | export default function Users(props)
4 | {
5 | let [searchParams, setSearchParams] = useSearchParams();
6 | return (
7 | Users {searchParams.get('name')}
8 |
)
9 | }
--------------------------------------------------------------------------------
/typescript/call_sing.js:
--------------------------------------------------------------------------------
1 | function doSomething(fn) {
2 | console.log(fn.description + " returned " + fn(6));
3 | }
4 | function isEven(num) {
5 | return num % 2 == 0;
6 | }
7 | //isEven.description = "Is even check a number is even or not";
8 | doSomething('Hello', isEven);
9 |
--------------------------------------------------------------------------------
/chapter13/ReadFilePromise.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs/promises');
2 | fs.readFile('hello.txt', 'utf8')
3 | //.then(data=>"File read output "+data)
4 | .then(data=>fs.readFile(data,'utf-8'))
5 | .then(finalContent=> console.log('Final Content ',finalContent))
6 | .catch(console.error);
--------------------------------------------------------------------------------
/chapter16/stream.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 |
3 | async function logChunks(readable) {
4 | for await (const chunk of readable) {
5 | console.log(chunk);
6 | }
7 | }
8 |
9 | const readable = fs.createReadStream('./hello.txt', {encoding: 'utf8'});
10 | logChunks(readable);
--------------------------------------------------------------------------------
/chapter4/Unary.html:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/react-frontend/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/chapter8/ObjectDestructuring.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/typescript/function.ts:
--------------------------------------------------------------------------------
1 | function greet(msg: string)
2 | {
3 | console.log("Hello ",msg);
4 | }
5 | greet("Jhon");
6 | greet("12");
7 |
8 | function add(x:number,y:number):number
9 | {
10 | return x+y;
11 | }
12 | let str = add(1,2), something:number;
13 |
14 | //str = "Hello";
--------------------------------------------------------------------------------
/typescript/interface.ts:
--------------------------------------------------------------------------------
1 | interface Point {
2 | x: number;
3 | y: number;
4 | }
5 |
6 | function printCoord(pt: Point) {
7 | console.log("The coordinate's x value is " + pt.x);
8 | console.log("The coordinate's y value is " + pt.y);
9 | }
10 |
11 | printCoord({ x: 100, y: 100 });
--------------------------------------------------------------------------------
/typescript/union.ts:
--------------------------------------------------------------------------------
1 | type promiseStatus = "pending" | "fullfilled" | "completed";
2 |
3 | let s: promiseStatus = "pending";
4 | //s = "something";
5 | console.log("Status ",s);
6 |
7 | let data : number | string ;
8 | data = "Hello";
9 | data = 200;
10 | console.log("Data ",data * 200);
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/src/features/counter/counterAPI.ts:
--------------------------------------------------------------------------------
1 | // A mock function to mimic making an async request for data
2 | export function fetchCount(amount = 1) {
3 | return new Promise<{ data: number }>((resolve) =>
4 | setTimeout(() => resolve({ data: amount }), 500)
5 | );
6 | }
7 |
--------------------------------------------------------------------------------
/Comment.html:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/chapter3/FloatingProblem.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/react-frontend/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render();
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/chapter16/fetch.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 |
3 | axios
4 | .get('https://jsonplaceholder.typicode.com/todos/1')
5 | .then(res => {
6 | console.log(`statusCode: ${res.status}`);
7 | console.log(res.data);
8 | })
9 | .catch(error => {
10 | console.error(error);
11 | });
--------------------------------------------------------------------------------
/react-redux-fourth-batch/src/app/hooks.js:
--------------------------------------------------------------------------------
1 | import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
2 |
3 | // Use throughout your app instead of plain `useDispatch` and `useSelector`
4 | export const useAppDispatch = () => useDispatch();
5 | export const useAppSelector = useSelector;
6 |
--------------------------------------------------------------------------------
/typescript/runtime_this.ts:
--------------------------------------------------------------------------------
1 | class MyClass {
2 | name = "MyClass";
3 | getName() {
4 | return this.name;
5 | }
6 | }
7 | const c = new MyClass();
8 | const obj = {
9 | name: "obj",
10 | getName: c.getName,
11 | };
12 |
13 | // Prints "obj", not "MyClass"
14 | console.log(obj.getName());
--------------------------------------------------------------------------------
/react-redux-fourth-batch/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/backend/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/chapter16/clone.js:
--------------------------------------------------------------------------------
1 | let another = {
2 | value : 20
3 | }
4 | let obj = {
5 | some : another
6 | }
7 | let clone = {...obj};
8 | clone.some.value ++;
9 |
10 | console.log("Clone.some.value ",clone.some.value);
11 | console.log("Obj.some.value ",obj.some.value);
12 | console.log("another.value ",another.value);
--------------------------------------------------------------------------------
/chapter3/VariableDeclaration.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/chapter5/ForIn.html:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/typescript/init.ts:
--------------------------------------------------------------------------------
1 | class Base {
2 | name = "base";
3 | constructor() {
4 | console.log("My name is " + this.name);
5 | }
6 | }
7 |
8 | class Derived extends Base {
9 | name = "derived";
10 | }
11 |
12 | // Prints "base", not "derived"
13 | const d = new Derived();
14 | console.log('D.name ',d.name);
--------------------------------------------------------------------------------
/react-frontend/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/react-frontend/src/pages/NotFoundPage.js:
--------------------------------------------------------------------------------
1 | import {Link} from "react-router-dom";
2 | import React from "react";
3 |
4 | export default function NotFoundPage(props)
5 | {
6 | return (
7 |
Not found any page-404
8 | Home
9 | )
10 | }
--------------------------------------------------------------------------------
/typescript/composite.js:
--------------------------------------------------------------------------------
1 | var tree = {
2 | children: [
3 | {
4 | data: "1"
5 | },
6 | {
7 | children: [
8 | {
9 | data: "1"
10 | }
11 | ]
12 | }
13 | ]
14 | };
15 | console.log("Tree ", tree);
16 |
--------------------------------------------------------------------------------
/typescript/null.js:
--------------------------------------------------------------------------------
1 | function doSomething(x) {
2 | if (x === null) {
3 | // do nothing
4 | }
5 | else {
6 | console.log("Hello, " + x.toUpperCase());
7 | }
8 | }
9 | doSomething("Jhon");
10 | function liveDangerously(x) {
11 | console.log(x.toFixed());
12 | }
13 | liveDangerously(12);
14 |
--------------------------------------------------------------------------------
/backend/.idea/backend.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/react-frontend/src/components/FancyBorder.js:
--------------------------------------------------------------------------------
1 | import "./FancyBorder.css";
2 | export default function FancyBorder(props)
3 | {
4 | console.log("Children ",props.children);
5 | return(
6 |
7 | {props.header}
8 | {props.children}
9 |
)
10 | }
--------------------------------------------------------------------------------
/typescript/overload.ts:
--------------------------------------------------------------------------------
1 | function makeDate(timestamp: number): Date;
2 | function makeDate(mOrTimestamp: number, d: number): Date;
3 | function makeDate(m: number, d?: number): Date{
4 | console.log("Date ");
5 | return new Date();
6 | }
7 | const d1 = makeDate(12345678);
8 | const d2 = makeDate(5, 5);
9 | const d3 = makeDate(1,2);
--------------------------------------------------------------------------------
/react-frontend/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/react-redux-fourth-batch/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/typescript/unition_2.ts:
--------------------------------------------------------------------------------
1 | function printId(id: number | string) {
2 | if (typeof id === "string") {
3 | // In this branch, id is of type 'string'
4 | console.log(id.toUpperCase());
5 | } else {
6 | // Here, id is of type 'number'
7 | console.log(id* 30);
8 | }
9 | }
10 |
11 | printId("Hello");
12 | printId(3)
--------------------------------------------------------------------------------
/redux-typescript-fourth-batch/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/typescript/constraint.js:
--------------------------------------------------------------------------------
1 | function longest(a, b) {
2 | if (a.length >= b.length) {
3 | return a;
4 | }
5 | else {
6 | return b;
7 | }
8 | }
9 | ;
10 | var max = longest([1, 2, 3, 4], [2, 3,]);
11 | console.log("Max ", max);
12 | var maxStr = longest("Hello", "Hi");
13 | console.log("Max Str ", maxStr);
14 |
--------------------------------------------------------------------------------
/typescript/construct_sing.js:
--------------------------------------------------------------------------------
1 | function fn(ctor) {
2 | return new ctor("hello");
3 | }
4 | var Human = /** @class */ (function () {
5 | function Human(str) {
6 | this.name = str;
7 | console.log("Human ", str);
8 | }
9 | return Human;
10 | }());
11 | var obj = fn(Human);
12 | console.log('Obj ', obj);
13 |
--------------------------------------------------------------------------------
/typescript/null.ts:
--------------------------------------------------------------------------------
1 | function doSomething(x: string | null) {
2 | if (x === null) {
3 | // do nothing
4 | } else {
5 | console.log("Hello, " + x.toUpperCase());
6 | }
7 | }
8 | doSomething("Jhon");
9 |
10 | function liveDangerously(x?: number | null) {
11 |
12 | console.log(x!.toFixed());
13 | }
14 | liveDangerously(12);
--------------------------------------------------------------------------------
/typescript/rest.js:
--------------------------------------------------------------------------------
1 | function multiply(n) {
2 | var m = [];
3 | for (var _i = 1; _i < arguments.length; _i++) {
4 | m[_i - 1] = arguments[_i];
5 | }
6 | return m.map(function (x) { return n * x; });
7 | }
8 | // 'a' gets value [10, 20, 30, 40]
9 | var a = multiply(10, 1, 2, 3, 4);
10 | console.log('A ', a);
11 |
--------------------------------------------------------------------------------
/StaticType.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | using namespace std;
4 |
5 |
6 | int main()
7 | {
8 | int a = 24;
9 | cout<<"A is "<
2 |
13 |