Skip to content

Instantly share code, notes, and snippets.

View sakilahmmad71's full-sized avatar
🏠
Working from home

Shakil Ahmed sakilahmmad71

🏠
Working from home
  • Dhaka,Bangladesh
View GitHub Profile

clone wars

Clone Wars - Open source clones of popular sites

100+ open-source clones and alternatives of popular sites like Airbnb, Amazon, Instagram, Netflix, TikTok, Spotify, WhatsApp, YouTube, etc. List contains source code, tutorials, demo links, tech stack, and GitHub stars count. Great for learning purpose!

-Made by Gourav Goyal

See full tables with better view 👉 gourav.io/clone-wars

You may want to install PostgreSQL from an official repository, since it is updated more frequently than official Ubuntu sources.

First, you should install prerequisite software packages that will be used to download and install software certificates for a secure SSL connection. sudo apt install wget ca-certificates

Then, get the certificate, add it to apt-key management utility and create a new configuration file with an official PostgreSQL repository address inside. wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

It is always a good idea to download information about all packages available for installation from your configured sources before the actual installation.

const actionTypes = {
toggle: 'TOGGLE',
on: 'ON',
off: 'OFF',
}
function toggleReducer(state, action) {
switch (action.type) {
case actionTypes.toggle: {
return {on: !state.on}
import { createContext, useContext, useReducer } from 'react';
const MyContext = createContext();
myContext.displayName = 'MyContext';
const MyContextProvider = ({ initialState = {}, ...props }) => {
const [state, dispatch] = useReducer(
(state, action) => {
switch (action?.type) {
case 'MYTYPE' : {
import axios from 'axios';
const MakeApiRequest = axios.create({
baseURL: "https://jsonplaceholder.typicode.com/",
headers: { 'Accept': 'application/json' },
timeout: 10000,
});
const setAuthToken = (token = '') => {
if (token) {
@sakilahmmad71
sakilahmmad71 / makeRequest.js
Last active July 25, 2021 20:27
Axios instance
import axios from "axios";
export default (history = null) => {
const baseURL = process.env.REACT_APP_BACKEND_URL;
let headers = {};
if (localStorage.token) {
headers.Authorization = `Bearer ${localStorage.token}`;
import axios, { CancelTokenSource } from 'axios';
import { useState, useEffect } from 'react';
import { PostInterface, defaultPostInterface } from './models/postInterface';
const App = () => {
/*
const [getVariableName, setValueVariableFunction] : [getVariableName_type, (setValueVariableFunction: setValueVariableFunction_type) => setValueVariableFunction_return_type] = useState<variable_type>(variableDefaultValue);
*/
const [posts, setPosts]: [PostInterface[], (posts: PostInterface[]) => void] = useState(defaultPostInterface);
const [loading, toggleLoading]: [boolean, (loading: boolean) => void] = useState<boolean>(true);