Skip to content

Instantly share code, notes, and snippets.

View yashaslokesh's full-sized avatar
🎯
Focusing

Yashas Lokesh yashaslokesh

🎯
Focusing
View GitHub Profile
@yashaslokesh
yashaslokesh / BlockZoo.sol
Created May 14, 2019 03:15
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
import "./BlockZooContest.sol";
contract BlockZoo is IERC721, BlockZooBreeding {
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
@yashaslokesh
yashaslokesh / BlockZoo.sol
Created May 11, 2019 03:55
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
import "./BlockZooContest.sol";
contract BlockZoo is IERC721, BlockZooBreeding {
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
@yashaslokesh
yashaslokesh / BlockZoo.sol
Created May 10, 2019 16:06
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
import "./BlockZooContest.sol";
contract BlockZoo is IERC721, BlockZooBreeding {
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
@yashaslokesh
yashaslokesh / BlockZoo.sol
Created May 10, 2019 11:21
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
import "./BlockZooContest.sol";
contract BlockZoo is IERC721, BlockZooBreeding {
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
@yashaslokesh
yashaslokesh / BlockZoo1.sol
Created May 10, 2019 06:25
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
// import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/introspection/ERC165.sol";
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol";
// import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
import "./BlockZoo.sol";
import "./IERC721.sol";
contract BlockZoo is IERC721, BlockZooBase {
from math import sqrt, floor
LIMIT = 1_00_000_000
sqrt_limit = floor(sqrt(LIMIT))
def palindrome(num):
str_num = str(num)
if str_num == str_num[::-1]:
return True
return False
from math import sqrt, floor
LIMIT = 1_00_000_000
sqrt_limit = floor(sqrt(LIMIT))
# Checks if a number is a palindrome
def palindrome(num):
str_num = str(num)
if str_num == str_num[::-1]:
return True
from math import sqrt, floor
LIMIT = 1_00_000_000
sqrt_limit = floor(sqrt(LIMIT))
# Our resultant sum
result_sum = 0
for start_num in range(1, sqrt_limit):
temp_sum = start_num ** 2
from math import sqrt, floor
# We can use underscores to separate sections in a number,
# they are ignored
LIMIT = 1_00_000_000
# We use floor because sqrt() returns a float, and so that
# this code can be generally applied to any limit
sqrt_limit = floor(sqrt(LIMIT))
# Loop through starting integers
for start_num in range(1, sqrt_limit):
import timeit
def make_setup_string(num):
string = "import efficient_fibonacci as fib\n"
string += f"num = {num}"
return string
def main():
print("\nLinear testing started")