Skip to content

Instantly share code, notes, and snippets.

View abel-masila's full-sized avatar
⚛️
Shipping code!

Abel Masila abel-masila

⚛️
Shipping code!
View GitHub Profile
const handleDBReponse = (response) => {
const appointments = response;
const today = moment().startOf("day"); //start of today 12 am
const initialSchedule = {};
initialSchedule[today.format("YYYY-DD-MM")] = true;
const schedule = !appointments.length
? initialSchedule
: appointments.reduce((currentSchedule, appointment) => {
const { slot_date, slot_time } = appointment;
const dateString = moment(slot_date, "YYYY-DD-MM").format("YYYY-DD-MM");
import React, { useState } from "react";
import axios from "axios";
function AddPosts() {
const [formData, setformData] = useState({
post: "",
title: "",
});
const handleChange = (event) => {
setformData({ ...formData, [event.target.name]: event.target.value });
};
import React, { useState, useEffect } from "react";
import axios from "axios";
function ViewPost(props) {
const [post, setPost] = useState({});
const id = props.match.params.id;
//OR const { id } = props.match.params;
useEffect(() => {
axios
.get(`https://jsonplaceholder.typicode.com/posts/${id}`)
.then((response) => {

Yoda Gitflow Workflow.

Develop and Master Branches

Instead of a single master branch, this workflow uses two branches to record the history of the project. The master branch stores the official release history, and the develop branch serves as an integration branch for features.

We already have a master branch for both projects. To create a develop branch, which will only be done once by one of the team members, run:

git checkout -b develop
or
git branch develop
const userA = getUser('existingUser'); // { name: Abel, status: 'lit' }
const userB = getUser('nonExistingUser'); // null
const userAExists = !!userA; // true
const userBExists = !!userB; // false
const x = 'abc'; // Associated with true.
const a = !x; // The ! determines x is associated with true and returns the opposite, false.
const b = !a; // The ! takes value 'a' of false and reverses it to true.
!!'abc' // Evaluates to true.
!!null // Evaluates to false.
const x = true; // Associated with true.
const a = !x; // The returns the opposite of 'x', false.
const b = !a; // The ! takes value 'a' of false and reverses it back to true.
!!true // Evaluates to true.
!!false // Evaluates to false.
function BankAccount(cash) {
this.cash = cash;
this.hasMoney = !!cash;
}
var account = new BankAccount(100.50);
console.log(account.cash); // 100.50
console.log(account.hasMoney); // true
var emptyAccount = new BankAccount(0);
console.log(emptyAccount.cash); // 0
<!DOCTYPE html>
<html>
<head>
<style>
/* Set the size of the div element that contains the map */
#map {
height: 400px; /* The height is 400 pixels */
width: 100%; /* The width is the width of the web page */
}
</style>
@abel-masila
abel-masila / docker-help.md
Created January 20, 2019 17:12 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info