Skip to content

Instantly share code, notes, and snippets.

View casweeney's full-sized avatar
👨‍💻
Building Platforms

Coding Cas casweeney

👨‍💻
Building Platforms
View GitHub Profile
fn main() {
println!("{}", factorial(4));
}
// Using Recursion
// fn factorial(n: usize) -> usize {
// if( n == 0) {
// return 1;
// } else {
// return factorial(n-1) * n;
fn main() {
println!("{}", fibonacci(7));
}
// Using Recursion
// fn fibonacci(n: usize) -> usize {
// if (n < 2) {
// return n;
// }
// Iteration
function fibonacci(n) {
const fib = [0, 1];
for (let i = 2; i <= n; i++) {
fib[i] = fib[i - 1] + fib[i - 2];
}
// const fibb = {
// fibonacci: fib,
use std::collections::HashSet;
use rand::Rng;
fn power_set(set: &Vec<i32>) -> Vec<Vec<i32>> {
let mut result = Vec::new();
let size = set.len();
let no_of_subsets = 1 << size;
for i in 0..no_of_subsets {
let mut subset = Vec::new();
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract MultiSig {
address owner;
address[] signers;
uint256 quorum;
uint256 txCount;
address nextOwner;
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs";
import { expect } from "chai";
import { ethers } from "hardhat";
describe("Lock", function () {
// We define a fixture to reuse the same setup in every test.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SaveEther {
mapping(address => uint256) savings;
event SavingSuccessful(address indexed user, uint256 indexed amount);
function deposit() external payable {
require(msg.sender != address(0), "wrong EOA");
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract HooziNFT is ERC721, Ownable {
constructor() ERC721("HooziNFT", "HOZ") Ownable(msg.sender) {}
function safeMint(address to, uint256 tokenId) public onlyOwner {
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
contract FractionalNft is ERC20, Ownable, ERC20Permit, ERC721Holder {
IERC721 public collection;
{
"message": "Completed Successfully",
"status": true,
"data": {
"banks": [
{
"bankCode": "090267",
"bankName": "Kuda."
},
{