This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'node:http'; | |
import fs from 'node:fs'; | |
import path from 'node:path'; | |
import { WebSocketServer } from 'ws'; | |
const connections = new Map(); | |
let currentConnectionNumber = 0 | |
const staticFolder = './dist' | |
const MIME_TYPES = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk') | |
const s3 = new AWS.S3({ | |
endpoint: process.env.S3_SPACES_ENDPOINT, | |
accessKeyId: process.env.S3_SPACES_ACCESS_KEY, | |
secretAccessKey: process.env.S3_SPACES_SECRET_KEY | |
}) | |
async function changeContentType() { | |
// Name of the bucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Require puppeteer | |
const puppeteer = require('puppeteer'); | |
(async () => { | |
// Create an instance of the chrome browser | |
// But disable headless mode ! | |
const browser = await puppeteer.launch({ | |
headless: false | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_menu() { | |
# Change 'menu' to your own navigation slug. | |
return wp_get_nav_menu_items('menu'); | |
} | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'custom', '/menu', array( | |
'methods' => 'GET', | |
'callback' => 'get_menu', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hash from 'object-hash' | |
import sizeof from 'object-sizeof' | |
import lruCache from 'lru-cache' | |
const cacheEnabled = true | |
const cacheMaxAge = 30 * 60 * 1000 | |
const cacheMaxSize = 128 * 1000 * 1000 | |
const getCacheKey = obj => hash(obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Json Extended Fields for json api | |
Author: Tuarisa | |
Description: Extends json functionality for wordpress REST API | |
*/ |