Skip to content

Instantly share code, notes, and snippets.

View sahilrajput03's full-sized avatar
💭
I'm happy these days.

Sahil Rajput sahilrajput03

💭
I'm happy these days.
View GitHub Profile
@sahilrajput03
sahilrajput03 / jekyll-installation-arch.sh
Created March 15, 2024 20:12 — forked from bast/jekyll-installation-arch.sh
Jekyll installation on Arch Linux.
sudo pacman -S ruby ruby-rdoc gcc make
gem update --user-install
gem install jekyll --user-install
# finally add $HOME/.gem/ruby/2.7.0/bin to your PATH variable
@sahilrajput03
sahilrajput03 / TODO-Draft-why-mediatation.md
Last active October 12, 2022 08:23
TODO: Publish to sahilrajput.ml

Why meditation?

Everything I write in this article is my perception of this mental techniquet which we all broadly refer to as term "meditation".

Doing more work doesn't mean any good if the other choice is doing same work with lesser thinking noise(concise thinking) or some more important work. Similarly, thinking fast at the level of mind isn't any good if the other choice is doing same work with concised thinking or thinking of some more important element. Meditation helps you have the other choice available to you and kind of makes you disabled to the first way coz it just don't make any sense to you now. Stimulators: Coffee can be good stimulator to help you condition and have ease with the meditation. Coffee must be milk-less and you may add sugar if you feel like that.

Why don't we progress on the way of evolution of spiritual level of the mind? I think the way we handle the phase of emotional needyness plays an important role. That means if you meditate on those moments and practise to give yours

@sahilrajput03
sahilrajput03 / useFetch.js
Last active October 1, 2020 11:27
This is a react hook for fetching data.
// Usage -
//import {useFetch} from "./useFetch.js";
//const url = "https://raw.githubusercontent.com/ajzbc/kanye.rest/quotes/quotes.json";
//const {data, loading} = useFetch(url);
// --
//Defining hook inside useFetch.js file.
import { useEffect, useState, useRef } from "react";
export const useFetch = (url) => {
const isMounted = useRef(true);
@sahilrajput03
sahilrajput03 / Rest api's.md
Last active August 20, 2023 19:26
A good list of rest api's.
@tannerlinsley
tannerlinsley / README.md
Last active April 12, 2024 17:04
Replacing Create React App with the Next.js CLI

Replacing Create React App with the Next.js CLI

How dare you make a jab at Create React App!?

Firstly, Create React App is good. But it's a very rigid CLI, primarily designed for projects that require very little to no configuration. This makes it great for beginners and simple projects but unfortunately, this means that it's pretty non-extensible. Despite the involvement from big names and a ton of great devs, it has left me wanting a much better developer experience with a lot more polish when it comes to hot reloading, babel configuration, webpack configuration, etc. It's definitely simple and good, but not amazing.

Now, compare that experience to Next.js which for starters has a much larger team behind it provided by a world-class company (Vercel) who are all financially dedicated to making it the best DX you could imagine to build any React application. Next.js is the 💣-diggity. It has amazing docs, great support, can grow with your requirements into SSR or static site generation, etc.

So why

@sahilrajput03
sahilrajput03 / mutable.js(from FUTURE).js
Last active October 5, 2020 09:25
A function which helps easying up un mutating state objects when we need to dispatch new unmutated states to `dispatch` calll. # unmutate
const getMutable = (state) => JSON.parse(JSON.stringify(state)); // This is doer.
const mutableState = getMutable(state);
mutableState.books[0].section[2] = 'Things to be learned in august.';
mutableState.books[1].section[4] = 'Things to be learned in november.';
dispatch(mutableState);
// ----------------------------------------------------------------------------------------------------------
// Antoher simple approach is using closures like immer.js does(but it does some depth comparisons too), for e.g. below is my
@tannerlinsley
tannerlinsley / useGlobalMemo.js
Created August 28, 2020 23:45
useGlobalMemo is a React hook that lets you share memoizations across an entire app using a unique key.
const cache = {}
export default function useGlobalMemo (key, fn, deps) {
if (!cache[key]) {
cache[key] = {
subs: 0,
deps,
value: fn(),
}
@iansu
iansu / README.md
Last active March 1, 2021 08:40
Create React App 4.0 Alpha Testing

Create New App

JavaScript Template

npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app

TypeScript Template

npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app

@sahilrajput03
sahilrajput03 / GitCommitEmoji.md
Created July 13, 2020 14:48 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji