Skip to content

Instantly share code, notes, and snippets.

View leslie-alldridge's full-sized avatar
😺
Coding with my cat - Looking for React / Python projects to contribute to.

Leslie Alldridge leslie-alldridge

😺
Coding with my cat - Looking for React / Python projects to contribute to.
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page title (goes in the tab on the browser)</title>
</head>
<body>
</body>
@leslie-alldridge
leslie-alldridge / restful.html
Created June 19, 2018 06:28
RESTful routing
<!DOCTYPE html>
<html>
<head>
<title>RESTful Routes</title>
<!-- <link rel="stylesheet" type="text/css" href="bootstrap.css"> -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
@leslie-alldridge
leslie-alldridge / revert git
Created June 24, 2018 08:05
revert to old commit
git revert --no-commit "entercommithashherewithout"""..HEAD
*** directories ***
pwd - display path of current working directory.
cd - current directory
ls - list all files
cd .. - up a directory
mkdir - make new directory
***
clear - clear window
const obj = faves.reduce((acc, entry, i, arr) => {
if (!acc.hasOwnProperty(entry.id)) acc[entry.id] = entry
return acc
}, {})
const noDupes = Object.keys(obj).map(key => obj[key])
import React from 'react'
import Job from './Job'
export default class JobDetail extends React.Component {
constructor (props) {
super(props)
this.state = {
showJobId: null,
data: this.props.data
addInventory (viewListID) {
console.log('hit');
this.setState(prevState => ({
viewListID: prevState.viewListID == viewListID ? null : viewListID
}));
}
{this.state.viewListID == bag.id && <BagList key={bag.id} id = {bag.id} description={bag.description} destination={bag.destination}/>}
this.setState(prevState => ({
check: !prevState.check
}));
//this function will return multiple functions (actions) to props. That's why it's named map dispatch to props.
//Dispatch is a way to say "go and do this thing for me"
//
//Using this code in react will allow us to say
//this.props.deleteBagDB(id), this.props.showItems(id), this.props.getBags()
//
//Remember: Import these action functions into your component first.
function mapDispatchToProps(dispatch) {
//all func below this line are for deleting a bag
//this function will tell our react front end to wait, while we go and fetch a bag. You can use something like
//if (this.props.isFetching == true) {display a loading spinner}
//this action will display in Redux dev tools as 'BAG_DEL_REQ' with it's relevant information.
function deleteReqBag(id) {
return {
type: "BAG_DEL_REQ",