Skip to content

Instantly share code, notes, and snippets.

View bjartek's full-sized avatar
💭
No power in the verse can stop me

Bjarte S. Karlsen bjartek

💭
No power in the verse can stop me
  • Shiny && Find && Versus
  • Lillesand, Norway
  • X @0xBjartek
View GitHub Profile
@bjartek
bjartek / gist:f05f80f8bc62812941e6d7034e9ea8fc
Created February 25, 2024 18:54
read file into struct
func ReadFileIntoStruct[T interface{}](fileName string) (*T, error) {
jsonFile, err := os.ReadFile(fileName)
if err != nil {
return nil, err
}
var objects T
err = json.Unmarshal(jsonFile, &objects)
if err != nil {
return nil, err
import "BasicNFT"
transaction(name: String) {
prepare(signer: auth(StorageCapabilities) &Account) {
signer.capabilities.storage.forEachController(
forPath:BasicNFT.minterPath,
revokeWithTag(tag: name)
)
}
import "NonFungibleToken"
import "BasicNFT"
transaction(receiver:Address) {
let minter :&BasicNFT.Minter
let collection : &{NonFungibleToken.Receiver}
prepare(signer: auth(BorrowValue) &Account) {
import "BasicNFT"
transaction(provider:Address, name:String) {
prepare(signer: auth(ClaimInboxCapability, SaveValue) &Account) {
//we get the capability from our inbox
let capability = signer.inbox.claim<&BasicNFT.Minter>(name, provider:provider)!
//we then save the capability to our storage so we can retrieve it
import "BasicNFT"
transaction(receiver:Address, name:String) {
prepare(signer: auth(StorageCapabilities, PublishInboxCapability) &Account) {
let storage= signer.capabilities.storage
//we issue a capability from our storage
let capability = storage.issue<&BasicNFT.Minter>(BasicNFT.minterPath)
@bjartek
bjartek / gist:53edd58aabda8c43766a238dc952b8da
Created October 23, 2023 16:54
flow cirulating supply
1036200000
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x14021c123e0 stack=[0x14021c12000, 0x14041c12000]
fatal error: stack overflow
runtime stack:
runtime.throw({0x10306d035?, 0x104379580?})
runtime/panic.go:992 +0x50
runtime.newstack()
runtime/stack.go:1101 +0x46c
runtime.morestack()
{
"networks": {
"emulator": {
"scripts": {
"bl0x": {
"code": "import Bl0x from 0xf8d6e0586b0a20c7\nimport MetadataViews from 0xf8d6e0586b0a20c7\n\npub fun main(address: Address, id:UInt64) : Bl0x.Metadata? {\n let account=getAccount(address)\n /* Check on bl0xPack */\n let bl0xCap = account.getCapability\u003c\u0026Bl0x.Collection{MetadataViews.ResolverCollection}\u003e(Bl0x.CollectionPublicPath)\n if !bl0xCap.check() {\n return nil\n }\n let bl0x = bl0xCap.borrow()!\n return bl0x.borrowViewResolver(id: id).resolveView(Type\u003cBl0x.Metadata\u003e())! as! Bl0x.Metadata\n}",
"spec": {
"order": [
"address",
"id"
@bjartek
bjartek / things-i-believe.md
Created December 17, 2020 08:22 — forked from stettix/things-i-believe.md
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.