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 qsort(array) { | |
if (array.length <= 1) { | |
return array; | |
} | |
const left = []; | |
const right = []; | |
const pivot = array.pop(); | |
for (let i = 0; i < array.length; i++) { |
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
service: apt-api | |
# Use the serverless-webpack plugin to transpile ES6 | |
plugins: | |
- serverless-webpack | |
- serverless-offline | |
custom: | |
# Our stage is based on what is passed in when running serverless | |
# commands. Or fallsback to what we have set in the provider section. |
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
state = { | |
vehicles: [{ | |
year: "", | |
make: "", | |
model: "", | |
color: "", | |
licensePlate: "", | |
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
import { Redirect } from 'react-router-dom' | |
// in function or class's render() : | |
const uid = this.props.uid | |
if (!uid) { | |
return <Redirect to='/' /> | |
} | |
// below component class or function | |
const mapStateToProps = (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
class ChildComp extends React.Component { | |
state = { | |
favFlaver: "", | |
} | |
// 2. 요 handleChange 에서 선택된 옵션값을 가져오고 setState! | |
handleChange(event) { | |
this.setState({ favFlaver: event.target.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
const mapStateToProps = (state) => { | |
return { | |
test: state.country | |
} | |
} | |
export default connect(mapStateToProps)(Home) |
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
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin') | |
admin.initializeApp(functions.config().firebase) | |
exports.helloWorld = functions.https.onRequest((request, response) => { | |
response.send("Hello Minjun!"); | |
}); | |
// Both of below lines return firestore database object | |
// admin.firestore() in cloud function |
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
// Component | |
import { compose } from 'redux' | |
import { connect } from 'react-redux' | |
import { firestoreConnect } from 'react-redux-firebase' | |
const mapStateToProps = (state, ownProps) => { | |
return { | |
projects: state.firestore.ordered.projects | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Title</title> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
font-family: arial, sans-serif; |