Skip to content

Instantly share code, notes, and snippets.

.bg-slate {
background-color: #4F5D61;
}
const emailList = [
{
id: 234,
author: {
firstName: "Natalie",
lastName: "Childs"
},
to: "Calvin",
message: "Heyyyy",
read: false,
import React from 'react'
export default function CategoryFilter() {
return (
<div style={{ border: "1px solid black", padding: "15px", margin: "15px" }}>
<h3>CategoryFilter Component</h3>
<button>Tell TransactionFilters I'm Set</button>
<button>Tell TransactionFilters I'm Cleared</button>
</div>
)
// https://www.codewars.com/kata/59de469cfc3c492da80000c5/train/javascript
function compress(sentence) {
// Get all the words lower case in an array
const words = sentence.split(" ").map(word => word.toLowerCase());
// Get rid of all the duplicates
const uniqueWords = words.filter( (word, index) => words.indexOf(word) === index );
// Make a string of the position of each word in the non-duplicates array
return words.map(word => uniqueWords.indexOf(word)).join("");
}
body {
margin: 0;
background-color: #fafafa;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.button {
border: 0;
padding: 15px;
background-color: lightgray;
import React from 'react';
import { PropTypes } from 'prop-types';
import { useSelector } from 'react-redux';
/**
* Shows a category name and the number of transactions in that category
* Expects to go inside a <ul> with the class "list-group"
*
* @component
* @example
// Racing
function startRiggedRace(riggedWinner, riggedLoser) {
var racers = [riggedWinner];
// Other ways we could add the rigged Winner
//racers.splice(0, 0, riggedWinner);
//racers.unshift(riggedWinner);
//racers.push(riggedWinner);
// Here's another solution I made previously using some fancy reduce stuff to make me look cool
// https://www.codewars.com/kata/576bb71bbbcf0951d5000044/train/javascript
function countPositivesSumNegatives(input) {
if(!input || input.length === 0) return [];
return input.reduce(
(result, num) => (num > 0) ? [++result[0], result[1]] : [result[0], result[1] + num],
[0, 0]
)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<nav>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="week2.js"></script>