Skip to content

Instantly share code, notes, and snippets.

View sanhuang's full-sized avatar

Taz Huang sanhuang

View GitHub Profile
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}
@sanhuang
sanhuang / gist:ffa97a68ac348e867aa7
Created February 25, 2016 13:04 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
<?php
namespace Personalwork\Auth;
use Phalcon\Events\Event,
Phalcon\Mvc\Dispatcher,
Phalcon\Mvc\User\Plugin;
use Personalwork\Exceptions\AuthExceptions as Exception;
@sanhuang
sanhuang / source_module_forum_forum_image.php
Created September 18, 2016 11:20
WeTalk修改SEO網址作法
dheader('Expires: '.gmdate('D, d M Y H:i:s', TIMESTAMP + 3600).' GMT');
if($attach['remote']) {
$filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
} else {
$filename = DISCUZ_ROOT.$_G['setting']['attachdir'].'forum/'.$attach['attachment'];
// $filename = '/home/wetalk/public_html/data/attachment/forum/'.$attach['attachment'];
}
@sanhuang
sanhuang / README.md
Created September 20, 2016 16:00
PHP套用lib mcrypt做加解密處理方法

從pttnews專案轉移出

使用方式

直接呼叫**encrypt()**進行加密,**decrypt()**進行解密。

// pass-for-check-key
  public $checkval = 'K2Jstudio';
  // chi
  private $password = '2w3e4rr5t62q';
@sanhuang
sanhuang / README.md
Last active September 27, 2016 09:59
紀錄使用classic ASP各種必要技巧
@sanhuang
sanhuang / IndexController.php
Last active September 30, 2016 14:48
透過Phalcon修改Dev-Tools,讓產生model檔案時可以讀入欄位註解,並且於Controllers內取出使用方法
In the Action()
```php
$reflection=$this->annotations->get("[modelclass]");
foreach($reflection->getPropertiesAnnotations() as $key => $collection) {
if( $collection->has('comment') ){
$anno=$collection->get('comment');
var_dump($anno->getArgument(0));
}
@sanhuang
sanhuang / README.md
Last active October 5, 2016 15:31
紀錄如何利用Phalcon\Annotations直接在Action()內處理當下Class的parser註釋

Annotations parser Action() comment of Controller

某一個Contrller範本

/**
 * @module content
 *
 * @buildresource("hello", "world", 1, 2, 3, false, true)
 *
@sanhuang
sanhuang / source::class::cache_class.php
Last active November 11, 2016 04:22
紀錄如何直接調整discuz原生程式對文章內容進行緩存作法!特別針對以文章編號進行目錄分割處理部分可以作為日後程式設計參考。
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: class_cache.php 27449 2014-10-06 17:52 by assassin0905 $
*/
if(!defined('IN_DISCUZ')) {
@sanhuang
sanhuang / README.md
Created November 29, 2016 07:25
繁簡體中文日文韓文的Unicode字元範圍

** 匹配Unicode字符的正則表達式

這裡是幾個主要非英文語系字符範圍(google上找到的):

  • 2E80~33FFh:中日韓符號區。收容康熙字典部首、中日韓輔助部首、注音符號、日本假名、韓文音符,中日韓的符號、標點、帶圈或帶括符文數字、月份,以及日本的假名組合、單位、年號、月份、日期、時間等。
  • 3400~4DFFh:中日韓認同表意文字擴充A區,總計收容6,582個中日韓漢字。
  • 4E00~9FFFh:中日韓認同表意文字區,總計收容20,902個中日韓漢字。
  • A000~A4FFh:彝族文字區,收容中國南方彝族文字和字根。
  • AC00~D7FFh:韓文拼音組合字區,收容以韓文音符拼成的文字。
  • F900~FAFFh:中日韓兼容表意文字區,總計收容302個中日韓漢字。
  • FB00~FFFDh:文字表現形式區,收容組合拉丁文字、希伯來文、阿拉伯文、中日韓直式標點、小符號、半角符號、全角符號等。