Skip to content

Instantly share code, notes, and snippets.

View ats1999's full-sized avatar
💭
I may be slow to respond.

Rahul kumar ats1999

💭
I may be slow to respond.
View GitHub Profile
// get item from local storage
export const getLocalStorage = (str)=>{
try {
return localStorage.getItem(str);
} catch (error) {
// cookie is blocked
return false;
}
}

How to write better code?

The example has been picked from operationsdashboard/src/Demo/Flight/Preflightdata.js

In order to write better code, we should always think about readiblity of code and nameing conventions. Readibility of code make it easy for new developer to adopt the code and make new changes. For example you can see t5, t4, convertTime2, etc in the code. Any new developer can not understant the code directly, he/she must have to read the entire code and understand it's uses.

Old code

  useEffect(() => {
@ats1999
ats1999 / mongo.md
Last active May 2, 2021 11:18
Quick commands for MongoDB

Let's Learn MongoDB commands

Update

Definition

db.collection.update(query, update, options)

syntax

db.collection.update(
@ats1999
ats1999 / AddC.java
Last active February 29, 2020 09:54
Web Application design and development (Rahul kumar)
package rmi;
/**
* This file contains class which have implemention of AddI interface
*/
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
/**
* This class defines add method, which is called by the client.
* @version 1.0
@mindplace
mindplace / git_and_github_instructions.md
Last active May 15, 2024 18:05
Pushing your first project to github

1. Make sure git is tracking your project locally

Do you need a refresher on git? Go through Codecademy's git course.

  1. Using your terminal/command line, get inside the folder where your project files are kept: cd /path/to/my/codebase. → You cannot do this simply by opening the folder normally, you must do this with the command line/terminal.
    → Do you need a refresher on using your command line/terminal? I've compiled my favorite resources here.

  2. Check if git is already initialized: git status

@jonschlinkert
jonschlinkert / markdown-toc_repeated-headings.md
Created December 15, 2015 19:42
Example table of contents generated by markdown-toc, correctly links repeated headings.