Skip to content

Commit e8e01cb

Browse files
committed
added css-grid & Js-DOM cheatSheet
1 parent 255bdf6 commit e8e01cb

File tree

8 files changed

+226
-5
lines changed

8 files changed

+226
-5
lines changed

Assets/gameMusic.mp3

0 Bytes
Binary file not shown.

CheatSheets/CSS Flexbox-Cheatsheet.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,5 @@
126126

127127
## Learn More about CSS Flexbox from here:
128128

129-
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
129+
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
130+
[![Learn More about CSS Flexbox from here:](https://css-tricks.com/wp-json/social-image-generator/v1/image/21059)](https://youtu.be/3nLglJtUHjA "CSS Flexbox Tutorial for Beginners")

CheatSheets/CSS Grid-CheatSheet.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
![JavaScript DOM Tutorial for Beginners](https://vishal-raj-1.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F381724cd-61ee-4dda-9317-da3c96afc9c6%2Fcss-3.png?table=block&id=e3ef2276-f491-476f-bbc5-e17bc16074c5&spaceId=2119cbee-b8d9-4533-9b59-63ea95d76e4e&width=250&userId=&cache=v2)
2+
3+
# CSS Grid Cheatsheet
4+
## 1. Grid container properties
5+
6+
## Display
7+
```css
8+
/* Sets the element to a grid container. */
9+
.container {
10+
display: grid;
11+
}
12+
```
13+
14+
## Grid Template Columns
15+
```css
16+
/* Defines the columns of the grid. */
17+
.container {
18+
grid-template-columns: 100px 100px 100px;
19+
}
20+
```
21+
22+
## Grid Template Rows
23+
```css
24+
/* Defines the rows of the grid. */
25+
.container {
26+
grid-template-rows: 100px 100px;
27+
}
28+
```
29+
30+
## Grid Template Areas
31+
```css
32+
/* Defines the areas of the grid. */
33+
.container {
34+
grid-template-areas:
35+
"header header"
36+
"sidebar content"
37+
"footer footer";
38+
}
39+
```
40+
41+
## Gap
42+
```css
43+
/* Specifies the size of the gap between grid items. */
44+
.container {
45+
gap: 10px;
46+
}
47+
```
48+
49+
## Justify Items
50+
```css
51+
/* Aligns items along the inline (row) axis. */
52+
.container {
53+
justify-items: center;
54+
}
55+
```
56+
57+
# Align Items
58+
```css
59+
/* Aligns items along the block (column) axis. */
60+
.container {
61+
align-items: center;
62+
}
63+
```
64+
65+
# Justify Content
66+
```css
67+
/* Aligns the grid along the inline (row) axis. */
68+
.container {
69+
justify-content: center;
70+
}
71+
```
72+
73+
# Align Content
74+
```css
75+
/* Aligns the grid along the block (column) axis. */
76+
.container {
77+
align-content: center;
78+
}
79+
```
80+
81+
## 2. Grid Item Properties
82+
## Grid Column Start
83+
84+
```css
85+
/* Specifies the start position of a grid item along the inline (row) axis. */
86+
.item {
87+
grid-column-start: 1;
88+
}
89+
```
90+
91+
## Grid Column End
92+
```css
93+
/* Specifies the start position of a grid item along the inline (row) axis. */
94+
.item {
95+
grid-column-start: 1;
96+
}
97+
```
98+
99+
## Grid Row Start
100+
```css
101+
/* Specifies the start position of a grid item along the block (column) axis. */
102+
.item {
103+
grid-row-start: 1;
104+
}
105+
```
106+
107+
## Grid Row End
108+
```css
109+
/* Specifies the end position of a grid item along the block (column) axis. */
110+
.item {
111+
grid-row-end: 3;
112+
}
113+
```
114+
115+
## Grid Area
116+
```css
117+
/* Specifies both the start and end positions of a grid item. */
118+
.item {
119+
grid-area: 1 / 1 / 3 / 3;
120+
}
121+
```
122+
123+
## Justify Self
124+
```css
125+
/* Aligns a grid item along the inline (row) axis. */
126+
.item {
127+
justify-self: center;
128+
}
129+
```
130+
131+
## Align Self
132+
```css
133+
/* Aligns a grid item along the block (column) axis. */
134+
.item {
135+
align-self: center;
136+
}
137+
```
138+
139+
## Learn More about CSS Grid from here:
140+
https://css-tricks.com/snippets/css/complete-guide-grid/
141+
[![CSS Grid Tutorial for Beginners](https://i.ytimg.com/vi/ULp7wPJ-rzQ/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAF_KnaTkQYj55zEN0fDGX-74JVKQ)](https://www.youtube.com/watch?v=ULp7wPJ-rzQ&ab_channel=VishalRajput "CSS Grid Tutorial for Beginners")

CheatSheets/Git-Cheatsheet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
| `git config --global user.email "youremail@example.com"` | Set your email for Git. |
99
| `git config --global color.ui true` | Enable color output. |
1010
| `git init` | Initialize a new Git repository. |
11-
| `git clone <repository url>` | Clone an existing repository to your local machine.|
11+
| `git clone <repository url>` | Clone an existing repository to your local machine.[either using https or SSH(when you have linked github with your computer using SSH keys) link] |
1212
| `git status` | Show the status of your working directory and staging area.|
1313
| `git add <file>` | Add a file to the staging area. |
1414
| `git commit -m "Commit message"` | Commit changes in the staging area with a message. |
15-
| `git branch` | Show a list of all branches in the repository. |
15+
| `git branch` | Show a list of all branches in the repository.[your current working branch will be green coloured with * mark before it] |
1616
| `git branch <branch name>` | Create a new branch with the given name. |
1717
| `git checkout <branch name>` | Switch to the branch with the given name. |
1818
| `git merge <branch name>` | Merge changes from the specified branch into the current branch.|

CheatSheets/HTML-CheatSheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183

184184
```html
185185

186-
<audio src="audio_file.mp3" controls></audio>
186+
<video src="video_file.mp4" controls></video>
187187

188188
```
189189

CheatSheets/JS DOM-CheatSheet.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
![JavaScript DOM Tutorial for Beginners](https://vishal-raj-1.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F2ce8ae32-c03f-42db-9865-9a8abc50aa83%2Fjs.png?table=block&id=408271f3-22a5-4395-8ee8-755bc459674e&spaceId=2119cbee-b8d9-4533-9b59-63ea95d76e4e&width=250&userId=&cache=v2)
2+
3+
# JavaScript DOM Cheatsheet
4+
5+
## What is DOM?
6+
7+
The Document Object Model (DOM) is a programming interface for HTML documents. It represents the page so that programs can change the document structure, style, and content.
8+
9+
## DOM Methods to find HTML elements:
10+
11+
### Get Element by Id
12+
Returns the element that has the ID attribute with the specified value.
13+
```jsx
14+
let element = document.getElementById("myElement");
15+
```
16+
17+
### Get Element by Class Name
18+
Returns a collection of all elements in the document with the specified class name.
19+
```jsx
20+
let elements = document.getElementsByClassName("myClass");
21+
```
22+
23+
### Get Elements By Tag Name
24+
Returns a collection of all elements in the document with the specified tag name.
25+
```jsx
26+
let elements = document.getElementsByTagName("p");
27+
```
28+
29+
### Query Selector All
30+
Returns all elements that matches a specified CSS selector(s) in the document
31+
```jsx
32+
let elements = document.querySelectorAll(".myClass");
33+
```
34+
35+
### InnerHTML
36+
Gets or sets the HTML content within an element.
37+
```jsx
38+
element.innerHTML = "<p>New HTML content</p>";
39+
```
40+
41+
### InnerText
42+
Gets or sets the text content within an element.
43+
```jsx
44+
element.innerText = "New text content";
45+
```
46+
47+
### Add Class
48+
Adds one or more class names to an element.
49+
```jsx
50+
element.classList.add("newClass");
51+
```
52+
53+
### Remove Class
54+
Removes one or more class names from an element.
55+
```jsx
56+
element.classList.remove("oldClass");
57+
```
58+
59+
### Add Event Listener
60+
Attaches an event handler to the specified element.
61+
```jsx
62+
const myButton = document.getElementById("myButton");
63+
64+
myButton.addEventListener("click", function() {
65+
console.log("Button clicked!");
66+
});
67+
```
68+

CheatSheets/JS-CheatSheet.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ const fruits = ['apple', 'banana', 'orange'];
210210
for (let fruit of fruits) {
211211
console.log(fruit);
212212
}
213+
// There is difference b/w for(let fruit in fruits) vs as shown above
214+
// `for...in` is used to iterate over properties of objects whereas `for...of` will iterate over values
215+
216+
for(let fruit in fruits){
217+
console.log(fruit); // O/P: 0 1 2
218+
}
213219

214220
// forEach method for iterating over arrays
215221
fruits.forEach((fruit, index) => {
@@ -301,6 +307,11 @@ console.log(even); // [2]
301307
### Reduce method
302308

303309
**`reduce()`** applies a function to each element of an array, resulting in a single output value.
310+
```jsx
311+
const numbers = [1, 2, 3];
312+
const sum = numbers.reduce((total, num) => total + num, 0);
313+
console.log(sum); // 6
314+
```
304315

305316
Learn More about JS from here:
306317
[![JavaScript Tutorial for Beginners](https://img.youtube.com/vi/9Shi7sbrHqY/sddefault.jpg)](https://www.youtube.com/watch?v=9Shi7sbrHqY&ab_channel=VishalRajput "JavaScript Tutorial for Beginners")

Projects/NotesApp/notesApp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div id="input-box">
1313
<input type="text" id="addTitle" placeholder="Title">
1414
<textarea name="" id="addText" cols="30" rows="10" placeholder="Take a note.."></textarea>
15-
15+
1616
<button id="addNote">Add</button>
1717
</div>
1818

0 commit comments

Comments
 (0)