Skip to content

Instantly share code, notes, and snippets.

View CodeLeom's full-sized avatar
🎯
Building

Ayodele Aransiola CodeLeom

🎯
Building
View GitHub Profile
@CodeLeom
CodeLeom / mood.sol
Created January 14, 2023 12:39
this is my first solidity contract at the 4 saturday of solidity bootcamp
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Mood {
string currentMood;
function setMood(string memory _newMood) external {
currentMood = _newMood;
}
@CodeLeom
CodeLeom / LogoGenerator.jsx
Created February 3, 2023 10:54
Generate Logo
import React, { useState } from "react";
const LogoGenerator = () => {
const [city, setCity] = useState("");
const handleSubmit = (event) => {
event.preventDefault();
// Call API to generate logo based on city name
// ...
};
@CodeLeom
CodeLeom / CustomLogo.jsx
Created February 3, 2023 10:55
Generate custom logo for your community
import React, { useState } from 'react';
const LogoGenerator = () => {
const [city, setCity] = useState('');
const [logo, setLogo] = useState(null);
const handleSubmit = event => {
event.preventDefault();
// Example code to generate logo based on city name
// Replace this with a real logo generation code
@CodeLeom
CodeLeom / summaryGenerator.js
Created February 3, 2023 10:57
A code to generate novel/book summary using Chat GPT. This code uses the Axios library to make a POST request to the OpenAI GPT-3 API and returns the generated summary
const axios = require('axios');
async function summarizeNovel(text) {
const response = await axios.post('https://api.openai.com/v1/engines/text-davinci-002/jobs', {
prompt: 'Please summarize this text:',
max_tokens: 100,
temperature: 0.5,
n: 1,
stop: ['Thank you.'],
text,
@CodeLeom
CodeLeom / fizzbuzz.js
Created February 3, 2023 11:01
This gist is an answer to, write the fizzbuzz javascript algorithm which returns an array of strings from 1 to N but for multiples of 3, print Fizz, multiples of 5, print Buzz, multiples of 3 and 5, print fizz buzz
function fizzbuzz(n) {
let result = [];
for (let i = 1; i <= n; i++) {
let output = "";
if (i % 3 === 0) {
output += "Fizz";
}
if (i % 5 === 0) {
output += "Buzz";
}
@CodeLeom
CodeLeom / DivisibleAlgo.js
Created February 3, 2023 11:03
This Gist solves the question: "Given a list of integers, determine how many of them are divisible by 11. If you encounter an integer in the list that is greater than or equal to 111, return 0 regardless of how many numbers are divisible by 11".
function countDivisibleBy11(list) {
let count = 0;
for (let i = 0; i < list.length; i++) {
if (list[i] >= 111) {
return 0;
}
if (list[i] % 11 === 0) {
count++;
}
}
@CodeLeom
CodeLeom / HouseRent.sol
Created March 24, 2023 17:27
This smart contract allows the tenant to pay the rent amount to the landlord and allows the landlord to withdraw the rent amount once the payment due date has passed. Here are the steps for using this smart contract: Deploy the smart contract by providing the addresses of the landlord and tenant, the rent amount, and the payment due date. The te…
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HouseRent {
address payable public landlord;
address payable public tenant;
uint256 public rentAmount;
uint256 public paymentDueDate;
bool public landlordHasWithdrawn;
@CodeLeom
CodeLeom / LotToken.sol
Created March 24, 2023 17:28
This is a basic implementation of an ERC-20 token
pragma solidity ^0.8.0;
contract LotToken {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
@CodeLeom
CodeLeom / App.js
Created June 11, 2023 21:10
Algolia Instant Search Demo
import React from 'react';
import algoliasearch from 'algoliasearch/lite';
import {
InstantSearch,
Configure,
Hits,
SearchBox,
DynamicWidgets,
Panel,
ClearRefinements,
@CodeLeom
CodeLeom / App.css
Created June 11, 2023 21:15
Css styling for the algolia instant search demo
em {
background: cyan;
font-style: normal;
}
body { font-family: sans-serif; padding: 1em; }
.header {
display: flex;
align-items: center;