repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
prolifick1/ts-algorithms
dist/majorityElement.d.ts
declare let majorityElement: (arr: number[]) => number | undefined; export default majorityElement;
prolifick1/ts-algorithms
src/majorityElement.ts
let majorityElement = function majorityElement(arr : number[]) { let limit = arr.length / 2; let seen = new Map(); for(let i = 0; i < arr.length; i++) { if(seen.has(arr[i])) { seen.set(arr[i], seen.get(arr[i]) + 1); } else { seen.set(arr[i], 1); } if(seen.get(arr[i]) > limit) { r...
prolifick1/ts-algorithms
src/bestTimeToBuySellStock.ts
<reponame>prolifick1/ts-algorithms function bestTimeToBuySellStock(arr : number[]) : number { let buy = 0; let sell = 1; let maxP = 0; while(sell < arr.length) { let profit = arr[sell] - arr[buy]; maxP = Math.max(maxP, profit); if(arr[sell] < arr[buy]) { buy = sell; } sell++; } ...
prolifick1/ts-algorithms
setupTests.ts
<gh_stars>1-10 import chai from "chai"; import sinonChai from "sinon-chai"; chai.use(sinonChai);
prolifick1/ts-algorithms
test/index.spec.ts
<reponame>prolifick1/ts-algorithms import { expect } from "chai"; import { spy } from "sinon"; it("runs a test", () => { const func = spy(); func(123); expect(func).to.have.been.calledWith(123); });
prolifick1/ts-algorithms
test/bestTimeToBuySellStock.spec.ts
<reponame>prolifick1/ts-algorithms import { expect } from 'chai'; import maxProfit from '../src/bestTimeToBuySellStock'; describe("#maxProfit", () => { it("returns max profit for a sequence where first time min index < max index", () => { expect(maxProfit([24, 11, 40, 12, 45, 44])).to.equal(34); }); it("retu...
prolifick1/ts-algorithms
test/binarySearch.spec.ts
import { expect } from 'chai'; import binarySearch from '../src/binarySearch'; describe('binarySearch', () => { it('should search number in sorted array', () => { expect(binarySearch([], 1)).to.equal(-1); expect(binarySearch([1], 1)).to.equal(0); expect(binarySearch([1, 2], 1)).to.equal(0); expect(...
prolifick1/ts-algorithms
src/binarySearch.ts
<filename>src/binarySearch.ts function binarySearch(arr: number[], target: number) : number { let start = 0; let end = arr.length - 1; while(start <= end) { let mid = Math.floor((start + end) / 2); if(arr[mid] === target) { return mid; } if(target < arr[mid]) { end = mid - 1; } ...
chenwainuo/audaces-perps-rest-server
src/utils/connection.ts
import { Connection } from "@solana/web3.js"; export const connection = new Connection(process.env.CONNECTION);
chenwainuo/audaces-perps-rest-server
src/utils/wallet.ts
import { Keypair, Connection, TransactionInstruction, Transaction, } from "@solana/web3.js"; const secretKey = JSON.parse(process.env.PRIVATE_KEY); export const wallet = Keypair.fromSecretKey(new Uint8Array(secretKey)); export const signAndSendTransactionInstructions = async ( // sign and send transaction ...
chenwainuo/audaces-perps-rest-server
src/run.ts
<gh_stars>0 require("dotenv").config(); import express from "express"; import helmet from "helmet"; import bodyParser from "body-parser"; import markets from "./routes/markets"; import orders from "./routes/orders"; import account from "./routes/account"; import positions from "./routes/positions"; export function ru...
chenwainuo/audaces-perps-rest-server
src/types/index.ts
export class ApiResponse { success: boolean; result: any; constructor(success: boolean = false, result?: any) { this.result = result; this.success = success; } }
chenwainuo/audaces-perps-rest-server
src/routes/markets.ts
<reponame>chenwainuo/audaces-perps-rest-server<filename>src/routes/markets.ts<gh_stars>1-10 import { Router } from "express"; import { MARKETS, MarketState, getOraclePrice } from "@audaces/perps"; import { ApiResponse } from "../types"; import { connection } from "../utils/connection"; import { PublicKey } from "@solan...
chenwainuo/audaces-perps-rest-server
src/routes/account.ts
import { Router } from "express"; import { ApiResponse } from "../types"; import { connection } from "../utils/connection"; import { signAndSendTransactionInstructions, wallet } from "../utils/wallet"; import { getUserAccountsForOwner, createUserAccount, closeAccount, depositCollateral, withdrawCollateral, ...
chenwainuo/audaces-perps-rest-server
src/routes/positions.ts
import { Router } from "express"; import { getOpenPositions, reducePositionBaseSize, increasePositionCollateral, increasePositionBaseSize, reducePositionCollateral, } from "@audaces/perps"; import { connection } from "../utils/connection"; import { wallet, signAndSendTransactionInstructions } from "../utils/w...
chenwainuo/audaces-perps-rest-server
src/utils/positions.ts
import { getOpenPositions } from "@audaces/perps"; import { PublicKey } from "@solana/web3.js"; import { connection } from "./connection"; import { wallet } from "./wallet"; export const getPositionFromIndex = async ( positionIndex: number, market: PublicKey ) => { const positions = await getOpenPositions(connec...
chenwainuo/audaces-perps-rest-server
src/routes/orders.ts
import e, { Router } from "express"; import { getTradeInfoFromTx, UserAccount, createPosition, PositionType, increasePosition, BNB_ADDRESS, getDiscountAccount, getMarketState, completeClosePosition, reducePositionBaseSize, } from "@audaces/perps"; import { connection } from "../utils/connection"; im...
chenwainuo/audaces-perps-rest-server
src/utils/errors.ts
<reponame>chenwainuo/audaces-perps-rest-server<filename>src/utils/errors.ts export const ErrorMessages = { orders: { side: "Invalid side. Can only be buy or sell", severalPositions: "This endpoint cannot be used if you have more than 1 position on the user account. Use /positions instead", invalidSi...
DanFraserUK/GESI
src/script/functions.ts
<reponame>DanFraserUK/GESI<filename>src/script/functions.ts /** * List all active player alliances * @param {boolean} opt_headers Boolean if column headings should be listed or not. Default: true * @param {string} version Which ESI version to use for the request. Default: Current ESI latest stable version. * @ret...
DanFraserUK/GESI
src/script/pollyfill.ts
if (!Array.prototype.find) { Object.defineProperty(Array.prototype, 'find', { value: function(predicate) { // 1. Let O be ? ToObject(this value). if (this == null) { throw new TypeError('"this" is null or not defined'); } var o = Object(this); // 2. Let len be ? ToLength(? ...
DanFraserUK/GESI
src/script/gesi.ts
/** * @OnlyCurrentDoc * Google ESI (GESI) * /u/blacksmoke16 @ Reddit * @Blacksmoke16#0016 @ Discord * https://discord.gg/eEAH2et */ import HtmlOutput = GoogleAppsScript.HTML.HtmlOutput; import User = GoogleAppsScript.Base.User; import HTTPResponse = GoogleAppsScript.URL_Fetch.HTTPResponse; const HEADERS: Object ...
DanFraserUK/GESI
src/script/endpoints.ts
<reponame>DanFraserUK/GESI<gh_stars>0 const SCOPES = [ "esi-mail.send_mail.v1", "esi-alliances.read_contacts.v1", "esi-assets.read_assets.v1", "esi-assets.read_corporation_assets.v1", "esi-bookmarks.read_character_bookmarks.v1", "esi-bookmarks.read_corporation_bookmarks.v1", "esi-calendar.read_calendar_ev...
pomali/priznanie-digital
src/pages/api/xml.ts
import { NextApiRequest, NextApiResponse } from 'next' import { convertToXML } from '../../lib/xml/xmlConverter' import { setDate } from '../../lib/utils' import { calculate } from '../../lib/calculation' import { TaxForm } from '../../types/TaxForm' import { TaxFormUserInput } from '../../types/TaxFormUserInput' expo...
pomali/priznanie-digital
src/pages/404.tsx
<gh_stars>1-10 import React from 'react' export default function Custom404() { return ( <> <h1 className="govuk-heading-l govuk-!-margin-top-3"> Stránka, ktorú hľadáte tu nie je. </h1> <p> Skontrolujte prosím či ste zadali správnu adresu alebo nás kontaktujte. </p> </>...
pomali/priznanie-digital
src/lib/cookie.ts
<filename>src/lib/cookie.ts<gh_stars>1-10 export const checkCookie = (key, value) => { return ( typeof document !== 'undefined' && new RegExp(`${key}=${value}(;|$)`).test(document.cookie) ) }
pomali/priznanie-digital
config/jest/cssTransform.ts
export default { process() { return 'module.exports = {};' }, getCacheKey() { return 'cssTransform' }, }
pomali/priznanie-digital
src/pages/odklad/osobne-udaje.tsx
import React from 'react' import { Form, FormikProps } from 'formik' import Link from 'next/link' import { useRouter } from 'next/router' import { NextPage } from 'next' import { FormWrapper, Input } from '../../components/FormComponents' import styles from '../osobne-udaje.module.css' import { FormErrors, Personal...
pomali/priznanie-digital
cypress/integration/postponeCases.spec.ts
<filename>cypress/integration/postponeCases.spec.ts import { executeAllPostponeCases } from './executeCase' describe('Postpone cases', () => { executeAllPostponeCases(['basic', 'foreignIncome']) })
pomali/priznanie-digital
src/types/E2eTestUserInput.ts
import { TaxFormUserInput } from './TaxFormUserInput' export interface E2eTestUserInput extends TaxFormUserInput { expectNgoDonationPage?: boolean }
pomali/priznanie-digital
__tests__/testCases/bugReport4Input.ts
import { E2eTestUserInput } from '../../src/types/E2eTestUserInput' // https://trello.com/c/7nXCramK/146-testovanie-chyby-pau%C5%A1%C3%A1lne-v%C3%BDdavky-a-strata export const bugReport4Input: E2eTestUserInput = { priloha3_r11_socialne: '5000', priloha3_r13_zdravotne: '5000', r005_meno: 'Fake', r004_priezvisk...
pomali/priznanie-digital
__tests__/osobne-udaje.test.ts
import { validate } from '../src/pages/osobne-udaje' import { testValidation } from './utils/testValidation' describe('osobne-udaje', () => { describe('#validate', () => { testValidation(validate, [ { input: { r001_dic: '', r004_priezvisko: '', r005_meno: '', ...
pomali/priznanie-digital
src/pages/odklad/suhrn.tsx
import React from 'react' import { NextPage } from 'next' import { getPostponeRoutes } from '../../lib/routes' import { PostponeUserInput } from '../../types/PostponeUserInput' import { BackLink } from '../../components/BackLink' import { EmailUserInput } from '../../types/UserInput' import { FormErrors } from '../../t...
pomali/priznanie-digital
src/pages/api/feedback.ts
<filename>src/pages/api/feedback.ts import { NextApiRequest, NextApiResponse } from 'next' import { makeAttachment, sendEmail } from '../../lib/sendinblue' export default async (req: NextApiRequest, res: NextApiResponse) => { const parsedBody = JSON.parse(req.body) const ipAddress = req.connection.remoteAddre...
pomali/priznanie-digital
src/pages/pokracovat.tsx
import React from 'react' import { Page } from '../components/Page' import { TaxForm } from '../types/TaxForm' import { TaxFormUserInput } from '../types/TaxFormUserInput' import { convertToXML } from '../lib/xml/xmlConverter' import { RedirectField, RedirectForm } from '../components/RedirectForm' import { setDate, to...
pomali/priznanie-digital
__tests__/calcIntegration.test.ts
<reponame>pomali/priznanie-digital import { promises as fs } from 'fs' import { parseStringPromise } from 'xml2js' import { convertToXML } from '../src/lib/xml/xmlConverter' import { calculate } from '../src/lib/calculation' import { TaxFormUserInput } from '../src/types/TaxFormUserInput' import { PostponeUserInput } f...
pomali/priznanie-digital
src/lib/validatePartnerBonusForm.ts
import { PartnerUserInput } from '../types/PageUserInputs' import { parseInputNumber } from './utils' import { PARTNER_MAX_ODPOCET } from './calculation' export const validatePartnerBonusForm = ( values: PartnerUserInput, step = null, ): boolean => { const step1 = true // first step is not validated const ste...
pomali/priznanie-digital
src/pages/index.tsx
<filename>src/pages/index.tsx import React from 'react' import Link from 'next/link' import styles from './index.module.css' import { Warning } from '../components/Warning' import { ExternalLink } from '../components/ExternalLink' const IconCheck = () => ( <svg xmlns="http://www.w3.org/2000/svg" height="24" ...
pomali/priznanie-digital
src/pages/api/ngo.ts
import { NextApiRequest, NextApiResponse } from 'next' import { AutoformResponseBody } from '../../types/api' import Fuse from 'fuse.js' import ngos from '../../../public/ngos.json' const maxCacheAgeInMinutes = 15 type CachedData = Partial<AutoformResponseBody> interface Cache { data: Fuse<CachedData> time: numb...
pomali/priznanie-digital
__tests__/testCases/with3percentInput.ts
import { E2eTestUserInput } from '../../src/types/E2eTestUserInput' import { with2percentInput } from './with2percentInput' export const with3percentInput: E2eTestUserInput = { splnam3per: true, ...with2percentInput, }
pomali/priznanie-digital
__tests__/cookie.test.ts
<filename>__tests__/cookie.test.ts<gh_stars>1-10 import { checkCookie } from '../src/lib/cookie' describe('cookie', () => { describe('#checkCookie', () => { beforeAll(() => { global['document'] = { cookie: '', } as any }) afterAll(() => { delete global['document'] }) i...
pomali/priznanie-digital
__tests__/testCases/bugReport3Input.ts
<filename>__tests__/testCases/bugReport3Input.ts import { E2eTestUserInput } from '../../src/types/E2eTestUserInput' export const bugReport3Input: E2eTestUserInput = { t1r10_prijmy: '45000', priloha3_r11_socialne: '1000', priloha3_r13_zdravotne: '1000', r122: '100', r031_priezvisko_a_meno: 'anon', r031_rod...
pomali/priznanie-digital
src/components/PartnerBonusFormSteps.tsx
<filename>src/components/PartnerBonusFormSteps.tsx import React from 'react' import { BooleanRadio, CheckboxSmall, Input } from './FormComponents' import { formatRodneCislo } from '../lib/utils' import { PartnerBonusFormProps } from './PartnerBonusForm' import { Details } from './Details' export const ApplyForBonusQue...
pomali/priznanie-digital
src/types/PageUserInputs.ts
import { TaxFormUserInput } from './TaxFormUserInput' import { PostponeUserInput } from './PostponeUserInput' export type IncomeAndExpenseUserInput = Pick< TaxFormUserInput, 't1r10_prijmy' | 'priloha3_r11_socialne' | 'priloha3_r13_zdravotne' | 'r122' > export type EmployedUserInput = Pick< TaxFormUserInput, '...
pomali/priznanie-digital
src/components/PartnerBonusForm.tsx
import { PartnerUserInput } from '../types/PageUserInputs' import React, { useEffect, useRef } from 'react' import { FormikProps } from 'formik' import { AlreadyAppliedQuestion, ApplyForBonusQuestion, ConditionsQuestion, EligiblePartnerForm, HouseholdQuestion, IncomeQuestion, NotEligible, PreviousButton...
pomali/priznanie-digital
src/components/BackLink.tsx
<filename>src/components/BackLink.tsx<gh_stars>1-10 import Link from 'next/link' import React from 'react' export interface BackLinkProps { href: string } export const BackLink = ({ href }: BackLinkProps) => ( <Link href={href}> <a className="govuk-back-link" data-test="back"> Späť </a> </Link> )
pomali/priznanie-digital
src/components/CookieBar.tsx
import React, { useEffect, useState } from 'react' import { parseCookies, setCookie } from 'nookies' /** * Displays GDPR cookie consent message. * * Does not read cookies server-side in getInitialProps() to benefit from NextJS static HTML export. * https://nextjs.org/docs/advanced-features/static-html-export * *...
pomali/priznanie-digital
src/components/PrivacyPolicyLink.tsx
<gh_stars>1-10 import React from 'react' import { ExternalLink } from './ExternalLink' export const PrivacyPolicyLink = () => ( <ExternalLink href="https://navody.digital/ochrana-osobnych-udajov"> Ochrana osobných údajov </ExternalLink> )
pomali/priznanie-digital
__tests__/iban.test.ts
import { makeValidate } from '../src/pages/iban' import { testValidation } from './utils/testValidation' import { TaxForm } from '../src/types/TaxForm' describe('iban', () => { describe('#validate', () => { describe('mozeZiadatVyplatitDanovyBonus', () => { const taxFormMock = { mozeZiadatVyplatitDa...
pomali/priznanie-digital
src/pages/api/status-check.ts
import { NextApiRequest, NextApiResponse } from 'next' import { getGitCommit } from '../../lib/constants' export default async (_req: NextApiRequest, res: NextApiResponse) => { try { res.status(200).send({ git_commit: getGitCommit(), }) } catch (error) { res.status(500) } }
pomali/priznanie-digital
src/types/UserInput.ts
import { TaxFormUserInput } from './TaxFormUserInput' import { PostponeUserInput } from './PostponeUserInput' export interface EmailUserInput { email?: string newsletter?: boolean } export interface FeedbackFormInput { whatWereYouDoing: string whatWentWrong: string email: string saving?: string } export ...
pomali/priznanie-digital
__tests__/dve-percenta.test.ts
<gh_stars>1-10 import { validate } from '../src/pages/dve-percenta' import { testValidation } from './utils/testValidation' describe('dve-percenta', () => { describe('#validate', () => { testValidation(validate, [ { input: { XIIoddiel_uplatnujem2percenta: undefined }, expected: ['XIIoddiel_...
pomali/priznanie-digital
__tests__/kupele.test.ts
import { validate } from '../src/pages/kupele' import { testValidation } from './utils/testValidation' describe('kupele', () => { describe('#validate', () => { testValidation(validate, [ { input: { kupele: undefined }, expected: ['kupele'], }, { input: { kupele...
pomali/priznanie-digital
src/pages/partner.tsx
<gh_stars>1-10 import React from 'react' import { Form } from 'formik' import { FormWrapper } from '../components/FormComponents' import { FormErrors, PartnerUserInput } from '../types/PageUserInputs' import { numberInputRegexp, validateRodneCislo } from '../lib/utils' import { PartnerBonusForm } from '../components/Pa...
pomali/priznanie-digital
src/pages/kupele.tsx
<reponame>pomali/priznanie-digital import React from 'react' import Link from 'next/link' import { FieldArray, Form } from 'formik' import { BooleanRadio, FormWrapper, Input, CheckboxSmall, } from '../components/FormComponents' import { FormErrors, SpaUserInput } from '../types/PageUserInputs' import { ErrorSu...
pomali/priznanie-digital
__tests__/partner.test.ts
<reponame>pomali/priznanie-digital import { validate } from '../src/pages/partner' import { testValidation } from './utils/testValidation' describe('partner', () => { describe('#validate', () => { testValidation(validate, [ { input: { r032_uplatnujem_na_partnera: undefined }, expected: ['r0...
pomali/priznanie-digital
__tests__/odklad-prijmy-zo-zahranicia.test.ts
<reponame>pomali/priznanie-digital import { validate } from '../src/pages/odklad/prijmy-zo-zahranicia' import { testValidation } from './utils/testValidation' describe('odklad/prijmy-zo-zahranicia', () => { describe('#validate', () => { testValidation(validate, [ { input: { prijmy_zo_zahranicia: un...
pomali/priznanie-digital
src/components/FormComponents.tsx
<reponame>pomali/priznanie-digital import React, { ReactNode } from 'react' import { Formik, FormikProps, useField, FormikConfig, FormikValues, } from 'formik' import classnames from 'classnames' import { UserInput } from '../types/UserInput' import { numberInputRegexp } from '../lib/utils' export type FormW...
pomali/priznanie-digital
src/components/Details.tsx
<gh_stars>1-10 import React, { ReactNode, useState } from 'react' export interface DetailsProps { title: string children: ReactNode } export const Details = ({ title, children }: DetailsProps) => { const [isOpen, setIsOpen] = useState(false) return ( <details className="govuk-details" data-module="govuk-d...
pomali/priznanie-digital
cypress/integration/cases2.spec.ts
import { executeAllTestCases } from './executeCase' describe('Cases', () => { executeAllTestCases([ 'withChildren', 'with2percent', 'with3percent', 'withSpa', 'withBonus', 'withTaxReturn', ]) })
pomali/priznanie-digital
src/components/ExternalLink.tsx
import React from 'react' export interface ExternalLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> { href: string children: React.ReactNode } export const ExternalLink = (props: ExternalLinkProps) => { const { href, children, ...anchorProps } = props return ( <a href={href} target="_blan...
pomali/priznanie-digital
src/pages/api/autoform.ts
<filename>src/pages/api/autoform.ts<gh_stars>1-10 import { NextApiRequest, NextApiResponse } from 'next' import { AutoformResponseBody } from '../../types/api' const baseUrl = 'https://autoform.ekosystem.slovensko.digital/api/corporate_bodies' const limit = 20 const token = process.env.autoformtoken if (!token) { ...
pomali/priznanie-digital
src/components/Analytics.tsx
<gh_stars>0 import React from 'react' export interface GoogleAnalyticsProps { id: string } export const GoogleAnalytics = ({ id }: GoogleAnalyticsProps) => ( <> <script async src={`https://www.googletagmanager.com/gtag/js?id=${id}`} /> <script dangerouslySetInnerHTML={{ __html: `window.dataL...
pomali/priznanie-digital
src/lib/constants.ts
export const getGitCommit = () => { try { const config = require('../../git-commit.json') return config.gitCommit } catch (error) { return '' } }
pomali/priznanie-digital
src/types/OutputJson.ts
// Generated by the amazing http://json2ts.com/ export interface TypDP { rdp: string odp: string ddp: string } export interface ZdanovacieObdobie { rok: string datumDDP: string } export interface SkNace { k1: string k2: string k3: string cinnost: string } export interface AdresaTrvPobytu { ulica...
pomali/priznanie-digital
src/components/Header.tsx
<reponame>pomali/priznanie-digital import React from 'react' import Link from 'next/link' import { useRouter } from 'next/router' const Header: React.FC = () => { const router = useRouter() const isLandingPage = router.pathname === '/' || router.pathname === '/domov' const logo = ( <a className="sdn-header_...
pomali/priznanie-digital
src/components/Warning.tsx
<reponame>pomali/priznanie-digital import React, { ReactNode } from 'react' export interface WarningProps { className?: string children: ReactNode } export const Warning = ({ children, className }: WarningProps) => ( <div className={`govuk-grid-column-full govuk-warning-text ${className}`}> <span className=...
pomali/priznanie-digital
src/lib/api.ts
<filename>src/lib/api.ts import { AutoformResponseBody, PSCResponseBody } from '../types/api' import { translit } from './utils' export const getCity = async (zip: string) => { const response = await fetch( `https://api.posta.sk/private/search?q=${zip.replace(/\D/g, '')}&m=zip`, ) const pscData: PSCResponseB...
pomali/priznanie-digital
src/pages/deti.tsx
import React from 'react' import Link from 'next/link' import { FieldArray, Form } from 'formik' import styles from './deti.module.css' import { BooleanRadio, Input, CheckboxSmall, FormWrapper, Select, } from '../components/FormComponents' import { ChildrenUserInput } from '../types/PageUserInputs' import { C...
pomali/priznanie-digital
src/components/AutoCompleteInput.tsx
import React, { useRef, useState } from 'react' import classNames from 'classnames' import { useField } from 'formik' import styles from './AutoCompleteInput.module.css' import { Input } from './FormComponents' import { UserInput } from '../types/UserInput' export interface AutoCompleteData extends Record<string, any>...
pomali/priznanie-digital
__tests__/utils/testValidation.ts
<gh_stars>1-10 export const testValidation = (method, scenarios) => { scenarios.forEach(({ input, expected }) => { const inputJson = JSON.stringify(input) const expectedJson = JSON.stringify(expected) it(`for ${inputJson} should return ${expectedJson}`, () => { const definedErrors = Object.keys(met...
pomali/priznanie-digital
src/components/RedirectForm.tsx
<filename>src/components/RedirectForm.tsx<gh_stars>1-10 import React, { useEffect, useRef } from 'react' import getConfig from 'next/config' import fileDownload from 'js-file-download' import { ErrorSummary } from './ErrorSummary' import Link from 'next/link' import { checkCookie } from '../lib/cookie' const { publicRu...
pomali/priznanie-digital
src/components/Footer.tsx
import React from 'react' import { Feedback } from './Feedback' import { TaxFormUserInput } from '../types/TaxFormUserInput' import { PostponeUserInput } from '../types/PostponeUserInput' import { ExternalLink } from './ExternalLink' import { PrivacyPolicyLink } from './PrivacyPolicyLink' interface Props { taxFormUs...
pomali/priznanie-digital
src/components/Page.ts
<filename>src/components/Page.ts import { NextPage } from 'next' import { TaxFormUserInput } from '../types/TaxFormUserInput' import { TaxForm } from '../types/TaxForm' import { PostponeUserInput } from '../types/PostponeUserInput' import { Route } from '../lib/routes' import { Router } from 'next/router' export inter...
pomali/priznanie-digital
__tests__/zamestnanie.test.ts
import { validate } from '../src/pages/zamestnanie' import { testValidation } from './utils/testValidation' describe('zamestnanie', () => { describe('#validate', () => { testValidation(validate, [ { input: { employed: undefined }, expected: ['employed'], }, { input: { employed: ...
pomali/priznanie-digital
__tests__/odklad-osobne-udaje.test.ts
import { validate } from '../src/pages/odklad/osobne-udaje' import { testValidation } from './utils/testValidation' describe('odklad/osobne-udaje', () => { describe('#validate', () => { testValidation(validate, [ { input: { dic: '', meno_priezvisko: '', titul: '', ...
pomali/priznanie-digital
src/pages/zamestnanie.tsx
<reponame>pomali/priznanie-digital import React from 'react' import { Form } from 'formik' import { BooleanRadio, FormWrapper, Input } from '../components/FormComponents' import { EmployedUserInput, FormErrors } from '../types/PageUserInputs' import { numberInputRegexp } from '../lib/utils' import { ErrorSummary } from...
pomali/priznanie-digital
src/components/Layout.tsx
import React from 'react' import Header from './Header' import Footer from './Footer' import { CookieBar } from './CookieBar' import { TaxFormUserInput } from '../types/TaxFormUserInput' import { PostponeUserInput } from '../types/PostponeUserInput' import { useRouter } from 'next/router' import { homeRoute } from '../...
pomali/priznanie-digital
src/pages/dve-percenta.tsx
import React, { useRef } from 'react' import Link from 'next/link' import { Form, FormikProps } from 'formik' import { BooleanRadio, CheckboxSmall, FormWrapper, Input, } from '../components/FormComponents' import { FormErrors, TwoPercentUserInput } from '../types/PageUserInputs' import styles from './osobne-uda...
pomali/priznanie-digital
src/components/ErrorSummary.tsx
<filename>src/components/ErrorSummary.tsx<gh_stars>1-10 import React from 'react' import { FormikErrors } from 'formik' interface ErrorItemProps { name: string label: string } const ErrorItem = ({ name, label }: ErrorItemProps) => { return ( <li key={name}> <a href={`#${name}`}>{label}</a> </li> ...
pomali/priznanie-digital
__tests__/hypoteka.test.ts
<reponame>pomali/priznanie-digital<gh_stars>1-10 import { validate } from '../src/pages/hypoteka' import { testValidation } from './utils/testValidation' describe('hypoteka', () => { describe('#validate', () => { testValidation(validate, [ { input: { r037_uplatnuje_uroky: undefined }, expec...
pomali/priznanie-digital
src/components/Nace.tsx
import React, { useEffect, useState, useRef } from 'react' import classnames from 'classnames' import Fuse from 'fuse.js' import { getNace } from '../lib/api' import styles from './Nace.module.css' import { AutoCompleteInput } from './AutoCompleteInput' const options = { shouldSort: true, includeScore: true, thr...
pomali/priznanie-digital
__tests__/testCases/with2percentInput.ts
<reponame>pomali/priznanie-digital<filename>__tests__/testCases/with2percentInput.ts import { E2eTestUserInput } from '../../src/types/E2eTestUserInput' export const with2percentInput: E2eTestUserInput = { priloha3_r11_socialne: '1000', priloha3_r13_zdravotne: '1000', r005_meno: 'Fake', r004_priezvisko: 'Name'...
pomali/priznanie-digital
__tests__/utils.test.ts
<reponame>pomali/priznanie-digital import { floorDecimal, ceilDecimal, parseStreetAndNumber, } from '../src/lib/utils' import { sortObjectKeys, formatCurrency, setDate, formatDate, numberInputRegexp, formatPsc, formatIco, translit, formatRodneCislo, validateRodneCislo, formatIban, validate...
pomali/priznanie-digital
src/lib/sendinblue.ts
<gh_stars>1-10 const baseUrl = 'https://api.sendinblue.com/v3' const token = process.env.sendinbluetoken const sender = { name: 'priznanie.digital', email: '<EMAIL>', } if (!token) { throw new Error('process.env.sendinbluetoken is not defined') } const headers = { accept: 'application/json', 'content-type':...
pomali/priznanie-digital
src/lib/xml/outputBasis.ts
<filename>src/lib/xml/outputBasis.ts import { OutputJson } from '../../types/OutputJson' const ZDANOVACIE_OBDOBIE__ROK = '2020' const sampleSchema: OutputJson = { dokument: { hlavicka: { dic: '', datumNarodenia: '', typDP: { rdp: '1', odp: '0', ddp: '0', }, ...
pomali/priznanie-digital
src/lib/calculation.ts
import { ChildInput, TaxFormUserInput } from '../types/TaxFormUserInput' import { Child, TaxForm } from '../types/TaxForm' import { getRodneCisloAgeAtYearAndMonth, floorDecimal, parseInputNumber, percentage, } from './utils' import Decimal from 'decimal.js' import { sum, ceilDecimal } from './utils' import { va...
pomali/priznanie-digital
src/pages/prijmy-a-vydavky.tsx
import React from 'react' import { Form, FormikProps } from 'formik' import { FormWrapper, Input } from '../components/FormComponents' import { FormErrors, IncomeAndExpenseUserInput } from '../types/PageUserInputs' import { numberInputRegexp } from '../lib/utils' import { ErrorSummary } from '../components/ErrorSummary...
pomali/priznanie-digital
src/pages/vysledky.tsx
import React from 'react' import { formatCurrency } from '../lib/utils' import { TaxFormUserInput } from '../types/TaxFormUserInput' import { Page } from '../components/Page' import Decimal from 'decimal.js' import { BackLink } from '../components/BackLink' import { CheckboxSmall, FormWrapper, Input } from '../componen...
pomali/priznanie-digital
src/lib/postpone/PostponeOutput.ts
<filename>src/lib/postpone/PostponeOutput.ts export interface PostponeOutput { dokument: Dokument } interface Dokument { hlavicka: Hlavicka } interface FyzickaOsoba { priezvisko: string meno: string // rodneCislo: RodneCislo; } interface Hlavicka { dic: string zaRok: string dovodDoplnenia: string fy...
RaviCheetirala/BookingWebApp
src/app/posearch/posearch.component.ts
import { Component, OnInit ,ViewChild} from '@angular/core'; import { BookingService } from '../services/booking.service'; import { PurchaseOrder } from '../model/purchaseorder'; import { ResultList,Result,AuditList } from '../model/resultobj'; import {animate, state, style, transition, trigger} from '@angular/animatio...
ericwooley/typed-redux-reducers
src/redux/counter/reducer.ts
<reponame>ericwooley/typed-redux-reducers<filename>src/redux/counter/reducer.ts import { createReducer } from '../../reducerTypes' import { actionBundles } from './actions' export interface ICounterState { count: number } const defaultState: ICounterState = { count: 0 } export default createReducer(defaultState, a...
ericwooley/typed-redux-reducers
src/redux/counter/actions.ts
import { IAction, actionFactory } from '../../reducerTypes' enum CounterTypes { INCREMENT = 'COUNTER/INCREMENT', ASYNC_INCREMENT = 'COUNTER/ASYNC_INCREMENT', DECREMENT = 'COUNTER/DECREMENT' } interface IState { count: number } export const actionBundles = { increment: actionFactory<IState, number>(CounterTy...
ericwooley/typed-redux-reducers
src/reducerTypes.ts
<filename>src/reducerTypes.ts export interface IAction<T = undefined> { type: string payload: T } export type ActionHandler<S, T> = (state: S, action: IAction<T>) => S export type ActionBundle<S, T> = { type: string actionCreator: (payload: T) => IAction<T> handler: ActionHandler<S, T> } export function actio...
ericwooley/typed-redux-reducers
src/redux/selectors.ts
<filename>src/redux/selectors.ts import counter from './counter/selectors' export default { counter }
ericwooley/typed-redux-reducers
src/redux/counter/selectors.ts
<reponame>ericwooley/typed-redux-reducers<gh_stars>1-10 import { ICounterState } from './reducer' type IStateWithCounter = { counter: ICounterState } const count = (state: IStateWithCounter) => state.counter.count export default { count }
ericwooley/typed-redux-reducers
src/counter.tsx
import * as React from 'react' import { connect } from 'react-redux' import { IState } from './redux/store' import selectors from './redux/selectors' import actions from './redux/actions' interface Props { count: number increment: (c: number) => any decrement: (c: number) => any asyncIncrement: (c?: number) => ...
ericwooley/typed-redux-reducers
src/redux/actions.ts
<gh_stars>1-10 import { actionCreators as counter } from './counter/actions' export default {counter}
ericwooley/typed-redux-reducers
src/index.tsx
<reponame>ericwooley/typed-redux-reducers<filename>src/index.tsx import * as React from 'react' import { render } from 'react-dom' import Counter from './counter' import store from './redux/store' import { Provider } from 'react-redux' const styles = { fontFamily: 'sans-serif', textAlign: 'center' } const App = ()...
ericwooley/typed-redux-reducers
src/redux/store.ts
<gh_stars>1-10 import { createStore, combineReducers, applyMiddleware, compose } from 'redux' import counter, { ICounterState } from './counter/reducer' import thunk from 'redux-thunk' export interface IState { counter: ICounterState } const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || c...
lauslim12/attendance
web/pages/admin/index.tsx
<reponame>lauslim12/attendance<filename>web/pages/admin/index.tsx import { Grid, Heading, Text, VStack } from '@chakra-ui/react'; import { memo } from 'react'; import { FaCheckDouble, FaDatabase } from 'react-icons/fa'; import MenuCard from '../../components/Card/MenuCard'; import Layout from '../../components/Layout'...