Skip to content

Instantly share code, notes, and snippets.

View maymax777's full-sized avatar
😇
What's happening?

maymax maymax777

😇
What's happening?
View GitHub Profile
@maymax777
maymax777 / index.html
Last active May 10, 2021 02:56
Access to camera and audio
<!-- HTML -->
<video id="video" width="160" height="120" autoplay></video><br>
<div id="div"></div>
pragma solidity ^0.4.19;
contract Roman {
uint[] key = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
string[] numerals = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"];
function solution(uint n) public view returns (string) {
// Convert the positive integer to a Roman Numeral
string memory res = "";
pragma solidity ^0.4.13;
contract Repeater {
function multiply(uint8 repeat, string pattern) returns (string) {
bytes memory bpattern = bytes(pattern);
uint resultLength = repeat * bpattern.length;
string memory result = new string(resultLength);
bytes memory bresult = bytes(result);
for (uint i = 0; i < resultLength; i++) {
bresult[i] = bpattern[i % bpattern.length];
pragma solidity ^0.4.19;
contract Problem {
function rowSumOddNumbers(int n) public pure returns (int) {
int end = (1 + n ) * n - 1;
int start = end - 2 * (n - 1);
int sum = (start + end) * n / 2;
return sum;
}
}
pragma solidity ^0.4.19;
contract Century {
function get(int year) public pure returns (int) {
return (year - 1) / 100 + 1;
}
}
pragma solidity ^0.4.19;
contract MaximumMultiple {
function maxMultiple(int d, int b) public pure returns (int) {
//
int max = d > b ? d : b;
int min = d < b ? d : b;
return max - max % min;
}
}
contract Staking {
function isContract(address _target) internal view returns (bool) {
if (_target == address(0)) {
return false;
}
uint256 size;
assembly {
size := extcodesize(_target)
}
contract Multisend {
function multisendEther(address[] memory recipients, uint256[] memory values)
external
payable
{
for (uint256 i = 0; i < recipients.length; i++)
payable(recipients[i]).transfer(values[i]);
uint256 balance = address(this).balance;
if (balance > 0) payable(msg.sender).transfer(balance);
}
pragma solidity ^0.8.10;
contract ReEntrancyGuard {
bool internal locked;
modifier noReentrant() {
require(!locked, "No re-entrancy");
locked = true;
_;
locked = false;
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./DateTime.sol";
/**