Skip to content

Instantly share code, notes, and snippets.

View yyc1217's full-sized avatar

Yeh-Yung Chang yyc1217

  • Taoyuan, Taiwan
View GitHub Profile
@yyc1217
yyc1217 / 0-description.md
Last active October 20, 2016 08:20
Trying to fix garbled filename in Laravel middleware.

If the filename is not in english, sometimes you user will get a confused filename when they trying to download files by IE browsers, this Laravel middleware can help you correct filename in middleware lavel.

如果你的檔案不是英文檔名,在用IE瀏覽器下載時,檔名會變成亂碼,這個middleware是用來解決這個問題的

Dependencies:

@yyc1217
yyc1217 / 1.origin.json
Last active December 8, 2015 13:36
行政單位api回傳範例
/* Before */
{
"unitCode" : "T400",
"chineseName" : "管理學院",
"englishName" : "College of Management",
"shortName" : "管理學院",
"fullName" : "管理學院",
"url" : "http://www.mgt.ncu.edu.tw",
"location" : {
"lat" : 24.970128,
@yyc1217
yyc1217 / Apache Usergrid 1.0 install on CentOS 7
Last active December 7, 2016 15:34
Apache Usergrid 1.0 install on CentOS 7
# 以下假設帳號有sudo的權限
# *************************
# 安裝 JDK 7 (8會有問題)
# *************************
# 切換資料夾
cd /opt
# 下載 jdk 7 可以依自己需求更改版本
Integer i = new Integer (100);
Integer p = new Integer(100);
if(i==p) System.out.println("i and p are the same object");
if(i.equals(p)) System.out.println(" i and p contain the same value");
//Output:
// i and p contain the same value
Integer i = 100;
Integer p = 100;
if (i == p) System.out.println("i and p are the same.");
if (i != p) System.out.println("i and p are different.");
if(i.equals(p)) System.out.println("i and p contain the same value.");
//Output:
// i and p are the same.
// i and p contain the same value.
@yyc1217
yyc1217 / gist:3856443
Last active July 24, 2023 08:31
身分證字號與居留證(統一證)編號檢核程式碼
/*******************************************************************************
* Copyright (c) 2012 Yeh-Yung Chang
* All rights reserved.
* http://experimentrecord.blogspot.tw
*******************************************************************************/
import java.util.Arrays;
public boolean isValidIDorRCNumber(String str) {
@yyc1217
yyc1217 / JavaScript
Created August 9, 2012 01:42
用jQuery動態地從其他檔案載入所需的欄位
$('document').ready(function(){
//欲載入的目標table
var destTable = $('#destTable');
//暫存的table
var tempTable = $('<table id="tempTable"></table>');
//載入外部檔案中的table至暫存的table,並在.load的callback中處理
tempTable.load('src.Html #all tr', function(data){
@yyc1217
yyc1217 / HTML
Created August 9, 2012 01:36
用jQuery動態地從其他檔案載入所需的欄位
<table id="all">
<tr>
<th>Row 1</th>
<td>Content 1</td>
</tr>
<tr>
<th>Row 2</th>
<td>Content 2</td>
</tr>
<tr>