Skip to content

Instantly share code, notes, and snippets.

💭
I love coding

Oyetoke Toby CITGuru

💭
I love coding
Block or report user

Report or block CITGuru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View API.md

API

Authentication

Login

route: /login method: POST

Request Body

@CITGuru
CITGuru / List.js
Created Aug 15, 2019
List Component
View List.js
import React, { useState, useEffect } from "react";
import axios from "axios";
const List = () => {
const url = "https://medrum.herokuapp.com/articles";
const [data, setData] = useState([]);
useEffect(() => {
axios.get(url).then(res => {
setData(res.data);
});
View app.js
const data = [
{name:"Oyetoke Toby", age:20, job_title:"Software Engineer", country:"Nigeria", gender:"male"},
{name:"Apata Dorcas", age:21, job_title:"Makeup Stylist", country:"Nigeria", gender:"female"},
{name:"Jonh Doe", age:22, job_title:"Graphic Designer", country:"US", gender:"male"},
{name:"Leke Oyetoke", age:30, job_title:"IT Manager", country:"Nigeria", gender:"male"},
]
const App =() => {
return (
<div>
View UserInformation.js
import React from 'react'
import PropTypes from 'prop-types'
const UserInformation = props => {
const {
modalOpen,
selected,
setSelected,
setModalState
} = useModalWithData()
View UserDetail.js
import React from 'react'
import PropTypes from 'prop-types'
function UserDetail(props) {
const { data } = props
if (!data) return null
return (
<div>
<h4>Name: {data.name}</h4>
<h4>Age: {data.age}</h4>
View UserTable.js
import React from 'react'
import PropTypes from 'prop-types'
function UserTable(props) {
const { data, setSelected, setModalState } = props
return (
<table>
<thead>
<tr>
View useModalWithData.js
export const useModalWithData = (
initialMode = false,
initialSelected = null
) => {
const [modalOpen, setModalOpen] = useModal(initialMode)
const [selected, setSelected] = useState(initialSelected)
const setModalState = state => {
setModalOpen(state)
if (state === false) {
setSelected(null)
View app.js
const App = ()=>{
const [itemModalOpen, setItemModalOpen, toggleModal] = useModal()
return (
<div className="App">
<button onClick={toggleModal}>Show Modal</button>
<CustomModal
title="Item Modal"
isActive={itemModalOpen}
handleClose={() => setItemModalOpen(false)}
>
View modals.js
import React from 'react'
import PropTypes from 'prop-types'
import {
Modal,
ModalBackground,
ModalContent,
ModalClose,
Title
} from 'bloomer'
View foobarchallenge.go
package main
import "fmt"
/*
In order to destroy Commander Lambda's LAMBCHOP doomsday device, you'll need access to it. But the only door leading to the LAMBCHOP chamber is secured with a unique lock system whose number of passcodes changes daily. Commander Lambda gets a report every day that includes the locks' access codes, but only she knows how to figure out which of several lists contains the access codes. You need to find a way to determine which list contains the access codes once you're ready to go in.
Fortunately, now that you're Commander Lambda's personal assistant, she's confided to you that she made all the access codes "lucky triples" in order to help her better find them in the lists. A "lucky triple" is a tuple (x, y, z) where x divides y and y divides z, such as (1, 2, 4). With that information, you can figure out which list contains the number of access codes that matches the number of locks on the door when you're ready to go in (for example, if there's 5 passcodes, you'd need to find a
You can’t perform that action at this time.