Skip to content

Instantly share code, notes, and snippets.

@allen501pc
allen501pc / NewGoogleFormSubmitEmail.js
Created Sep 15, 2013
新版的Google表單API範例:寄發Email提醒
View NewGoogleFormSubmitEmail.js
/* 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());
View src.makefile.am.sh
# 主程式執行檔稱為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++
View project.makefile.am.sh
# 程式碼目錄位於src資料夾下
SUBDIRS = src
# 資料文件放在doc資料夾下
docdir = doc
# 說明文件位於README
dist_doc_DATA = README
View configure.ac.sh
# 進行專案初始化,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 Nov 12, 2012
function PMA_generate_common_url ($db = '', $table = '', $delim = '&')
View PMA_generate_common_url.php
<?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 Oct 27, 2012
Transform all variables of _POST or _GET arries into global variables.
View global_transform.php
<?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 Sep 29, 2012
幸運輪盤點名系統
View class_db.php
<?php
/* 檔案名稱:class_db.php
* 作者:Jyun-Yao Huang
* 簡述:自行製作的資料庫Object,支援新增、刪除、修改等查詢功能。
*/
// 使用設定檔.
include_once('setting.php');
@allen501pc
allen501pc / initialization_settings.php
Created Aug 2, 2012
Initialization of settings for PHP.
View initialization_settings.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)
{
/* 初始化環境設定 */
@allen501pc
allen501pc / POP3NCHU.php
Created Jun 18, 2012
POP3 Authentication for NCHU.
View POP3NCHU.php
<?php
/* Program: Authenticate E-Mail for NCHU by POP3
* Author: Jyun-Yao Huang (Allen, allen501pc@gmail.com)
* Date: 18th June, 2012
*/
list($user,$domain) = @explode("@",$_POST['email']);
//list($user,$domain) = @explode("@","your @mail.nchu.edu.tw here");
$answer="";
@allen501pc
allen501pc / demo_picture.php
Created May 5, 2012
Show the encrypted url picture.
View demo_picture.php
<?php
$EncUrl = ImageURLEncryption("http://l.yimg.com/f/i/tw/hp/mh/09purple.gif","picture");
/* 例如我要隱藏上面的圖片URL,透過Mask = "picture",來加密,因此$EncUrl輸出結果為
aEB0RjpML1guTmkMZxdjDG0WZhtpFnQUL1BwHG1bLwA5RHVEcA9lGmdeZg==
*/
/* 以下藉由demo_picture.php 來展示圖檔 */
$Type = @$_GET['type'];
$ResourceID = @$_GET['resource_id'];