Skip to content

Instantly share code, notes, and snippets.

import { db } from "./index"
import { usersTable, subjects, decks } from "./schema"
import bcrypt from "bcrypt"
const SUBJECT_IDS = {
MAT1: "00000000-0000-0000-0000-000000000101",
ECO: "00000000-0000-0000-0000-000000000102",
MNG: "00000000-0000-0000-0000-000000000103",
OIKT: "00000000-0000-0000-0000-000000000104",
@petarfon
petarfon / AuthForm.tsx
Created January 16, 2026 11:26
Authentication Form
"use client";
import { useState } from "react";
import Link from "next/link";
type Mode = "login" | "register";
export default function AuthForm({ mode }: { mode: Mode }) {
const [err, setErr] = useState("");
@petarfon
petarfon / data.ts
Last active November 26, 2025 17:53
import {FullDeckDto, FullSubjectDto} from "@/shared/types";
export const mockSubjects: FullSubjectDto[] = [
{ id: 1, name: "Matematika 1", createdAt: new Date("2024-01-10") },
{ id: 2, name: "Ekonomija", createdAt: new Date("2024-01-11") },
{ id: 3, name: "Menadžment", createdAt: new Date("2024-01-12") },
{ id: 4, name: "OIKT", createdAt: new Date("2024-01-13") },
{ id: 5, name: "Psihologija", createdAt: new Date("2024-01-14") },
{ id: 6, name: "Marketing", createdAt: new Date("2024-01-15") },
{ id: 7, name: "Osnovi organizacije", createdAt: new Date("2024-01-16") },
@petarfon
petarfon / productsData.json
Created December 11, 2023 11:44
Potrebni podaci
{
"items": [
{
"id": 1,
"title": "Chocolate",
"description": "Chocolate is a food made from cacao beans. It is used in many desserts like pudding, cakes and candy",
"amount": 0
},
{
"id": 2,
@petarfon
petarfon / App.css
Last active December 4, 2024 22:13
react-master
.navBar {
display: flex;
flex-direction: row;
background-color: rgb(211, 211, 211);
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: rgb(175, 175, 175);
align-items: center;
min-height: 40px;
padding-left: 25px;
@petarfon
petarfon / App.tsx
Last active September 29, 2023 15:31
Beaker Smart Contract
import { DeflyWalletConnect } from '@blockshake/defly-connect'
import { DaffiWalletConnect } from '@daffiwallet/connect'
import { PeraWalletConnect } from '@perawallet/connect'
import { PROVIDER_ID, ProvidersArray, WalletProvider, useInitializeProviders, useWallet } from '@txnlab/use-wallet'
import algosdk from 'algosdk'
import { SnackbarProvider } from 'notistack'
import { useState } from 'react'
import AppCalls from './components/AppCalls'
import Calculator from './components/Calculator'
import ConnectWallet from './components/ConnectWallet'
@petarfon
petarfon / index.mjs
Last active November 2, 2022 08:42
Morra game v4.0 with ask
import { loadStdlib, ask } from '@reach-sh/stdlib';
import * as backend from './build/index.main.mjs';
const stdlib = loadStdlib();
const isAlice = await ask.ask(
`Are you Alice?`,
ask.yesno
);
const who = isAlice ? 'Alice' : 'Bob';
@petarfon
petarfon / index.mjs
Created October 30, 2022 16:03
Morra game v3.0
import { loadStdlib } from '@reach-sh/stdlib';
import * as backend from './build/index.main.mjs';
const stdlib = loadStdlib({REACH_NO_WARN: 'Y'});
// const stdlib = loadStdlib(process.env);
const startingBalance = stdlib.parseCurrency(100);
const accAlice = await stdlib.newTestAccount(startingBalance);
const accBob = await stdlib.newTestAccount(startingBalance);
const fmt = (x) => stdlib.formatCurrency(x, 4);
@petarfon
petarfon / index.mjs
Created October 30, 2022 10:17
Morra game v2.1
import { loadStdlib } from '@reach-sh/stdlib';
import * as backend from './build/index.main.mjs';
const stdlib = loadStdlib({REACH_NO_WARN: 'Y'});
// const stdlib = loadStdlib(process.env);
const startingBalance = stdlib.parseCurrency(100);
const accAlice = await stdlib.newTestAccount(startingBalance);
const accBob = await stdlib.newTestAccount(startingBalance);
const fmt = (x) => stdlib.formatCurrency(x, 4);
@petarfon
petarfon / index.mjs
Created October 30, 2022 08:40
Morra game v1.1
import { loadStdlib } from '@reach-sh/stdlib';
import * as backend from './build/index.main.mjs';
const stdlib = loadStdlib(process.env);
const startingBalance = stdlib.parseCurrency(100);
const accAlice = await stdlib.newTestAccount(startingBalance);
const accBob = await stdlib.newTestAccount(startingBalance);
const fmt = (x) => stdlib.formatCurrency(x, 4);
const getBalance = async (who) => fmt(await stdlib.balanceOf(who));