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 / 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 / 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 / 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 / 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 / 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 / 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;
}