Skip to content

Instantly share code, notes, and snippets.

View the-liquid-metal's full-sized avatar

Hendra Gunawan the-liquid-metal

View GitHub Profile
@the-liquid-metal
the-liquid-metal / mysql-stored-procedure-proper_date.sql
Created December 7, 2023 17:28
mysql stored procedure proper_date clean-up text field from unstructured text. valid mysql date remain intact, invalid date converted to null.
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `proper_date`(`value` TEXT)
RETURNS TEXT
LANGUAGE SQL
DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
# preprocessing ----------------------------------------------------------------------------------------------------
window.prop1 = 11;
window.prop2 = 22;
b = function() {
console.log("this: ", this);
console.log("this.prop1: ", this.prop1);
console.log("this.prop2: ", this.prop2);
}
console.log("\n=== b() without context -> window ===");
@the-liquid-metal
the-liquid-metal / private fields-1.js
Last active January 11, 2021 00:29
private fields
class A {
constructor() {
console.log("A constructor is called");
}
// ---------------------------------------------
#prop1;
set prop1(val) {
this.#prop1 = val;
}
get prop1() {
*PHP*
================
class a {
function f1() {echo "f1 from 'a'";}
}
class b extend a {
function b1() {echo "b1 from 'b'";}
function b2() {echo "b1 from 'b'";}
}
The ordinary and simplest way to write enum in PHP is:
class MyEnum {
const val1 = "val1";
const val2 = "val2";
const val3 = "val3";
}
and the way to use enum is: