Skip to content

Instantly share code, notes, and snippets.

@jonilsonds9
jonilsonds9 / file-buffer-nestjs.ts
Last active October 17, 2023 23:11
Uploading binary file (buffer) using NestJS
// Had to upload a binary file but multer only works with `multipart/form-data`
// And NestJS parses the request. So I had to manually upload it.
// First in `main.ts` I had to edit the following line:
const app = await NestFactory.create(AppModule);
// For:
const app = await NestFactory.create(AppModule, { bodyParser: false });
@thomasfw
thomasfw / wpmail-enhanced-attachments.php
Last active March 20, 2024 23:47
Enable non-filesystem attachments with wp_mail()
<?php
/**
* Plugin Name: Enhanced WP Mail Attachments
* Plugin URI: https://gist.github.com/thomasfw/5df1a041fd8f9c939ef9d88d887ce023/
* Version: 0.1
*/
/**
* Adds support for defining attachments as data arrays in wp_mail().
@qin-yu
qin-yu / configure-git.md
Last active May 31, 2024 05:30
Configure Git and setup GitHub on new machine
@tameemsafi
tameemsafi / emails.php
Last active April 15, 2024 12:42
Send an email programmatically in wordpress with wp_mail using the woocommerce transaction emails template.
<?php
// Define a constant to use with html emails
define("HTML_EMAIL_HEADERS", array('Content-Type: text/html; charset=UTF-8'));
// @email - Email address of the reciever
// @subject - Subject of the email
// @heading - Heading to place inside of the woocommerce template
// @message - Body content (can be HTML)
function send_email_woocommerce_style($email, $subject, $heading, $message) {
@brenopolanski
brenopolanski / merge-pdf-ghostscript.md
Last active May 2, 2024 06:56
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.