Skip to content

Instantly share code, notes, and snippets.

View nathleia's full-sized avatar

paul altefogt nathleia

  • nathleia llc
View GitHub Profile
// ------------App Component ------------------------
import React, { useState } from "react";
import ClickTimes from "./ClickTimes";
import TimestampsDisplay from "./TimestampsDisplay";
function App() {
// this line is creating some state "stuff"
// it makes a variable called timestamps and initializes it to an empty array
// it also creates a function setTimestamps that will allow us to update the
// variable timestamps
const webhookCallbackUrl = `${process.env.SIGN_NOW_WEBHOOK_CALLBACK_URL}/api/sign-now/${dataType}/${dataItemId}/pdf`;
// create document signed webhook
await createSigningCompleteWebhook(authToken, documentId, webhookCallbackUrl);
// create signing declined webhook
await createSigningDeclinedWebhook(
signNowApi,
authToken,
documentId,
webhookCallbackUrl
function showHelpOptions(optionsArray) {
let optionString = "Enter a keyword for help with a topic: "
optionString += optionsArray.join(', ')
optionString += '.'
return optionString;
}
import React from "react";
import Header from "./Header";
import HobbyList from "./HobbyList";
import Activity from "./Activity";
function App() {
const name = "Kitty Kat";
const birthday = "January 1";
const imageSrc =
"https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg";
import React from "react";
import "./HobbyList.css";
function HobbyList(props) {
const { hobbies } = props;
const listItems = hobbies.map((hobby, index) => <li key={index}>{hobby}</li>);
if (listItems.length > 0) {
return (
<div>
<h4>Hobbies</h4>
const create = (req, res) => {
const knex = req.app.get("db");
const newScience = {
name: req.body.name,
description: req.body.description,
}
knex("sciences")
.insert(newScience)
.returning("*")
.then((createdRecords) => createdRecords[0])
const create = (req, res) => {
const knex = req.app.get("db");
const newScience = {
name: req.body.name,
description: req.body.description,
}
knex("sciences")
.insert(newScience).returning("*")
.then((createdRecords) => {
const newRecord = createdRecords[0];
import React, { useEffect, useState } from "react";
import PostDetail from "./PostDetail";
function App() {
const [posts, setPosts] = useState([]);
const [comments, setComments] = useState([]);
const [currentId, setCurrentId] = useState(1);
const onClickPost = async (post) => {
console.log('POST CLICKED');
function getMostPopularAuthors(books, authors) {
// we are going to use reduce to get an array of objects that have
const authorList = books.reduce((acc, book) => {
// grab the authorId and borrows array
const { authorId, borrows } = book;
// get the authorObj
const authorObj = authors.find(author => author.id === authorId);
// TODO: return an array of users from /users in form of { data: Array }
app.use('/users', (req, res, next) => {
// we don't need to get anything from the request
// because this endpoint just automatically returns
// the list of users
// const { users } = req.params
// it wants the response data to look like this
// an object with a 'data' property that contains the user list
const response = {