Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
we can create the future we want

Kenny adeleke5140

💭
we can create the future we want
View GitHub Profile
View illustration1.svg
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 Apr 21, 2022
Hello World smart contract
View HelloWorld.sol
// 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 Apr 21, 2022
Revert Ballot once the 5min Ballot time is exceeded
View Ballot.sol
// 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
Read input from STDIN and print Output to STDOUT
View HelloWorld.go
package main
// import the required packages
import (
"fmt"
"bufio"
"os"
)
func main {
@adeleke5140
adeleke5140 / Resources.md
Last active May 8, 2022
An InventoryList to add, remove and get items in an inventory
View Resources.md
@adeleke5140
adeleke5140 / Layout.jsx
Created May 8, 2022
A Layout React Component using React Router
View Layout.jsx
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
Track the value of an input with State
View controlledInput.jsx
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
collect data from React Form
View Form.jsx
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
Submitting a form to a remote server
View Form.js
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
Regarding Environmental Variables
View environmental-variables.md

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.