Skip to content

Instantly share code, notes, and snippets.

View adeleke5140's full-sized avatar
💭
crafting software

Kenny adeleke5140

💭
crafting software
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adeleke5140
adeleke5140 / HelloWorld.sol
Last active April 21, 2022 20:14
Hello World smart contract
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
contract HelloWorld{
function storeNumber() pure internal returns (uint myNumber) {
myNumber = 5;
}
function retrieveNumber() pure public returns (uint myNum_){
myNum_ = storeNumber();
@adeleke5140
adeleke5140 / Ballot.sol
Created April 21, 2022 23:50
Revert Ballot once the 5min Ballot time is exceeded
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
contract Ballot {
struct Voter {
uint weight;
bool voted;
address delegate;
uint vote;
}
@adeleke5140
adeleke5140 / HelloWorld.go
Last active May 8, 2022 11:56
Read input from STDIN and print Output to STDOUT
package main
// import the required packages
import (
"fmt"
"bufio"
"os"
)
func main {
@adeleke5140
adeleke5140 / Resources.md
Last active May 8, 2022 12:06
An InventoryList to add, remove and get items in an inventory
@adeleke5140
adeleke5140 / Layout.jsx
Created May 8, 2022 16:32
A Layout React Component using React Router
const Layout = ({ children }) => {
return(
<React.Fragment>
<Header/>
<div className ="wrapper">
<Navigation />
<main>{ children } </main>
</div>
</React.Fragment>
)
@adeleke5140
adeleke5140 / controlledInput.jsx
Created May 9, 2022 08:24
Track the value of an input with State
import React, { useState } from 'react';
const TrickInput = () => {
const [text, setText] = useState(
'try typing something'
);
const handleChange = event => {
setText(event.target.value);
};
@adeleke5140
adeleke5140 / Form.jsx
Created May 10, 2022 03:33
collect data from React Form
import { useState } from "react";
const SignUp = () => {
const [values, setValues] = useState();
const onChange = (event) => {
setValues({
...values,
[event.target.name]: event.target.value
});
@adeleke5140
adeleke5140 / Form.js
Last active May 12, 2022 16:17
Submitting a form to a remote server
const myForm = document.getElementById('my-form');
const url = 'http://localhost:8080/';
myForm.addEventListener('submit', async event => {
event.preventDefault();
const formData = new FormData(myForm);
const response = await fetch(url, {
method: 'post',
body: formData
});
@adeleke5140
adeleke5140 / environmental-variables.md
Created May 12, 2022 23:19
Regarding Environmental Variables

When using Vite to bootstrap a react app, the .env file must be in the same directory as the package.json and not in the src directory.

After that, import it with import.meta.env.VITE_API_KEY

P.S: VITE_API_KEY is the name of the environmental variable you initally created.