Skip to content

Instantly share code, notes, and snippets.

Marcus Zierke marcuszierke

View GitHub Profile
View index.js
summarizer = (sum) => {
if (sum === 0) {
return 0;
}
return sum + summarizer(sum - 1);
}
console.log(summarizer(100));
View index.js
const magicNumber = (range) => {
[...Array(range + 1).keys()].map(n => {
const res = n**5 - 5*n**3 + 4*n;
if (res >= 120 && (res % 120 !== 0)) {
return n;
}
})
return 'no number found';
}
@marcuszierke
marcuszierke / contactForm.js
Created Oct 16, 2019
React Contact Form without using state
View contactForm.js
import React, { useState } from 'react';
const ContactForm = () => {
const [newsletterValue, setNewsletterValue] = useState(false);
function changeNewsletterValue() {
setNewsletterValue(!newsletterValue);
}
function handleSubmit(event) {
@marcuszierke
marcuszierke / contactForm2.js
Last active Oct 16, 2019
React Contact Form without using state
View contactForm2.js
import React, { useState } from 'react';
const ContactForm = () => {
const [newsletterValue, setNewsletterValue] = useState(false);
function changeNewsletterValue() {
setNewsletterValue(!newsletterValue);
}
...
@marcuszierke
marcuszierke / contactForm1.js
Created Oct 16, 2019
React Contact Form without using state
View contactForm1.js
import React from 'react';
const ContactForm = () => {
function handleSubmit(event) {
event.preventDefault();
const data = {};
const formElements = Array.from(event.target);
formElements.map(input => (data[input.name] = input.value));
}
View lotto.py
import unittest
def bn(draws=None, balls=None):
#error message for missing input
if draws == None or balls == None: return "Missing Input"
#error message for negative input
if draws < 0 or balls < 0: return "Input has to be a number >= 0"
#error message if draws > balls
if balls<draws: return "Input number for draws has to be <= input number for balls"
#defining the factorial function
@marcuszierke
marcuszierke / ticTacToe.html
Created Oct 31, 2017
Another Free Code Camp challenge to code the Tic Tac Toe game
View ticTacToe.html
<html>
<head>
<meta charset="utf-8">
<title>Free Code Camp - Tic Tac Toe Game</title>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.12/themes/redmond/jquery-ui.css">
<style type="text/css"><
body {
background-color: white;
View simonGame.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>FCC Simon Game</title>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css">
body {
background-color: beige;
@marcuszierke
marcuszierke / twitchTV.html
Last active Oct 19, 2017
Free Code Camp - TwitchTV
View twitchTV.html
<html>
<head>
<meta charset="utf-8">
<title>Twitch.tv - Viewer</title>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css">
<link href="https://fonts.googleapis.com/css?family=Catamaran" rel="stylesheet">
@marcuszierke
marcuszierke / pomodora.html
Last active Oct 21, 2017
Free Code Camp Pomodora Clock
View pomodora.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Free Code Camp Pomodora Clock</title>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<audio id="buzzer" src="http://codingtutorials360.com/14244764.mp3" type="audio/mpeg"></audio>
<audio id="buzzer2" src="paused.wav" type="audio/mpeg"></audio>
<style type="text/css">
You can’t perform that action at this time.