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
@superjojo140
superjojo140 / postgresql_arch_tutorial.md
Created December 4, 2019 09:56
Setup local PostgreSQL and pgAdmin on ArchLinux

Working with local PostgreSQL and pgAdmin on ArchLinux

Daily Usage

Start postgreSQL

$ sudo systemctl start postgresql
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
@tannerlinsley
tannerlinsley / hooks.js
Created January 25, 2019 17:00
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)
@tannerlinsley
tannerlinsley / Counter.js
Last active September 20, 2023 13:33
Global React State with Context and Immer
import { useCount, useIncrement, useDecrement } from './store.Count'
export default function Counter () {
const count = useCount()
const increment = useIncrement()
const decrement = useDecrement()
return (
<div>
<div>Count: {count}</div>
@pedrouid
pedrouid / setup-ssl.md
Last active April 29, 2024 21:39
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
// Source
const MyCompSource = ''
// @source MyCompSource
const MyComp = (
<div>
Hello there!
</div>
)
@tannerlinsley
tannerlinsley / .block
Created April 4, 2018 21:49 — forked from mbostock/.block
Grouped Bar Chart
license: gpl-3.0
@spemer
spemer / customize-scrollbar.css
Last active April 23, 2024 13:25
✨ 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 */
@santisbon
santisbon / Search my gists.md
Last active April 26, 2024 18:39
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

@tannerlinsley
tannerlinsley / index.html
Last active October 13, 2020 13:34 — forked from d3noob/.block
Simple bar graph in v4
<!DOCTYPE html>
<meta charset="utf-8">
<style> /* set the CSS */
.bar { fill: steelblue; }
</style>
<body>
<!-- load the d3.js library -->