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
ionic platform add android | |
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
this.navCtrl.push(Details); |
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
// Dirty Code | |
const a = Obj1.a | |
const b = Obj1.b | |
const c = Obj1.c | |
//Clean Code | |
const {a,b,c} = Obj1 |
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
// this code will assign Obj1 with an | |
// empty object and put it in Obj2 | |
const Obj2 = Object.assign({}, Obj1) |
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
// Dirty Code | |
const { Obj2 } = this.state | |
Obj2.value = "new value" | |
this.setState({ | |
Obj2 | |
}) | |
// Clean Code | |
this.setState(update(this.state, { |
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
// Clean Code Not West Your Time | |
// It's hard to learn new things like ES6/5 | |
// and use it's features in code | |
// Dirty Codes | |
const myArray = [obj1, obj2, obj3, ..., objn] // your static array | |
const myNewArray = myArray.foreEach(function(elm){ | |
elm.value = elm.value + "new value" | |
}) |
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
// Comments in your code. | |
// Dirty Code | |
function priceFormatter(price, separator = '/') { | |
if (price == null) // return when price is null | |
return '' | |
let tmp_price = [], | |
tmp_c = 1; // initial variables | |
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
// Code DRY | |
// Dirty Code | |
export default App = (props) => { | |
return ( | |
<div className="my-app"> | |
<div className="custom-button"> | |
<span className="icon icon-user"/> | |
<span className="content">Add New Member</span> |
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
// Dirty Code | |
clas MyComponent extends Component { | |
render(){ | |
return 'This is my Class Component' | |
} | |
} | |
// Clean Code | |
const MyComponent = (props) => { |
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
// Dirty Code | |
class MyComponent extends Component { | |
constructor(props) { | |
super(props) | |
this.handleOne = this.handlerOne.bind(this) | |
this.handleTwo = this.handlerTwo.bind(this) | |
this.handleThree = this.handlerThree.bind(this) | |
} |
OlderNewer