Skip to content

Instantly share code, notes, and snippets.

function settleMunich () {
const recordedAmountPaidByMaxForAllOfUs = 75 + 150 + 13 + 78 + 45 + 27 + 23 + 39 + 13 + 60 + 96 + 35;
const recordedAmountPaidByMaxForJustJacobAndHimself = 95 + 38+ 1000 + 295;
const notRecordedOrSneakilyPaidForAmount = 140; // ~
const grossTotal = recordedAmountPaidByMaxForAllOfUs + recordedAmountPaidByMaxForJustJacobAndHimself + notRecordedOrSneakilyPaidForAmount;
const amountOwedByAlex = Math.ceil((recordedAmountPaidByMaxForAllOfUs / 3) + (notRecordedOrSneakilyPaidForAmount / 3));
const amountOwedByJacob = Math.ceil((recordedAmountPaidByMaxForAllOfUs / 3) + (notRecordedOrSneakilyPaidForAmount / 3) + (recordedAmountPaidByMaxForJustJacobAndHimself / 2));
'use strict'
function isValidHash (str) {
let count = 0
for (let character of str) {
if (character === '#') count += 1
}
if (count === 0) return true
return count === 1 && str.indexOf('#') === str.length - 1
}
@JacobTheEvans
JacobTheEvans / server.js
Created January 10, 2018 23:47
An example of using async/await is express and mongoose.
const {Router} = require("express");
const todoRouter = Router();
const Todo = require("../models/todo.js");
todoRouter.route("/")
.get(async (req, res) => {
try {
let todos = await Todo.find({});
res.status(200).send({todos});
const express = require("express");
const cors = require("cors");
const path = require("path");
const app = express();
app.use(cors());
app.use(express.static(path.resolve(__dirname, "..", "build")));
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const request = require("request");
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(cors());
@JacobTheEvans
JacobTheEvans / main.py
Created November 8, 2017 18:03
How to gen all strings of a given character range
from string import digits, ascii_uppercase, ascii_lowercase, punctuation
from itertools import product
def gen_possible_strings_without_punctuation(minLength, maxLength):
possibleChars = digits + ascii_uppercase + ascii_lowercase
charsList = list(possibleChars)
result = []
for n in range(minLength, maxLength + 1):
@JacobTheEvans
JacobTheEvans / app.js
Created October 13, 2017 10:50
Callback recipe example
var cookChicken = function(cb) {
console.log("I am cooking the chicken");
setTimeout(function() {
console.log("Chicken is done");
cb();
}, 2000);
}
var cutVeggies = function() {
console.log("I cut the veggies");
@JacobTheEvans
JacobTheEvans / script.js
Created September 7, 2017 20:47
Using base JavaScript to add array of data to page
var menu = [
{
name: "Pizza",
cost: 10,
isGood: true
},
{
name: "Sandwich",
cost: 10,
isGood: true
```index.js```
import React from "react";
import ReactDOM from "react-dom";
//import components
import NameContainer from "./containers/name-container.js";
class App extends React.Component {
render() {
return (

Extra requirements

1. Must have multiple views in angular.

If you can not think of how to do multiple views checkout the guide below.

Guide to views

Home page

View of all posts from your website.

Must be able to click on an item then go to the next view.

Post page

See just that post with a comment section.

About page