Skip to content

Instantly share code, notes, and snippets.

View jrignacio's full-sized avatar
🆕
Starting something new

jr jrignacio

🆕
Starting something new
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jrignacio on github.
  • I am jrignacio (https://keybase.io/jrignacio) on keybase.
  • I have a public key whose fingerprint is C8B5 F9DB 2DB4 6E68 C10B AB4B AEC2 42DD 10B4 A82A

To claim this, I am signing this object:

@jrignacio
jrignacio / regex-sg.js
Last active January 15, 2023 14:39
Regular expressions for common form fields in Singapore
contact = /(^[689]{1}\d{7}$)/;
mobile = /(^[89]{1}\d{7}$)/;
nric_fin = /^[FGST]{1}\d{7}[A-Z]{1}$/i;
email = /^([A-Z0-9_\.\-\+])+\@(([A-Z0-9\-])+\.)+([A-Z0-9]{2,4})+$/i;
postal_code = /(^\d{6}$)/;
unit_no = /([-#0-9])/;
@jrignacio
jrignacio / datetime.php
Created December 9, 2010 06:49
Date and time with ms in GMT+8
<?php
function datetime() {
date_default_timezone_set('Asia/Singapore');
$microtime = explode(" ",microtime());
$time = (int)$microtime[1];
$milliseconds = round($microtime[0]*1000);
$milliseconds = sprintf("%03d", $milliseconds);
$datetime = date('Y-m-d H:i:s',$time).'.'.$milliseconds;
return $datetime;
}
<!DOCTYPE html>
<html manifest="manifest.php" lang="en-US">
<head>
<title>Reference Library</title>
<meta id="Copyright" name="Copyright" content="Copyright 2010 Apple Inc. All Rights Reserved.">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link type="image/png" rel="apple-touch-icon" href="images/icon.png">
<?php
function utf8_urldecode($str) {
$str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
return html_entity_decode($str,null,'UTF-8');;
}
?>