Skip to content

Instantly share code, notes, and snippets.

View Tommy0412's full-sized avatar

Tommy0412

  • Croatia
  • 13:10 (UTC +02:00)
View GitHub Profile
@Tommy0412
Tommy0412 / two-letter_language_convert.php
Created February 22, 2025 18:52
two-letter language codes to full language names
<?php
function getFullLanguageName($languageCode) {
// Map two-letter language codes to full language names
$languageMap = [
'en' => 'English',
'fr' => 'French',
'es' => 'Spanish',
'de' => 'German',
'it' => 'Italian',
'pt' => 'Portuguese',
/* port of https://github.com/beautify-web/js-beautify/blob/master/python/jsbeautifier/unpackers/packer.py (MIT) */
var unpacker = {
unpack: function (str) {
var params = unpacker.filterargs(str);
var payload = params[0], symtab = params[1], radix = params[2], count = params[3];
if (count != symtab.length) {
throw new Error("Malformed p.a.c.k.e.r. symtab. (" + count + " != " + symtab.length + ")");
}
var unbase = unpacker.unbaser(radix);
var lookup = (word) => symtab[unbase(word)] || word;
@Tommy0412
Tommy0412 / recursive_extract_zip_node.js
Created May 29, 2024 15:39 — forked from dev-drprasad/recursive_extract_zip_node.js
Extract uploaded zip files using express.js and nodejs with recursive extraction
const express = require('express');
const fs = require('fs');
const extract = require('extract-zip')
const formidable = require('formidable');
const path = require('path');
const uploadDir = path.join(__dirname, '/uploads/');
const extractDir = path.join(__dirname, '/app/');
if (!fs.existsSync(uploadDir)) {
fs.mkdirSync(uploadDir);
}
@Tommy0412
Tommy0412 / cors.php
Created May 29, 2024 12:52 — forked from avtaniket/cors.php
Handle CORS in PHP
<?php
/* Handle CORS */
// Specify domains from which requests are allowed
header('Access-Control-Allow-Origin: *');
// Specify which request methods are allowed
header('Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS');
@Tommy0412
Tommy0412 / example.srt
Last active May 21, 2024 16:06 — forked from matibzurovski/example.srt
Example srt file
1
00:00:00,000 --> 00:00:00,000
-