Skip to content

Instantly share code, notes, and snippets.

@ve3
ve3 / strftime-to-intldateformatter-converter.php
Last active June 19, 2023 12:33
Convert strftime format to IntlDateFormatter pattern.
<?php
/**
* PHP `strftime()` format to `IntlDateFormatter()` pattern converter.
*
* PHP `strftime()` is deprecated since v 8.1. They recommended to use `IntlDateFormatter()` instead.
* However `IntlDateFormatter()` pattern does not fully supported all format that `strftime()` does.
*
* Run this file to get the result of most close pattern to `strftime()` based on Thai locale.
*
* @license MIT
@ve3
ve3 / index.html
Last active August 9, 2023 15:22
Bootstrap 5 one sidebar layout best fit for help & support page. (preview https://codepen.io/ve3/pen/MWzdEvj)
<!doctype html>
<html lang="th">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ความช่วยเหลือ &amp; สนับสนุน</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
<link rel="stylesheet" href="../assets/css/support-style.css">
</head>
@ve3
ve3 / Encryption.js
Last active August 10, 2023 10:51
Encrypt and decrypt between programming languages (PHP & JavaScript). (Newer version here https://gist.github.com/ve3/b16b2dfdceb0e4e24ecd9b9078042197 )
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
@ve3
ve3 / profit-calculator.html
Last active November 18, 2023 07:23
profit calculator. demo ( https://codepen.io/ve3/pen/GRzyzLJ )
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>คำณวนกำไร</title>
<style type="text/css">
button,
input[type="button"],
input[type="submit"],
@ve3
ve3 / 01-form-single.html
Last active November 22, 2023 10:25
Slice large file into chunks and upload using JavaScript.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>XHR upload large file with slice</title>
<style>
#debug {
border: 3px dashed #ccc;
margin: 10px 0;
padding: 10px;
@ve3
ve3 / wp-hooks-trace.php
Last active December 24, 2023 13:33
WordPress hooks (actions & filters) trace.
<?php
/**
* Plugin Name: WP hooks trace
* Description: Enable trace > browse or work > disable trace. And everything will be written into this plugin folder /hooks-trace.txt file.
* License: MIT
*/
// You can use this plugin for any purpose without attribution required.
add_filter('plugin_row_meta', 'rdht_pluginRowMeta', 10, 4);
@ve3
ve3 / Encryption.js
Created February 6, 2023 14:37
Cross languages encrypt/decrypt with AES-256-GCM
'use strict';
/**
* Encryption class for encrypt/decrypt data.
*/
export default class Encryption {
@ve3
ve3 / typography-and-form.html
Last active April 1, 2024 22:23
Most of HTML elements for styling with your CSS.
<!--You can use for any purpose, think it is MIT license or no license-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTML for styling</title>
<!--add your css here-->
</head>
<body>