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 / download.js
Created October 24, 2023 02:53
Automating Puppeteer download functionality
import puppeteer from 'puppeteer'
import * as fs from 'fs';
//function to handle timeout
function delay(time) {
return new Promise(resolve => setTimeout(resolve, time));
}
const browser = await puppeteer.launch({
@CodeLeom
CodeLeom / dual.js
Created October 24, 2023 02:48
Code Sample to handle Upload and Download action with Puppeteer
import puppeteer from 'puppeteer'
//function to handle timeout
function delay(time) {
return new Promise(resolve => setTimeout(resolve, time));
}
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
@CodeLeom
CodeLeom / todo.sol
Created August 4, 2023 11:27
A simple todo list smart contract
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
contract TodoList {
struct Todo {
string text;
bool isComplete;
}
Todo[] public todos;
@CodeLeom
CodeLeom / Ownable.sol
Last active August 2, 2023 12:56
A smart contract that allows only the contract owner to perform an action
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract Ownable {
address public owner;
constructor() {
owner = msg.sender;
}
@CodeLeom
CodeLeom / Commit.md
Last active August 1, 2023 10:16
Git Commit Convention, using the convention for writing git-commit messages. It is based on the AngularJS project (doc, commits).

Commit Message should come with a :

This means that, whatever you are working on, fall under the category of types mentioned below.

No. Type Description
1 feat use this type to describe a new feature
2 fix use this type to describe a bug fix
3 doc use this type to describe a documentation contribution or improvement
4 style use this type to describe formatting, missing semicolons, or page styling
5 refactor use this type to describe code refactor
@CodeLeom
CodeLeom / AutoDeploy.yml
Created July 4, 2023 10:35 — forked from Auwalms/AutoDeploy.yml
This action builds, authenticate and deploy an app to two seperate instances depending on the branch a push is made to.
name: api-deployment
on:
push:
branches:
- master
- stagging
jobs:
build-staging:
@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;
@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 / 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 / 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;