Instantly share code, notes, and snippets.

View reactrouter.js
import React, { Component } from 'react'
import { NavLink, Switch, Route } from 'react-router-dom'
import './App.css'
const Navigation = () => (
<NavLink exact activeClassName="current" to="/">Home</NavLink>

React Notes

  • A React component can only return one parent element.
return <h1>Hello</h1><p>World</p>            // error
return <div><h1>Hello</h1><p>World</p></div> // okay 
  • JavaScript expressions can be interpolated in JSX with {}

Roadmap of Web Development

Getting Started

Operating System

What operating system your computer runs on.

  • Mac, Windows, Linux

Pandoc Resources

brew instal pandoc
mkdir pandocking
cd pandocking
pandoc -s -o chapter1.html



PHP Functions

Display PHP errors

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
View .prettierrc
"semi": false,
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"bracketSpacing": true

Build a REST API With Node.js and Express: Connecting a Database

In Part 1: Understanding RESTful APIs, we learned what the REST architecture is, what HTTP request methods and responses are, and how to understand a RESTful API endpoint. In Part 2: How to Set Up an Express API Server, we learned how to build servers with both Node's built in http module and the Express framework, and how to route the app we created to different URL endpoints.

Currently, we're using static data to display user information in the form of a JSON feed when the API endpoint is hit with a GET request. In this tutorial, we're going to set up a MySQL database to store all the data, connect to the database from our Node.js app, and allow the API to use the GET, POST, PUT, and DELETE methods to create a complete API.


Up to this point, we have not used a database to store or manipulate any data, so we're going to set one up. This tutorial will be using MySQL, and if you already have MySQL insta

View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Upload Functions</title>
View .bash_profile
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\$(parse_git_branch)\[\033[m\]\$ "
View git-deploy.bash
read -r -p 'Commit message: ' ${desc} # prompt user for commit message
git add . # track all files
git add -u # track all deleted files
git commit -m "$desc" # commit with message
git push origin master # push to origin
git push production master # push to development server