目的 | Visual Studio Code | IntelliJ | 補足 |
---|---|---|---|
行複製 | Option + Shift + ↑ or ↓ | Command + D | Option + Shift + ↑ or ↓はIntelliJでは行入れ替えのショートカットキー |
行削除 | Command + Shift + K Command + X ※ ※ Clipbordに登録されるので、Command + Vで貼り付けできる |
Command + Delete | |
行追加※行末にいない状態で追加 | Command + EnterCommand + Shift + Enter ※※ Shiftをつけてると、上に行が追加される | Shif |
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
List<S> dedupe<T, S>(List<S> values, T Function(S) key) { | |
var valuesSet = <T>{}; | |
List<S> results = []; | |
for (var element in values) { | |
if (!valuesSet.contains(key(element))) { | |
valuesSet.add(key(element)); | |
results.add(element); | |
} | |
} | |
return results; |
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
export default createReducer(initialState, { | |
[types.INCREMENT](state) { | |
return Object.assign({}, state, {value: state.value + 1}); | |
}, | |
[types.DECREMENT](state) { | |
return Object.assign({}, state, {value: state.value - 1}); | |
}, | |
}); |
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
import { createStore } from 'redux'; | |
import rootReducer from '../reducers'; | |
export default function configureStore(initialState) { | |
const store = createStore( | |
rootReducer, | |
initialState, | |
); | |
return store; | |
} |
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
// handersには(state, action) => stateのreducerが渡される | |
export function createReducer(initialState: Object, handlers: Object): Function { | |
return function reducer(state: Object = initialState, action: Object): Object { | |
if ({}.hasOwnProperty.call(handlers, action.type)) { | |
// [ ]はaction.typeをKeyにしたreducerを返却 | |
return handlers[action.type](state, action); | |
} | |
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
import { createStore } from 'redux'; | |
import rootReducer from '../reducers'; | |
export default function configureStore(initialState) { | |
const store = createStore( | |
rootReducer, | |
initialState, | |
); | |
return store; | |
} |