Skip to content

Instantly share code, notes, and snippets.

@lucianovalenca
lucianovalenca / readme.md
Created January 7, 2024 14:29 — forked from slava-vishnyakov/readme.md
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@lucianovalenca
lucianovalenca / font-size.ts
Created September 16, 2023 19:56 — forked from gregveres/font-size.ts
font-size for tiptap 2
import { Extension } from "@tiptap/core";
import "@tiptap/extension-text-style";
export type FontSizeOptions = {
types: string[];
};
declare module "@tiptap/core" {
interface Commands<ReturnType> {
fontSize: {
@lucianovalenca
lucianovalenca / line-height.ts
Created September 16, 2023 19:56 — forked from gregveres/line-height.ts
line-heights for tiptap 2
import { Extension } from "@tiptap/core";
export interface LineHeightOptions {
types: string[];
heights: string[];
defaultHeight: string;
}
declare module "@tiptap/core" {
interface Commands<ReturnType> {
@lucianovalenca
lucianovalenca / rest-api-response-format.md
Created January 3, 2023 14:33 — forked from igorjs/rest-api-response-format.md
REST API response format based on some of the best practices
@lucianovalenca
lucianovalenca / node_nginx_ssl.md
Created April 24, 2022 23:46 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@lucianovalenca
lucianovalenca / https_nginx_express_node_config.md
Created April 24, 2022 21:13 — forked from basharovV/https_nginx_express_node_config.md
How to configure HTTPS with Lets Encrypt, Nginx reverse proxy, Express and Node

How to configure HTTPS with Lets Encrypt, Nginx reverse proxy, Express and Node

  1. Have a Node app ready for production.
  2. Create an app.js file in your project directory:
const express = require('express');
const path = require('path');
const app = express();

// Allow dotfiles - this is required for verification by Lets Encrypt's certbot
<?php
# StackOverflow related question: http://stackoverflow.com/questions/34886008/create-nested-array-by-array-of-key
# The @Gavriel's answer is pretty good!
# But it could be somewhat more "*easy to catch*" like this:
$new = $value;
foreach (array_reverse($keys) as $valueAsKey) $new = [$valueAsKey => $new];
# In fact, it's a version of @Gavbriel's answer using array_reverse() and some semantic variables.
After checking multiple tutorials I had to take pieces from each of the following to get this to work on my Win10 system:
* https://www.howtogeek.com/165268/how-to-add-open-powershell-here-to-the-context-menu-in-windows/
* https://www.tenforums.com/tutorials/60175-open-powershell-window-here-context-menu-add-windows-10-a.html
Basically it uses the steps from the first article, but under the `background` path from the second article.
Neither article on its own worked for me.
Steps:
https://expressjs.com/pt-br/guide/database-integration.html
https://towardsdatascience.com/static-hosting-with-ssl-on-s3-a4b66fb7cd00