Skip to content

Instantly share code, notes, and snippets.

View eva0919's full-sized avatar

Mike Chen (eva0919) eva0919

View GitHub Profile
@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 / 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 / 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;
}
{
"mapSize":16
}
const counter = ( state = 0, action ) => {
switch( action.type ){
case 'INCREMENT':
return state + 1 ;
case 'DECREMENT':
return state - 1 ;
default:
return state;
}
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) {

前題

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

程式