Skip to content

Instantly share code, notes, and snippets.

View vivekascoder's full-sized avatar
💭
Learning

Vivek vivekascoder

💭
Learning
View GitHub Profile
[
{
"address": {
"ens_domain_name": null,
"hash": "0x00DDC08D535918425709DA3e50134AE7CFb2eFf9",
"implementation_name": null,
"is_contract": false,
"is_verified": null,
"metadata": null,
"name": null,
{
"type": "Strategy",
"data": {
"cron": "* ** ",
"cronjob": {
"type": "Weighted",
"data": [
{
"type": "Weight",
{
"editor.minimap.enabled": false,
"workbench.startupEditor": "none",
"vim.easymotion": true,
"vim.incsearch": true,
"vim.useSystemClipboard": true,
"vim.useCtrlKeys": true,
"vim.hlsearch": true,
"vim.insertModeKeyBindings": [
{
{
"editor.minimap.enabled": false,
"breadcrumbs.enabled": false,
"workbench.startupEditor": "none",
"vim.easymotion": true,
"vim.incsearch": true,
"vim.useSystemClipboard": true,
"vim.useCtrlKeys": true,
"vim.hlsearch": true,
"vim.insertModeKeyBindings": [
module 0x3::token {
...
struct TokenId has store, copy, drop {
token_data_id: TokenDataId,
property_version: u64,
}
struct TokenDataId has copy, drop, store {
creator: address,
public entry fun mint_nft(account: &signer) acquires ResourceSigner, MintingInfo {
let (resource, resource_addr) = resource_account();
let minting_info = borrow_global_mut<MintingInfo>(@rangers);
let name = string::utf8(b"");
string::append(&mut name, minting_info.base_name);
string::append(&mut name, to_string(minting_info.index));
let img = generate_base64_image(minting_info.index);
let uri = generate_base64_metadata(img, minting_info.index);
std::debug::print(&uri);
@vivekascoder
vivekascoder / hasher.rs
Created December 25, 2022 13:51
implementing Hash trait for a struct.
use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
#[derive(Debug)]
struct A {
a: i32
}
impl Hash for A {
public fun get_random_between(hash: vector<u8>, low: u64, high: u64): u64 {
assert!(high > low, E_WTF_DUDE);
let range = high - low;
let a = aptos_hash::sip_hash(hash);
let b = low + (a % range);
debug::print(&b);
return low + (a % range)
}
use std::rc::Rc;
enum List {
Cons(i32, Rc<List>),
Nil,
}
use self::List::{Cons, Nil};
pub fn implement() {
{
"extensions.ignoreRecommendations": true,
"bracketPairColorizer.depreciation-notice": false,
"terminal.integrated.lineHeight": 1.2,
// "github.copilot.enable": {
// "*": true,
// "yaml": false,
// "plaintext": false,
// "markdown": false,
// "python": false,