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 / cronMan.js
Last active September 21, 2019 12:17
Setup all the cron jobs needed by the application
const scheduler = require("./scheduler/scheduler");
const deleteInactives = require("./cron-jobs/deleteInactives");
// schedule the deleteInactive users job
scheduler(10000, deleteInactives);
@cziem
cziem / addUserToDB.js
Created September 21, 2019 13:30
Add users to our database...
const users = [
{
id: 1,
name: "Leanne Graham",
username: "Bret",
email: "[email protected]",
isActive: false,
address: {
street: "Kulas Light",
suite: "Apt. 556",
@cziem
cziem / AddPost.jsx
Created October 2, 2019 14:41
Add a new post
import React, { useQuery } from "react";
const AddPost = () => {
const [postState, setPostState] = useQuery({
title: "",
body: ""
});
const handleChange = e => {
setPostState({ [e.target.name]: e.target.value });
};
return (
@cziem
cziem / useReducer.js
Created October 2, 2019 14:44
Add post using the useReducer
import React, { useReducer } from "react";
const AddPost = () => {
const [postState, setPostState] = useReducer(
(state, newState) => ({ ...state, ...newState }),
{
title: "",
body: ""
}
);
@cziem
cziem / createPost.js
Created October 2, 2019 14:46
Create a new post
import React, { useReducer } from "react";
import { useMutation } from "@apollo/react-hooks";
const AddPost = () => {
const ADD_POST = gql`
mutation(
$authorId: ID!
$title: String!
$body: String
$isPublished: Boolean
) {
@cziem
cziem / main.py
Created October 21, 2019 10:56
main script to get the drone up and running
from src.controller.services.delays import command_delays as delays
from src.controller.services.drone_services import Drone
from time import sleep
import sys
'''
'takeoff', 'land', 'time?', 'speed?',
'''
command_list = ['command', 'battery?']
@cziem
cziem / fly.js
Created October 21, 2019 10:59
Node script to spawn a new child process
const { spawn, exec } = require('child_process')
const drone = spawn('python', ['./src/controller/main.py'])
drone.stdout.pipe(process.stdout)
@cziem
cziem / currencies.js
Created January 28, 2020 09:16
List of Countries, currencies and code
export const countries = [
{
code: "AE",
currency: "AED",
currencyName: "United Arab Emirates Dirham",
name: "United Arab Emirates"
},
{
code: "AF",
currency: "AFN",
@cziem
cziem / index.html
Last active October 8, 2020 11:59
TS Quote generator
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quotifr | Inspirational quotes for your daily start up</title>
<link rel="shortcut icon" href="assets/quote-icon.jpg" type="image/jpg">
<link rel="stylesheet" href="styles/styles.css">
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"
integrity="sha384-SlE991lGASHoBfWbelyBPLsUlwY1GwNDJo3jSJO04KZ33K2bwfV9YBauFfnzvynJ"
@cziem
cziem / styles.css
Created October 5, 2020 00:20
Ts Quote generator styles
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@200;300;400;600&display=swap');
html {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
min-height: 100vh;