Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meeting Application | Pradyuman Agrawal #25

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Pradyuman_Agrawal/Week-0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To spin up MYSQL server as a container (what i ended up using for setting up Mysql on my laptop)

```docker run -p 3306:3306 --name nodejs-mysql -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_DATABASE=user_db -d mysql:5.7```

To open it with an interactive shell

```docker exec -it <container-id> bash```
29 changes: 29 additions & 0 deletions Pradyuman_Agrawal/Week-0/array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let arr=[34,56,76,54,60]

let min=arr[0],max=arr[0],sum=0,totalFail=0,totalPass=0

for(const a of arr){
console.log(a)
if(a<min)
min=a;
else if(a>max)
max=a;
sum+=a;
if(a>=50)
totalPass++
else
totalFail++;
}
console.log(`Min score was ${min}`)
console.log(`Max score was ${max}`)
console.log(`Sum score was ${sum}`)
console.log(`total Pass score was ${totalPass}`)
console.log(`total Fail score was ${totalFail}`)


const numbers = [1, 2, 3, 4, 5]

for (const num of numbers) {
console.log(num)
}

17 changes: 17 additions & 0 deletions Pradyuman_Agrawal/Week-0/conditional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

//day 2

let marks = 9

if(marks>=90){
alert("Yippee you got A grade")
}
else if(marks>=80){
alert("you got B grade")
}
else if(marks>=60){
alert("you got C grade, more efforts required!")
}
else{
alert("we need to have a serious talk, you got a D")
}
4 changes: 4 additions & 0 deletions Pradyuman_Agrawal/Week-0/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Pradyuman Agrawal",
"address": "Po Box City"
}
19 changes: 19 additions & 0 deletions Pradyuman_Agrawal/Week-0/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const mysql = require('mysql');

const con = mysql.createConnection({
host: "localhost",
user: "root",
password: "pass"
});

con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
con.query(`SELECT * FROM user_db.user`, function(err, result, fields) {
if (err)
console.log(err);
if (result)
console.log(result);
});
con.end();
});
7 changes: 7 additions & 0 deletions Pradyuman_Agrawal/Week-0/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<head></head>
<body bgcolor="black">
<script src="demo.js"></script>
<script src="array.js"></script>
<script src="conditional.js"></script>
</body>
22 changes: 22 additions & 0 deletions Pradyuman_Agrawal/Week-0/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
let string = "JavasCript"
console.log(string)

string="hello"
console.log(string)

string[0]="a"
console.log(string)


let a=10;
console.log(a)
a=5
console.log(a)


const num = Math.floor(Math.random () * 101)
console.log(num)

const now = new Date()
console.log(now)
console.log(now.getTime())
19 changes: 19 additions & 0 deletions Pradyuman_Agrawal/Week-0/es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Task
const EvenOdd = num => {
if (num % 2)
console.log("Odd Number");
else
console.log("Even Number");
};

EvenOdd(10);

const user = {
username: "Pradyuman",
password: "pass",
};

let { username, password } = user;

console.log(username);
console.log(password);
16 changes: 16 additions & 0 deletions Pradyuman_Agrawal/Week-0/fun.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const square = function() {
let n=1
return n * n
}

console.log(square())

const arrFun = (name)=>{
console.log(`hello there, ${name}`)
}

arrFun("Pradyuman");

(function(name) {
console.log(name)
})("pradyuman")
169 changes: 169 additions & 0 deletions Pradyuman_Agrawal/Week-0/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Pradyuman_Agrawal/Week-0/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"mysql": "^2.18.1"
}
}
23 changes: 23 additions & 0 deletions Pradyuman_Agrawal/Week-0/readJson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const fs =require("fs")

function jsonReader(filePath, cb) {
fs.readFile(filePath, (err, fileData) => {
if (err) {
return cb(err)
}
try {
const object = JSON.parse(fileData)
return cb(null, object)
} catch(err) {
return cb(err)
}
})
}

jsonReader('./data.json', (err, user) => {
if (err) {
console.log(err)
return
}
console.log(user.address)
})
15 changes: 15 additions & 0 deletions Pradyuman_Agrawal/Week-0/writeJson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const fs = require("fs")

const user = {
name: "Pradyuman Agrawal",
address: "Po Box City",
}

const jsonString = JSON.stringify(user,null,2)
fs.writeFile('./data.json', jsonString, err => {
if (err) {
console.log('Error writing file', err)
} else {
console.log('Successfully wrote file')
}
})
3 changes: 3 additions & 0 deletions Pradyuman_Agrawal/teams_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.env
package-lock.json
Loading