View localStorage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addItems = document.querySelector(".add-items"); | |
const itemsList = document.querySelector(".plates"); | |
const items = JSON.parse(localStorage.getItem("items")) || []; | |
function addItem(e) { | |
e.preventDefault(); | |
// console.log('Hello'); | |
const text = this.querySelector("[name=item]").value; | |
const item = { | |
text, |
View localStorage-index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>LocalStorage</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> |
View localStorage-style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
box-sizing: border-box; | |
background: url("oh-la-la.jpeg") center no-repeat; | |
background-size: cover; | |
min-height: 100vh; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
text-align: center; | |
font-family: Futura, "Trebuchet MS", Arial, sans-serif; |
View DataFetching.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
import Axios from "axios"; | |
function DataFetching() { | |
const [post, setPost] = useState({}); | |
const [id, setId] = useState(1); | |
const [idFromButtomClick, setIdFromButtomClick] = useState(1); | |
const handleClick = () => { | |
setIdFromButtomClick(id); |
View DataFetching2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useReducer, useEffect } from "react"; | |
import axios from "axios"; | |
const initialState = { | |
loading: true, | |
error: "", | |
post: {}, | |
}; | |
const reducer = (state, action) => { |
View BinarySearch.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++ program to implement recursive Binary Search | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define ll long long int | |
int binarySearch(int arr[], int l, int r, int x) { | |
while (l <= r) { | |
int m = l + (r - l) / 2; |
View reversedSorted.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Binary Search algorithm on a reversed sorted array. | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define ll long long int | |
int main(){ | |
ios :: sync_with_stdio(false); | |
cin.tie(0); |
View Occurance.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Finding First and Last Occurance an Element in a Sorted Array | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define ll long long int | |
int main(){ | |
ios :: sync_with_stdio(false); | |
cin.tie(0); |
View Floor.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Finding Floor of an Element in a Sorted array | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define ll long long int | |
int main(){ |
View Ceil.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Finding Ceil of an Element in a Sorted array | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define ll long long int | |
int main(){ |
OlderNewer