This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.18; | |
import { SimpleStorage } from "./SimpleStorage.sol"; | |
contract StorageFactory { | |
SimpleStorage[] public listOfSimpleStorageContracts; | |
function createSimpleStorageContract() public { | |
listOfSimpleStorageContracts.push(new SimpleStorage()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.18; | |
contract SimpleStorage { | |
// Basic Types: boolean, unit, int, address, bytes | |
// bool hasFavoriteNumber = true; | |
// uint256 favoriteNumber = 88; | |
// string favoriteNumberInText = "eighty-eight"; | |
// int256 favoriteInt = -88; | |
// address myAddress = 0x687Ff6d6a2D149f6475b83BaEC087067b62BE9E8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.charset.StandardCharsets; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
import java.time.LocalDateTime; | |
import java.util.ArrayList; | |
import java.util.Base64; | |
import java.util.Collection; | |
import java.util.List; | |
public class BlockChain { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RegexTestStrings { | |
public static final String TEST = "This is my small example string which I'm going to use for pattern matching."; | |
public static void main(String[] args) { | |
System.out.println(TEST.matches("\\w.*")); | |
// split by whitespace | |
String[] splitStr = TEST.split("\\s+"); | |
System.out.println(splitStr.length); | |
for (String str : splitStr) { | |
System.out.println(str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Circle(radius) { | |
this.radius = radius; | |
this.area = function() { | |
return this.radius * this.radius * Math.PI; | |
}; | |
} | |
var instance = {}; | |
Circle.call(instance, 5); | |
instance.area(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function greeter(saluatation) { | |
var counter = 0; // If in java counter needs to be defined as final | |
var prefix = '. ' + saluatation + ' '; | |
return function (name) { // is bound to counter and prefix, (we call the variables that we are bound to closure) | |
counter++; // same reference to the outter counter, therefore keeps state | |
return counter + prefix + name + '!'; | |
}; | |
} | |
var greet = greeter('Hello'); |