Skip to content

Instantly share code, notes, and snippets.

// https://www.codewars.com/kata/52fba66badcd10859f00097e/train/javascript
const VOWELS = "aeiouAEIOU"
function isNotVowel(letter) {
//const lowerLetter = letter.toLowerCase()
return !VOWELS.includes(letter)
// return lowerLetter !== "a" && lowerLetter !== "e"
// && lowerLetter !== "i" && lowerLetter !== "o"
// && lowerLetter !== "u"
import React, { useEffect, useState } from 'react'
const fetchAllTasks = async () => {
try {
const response = await fetch("/api/tasks");
// Check if the server successfully responded but the response says something went wrong
if(!response.ok) {
// You could return a nicer error message here instead of just null
return null;
import { useState, useEffect, useRef } from 'react';
import { Card, CardImg, CardText, CardBody, CardTitle } from 'reactstrap';
import { useSpring, animated } from 'react-spring';
const AnimatedDisplayCard = ({ item }) => {
const { image, name, description } = item;
// Set up some animation pieces of state
const [toggle, setToggle] = useState(false);
const [opacity, setOpacity] = useState(1);
.bg-slate {
background-color: #4F5D61;
}
.bg-image-chair {
background-image: url("images/chair.jpg");
background-size: cover;
}
.height-500 {
function feast(beast, dish) {
return beast[beast.length - 1] === dish[dish.length - 1] && beast[0] === dish[0]
}
import React, { useEffect, useState } from 'react'
// Note: This function could be combined with the refreshTasks function
const fetchAllTasks = async () => {
// Get the response
const response = await fetch("/api/tasks");
// Parse the data from the response
const data = await response.json();
// Handle how Mirage.js packages up the response
return data.tasks;
function countPositivesSumNegatives(input) {
// check for empty array or null
if(input === null || input.length === 0) {
return [];
}
// get the positive numbers
const positiveNumbers = input.filter(number => number > 0)
// count how many
const countOfPositive = positiveNumbers.length;
function pillars(numPill, dist, width) {
if(numPill === 1) {
return 0;
}
return ((numPill - 1) * dist * 100) + ((numPill - 2) * width);
}
// [ ] [ ]
class Elevator {
constructor(capacity) {
this.capacity = capacity;
this.numPeopleInside = 0;
this.nextFloor = 0;
}
goToNextFloor() {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>THIS GOES IN THE TOP BAR</title>
</head>
<body>
<!-- <div>
This is a heading
</div>