Skip to content

Instantly share code, notes, and snippets.

View eva0919's full-sized avatar

Mike Chen (eva0919) eva0919

View GitHub Profile

前題

  • [兩個大神吵架]      
    但由於code讓我跑起來都還是停留在sync的感覺,但明明感覺async await的語法跟yield應該可以互換才對,我資質愚鈍,只好再看一下官方文件(遺忘好久) 來修改一下。    

程式

const todo = ( state, action) =>{
switch (action.type) {
case 'ADD_TODO':
return {
id: action.id,
text: action.text,
completed: false
};
case 'TOGGLE_TODO':
if (state.id !== action.id) {
const counter = ( state = 0, action ) => {
switch( action.type ){
case 'INCREMENT':
return state + 1 ;
case 'DECREMENT':
return state - 1 ;
default:
return state;
}
{
"mapSize":16
}
@eva0919
eva0919 / game.js
Created September 12, 2015 07:26
Piccollage question#3
var boardWidth = 50,
boardHight = 50,
circleArray = new Array(25),
c_canvas,
canvasContext;
function Cell(row, column) {
this.row = row;
this.column = column;
}
@eva0919
eva0919 / calColemanLiau.rb
Last active September 13, 2015 03:18
Piccollage question#4
def calColemanLiau(block_text)
# Don't know if \n can decide sentence or using .
# Using my own way to avoid those situation
sentenceNumber = getSentenceNumber( block_text )
words = getWords(block_text)
wordsSize = words.size
letterNumber = 0
words.each do |w|
letterNumber += w.gsub(/\W/,"").size
end
@eva0919
eva0919 / goodPoint.rb
Last active September 18, 2015 09:15
Piccollage question#2
def goodPoint(arr)
arrSize = arr.size
tempArr = Array.new(arrSize-1)
tempArr.each_index do |ind|
tempArr[ind] = arr[ind+1] - arr[ind]
end
maxNumber = 0
tempMaxNumber = 0
flag = 0
(0..arrSize-2).each do |i|
@eva0919
eva0919 / firstchar.rb
Created September 11, 2015 11:22
Piccollage question#1
def firstchar(text)
return text.split(" ").map{ |c| c[0] }.reduce(:+)
end
為何一直無法接收到交易成功後的回傳參數?
請確認以下部分:
1.網址的部分,必須使用正式合法的Domain Name,不可使用IP位址。
2.因資安政策的因素,目前port的部分,必須設定為80 或443。
2B432B9057D0439F5C3B357ED8D8B2BA
2/5
6d19c95351f3d23b468036a9352cc86b
2/10
- allALipayCallBack: {PaymentType = ("Alipay_Alipay"); MerchantID = ("1047153"); TradeAmt = ("1425"); TradeNo = ("1502101527144625"); CheckMacValue = ("361FAD9EA40779CDD7A94D123156244C"); SimulatePaid = ("1"); TradeDate = ("2015/02/10 15:27:14"); PaymentDate = ("2015/02/10 15:27:43"); RtnMsg = ("付款成功"); RtnCode = ("1"); PaymentTypeChargeFee = ("0.0000"); MerchantTradeNo = ("hypoOnlieTest5Produc"); }