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.
@lucianovalenca
lucianovalenca / Cordova for iOS
Created March 24, 2017 00:21 — forked from peteygao/Cordova for iOS
Step by Step guide to installing Cordova for iOS development
1. Install Xcode, if you haven't already.
a. Once installed, run Xcode and accept the license agreement.
b. Go into Xcode Prefs (Cmd + ,), go to Downloads, and install "Command Line Tools for Xcode" (or something named similarily)
2. Install Homebrew (copy and paste the following into your terminal):
```bash
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@lucianovalenca
lucianovalenca / nginx.default.conf
Created October 17, 2016 23:06 — forked from sumardi/nginx.default.conf
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@lucianovalenca
lucianovalenca / css_resources.md
Created July 1, 2014 01:33 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides