Skip to content

Instantly share code, notes, and snippets.

View abc0990cba's full-sized avatar
🍍
Focusing

abc0990cba

🍍
Focusing
View GitHub Profile
@abc0990cba
abc0990cba / loader.js
Created January 5, 2024 19:28 — forked from umcconnell/loader.js
Loading animation for node console
// Adapted from https://stackoverflow.com/questions/34848505/how-to-make-a-loading-animation-in-console-application-written-in-javascript-or
/**
* Create and display a loader in the console.
*
* @param {string} [text=""] Text to display after loader
* @param {array.<string>} [chars=["⠙", "⠘", "⠰", "⠴", "⠤", "⠦", "⠆", "⠃", "⠋", "⠉"]]
* Array of characters representing loader steps
* @param {number} [delay=100] Delay in ms between loader steps
* @example
@abc0990cba
abc0990cba / DockerFile - API
Created December 28, 2023 20:42 — forked from gmoreiraGP/DockerFile - API
NGINX - Mongo DB - ExpressJS - NextJS
# pull the Node.js Docker image
FROM node:alpine
# create the directory inside the container
WORKDIR /var/www/api
# copy the package.json files from local machine to the workdir in container
COPY package*.json ./
# run npm install in our local machine
@abc0990cba
abc0990cba / useScript.tsx
Created October 28, 2023 10:02 — forked from addisonschultz/useScript.tsx
A React hook that lets you add script tags to a component. Useful when needing to load scripts for components in Framer X.
import * as React from "react"
import { useState, useEffect } from "react"
// Hook
let cachedScripts = []
export function useScript(src) {
// Keeping track of script loaded and error state
const [state, setState] = useState({
loaded: false,
@abc0990cba
abc0990cba / samplerest.js
Created September 24, 2023 18:34 — forked from joshbirk/samplerest.js
Sample of using passport w/ mult strategies
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')
@abc0990cba
abc0990cba / tokens.md
Created June 17, 2023 23:57 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@abc0990cba
abc0990cba / nginx_nodejs.md
Created June 4, 2023 18:08 — forked from tomasevich/nginx_nodejs.md
Сервер в связке Nginx + NodeJs

Сервер в связке Nginx + NodeJs

Данная пошаговая инструкция поможет освоить основы на простом примере

Для справки

Сервер поднимался на Debian 8 c характеристиками:

CPU - 1 ядро x 500 МГц