Skip to content

Instantly share code, notes, and snippets.

View sahilrajput03's full-sized avatar
💭
Eating, Sleeping, Coding, Repeat.

Sahil Rajput sahilrajput03

💭
Eating, Sleeping, Coding, Repeat.
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 / arrayBufferToString.js
Created November 13, 2022 14:40 — forked from skratchdot/arrayBufferToString.js
Array Buffer -> String and String -> ArrayBuffer conversions in javascript
// source: http://stackoverflow.com/a/11058858
function ab2str(buf) {
return String.fromCharCode.apply(null, new Uint16Array(buf));
}
@sahilrajput03
sahilrajput03 / setup-ssl.md
Created October 16, 2022 14:53 — forked from pedrouid/setup-ssl.md
Setup SSL with NGINX reverse proxy

Get a Free SSL Certificate With Let’s Encrypt

Let’s Encrypt is a free, automated, and open Certificate Authority.

  1. Install tools for using the Let's Encrypt certificates using Certbot
  sudo apt-get update \
  sudo apt-get install software-properties-common
@sahilrajput03
sahilrajput03 / hooks.js
Created October 13, 2020 09:44 — forked from tannerlinsley/hooks.js
useCancellable, useRefresh combo
const useCancellable = fn => {
const requestRef = useRef(0)
return async (...args) => {
// Keep track of latest promise ID
const id = Date.now()
requestRef.current = id
// Wait for resolution
const res = await fn(...args)
@sahilrajput03
sahilrajput03 / makeStore.js
Last active October 22, 2020 14:56 — forked from tannerlinsley/makeStore.js
makeStore react hook(without immerjs 😂) #react #hook #hooks #store #React.createContext #useContext #useContext
function makeStore({ actions }) {
// Make a context for the store
const context = React.createContext();
// Make a provider that takes an initialValue
const Provider = ({ initialValue = {}, children }) => {
// Make a new state instance
const [state, setState] = useState(initialValue);
// Bind the actions with the old state and args
@sahilrajput03
sahilrajput03 / Counter.js
Last active October 22, 2020 10:51 — forked from tannerlinsley/Counter.js
counter as hook #hooks #hook #counter #useCounter
const useCount = () => {
const [{ count }, setState] = useStore();
const increment = () => {
setState(old => ({
...old,
count: old.count + 1
}));
}
@sahilrajput03
sahilrajput03 / README.md
Created October 12, 2020 10:42 — forked from tannerlinsley/README.md
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 / customize-scrollbar.css
Created October 2, 2020 19:16 — forked from spemer/customize-scrollbar.css
Customize website's scrollbar like Mac OS. Not supports in Firefox and IE.
/* Customize website's scrollbar like Mac OS
Not supports in Firefox and IE */
/* total width */
body::-webkit-scrollbar {
background-color: #fff;
width: 16px;
}
/* background of the scrollbar except button or resizer */
@sahilrajput03
sahilrajput03 / Search my gists.md
Created September 26, 2020 16:43 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@sahilrajput03
sahilrajput03 / README.md
Created September 18, 2020 16:43 — forked from iansu/README.md
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