Skip to content

Instantly share code, notes, and snippets.

View jstorm31's full-sized avatar

Jiří Zdvomka jstorm31

View GitHub Profile
@jstorm31
jstorm31 / mintNFTTicket.ts
Created April 24, 2022 14:38
Mint NFT ticket with Cardinal
import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes';
import { Wallet } from '@project-serum/anchor';
import { clusterApiUrl, Connection, Keypair, PublicKey, sendAndConfirmRawTransaction } from '@solana/web3.js';
import { IssueParameters, issueToken } from '@cardinal/token-manager';
import { InvalidationType, TokenManagerKind } from '@cardinal/token-manager/dist/cjs/programs/tokenManager';
const connection = new Connection(clusterApiUrl('devnet'));
// Test account created by solana CLI
const issuerPublicKey = new PublicKey('3RtKcbE5LpSScrEHHNiGBBD25xVNPLezbY7S2TAwdXis');
@jstorm31
jstorm31 / Utils.swift
Last active April 4, 2020 10:15
Swift Czech bank account validation
// Rewritten from PHP code excerpt from https://www.kutac.cz/pocitace-a-internety/jak-poznat-spravne-cislo-uctu
import Foundation
final class Utils {
static let bankCodes: Set = [100, 300, 600, 710, 800, 2010, 2020, 2030, 2060, 2070, 2100, 2200, 2220, 2240, 2250, 2260, 2275, 2600, 2700, 3030, 3050, 3060, 3500, 4000, 4300, 5500, 5800, 6000, 6100, 6200, 6210, 6300, 6700, 6800, 7910, 7940, 7950, 7960, 7970, 7980, 7990, 8030, 8040, 8060, 8090, 8150, 8190, 8198, 8199, 8200, 8215, 8220, 8225, 8230, 8240, 8250, 8255, 8260, 8265, 8270, 8272, 8280, 8283, 8291, 8292, 8293, 8294, 8296]
/// Validates Czech bank account number
static func isValid(bankAccount: String) -> Bool {
let bankAccountRegex = try! NSRegularExpression(pattern: "^(?:([0-9]{1,6})-)?([0-9]{2,10})\\/([0-9]{4})$")