Skip to content

Instantly share code, notes, and snippets.

View nakorndev's full-sized avatar

Nakorn Sinpadung nakorndev

View GitHub Profile
@Atinux
Atinux / sse.ts
Last active April 22, 2024 20:39
SSE endpoint example with Nuxt 3
// ~/server/api/sse.ts
export default defineEventHandler(async (event) => {
if (!process.dev) return { disabled: true }
// Enable SSE endpoint
setHeader(event, 'cache-control', 'no-cache')
setHeader(event, 'connection', 'keep-alive')
setHeader(event, 'content-type', 'text/event-stream')
setResponseStatus(event, 200)
@silkyland
silkyland / strToThaiSlug.js
Last active January 20, 2024 19:15
Convert string to slug in Thai language for SEO Friendly in JavaScript
/**
* Translates a string to a Thai slug format.
* @param {string} inputString - The string to translate.
* @returns {string} The translated string.
*/
function toThaiSlug(inputString) {
// Replace spaces with hyphens
let slug = inputString.replace(/\s+/g, '-');
// Translate some characters to Thai
@jcamp
jcamp / video-editors-opensource.md
Last active April 25, 2024 12:40
OpenSource Video Editors
@vluzrmos
vluzrmos / paginate.php
Created July 20, 2016 14:31
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@triztian
triztian / gen-ssh-keys.md
Last active November 4, 2023 11:47
DigitalOcean Generate SSH keys

Adding SSH Keys to Droplets

How it Works

You can add SSH keys to DigitalOcean which can then be selected during the droplet create process to add the selected SSH keys under the root user.

When using SSH keys a root password will no longer be set as SSH keys will be used as the preferred method of access.

We do not manage the server after creation, so editing, adding, or removing SSH keys from the SSH interface will not affect any of the stored keys on droplets that you have created.

@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet