Skip to content

Instantly share code, notes, and snippets.

@twlca
twlca / style.css
Last active October 7, 2016 01:29
Share Stylesheet for all tdv site
body { font-size: 14px; }
table { border-collapse: collapse; }
th, td { border: 1px solid #999; padding: 3px 6px; }
pre { border: 1px solid #999; padding: 9px; border-radius: 4px; font-family: courier new; background: #f8f8f8; }
nav ul { list-style-type: none; }
nav ul li { display: block; }
nav ul li a { text-decoration: none; }
@twlca
twlca / circular_date_presentation.html
Created October 13, 2016 01:13
以顯眼的日期表示方式呈現活動欄位
<style>
.circle_box { width: 64px; height: 64px; border-radius: 50%; text-align: center; vertical-align: middle; font-size: 20; font-family: helvetica; color: #888; -webkit-box-shadow: inset 3px 2px 19px -2px rgba(0,0,0,0.58);
-moz-box-shadow: inset 3px 2px 19px -2px rgba(0,0,0,0.58);
box-shadow: inset 3px 2px 19px -2px rgba(0,0,0,0.58); float: left; margin-right: 8px; }
.mon { font-size: 32px; font-weight: bold; }
.m_title { color: steelblue; font-weight: bold; font-family: helvetica; width: 360px; }
.m_title p { font-size: 14px; color: #333; margin-top: 0;}
.cr { clear: both; }
</style>
<div class="circle_box"><span class="mon">12</span><br />2</div>
@twlca
twlca / pidCheck.js
Created October 14, 2016 06:15
檢查身分證字號
/* 依據內政部:
1. 身分證編碼原則
2. 外來人口統一證號編碼原則(居留證) https://www.immigration.gov.tw/ct_cert.asp?xItem=1106801&ctNode=32601&mp=1
身分證及居留證通用
第一碼 縣市編碼原則:
A=10 台北市 J=18 新竹縣 S=26 高雄縣
B=11 台中市 K=19 苗栗縣 T=27 屏東縣
C=12 基隆市 L=20 台中縣 U=28 花蓮縣
D=13 台南市 M=21 南投縣 V=29 台東縣
@twlca
twlca / digit_transfer.js
Created October 15, 2016 04:11
在公文、表單標題等應用場合,有時需要將年、月、日日期註記轉記轉換成中文小寫。由於儲存在資料庫中的日期資料通常是由阿拉伯數字型式儲存(以利計算),所以在此類應用必需轉換。
var digits = '0123456789'; // 阿拉伯數字
var small_chinese_digits = '〇一二三四五六七八九'; // 中文小寫數字
var capital_chinese_digits = '零壹貮參肆伍陸㭍捌玖拾佰仟萬億兆'; // 中文大寫數字,應用侷限在金融,例如支票、匯款單、存款/提款單等
// 由阿拉伯數字轉換成小寫中文數字
var year = '106';
year.split('').map( function( item ) {
return small_chinese_digits.split('')[item];
}).join('');
// 回傳 "一〇五"
var digits = '0123456789'; // 阿拉伯數字
var small_chinese_digits = '〇一二三四五六七八九'; // 中文小寫數字
var capital_chinese_digits = '零壹貮參肆伍陸㭍捌玖拾佰仟萬億兆'; // 中文大寫數字,應用侷限在金融,例如支票、匯款單、存款/提款單等
// 由阿拉伯數字轉換成小寫中文數字
var year = '106';
year.split('').map( function( item ) {
return small_chinese_digits.split('')[item];
}).join('');
// 回傳 "一〇五"
@twlca
twlca / fill_form_fields_via_array_in_php.php
Created October 21, 2016 14:22
以 PHP 的陣列定義表單輸入項參數,再以迴圈完成每個輸入項名稱加上 $prefix,以保障資料庫安全
<?php
$prefix = 'tdva_';
$application_unit_info = array(
array(
'type' => 'text',
'name' => $prefix . '運用單位'
),
array(
'type' => 'text',
'name' => $prefix . '承辦人'
@twlca
twlca / open_data_taipai.json
Last active February 8, 2017 05:18
臺北市政府公開資料格式
{
"編號" : "id",
"計費方式" : "cost",
"資料集描述" : "description",
"資料集語系" : "language",
"資料集所屬管理機關聯絡人電子郵件" : "",
"收錄期間(迄)" : "",
"資料集說明網址" : "",
"資料集所屬管理機關名稱" : "",
"資料集所屬管理機關聯絡人電話" : "",
@twlca
twlca / tva.taitung_metadata.json
Last active February 8, 2017 09:45
臺東縣志願服務協會開放資料-資料集架構
{ "id": "",
"format": "",
"metadata_modified": "",
"title": "",
"type": "",
"display_name": "",
"author": "",
"attirbuteCategory": "",
"baseLaw": "",
"publishCategory": "",
@twlca
twlca / tva_organization.json
Created February 8, 2017 09:54
志工隊運用單位及志工隊資料集架構
{ "organizationName": "",
"zip": "",
"county": "",
"address": "",
"organizationId": "",
"orgContactName": "",
"orgContactPhone": "",
"orgContactMobile": "",
"orgContactEmail": "",
"orgAddress": "",
@twlca
twlca / tva_member_data.json
Created February 8, 2017 10:42
會員開放資料
{"id": null,
"organizationName": null,
"orgContactName": null,
"orgAddress": null,
"phone": null,
"fax": null,
"relatedURL": null,
"zip": null,
"orgContactTitle": null,
}