Use Snippets tab of Chrome browser inspector to run your code instead of console


While developing projects, we may need to take help from other projects hosted on github.com. General procedure involves cloning the repository, because it is not easy to navigate through the files on github.com.

https://github.com/conwnet/github1s solves this simple issue of easing navigation through files in browser itself

Checkout below repo link

https://github1s.com/conwnet/github1s

Instead of github.com it is github1s.com

You can easily navigate through any github public repository, by adding 1s after Github in the repo link


Reviewing pull requests is very important in order to ensure that consistent practice is followed all throughout the code, thus all stakeholders should promote pull request review as an important task

Considering a team of 6–7 developers will create 3–10 pull requests in a week it is important that we…


In every frontend code we use a lot of colours in scss.

First bit of optimisation is to put all the colour variables in a separate file, so that we can get all the colours used in our project at one place

Now second bit is about giving proper names…


I work at Nium where we handle international money transfer, so we have pages where we show clients a list of transactions, and this is where I got a good case to make medium post!

See the case —

A user does a transaction in India at 2am 20-October, it…


Gist: -> Either return a new value *or* modify the draft

A recipe function is used to update the value in immer library, here’s an example

const recipe = draft => {
draft.cool = true;
}
const newValue = produce(recipe, {cool: false})
console.log(newValue) // { cool: true }
  1. You mutate the draft to create a newValue, returning draft after modifying it…


I am writing this code snippet that should be helpful to you as a utility function.
It will throw an exact error for you when you want to assert, that something should not be null or undefined

export const shouldNotBeNull = (container: any) => {const entries = Object.entries(container);let error = '';const getErrorMessage = (variable: string, token: string) =>`${variable} should not be ${token}`;const addError = (errorString: string) => (error += errorString);for (let i = 0; i < entries.length; i++) {let [key, value] = entries[i];if (value === null) {addError(getErrorMessage(key, 'null'));}if (value === undefined) {addError(getErrorMessage(key, 'undefined'));}}if (error.length > 0) {throw new Error(error);}};

link to gist
Thank you!


We write unit tests so as to make sure our code functions as expected and we can get notified when there is a change in behaviour by the test-runner

We should write comments so that a developer can reassure his understanding of code by reading comments

Thus it can also…


Suppose we have an API /getTransaction with following response

{
transactionId: “TCC1232434”,
bankName: “ABC”,
accountNumber: 12131314,
transactionComments: "comments"
}

We might have another API to create the transaction and generally, transactionComments is an optional field

So while creating a transaction if someone does not enter transaction comments, nothing is stored…


As a good practice, we keep a separate deployment instance=(qa=app.qa.com) apart from main deployment=(production=app.com), so that we can test our development on qa instance before moving that code to production instance

Adding a further level of safety, the code deployment to these different instances (qa and production) also goes from…

Akshay Jain

I love learning

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store