Skip to content

Instantly share code, notes, and snippets.

View mingtsay's full-sized avatar
🇹🇼

Ming Tsay mingtsay

🇹🇼
View GitHub Profile
@mingtsay
mingtsay / mt.gettext.php
Created April 30, 2011 14:36
mt's gettext
<?php
/**
* Define: FILE_ROOT_PATH
* Set Value: $lang
* Create an ini file: i18n/lang.ini
* Call function: _gettext("Homepage") or someelse string
**/
function _gettext($text) {
global $lang;
$langs = parse_ini_file(FILE_ROOT_PATH . "i18n/lang.ini", true);
@mingtsay
mingtsay / dataurl.php
Created May 1, 2011 05:59
Data URL Praser
<?php
# Demo: http://mt.aa.am/dataurl.php
# data:[<MIME-type>][;charset=<encoding>][;base64],<data>
if(isset($_GET['uri']) || isset($_POST['uri']) || isset($_GET['file'])) {
if(isset($_GET['uri'])) $uri = $_GET['uri'];
else if(isset($_POST['uri'])) $uri = $_POST['uri'];
else if(isset($_GET['file'])) {
$file = $_GET['file'];
if(!(strtolower(substr($file, 0, 7)) == "http://" || strtolower(substr($file, 0, 8)) == "https://"))
@mingtsay
mingtsay / f.vbp
Created May 1, 2011 11:03
vb.net function check name
function 檢查姓名(byval 姓名 as string) as boolean
dim 檢查 as boolean
for i as integer = 1 to len(姓名)
檢查 = false
select case lcase(mid(姓名, i, 1))
case "0"
case "1"
case "2"
case "3"
case "4"
@mingtsay
mingtsay / chatroom.php
Created May 19, 2011 14:48
mt's Chatroom
<?php
$cls = true;
$use_same_db = false;
$old = true;
define("MT_TIMEOUT", 10);
function video_id($url) {
$parse_url = parse_url($url);
$query = array();
@mingtsay
mingtsay / .0
Created May 21, 2011 09:54
[PHP] l18n/i10n Language
Open Source
You can use these code if you want to.
Please note that it is not allowed to use on commercial.
<html>
<center>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>註冊 - 網址方盒 - 為縮短網址而誕生的網站!!</title>
<script src="/js/jquery.js" type="text/javascript"></script>
<script src="/js/jquery.validate.js" type="text/javascript"></script>
<script src="/js/cmxforms.js" type="text/javascript"></script>
<script src="/js/load.js" type="text/javascript"></script>
<link rel="shortcut icon" href="/favicon.ico">
@mingtsay
mingtsay / maze.c
Created February 3, 2012 16:42
解迷宮
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
void loadmap(char *, int **, int *, int *, int *, int *);
void gomap(int *, int *, int *, int, int, int);
void backmap(int *, int *, int *, int *, int, int);
int summap(int *, int);
@mingtsay
mingtsay / 巴斯卡.c
Created February 4, 2012 04:26
巴斯卡三角形C語言範例
#include <stdio.h>
#include <stdlib.h>
void p(double *);
int main()
{
int n; //層數
int i, j; //迴圈用變數
double d[500];
@mingtsay
mingtsay / led.c
Created February 10, 2012 13:36
LED控制
#include <AT89X51.H>
#include <stdio.h>
void delay(int ms);
main()
{
int i = 0;
int btnL, btnR;