Skip to content

Instantly share code, notes, and snippets.

Avatar

Ira Herman iscott

View GitHub Profile
@iscott
iscott / node_console_repl_shell_for_mongoose.md
Created Aug 10, 2020
How to access your MongoDB in a command-line node shell using mongoose
View node_console_repl_shell_for_mongoose.md

How to access your MongoDB in a command-line node shell using mongoose

To load up a node console where you can access the database:

in terminal, run node then paste in these lines:

require("dotenv").config();
// Connect to mongodb:
require("./config/database");
// Load up our models:
View python_django_command_lines.md

Run Server:

python3 manage.py runserver

Create DB:

createdb

Make migrations:

python3 manage.py makemigrations

Migrate DB:

@iscott
iscott / classroom_culture.md
Created Apr 2, 2020
Classroom culture, intentions, and how to succeed
View classroom_culture.md

Classroom Culture

How to succeed in class:

  • Take initiative.
  • Ask for help.
  • Practice, practice, practice.

Let's all agree to:

  • Treat each other with respect
  • Avoid bringing distractions into class
View rest_crud_chart.md

RESTful Routes to CRUD Mapping

Example resource: posts

HTTP Method
(Verb)
URI (endpoint) CRUD Operation Typical
Controller Action
Has Data
Payload
GET /posts Read all posts index No
GET /posts/:id Read a specific post show No
POST /posts Create a new post create Yes
PUT/PATCH /posts/:id Update specified post update Yes
View git_workflow_cheatsheet.md

Git Workflow CheatSheet

By Ira Herman


Use this workflow when working with teams to take advantage of Pull Requests and keep the master branch clean.

Creating and using your own branch locally:

@iscott
iscott / 01-useState.md
Created Mar 24, 2020
useState hook in React
View 01-useState.md

Hooks: useState

Learning Objectives:

  • Explain what hooks do and how they let us use function components instead of class components.
  • Work with tuples.
  • Practice converting stateful class components to functional components with the useState hook.

🔗Codesandbox Demo

@iscott
iscott / 00-intro-to-hooks.md
Created Mar 24, 2020
Intro to React Hooks
View 00-intro-to-hooks.md

React Hooks

Intro to Hooks

Hooks were introduced in React Version 16.8.

Before hooks, all state needed to be within a Class component. Class components come with a lot of boilerplate, which can feel bulky, especially when dealing with a simpler state. Function components, on the other hand, are generally simpler and easier to read - but, until recently, could not manage their own state: they would receive some props, and return some JSX based on those props.

Hooks introduce state management to Function components, using a simpler and more flexible API. Here's an example of a Class component refactored to be a Function component with hooks:

View django_command_lines_cheatsheet.md

Run Server:

python3 manage.py runserver

Create DB:

createdb <dbname>

Make migrations:

python3 manage.py makemigrations

Migrate DB:

@iscott
iscott / atom_packages.md
Created May 17, 2018
My Recommended Atom Packages and Theme to make Atom a Fully-Featured Editor
View atom_packages.md

Atom Packages & Notes

This document will recommend some of my favorite packages (plugins, add-ons, whatever you want to call them...they're awesome) for the Atom text editor. These give atom many of the features of a full IDE (Integrated Development Environment).

Atom Website

To browse & install packages, (in the menu bar) go to Atom >> Preferences >> Install and search for your desired package. Click install. That's it!

There are links to the package documentation from the Atom site. You can also view instructions on how to use each package from the packages menu Atom >> Preferences >> Packages

@iscott
iscott / Javascript functions and conditionals using (){}, and semicolons.md
Last active Jun 7, 2017
Javascript functions and conditionals using (){}, and semicolons cheatsheet
View Javascript functions and conditionals using (){}, and semicolons.md

Javascript functions and conditionals using (){}, and semicolons

CURLY BRACES:

Curly braces {} almost always indicate a block of code. { means START } means END

Keywords like

You can’t perform that action at this time.