Skip to content

Instantly share code, notes, and snippets.

HTTP and Node.js

Objectives

By the end of this lesson, you should be able to...

  • Explain what an HTTP server is
  • Explain why an HTTP server is useful
  • Explain what an HTTP request is
  • Explain what an HTTP response is
  • Create a Node.js HTTP server with the http module
@MrJadaml
MrJadaml / steps.md
Created February 21, 2017 16:36
Hello Vim

Steps

Part 1: Setup

  • create new dir basic-vim and cd into it: take basic-vim
  • create new file touch foo.js
  • initilize a git repo git init
  • add some code to the foo file
const hello = (name) => {
  const greet = `Well hello there, ${name}`;
@MrJadaml
MrJadaml / Address.jsx
Last active February 8, 2017 21:25
styled-components module structure
import React from 'react';
import { Input, Select, Option, Label } from '../assets/styled-components/forms.js';
class Address extends React.Component {
render() {
return (
<section>
<h3>Address Component</h3>
<Label fullwidth >Street 1:
<Input type="text" fullwidth />
@MrJadaml
MrJadaml / mac-maker.md
Last active November 20, 2016 23:06
Initial notes for the items that will be rolled into a development environment build script.

Packages/bins

  • npm
  • node.js
  • ohmyzsh
  • Brew
  • awscli
  • httpie
  • postgresql
  • tmux

We are describing some scenarios that involve tapping into the component lifecycle:

  • You want to make a request to fetch the user's orders when you are ready to display the orders table (a component).
  • You want to detect when a search field has changed to trigger a new search request.
  • You are filtering a set of cities in the United States based on search in your render method. For performance reasons, you only want to render when the search field has changed.
  • You want to display a new flashcard on the screen but you want to use a CSS transition to make what's currently there fade out.
  • You need to initialize a UI component from a third party (think Materialize, chart.js, d3) once it is loaded.
@MrJadaml
MrJadaml / react-router-v4.md
Last active February 26, 2017 18:58
React Router has undergone a rewrite for version 4. This is a short walkthrough on getting going with v4.

Objectives

  • What is React Router v4
  • Explain what the BrowserRouter component is for
  • Explain what the Link component is for
  • Explain what Router and Miss components are for

React Router v4

@MrJadaml
MrJadaml / all-props.json
Last active December 16, 2016 00:15
Organization of USDA plants data. WIP
[
[
"usdaplants_table",
"characteristics_20160713_table",
"usda_plants_20160713_table"
], [
"id",
"betydb.species.id",
"Genus",
"Species",
(function() {
'use strict';
const server = 'https://galvanize-todos.herokuapp.com/is-persons';
const app = angular.module('todoApp');
app.controller('PeopleCtrl', PeopleCtrl);
app.controller('PersonCtrl', PersonCtrl);
app.controller('TodoListCtrl', TodoListCtrl);
WARN engine [email protected]: wanted: {"node":"^0.10.3 || ^0.12.0"} (current: {"node":"4.2.6","npm":"2.14.12"})
-
> [email protected] install /Users/Jadam/.nvm/versions/node/v4.2.6/lib/node_modules/t2-cli/node_modules/usb
> node-pre-gyp install --fallback-to-build
[usb] Success: "/Users/Jadam/.nvm/versions/node/v4.2.6/lib/node_modules/t2-cli/node_modules/usb/src/binding/usb_bindings.node" is installed via remote
/Users/Jadam/.nvm/versions/node/v4.2.6/bin/t2 -> /Users/Jadam/.nvm/versions/node/v4.2.6/lib/node_modules/t2-cli/bin/tessel-2.js
> [email protected] postinstall /Users/Jadam/.nvm/versions/node/v4.2.6/lib/node_modules/t2-cli
> t2 install-drivers || true
1. \dt
2. \du
3. SELECT * FROM owners;
4. SELECT name FROM owners;
5. SELECT age FROM owners ORDER BY age ASC;
6. SELECT * FROM owners WHERE name = 'Donald';
7. SELECT * FROM owners WHERE age > 30;
8. SELECT * FROM owners WHERE name LIKE 'E%';
9. INSERT INTO owners (name, age) VALUES ('John',33);
10. INSERT INTO owners (name, age) VALUES ('Jane',43);