This file contains 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
WHAT'S WRONG WITH THE CODE? | |
# Write a method that converts an array of ten integers into a phone number in the format "(123) 456-7890". | |
def to_phone_number(arr) | |
chunk_one = arr[0..2].join | |
chunk_two = arr[3..5].join | |
chunk_three = arr[6..9].join | |
"(" + chunk_one + ")" + " " + chunk_two + "-" + chunk_three | |
end |
This file contains 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
function booWho(bool) { | |
// the fastet way to solve this problem | |
return typeof bool==="boolean"; | |
} | |
booWho(null); | |
/* another way to solve it |
This file contains 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
https://codepen.io/AK-47/pen/goVORq |
This file contains 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
class Box extends React.Component{ | |
constructor(props){ | |
super(props) | |
var c = [] | |
for(var i=0; i<100; i++){ | |
c.push( <Cell key={i} id={i} cells={c} /> ) | |
} | |
this.state={cells:c} |
This file contains 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
[ | |
{"_id":1,"title":"Unlocking Android","isbn":"1933988673","publishedDate":{"$date":"2009-04-01T00:00:00.000-0700"},"shortDescription":"Unlocking Android: A Developer's Guide provides concise, hands-on instruction for the Android operating system and development tools. This book teaches important architectural concepts in a straightforward writing style and builds on this with practical and useful examples throughout.","longDescription":"Android is an open source mobile phone platform based on the Linux operating system and developed by the Open Handset Alliance, a consortium of over 30 hardware, software and telecom companies that focus on open standards for mobile devices. Led by search giant, Google, Android is designed to deliver a better and more open and cost effective mobile experience. Unlocking Android: A Developer's Guide provides concise, hands-on instruction for the Android operating system and development tools. This book teaches important architectural concepts in a straightforward writing st |
This file contains 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, {Component} from 'react'; | |
class App extends Component { | |
render() { | |
return ( | |
<h1>Redux Form</h1> | |
) | |
} | |
} | |
export default App; |
This file contains 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, {Component} from 'react'; | |
import {Field, reduxForm} from 'redux-form'; | |
class LoginForm extends Component { | |
render () { | |
const {handleSubmit} = this.props; | |
return ( | |
<form onSubmit={handleSubmit}> | |
<Field |
This file contains 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
mport React, {Component, Fragment} from 'react'; | |
import LoginForm from '../components/LoginForm'; | |
class App extends Component { | |
submit = values => { | |
window.alert (JSON.stringify (values)); | |
}; | |
render () { |
This file contains 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'; | |
export const myInput = props => { | |
return ( | |
<input {...props.input} type={props.type} placeholder={props.placeholder} /> | |
); | |
}; |
This file contains 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 const validate = inputs => { | |
const errors = {}; | |
if (!inputs.username) { | |
errors.username = 'Введите имя пользователя'; | |
} else if (inputs.username !== 'Юрчик') { | |
errors.username = 'Имя пользователя неверно'; | |
} | |
if (!inputs.password) { | |
errors.password = 'Введите ваш пароль'; | |
} |
OlderNewer