Skip to content

Instantly share code, notes, and snippets.

View ymhuang0808's full-sized avatar
🌊
Experiencing in rough sea

YMHuang ymhuang0808

🌊
Experiencing in rough sea
View GitHub Profile
@ymhuang0808
ymhuang0808 / Hands-on-writing-test-with-PHPUnit
Last active August 29, 2015 14:12
第一次用 PHPUnit 寫測試就上手
## 一、什麼是測試?測試的重要性?
開發者在撰寫程式的時候,程式不大可能會沒有問題,所以通常就需要驗證程式的執行是不是符合預期。測試程式能用來驗證程式程式的運作是不是正常的,並發現程式中的錯誤,以增加軟體品質。
下面是一個活動報名的系統:
[![測試活動報名系統](http://blog.fmbase.tw/wp-content/uploads/2014/12/詳細活動-1024x859.png)](http://blog.fmbase.tw/wp-content/uploads/2014/12/詳細活動.png)
這一個活動報名系統主要提供使用者報名活動,在報名活動內還有一些子功能,像是「限制活動報名人數」,如果是這一個子功能,該如何測試呢?
@ymhuang0808
ymhuang0808 / string_hash_benchmark.rb
Last active August 29, 2015 14:17
Benchmark String and Hash in Ruby
require "benchmark"
precomputed_string = "Very long string value"*100
precomputed_symbol = precomputed_string.to_sym
MAP = {
"key1" => true,
:key2 => true,
precomputed_string => true,
precomputed_symbol => true
}
@ymhuang0808
ymhuang0808 / as-osm.geojson
Last active September 6, 2015 06:13
Academia Sinica GeoJSOn Export from OSM
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ymhuang0808
ymhuang0808 / routes.php
Last active December 7, 2015 02:42
JWT-Auth for refreshing token
$api = app('Dingo\Api\Routing\Router');
// Version 1.0
$api->version('v1.0', function ($api) {
// ignore other endpoints
/*
|--------------------------------------------------------------------------
| Refresh token endpoint
|--------------------------------------------------------------------------
@ymhuang0808
ymhuang0808 / error.log
Created December 7, 2015 13:32
Ushahidi Android Login Crash Log
12-04 14:42:14.869 29644-29644/com.ushahidi.platform.mobile.app.internal.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ushahidi.platform.mobile.app.internal.debug, PID: 29644
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:62)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
@ymhuang0808
ymhuang0808 / docker-on-macos.md
Last active October 2, 2016 04:38
Docker on macOS

Diagnose information

Docker for Mac: version: 1.12.1 (2d5b4d9)
OS X: version 10.12 (build: 16A323)
logs: /tmp/E2010294-2643-4695-81A0-4355D20551C6/20160929-174317.tar.gz
[OK]     docker-cli
[OK]     virtualization kern.hv_support
[OK]     menubar
[OK]     moby-syslog
[OK]     dns

Keybase proof

I hereby claim:

  • I am ymhuang0808 on github.
  • I am johnhuang0808 (https://keybase.io/johnhuang0808) on keybase.
  • I have a public key whose fingerprint is 481C 8A42 E5E6 5B94 82CC 23A0 71F4 61BD A920 18CE

To claim this, I am signing this object:

@ymhuang0808
ymhuang0808 / libsodium_alice_bob.php
Last active February 14, 2017 02:59
Simple demo for public-key cryptography by libsodium in PHP
<?php
/**
* Installation: https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-libsodium
* Reference from: https://paragonie.com/book/pecl-libsodium/read/05-publickey-crypto.md
*/
// Alice
$alice_secret = "a9af0bc2b215f9c55734150d296256c8423705d43ddb3823ec99cf4f8fc2d79f";
$alice_public = "e7482479ac9f850248656659ee935e0acda8796cc5354a751f165b93a06e163e";
@ymhuang0808
ymhuang0808 / _blog_style.scss
Last active November 21, 2017 14:39
Main Templates
body {
padding-top: 54px;
}
@media (min-width: 992px) {
body {
padding-top: 56px;
}
}
<form method="POST" action="<!-- URL -->">
<div class="form-group">
<label for="title">標題</label>
<input type="text" class="form-control" id="title" name ="title" placeholder="輸入標題">
</div>
<div class="form-group">
<label for="body">內容</label>
<textarea class="form-control" name="body" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-default">送出</button>