- [兩個大神吵架]
但由於code讓我跑起來都還是停留在sync的感覺,但明明感覺async await的語法跟yield應該可以互換才對,我資質愚鈍,只好再看一下官方文件(遺忘好久) 來修改一下。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var boardWidth = 50, | |
| boardHight = 50, | |
| circleArray = new Array(25), | |
| c_canvas, | |
| canvasContext; | |
| function Cell(row, column) { | |
| this.row = row; | |
| this.column = column; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "mapSize":16 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const counter = ( state = 0, action ) => { | |
| switch( action.type ){ | |
| case 'INCREMENT': | |
| return state + 1 ; | |
| case 'DECREMENT': | |
| return state - 1 ; | |
| default: | |
| return state; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { |
OlderNewer