Skip to content

Instantly share code, notes, and snippets.

View cziem's full-sized avatar
:octocat:
Coding

Favour George C cziem

:octocat:
Coding
View GitHub Profile
@cziem
cziem / contact-us.scss
Created September 13, 2018 17:44
Contact Us Section
.contact_us {
display: flex;
height: auto;
background: #1d1e22;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}
.contact_us h3 {
@cziem
cziem / mocha-test.js
Created September 15, 2018 22:59
Testing with Mocha
const assert = require('assert');
const { add, substract, divide, multiply, validateNumbers } = require('./operations')
it ('correctly calculates the sum of 1 and 3', () => {
assert.equal(add(1, 3), 4);
})
it ('correctly calculates the difference of 33 and 3', () => {
assert.equal(substract(33, 3), 30);
})
@cziem
cziem / operations.js
Created September 15, 2018 23:01
Operations.js
const add = (x, y) => (+x) + (+y);
const substract = (x, y) => (+x) - (+y);
const multiply = (x, y) => (+x) * (+y);
const divide = (x, y) => (+x) / (+y);
const validateNumbers = (x, y) => {
if (isNaN(x) || isNaN(y)) {
return false;
}
return true
@cziem
cziem / calc.js
Created September 15, 2018 23:03
Calc file
const assert = require('assert');
const { add, substract, divide, multiply, validateNumbers } = require('./operations')
it ('correctly calculates the sum of 1 and 3', () => {
assert.equal(add(1, 3), 4);
})
it ('correctly calculates the difference of 33 and 3', () => {
assert.equal(substract(33, 3), 30);
})
@cziem
cziem / eslintrc.json
Created November 3, 2018 14:43
eslintrc configurations
{
"extends": [
"eslint:recommended"
],
"plugins": [
"react",
"jsx-a11y",
"import"
],
"parserOptions": {
@cziem
cziem / webpack.config.js
Created November 3, 2018 21:29
webpack custom configuration for mern stack application
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: "./client/src/index.js",
output: {
path: path.resolve(__dirname, "./dist"),
filename: "index-bundle.js"
},
module: {
@cziem
cziem / server.js
Created November 4, 2018 23:26
minimal setup for the server.js
const express = require('express')
const bodyParser = require('body-parser')
const mongoose = require('mongoose')
const cors = require('cors')
require('dotenv').config()
const app = express()
const port = process.env.PORT || 5000
// Connect to the database
@cziem
cziem / default.js
Created November 4, 2018 23:28
a default route
const express = require('express')
const router = express.Router()
// create a route for default endpoint
router.get('/', (req, res) => {
 res.json({
 message: 'Welcome to the server-side'
 })
})
@cziem
cziem / server.js
Created November 4, 2018 23:30
updated server.js file
const express = require('express')
const bodyParser = require('body-parser')
const mongoose = require('mongoose')
const cors = require('cors')
require('dotenv').config()
// import routes
const default = require('./routes/welcome')
const app = express()
const port = process.env.PORT || 5000
@cziem
cziem / sticky_navbar.html
Created November 11, 2018 21:58
Starter code for the sticky navbar
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Sticky Navbar</title>
</head>
<body>