Skip to content

Instantly share code, notes, and snippets.

@allen501pc
allen501pc / PHP_Mailer_基本範例.php
Created December 29, 2011 06:41
PHPMailer 基本範例 (含發送附件檔)
<?php
include("class.phpmailer.php"); // 匯入PHPMailer library
$mail= new PHPMailer(); //建立新物件
$mail->IsSMTP(); //設定使用SMTP方式寄信
$mail->SMTPAuth = true; //設定SMTP需要驗證
$mail->SMTPSecure = "ssl"; // Gmail的SMTP主機需要使用SSL連線
$mail->Host = "smtp.gmail.com"; //Gamil的SMTP主機
$mail->Port = 465; //Gamil的SMTP主機的SMTP埠位為465埠。
$mail->CharSet = "utf-8"; //設定郵件編碼,預設UTF-8
@allen501pc
allen501pc / [C++] Multiple key with unique property (implemented by STL:map)
Created January 22, 2010 09:50
Multiple key with unique property (implemented by STL:map)
#include <iostream>
#include <map>
using namespace std;
class object ;
class object
{
public:
static int count;
int value1;
@allen501pc
allen501pc / NewGoogleFormSubmitEmail.js
Created September 15, 2013 08:25
新版的Google表單API範例:寄發Email提醒
/* Gogole Form 專用發送EMail程序 */
function sendMails(e) {
// 取得使用者送出的資料(陣列)
var currentItemResponses = e.response.getItemResponses();
// 注意,每一筆array entry用來表示每個表單的問題與答案。
// 在本範例中,第一個entry是姓名(index 0),第二個entry是EMail (index 1)。
// 我們使用getItem可以獲得提問的問題選項物件,getResponse則是取得該問題的輸入答案。
// 例如index 0的提問選項為「使用者姓名」,而輸入的答案為「Allen」。則可以用以下語法獲得所需資料。
// Logger.log("Question %s = %s", currentItemResponses[0].getItem().getTitle(), currentItemResponses[0].getResponse());
# 程式碼目錄位於src資料夾下
SUBDIRS = src
# 資料文件放在doc資料夾下
docdir = doc
# 說明文件位於README
dist_doc_DATA = README
# 主程式執行檔稱為Add
bin_PROGRAMS = Add
# 主程式執行檔編譯所需程式碼
Add_SOURCES = Add.cpp
# 主程式執行檔連結時,所需load的library
Add_LDADD = -L/usr/local/lib -lcurlpp -lcurl -lstdc++ -L/usr/lib -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lkrb5support -lpthread -lkeyutils -lcom_err -lidn -lssl -lcrypto -lz -lconfig++
# 進行專案初始化,AC_INIT(安裝包名稱或專案名稱, 版本號,[聯絡資訊],[TarName])
AC_INIT([project],[1.0],[allen501pc@gmail.com])
# 程式碼是否存在?
AC_CONFIG_SRCDIR([src/Add.cpp])
# 設定Automake版本最少為1.9
AM_INIT_AUTOMAKE([1.9])
# 確定C++編譯器是否存在
AC_PROG_CXXCPP
AC_PROG_RANLIB
# 以下使用C++ Marco進行確認
@allen501pc
allen501pc / PMA_generate_common_url.php
Created November 12, 2012 06:20
function PMA_generate_common_url ($db = '', $table = '', $delim = '&amp;')
<?php
function PMA_generate_common_url ($db = '', $table = '', $delim = '&amp;')
{
if (is_array($db)) {
$params =& $db;
$delim = empty($table) ? $delim : $table;
$questionmark = '?';
} else {
$params = array();
@allen501pc
allen501pc / global_transform.php
Created October 27, 2012 13:44
Transform all variables of _POST or _GET arries into global variables.
<?php
/*
* Author: Allen ( allen501pc@gmail.com )
* Date: October 27, 2012.
* Description: Transform all variables of _POST or _GET arries into global variables.
* For example, if you want to get a variable from _GET array with index 'regist', you should use $_GET['regist'] to get that.
* Now we use the following transformation codes, then you can just use $regist to get the content.
* Note that the basic idea is from http://goo.gl/Vuxhj
*/
@allen501pc
allen501pc / class_db.php
Created September 29, 2012 06:03
幸運輪盤點名系統
<?php
/* 檔案名稱:class_db.php
* 作者:Jyun-Yao Huang
* 簡述:自行製作的資料庫Object,支援新增、刪除、修改等查詢功能。
*/
// 使用設定檔.
include_once('setting.php');
@allen501pc
allen501pc / initialization_settings.php
Created August 2, 2012 07:42
Initialization of settings for PHP.
<?php
/* Author: Allen (allen501pc@gmail.com)
Brief: Initialization of settings for PHP.
Date: August 2, 2012.
*/
/* 開啟Debug模式 */
define("IS_DEBUG_MODE",1);
if(IS_DEBUG_MODE)
{
/* 初始化環境設定 */