Skip to content

Instantly share code, notes, and snippets.

View nijjwal's full-sized avatar
🎯
Focusing - Don't disturb

Nijjwal nijjwal

🎯
Focusing - Don't disturb
View GitHub Profile
@nijjwal
nijjwal / .json
Created March 8, 2020 05:17
AWS Make All Object Public inside a Bucket after allowing public access to the bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::nijjwal.com/*"
}
@nijjwal
nijjwal / gist:8da28c9acff8baf45922e4c34ed77041
Last active March 9, 2020 01:25
update ec2, install apache web server, start apache, and every time ec2 starts start apache web server, and create an index.html file with some content in the web root directory
#!/bin/bash
yum update -y
yum install httpd -y
service httpd start
chkconfig on
cd /var/www/html
echo "<html><body>us-second-server</body></html>">index.html
@nijjwal
nijjwal / .dart
Created May 23, 2020 02:51
sample dart code to for dart pad
List<String> names = ['Angela','John','Nijjwal','Jane'];
@nijjwal
nijjwal / Signup.js
Last active October 9, 2022 09:36
react map
import React, { useState } from 'react'
export default function Signup() {
const people = [{name:'Jamie', age:37, id:1},{name:'Tyrion', age:36, id:2}];
const [users, updateUser] = useState(people);
//For Printing in cosole
people.map((person)=>{
console.log(person.name)
@nijjwal
nijjwal / useContext-App.js
Created October 10, 2022 01:15
useContext Hook # 3 sample code
import { useContext, createContext } from "react";
const moods = {
happy: ':)',
sad: ':('
};
const MoodContext = createContext(moods);
function App() {
@nijjwal
nijjwal / PrivateRoute.js
Created October 10, 2022 09:04
React - Private Route - Protecting Dashboard with a Wrapper Class
//Code for PrivateRoute.js
import React from "react";
import { Navigate } from "react-router-dom";
import { useAuth } from "../contexts/AuthContext";
export default function PrivateRoute({ children }) {
const { currentUser } = useAuth();