View SwordNFT.sol
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.7; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
library Base64 { | |
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | |
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000" |
View KlaytnContractTemplate.sol
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.2; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
import "@openzeppelin/contracts/utils/math/SafeMath.sol"; | |
View fh_traversing_api_payloads.rb
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
# While in IRB, use the Ruby JSON library with: | |
require 'json' | |
# Then pass stringifed JSON content into it, surrounded by single quotes: | |
JSON.parse('stringified json here') | |
# In this lecture we learned a new Hash method: | |
hash.delete(:key_or_string) | |
# This will remove by the key AND the key's corresponding value from a hash. |
View fh_interactiving_scripting_assign_variables.rb
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
this, that = ARGS | |
one, two, three = [1, 2, 3] |
View fh_looping_multi_single_line.rb
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
# Multi-line inner loop blocks | |
collection.each do |parameter_name| | |
# logic_here | |
end | |
# Single-line inner loop blocks | |
collection.each { |parameter_name| logic_here } |
View fh_revisiting_operators.rb
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
def +(parameter_here) | |
# logic here | |
end |
View fh_destructive_non_destructive_methods.rb
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
"string".gsub("g", "") # => "strin" (new value) | |
"string".gsub!("g", "") # => "strin" (modified original value) |
View fh_accessing_hashes.rb
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
hash = { person: "Ryan" } | |
hash.stringify_keys | |
# => { "person" => "Ryan" } you should see this result after hitting enter |
View fh_method_recipes_chained.rb
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
def create_full_name(first, last) | |
"#{first} #{last}" | |
end | |
name_length = create_full_name("Ryan", "Kulp").length |
View fh_method_recipes_non_chained.rb
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
def create_full_name(first, last) | |
"#{first} #{last}" | |
end | |
full_name = create_full_name("Ryan", "Kulp") | |
name_length = full_name.length |
NewerOlder