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, | |
completed:false, | |
text: action.text, | |
}; | |
case 'TOGGLE_TODO': | |
if(state.id !== action.id){ |
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
let list = [2,3,1]; | |
const addCounter = (list)=>{ | |
return[...list, 0]; | |
} | |
const removeCounter = (list, index) => { | |
return [ | |
...list.slice(0,index), | |
...list.slice(index+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
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
import React from 'react'; | |
import Footer from './Footer.js'; | |
import Sidebar from './Sidebar.js'; | |
import AllAlbums from './AllAlbums.js'; | |
import SingleAlbum from './SingleAlbum.js' | |
import axios from 'axios'; | |
export default class Main extends React.Component { | |
constructor(props) { | |
super(props); |
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
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! LineTableViewCell | |
let eachLine = subwayDataStore.subwayArrayList[indexPath.row] | |
Optional option 1 : | |
if let iconName = eachLine.letter { | |
cell.iconLabel.image = UIImage(named:iconName.lowercaseString) | |
} | |
Optional option 2 : | |
let imageName = eachLine.letter.map {_ in | |
eachLine.letter!.lowercaseString |
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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
NSArray *germanMakes = @[@"A"]; | |
NSArray * fin = [self sortMidtoFront:germanMakes]; | |
NSLog(@"fin = [%@]",fin); | |
NSLog(@"testing Number is %lu",(unsigned long)[self checkMidNumber:2]); |