Skip to content

Instantly share code, notes, and snippets.

View imchiennb's full-sized avatar
🌥️
Every Cloud Has A Silver Lining.

Chien. imchiennb

🌥️
Every Cloud Has A Silver Lining.
View GitHub Profile
@Venryx
Venryx / Example.tsx
Last active February 9, 2023 22:36
Using "useImperativeHandle" in a React functional component, with automatic TypeScript typing
import {forwardRef, useImperativeHandle, ForwardRefExoticComponent, RefAttributes, Ref} from "react";
export type Handle<T> = T extends ForwardRefExoticComponent<RefAttributes<infer T2>> ? T2 : never;
export const Parent = (props: {})=> {
let childHandle: Handle<typeof Child>;
return (
<div onClick={()=>childHandle.SayHi()}>
<Child name="Bob" ref={c=>childHandle = c}/>
</div>
@prograhammer
prograhammer / git-cheat-sheet.md
Last active March 14, 2023 17:44
Git cheat sheet for some useful Git commands and command scenarios.
@zcmgyu
zcmgyu / React + ESLint + Babel + Airbnb Javascript Style Guide + Prettier + VS Code (2021).md
Last active August 14, 2023 11:44
React + ESLint + Babel + Airbnb Javascript Style Guide + Prettier + VS Code

Setup

Setup ESLint, Pritter, Airbnb JS Style in Create React App project with VS Code editor

  • Plugins: Prettier, Html, React Hooks

Prerequisites

Latest node, VSCode, npm, yarn

@jayremnt
jayremnt / unfollow-all-users-not-friend.js
Last active August 30, 2023 16:34
Unfollow all users who are not your friends
/*
Script by JayremntB, 2020
Unfollow all users who are not your friends
Please copy all the code to make sure that you will not get any errors
Before run this script, please navigate to https://www.facebook.com/me/following
*/
// You can change time delay below or not (in milliseconds, 1 s = 1000 ms)
let delayTime = 0;
@dvdbng
dvdbng / vim-heroku.sh
Last active December 22, 2023 18:00
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@paulnguyen-mn
paulnguyen-mn / reactjs-learning-path-2020.md
Created June 25, 2020 15:46
Lộ trình học ReactJS cơ bản cho người mới bắt đầu 2020 🚀

Lộ trình học ReactJS cơ bản cho người mới bắt đầu 2020 🎉

  • Đôi tượng: mới bắt đầu học ReactJS mà không biết học những gì.
  • Yêu cầu kiến thức:
@magicznyleszek
magicznyleszek / css-selectors.md
Last active March 29, 2024 01:12
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {
@sohamkamani
sohamkamani / rsa.js
Last active April 7, 2024 21:41
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})
@ibraheem4
ibraheem4 / postgres-brew.md
Last active April 14, 2024 20:30 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@bradtraversy
bradtraversy / python_heroku.MD
Created August 16, 2019 16:38
Python & Postgres Heroku Deployment

Python Heroku Deployment

Steps to create a postgres database and deply a Python app to Heroku

Install guinicorn locally

pipenv install gunicorn
or
pip install gunicorn