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
// example HTML | |
<div class="container"> | |
<div data-example="100"> | |
<div class="some-div"> | |
<span>Some text</span> | |
</div> | |
</div> | |
<div data-example="200"> | |
<div class="some-div"> | |
<span>Some text</span> |
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 foo = (() => { | |
const bar = str => str.split(''); | |
return { | |
bar | |
} | |
})(); |
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
function Hand() { | |
this.cards = []; | |
this.score = function () { | |
var i; | |
var total = 0; | |
for (i = 0; i < this.cards.length; i++) { | |
if (this.cards[i].rank === "A") { | |
total++; |
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
// Option 1 (wrong) | |
function superclass() {this.stuff="stuff";} | |
function subclass(superclass) {} | |
// Option 2 (wrong) | |
function superclass() {this.stuff="stuff";} | |
function subclass() {subclass.prototype = new superclass();} | |
// Option 3 (the option that I chose) - wrong | |
function superclass() {this.stuff="stuff";} |
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
// bad? | |
function foo() {this.stuff="stuff";} | |
var bar = new foo(); | |
// good... | |
function foo() {this.stuff="stuff";} | |
function bar() {} | |
bar.prototype = new foo(); |
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 mockData = { message: 'Welcome!' }; | |
const controllers = { | |
createOne(model, body) { | |
return Promise.resolve(mockData); | |
}, | |
updateOne(documentToUpdate, update) { | |
return Promise.resolve(mockData); | |
}, | |
deleteOne(documentToDelete) { |
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
function ready(fn) { | |
if ( | |
if (document.attachEvent) { | |
document.readyState === 'complete' ; | |
} else { | |
document.readyState === 'loading'; | |
} | |
){ | |
fn(); | |
} else { |
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
function ready(fn) { | |
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){ | |
fn(); | |
} else { | |
document.addEventListener('DOMContentLoaded', fn); | |
} | |
} |
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 Task from './Task'; | |
import PropTypes from 'prop-types'; | |
class TaskList extends React.Component { | |
// eslint-disable-next-line react/sort-comp | |
constructor(props) { | |
super(props); | |
TaskList.updateStatus = TaskList.updateStatus.bind(this); |
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
Blah.propTypes = { | |
someObj = { | |
name: PropTypes.string, | |
age: PropTypes.number | |
} | |
} |