Skip to content

Instantly share code, notes, and snippets.

View anmolsukki's full-sized avatar
🎯
Software Engineer | Web Developer

Anmol Kumar Singh anmolsukki

🎯
Software Engineer | Web Developer
View GitHub Profile
const book = {
title: "Ego is the enemy",
author: "Ryan Holiday"
}
const bookJson = JSON.stringify(book);
console.log(bookJson)
const personData = JSON.parse(bookJson)
console.log(personData.author)
@anmolsukki
anmolsukki / index.js
Created May 5, 2020 12:39
[ NodeJs ] Write Json FileSystem ( https://repl.it/@anmolsukki/2WriteJsonFile )
const fs = require("fs");
const book = {
title: "Ego is the enemy",
author: "Ryan Holiday"
}
const bookJson = JSON.stringify(book);
fs.writeFileSync("1-person.json", bookJson)
const fs = require("fs");
const dataBuffer = fs.readFileSync("person.json")
console.log(dataBuffer)
console.log(dataBuffer.toString())
const dataJSON = dataBuffer.toString()
const data = JSON.parse(dataJSON)
console.log(data.title)
@anmolsukki
anmolsukki / index.js
Created May 5, 2020 12:46
[ NodeJs ] Read Write Json Challenge ( https://repl.it/@anmolsukki/4ReadWriteJson )
const fs = require('fs')
const dataBuffer = fs.readFileSync('person.json')
const dataJSON = dataBuffer.toString()
const user = JSON.parse(dataJSON)
user.name = 'Gunther'
user.age = 54
const userJSON = JSON.stringify(user)
square = (x) => {
return x * x
}
console.log(square(3))
const squares = (x) => x * x;
console.log(squares(4))
@anmolsukki
anmolsukki / App.js
Last active May 5, 2020 13:50
[ NodeJs ] Json File Crud ( yargs )
const yargs = require('yargs')
const notes = require('./notes.js')
// Customize yargs version
yargs.version('1.1.0')
// Create add command
yargs.command({
command: 'add',
describe: 'Add a new note',
@anmolsukki
anmolsukki / MongoBackup.sh
Created May 5, 2020 13:59
[ Shell Script ] Shell Script Basic Command
#!/bin/sh
# Database Name to backup
MONGO_DATABASE="dbname"
# Database host name
MONGO_HOST="127.0.0.1"
# Database port
MONGO_PORT="27017"
# Backup directory
BACKUPS_DIR="/Users/deepak/Desktop/BackupFile/$MONGO_DATABASE"
# Database user name
@anmolsukki
anmolsukki / another_script.sh
Created May 5, 2020 14:02
[ Shell Script ] Run Shell Script by using another Shell Script
# another shell script
echo "This script is succesfully running."
echo "Have Fun."
import React from "react";
import axios from "axios";
const APIKEY = "AIzaSyDFVJQ4ucMjge4_7z3wIBlN4BQxAiI2f9c";
const ChannelID = "UCblDw1QEzTOL2CFO_BeV3Sw";
const result = 10;
var finalURL = `https://www.googleapis.com/youtube/v3/search?key=${APIKEY}&channelId=${ChannelID}&part=snippet,id&order=date&maxResults=${result}`;
class App extends React.Component {
constructor(props) {
import React, { Component } from "react";
class Home extends Component {
constructor(props) {
super(props);
this.state = {
AccordionData: [
{ expanded: false, title: "collapse 1", body: "Accordian Example 1" },
{ expanded: false, title: "collapse 2", body: "Accordian Example 2" },
{ expanded: false, title: "collapse 3", body: "Accordian Example 3" },