Skip to content

Instantly share code, notes, and snippets.

View drteresavasquez's full-sized avatar
:octocat:
BUILDING

Dr. Teresa Vasquez drteresavasquez

:octocat:
BUILDING
View GitHub Profile
@drteresavasquez
drteresavasquez / next-13-navbar.js
Created October 28, 2023 23:58
Navbar with React-bootstrap and NEXTjs 13
'use client'; // MUST have for
import Link from 'next/link';
import React, { useState } from 'react';
import { Nav, Navbar} from 'react-bootstrap';
import { AiFillEye } from 'react-icons/ai';
import { BsPlayBtnFill, BsInfoCircleFill } from 'react-icons/bs';
import { IoPeopleCircleOutline } from 'react-icons/io5';
import { LuHelpingHand } from 'react-icons/lu';
document.querySelctor('form').addEventListener('submit', (e) => {
e.preventDefault(); // this prevents the form from reloading on submit
console.log("submitted")
// 1. grab the value from the form
const name = document.querySelector("#name").value;
// 2. create a new object with it
const newObj = {
name,
complete: false,
  1. Create your models
    • This is how you define the data stored in the database and how that data is saved
  2. Create your forms (using ModelForm: https://docs.djangoproject.com/en/4.2/topics/forms/modelforms)
  3. Created view
    • This makes the data (aka: context) available to the html template
  4. Create the template that interpolates the data from the view
    • This renders the form
  5. Create a URL that serves the view to users
    • EXAMPLE:
* {
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
}
html,
body {
margin: 0;
padding: 0;
@drteresavasquez
drteresavasquez / get-started-with-storybook.md
Last active May 13, 2023 01:35
Set up a Storybook Project

Get Started

Create a React App

Once the app is created, run:

npx storybook@latest init
@drteresavasquez
drteresavasquez / Counter.js
Created July 12, 2022 01:14
Counter App Example
import React, { useState } from 'react';
import PropTypes from 'prop-types';
export default function Counter({ title }) {
const [value, setValue] = useState(0);
const handleClick = () => {
setValue((prevState) => prevState + 1);
};
@drteresavasquez
drteresavasquez / singleJoke.json
Created May 10, 2022 14:41
Joke API Payloads
{
"formatVersion": 3,
"category": "Programming",
"type": "single",
"joke": "",
"flags": {
"nsfw": false,
"religious": false,
"political": false,
"racist": false,
@drteresavasquez
drteresavasquez / index.html
Last active May 10, 2022 13:15
Button Code
<a target="_blank" class="courseButton" href="https://githubtools.reppedintech.com/u/codetracker-learning/{PLACE REPO NAME HERE}" target="_blank">Copy Repo</a>
@drteresavasquez
drteresavasquez / index.html
Last active May 7, 2022 19:09
Sorting Hat to Webpack
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
// This is an example of making YOUR uid the admin so that you can have access to routes while others who try to login don't have access to provate routes, but you get their info in your database.
const [admin, setAdmin] = useState(null);
const [loggedInUser, setLoggedInUser] = useState(null);
const history = useHistory();
useEffect(() => {
firebase.auth().onAuthStateChanged((authed) => {
if (authed && (authed.uid === process.env.REACT_APP_ADMIN_UID)) {
setAdmin(true);