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 / bookr.css
Created January 30, 2019 20:53
Style rules for the Bookr application built with GraphQL and Apollo Client
@import url('https://fonts.googleapis.com/css?family=Nunito');
* {
margin: 0;
padding: 0;
}
body {
background: #eee;
font-family: 'Nunito', sans-serif;
@cziem
cziem / old-way.html
Created April 10, 2019 09:10
Old way
<!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" />
<title>CSS Flexbox : It's all in the box (part 1)</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
@cziem
cziem / settings.json
Last active June 13, 2019 14:58
Setup your vscode with stylish fonts
{
"files.autoSave": "onFocusChange",
"editor.tabSize": 2,
"editor.multiCursorModifier": "ctrlCmd",
"editor.wordWrap": "on",
"editor.fontFamily": "Fira Code iScript",
"editor.fontLigatures": true,
"terminal.integrated.fontFamily": "'Fira Code iScript'",
"emmet.includeLanguages": {
"ejs": "html",
@cziem
cziem / payCard.html
Last active July 15, 2019 16:53
PayCard Functionality
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-eqX-UA-Compatible content="ie=edge" />
<title>Mini App</title>
<style>
body {
margin: 0;
@cziem
cziem / vscode-settings.json
Created July 25, 2019 14:45
My VsCode Settings
{
"files.autoSave": "onFocusChange",
"editor.tabSize": 2,
"editor.multiCursorModifier": "ctrlCmd",
"editor.wordWrap": "on",
"editor.fontFamily": "Fira Code iScript",
"editor.fontLigatures": true,
"terminal.integrated.fontFamily": "'Fira Code iScript'",
"emmet.includeLanguages": {
"ejs": "html",
@cziem
cziem / handler.js
Created August 17, 2019 12:48
contrived example of working with mongoose populate
const { Post, Author } = require('./models/post.schema')
const { Poem, User } = require('./models/poem.schema')
// Then for the post, you can run a mongoose populate like so...
const getPosts = async (req, res) => await Post.find({}).populate('author')
// Then for the poem, you want to run a mongoose populate like so...
const getPoems = async (req, res) => await Poem.find({}).populate({
path: 'author',
model: 'User'
@cziem
cziem / config.json
Created September 6, 2019 21:05
configuration example values
{
"test": {
"SECRET_KEY": "yOUrsEkretKey",
"MONGODB_URI_OFFLINE": "mongodb://localhost:27017/goals",
"PORT": 4400,
"SALT_ROUND": 15,
"BASE_URL": "http://localhost:3000",
"SSL_PORT": 4040,
"SENDER_EMAIL": "sales@goals-now.com",
"SENDER_PASS": "21b-19f318b0",
@cziem
cziem / index.js
Created September 21, 2019 09:47
Setup the an express server
const express = require("express");
const mongoose = require("mongoose");
const port = process.env.PORT || 4000;
const uri = process.env.MONGODB_URI;
const options = {
useCreateIndex: true,
useNewUrlParser: true,
useFindAndModify: false,
@cziem
cziem / scheduler.js
Last active September 21, 2019 11:43
The scheduler fuction
const scheduler = (timer, action) => {
setInterval(action, timer)
}
process.nextTick(() => scheduler);
module.exports = scheduler
@cziem
cziem / deleteInactives.js
Last active September 21, 2019 12:03
Deletes all inactive users from the DB
const User = require("../../models/user.schema");
const deleteInactives = async () => {
const deletedUsers = await User.deleteMany({ isActive: false });
if (deletedUsers.ok === 1) {
let verb = deletedUsers.n > 1 ? "users" : "user";
console.log(`${deletedUsers.deletedCount} Inactive ${verb} deleted`);
} else {
return "Error deleting users";