repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/server/router/resumes/resumes-comments-user-router.ts | apps/portal/src/server/router/resumes/resumes-comments-user-router.ts | import { z } from 'zod';
import { ResumesSection } from '@prisma/client';
import { createProtectedRouter } from '../context';
type ResumeCommentInput = Readonly<{
description: string;
resumeId: string;
section: ResumesSection;
userId: string;
}>;
export const resumesCommentsUserRouter = createProtectedRouter... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/server/router/resumes/resumes-resume-user-router.ts | apps/portal/src/server/router/resumes/resumes-resume-user-router.ts | import { z } from 'zod';
import type { FilterCounts } from '~/utils/resumes/resumeFilters';
import {
getWhereClauseFilters,
resumeGetFilterCounts,
} from '~/utils/resumes/resumePrismaUtils';
import { createProtectedRouter } from '../context';
import type { Resume } from '~/types/resume';
export const resumesRes... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/server/router/resumes/resumes-resume-router.ts | apps/portal/src/server/router/resumes/resumes-resume-router.ts | import { z } from 'zod';
import { Vote } from '@prisma/client';
import type { FilterCounts } from '~/utils/resumes/resumeFilters';
import {
getWhereClauseFilters,
resumeGetFilterCounts,
} from '~/utils/resumes/resumePrismaUtils';
import { createRouter } from '../context';
import type { Resume } from '~/types/res... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/index.tsx | apps/portal/src/ui/index.tsx | // Alert
export * from './Alert/Alert';
export { default as Alert } from './Alert/Alert';
// Badge
export * from './Badge/Badge';
export { default as Badge } from './Badge/Badge';
// Banner
export * from './Banner/Banner';
export { default as Banner } from './Banner/Banner';
// Button
export * from './Button/Button';
e... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Toast/Toast.tsx | apps/portal/src/ui/Toast/Toast.tsx | import { Fragment, useEffect, useRef } from 'react';
import { Transition } from '@headlessui/react';
import { CheckIcon } from '@heroicons/react/24/outline';
import { XMarkIcon } from '@heroicons/react/24/solid';
type ToastVariant = 'failure' | 'success';
export type ToastMessage = {
duration?: number;
subtitle?:... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Toast/ToastsProvider.tsx | apps/portal/src/ui/Toast/ToastsProvider.tsx | import React, { createContext, useContext, useState } from 'react';
import type { ToastMessage } from './Toast';
import Toast from './Toast';
type Context = Readonly<{
showToast: (message: ToastMessage) => void;
}>;
export const ToastContext = createContext<Context>({
// eslint-disable-next-line @typescript-esli... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/RadioList/RadioListContext.ts | apps/portal/src/ui/RadioList/RadioListContext.ts | import type { ChangeEvent } from 'react';
import { createContext, useContext } from 'react';
type RadioListContextValue<T = unknown> = {
defaultValue?: T;
name?: string;
onChange?: (
value: T,
event: ChangeEvent<HTMLInputElement>,
) => undefined | void;
value?: T;
};
export const RadioListContext =
... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/RadioList/RadioListItem.tsx | apps/portal/src/ui/RadioList/RadioListItem.tsx | import clsx from 'clsx';
import { useId } from 'react';
import { useRadioListContext } from './RadioListContext';
type Props<T> = Readonly<{
description?: string;
disabled?: boolean;
label: string;
value: T;
}>;
export default function RadioListItem<T>({
description,
disabled = false,
label,
value,
}... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/RadioList/RadioList.tsx | apps/portal/src/ui/RadioList/RadioList.tsx | import clsx from 'clsx';
import type { ChangeEvent } from 'react';
import { useId } from 'react';
import { RadioListContext } from './RadioListContext';
import RadioListItem from './RadioListItem';
export type RadioListOrientation = 'horizontal' | 'vertical';
type Props<T> = Readonly<{
children: ReadonlyArray<Reac... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Dialog/Dialog.tsx | apps/portal/src/ui/Dialog/Dialog.tsx | import clsx from 'clsx';
import { Fragment, useRef } from 'react';
import { Dialog as HeadlessDialog, Transition } from '@headlessui/react';
type Props = Readonly<{
children: React.ReactNode;
isShown: boolean;
onClose: () => void;
primaryButton: React.ReactNode;
secondaryButton?: React.ReactNode;
title: st... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Select/Select.tsx | apps/portal/src/ui/Select/Select.tsx | import clsx from 'clsx';
import type { ForwardedRef, SelectHTMLAttributes } from 'react';
import { forwardRef } from 'react';
import { useId } from 'react';
type Attributes = Pick<
SelectHTMLAttributes<HTMLSelectElement>,
'disabled' | 'name' | 'onBlur' | 'onFocus' | 'required'
>;
export type SelectItem<T> = Reado... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/TextArea/TextArea.tsx | apps/portal/src/ui/TextArea/TextArea.tsx | import clsx from 'clsx';
import type {
ChangeEvent,
FocusEvent,
ForwardedRef,
TextareaHTMLAttributes,
} from 'react';
import React, { forwardRef, useId } from 'react';
type Attributes = Pick<
TextareaHTMLAttributes<HTMLTextAreaElement>,
| 'autoComplete'
| 'autoFocus'
| 'disabled'
| 'maxLength'
| 'm... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/DropdownMenu/DropdownMenuItem.tsx | apps/portal/src/ui/DropdownMenu/DropdownMenuItem.tsx | import clsx from 'clsx';
import React from 'react';
import { Menu } from '@headlessui/react';
type Props = Readonly<{
href?: string;
isSelected?: boolean;
label: React.ReactNode;
onClick: () => void;
}>;
export default function DropdownMenuItem({
href,
isSelected = false,
label,
onClick,
}: Props) {
... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/DropdownMenu/DropdownMenu.tsx | apps/portal/src/ui/DropdownMenu/DropdownMenu.tsx | import clsx from 'clsx';
import React, { Fragment } from 'react';
import { Menu, Transition } from '@headlessui/react';
import { ChevronDownIcon } from '@heroicons/react/24/solid';
import DropdownMenuItem from './DropdownMenuItem';
export type DropdownMenuAlignment = 'end' | 'start';
export type DropdownMenuSize = 'l... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/HorizontalDivider/HorizontalDivider.tsx | apps/portal/src/ui/HorizontalDivider/HorizontalDivider.tsx | import clsx from 'clsx';
type Props = Readonly<{
className?: string;
}>;
export default function HorizontalDivider({ className }: Props) {
return (
<hr
aria-hidden={true}
className={clsx('my-2 h-0 border-t border-slate-200', className)}
/>
);
}
| typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/SlideOut/SlideOut.tsx | apps/portal/src/ui/SlideOut/SlideOut.tsx | import clsx from 'clsx';
import { Fragment } from 'react';
import { Dialog, Transition } from '@headlessui/react';
import { XMarkIcon } from '@heroicons/react/24/outline';
export type SlideOutSize = 'lg' | 'md' | 'sm' | 'xl';
export type SlideOutEnterFrom = 'end' | 'start';
type Props = Readonly<{
children: React.R... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Alert/Alert.tsx | apps/portal/src/ui/Alert/Alert.tsx | import clsx from 'clsx';
import type { ReactNode } from 'react';
import {
CheckCircleIcon,
ExclamationTriangleIcon,
InformationCircleIcon,
XCircleIcon,
} from '@heroicons/react/20/solid';
export type AlertVariant = 'danger' | 'info' | 'success' | 'warning';
type Props = Readonly<{
children: ReactNode;
tit... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Pagination/Pagination.tsx | apps/portal/src/ui/Pagination/Pagination.tsx | import clsx from 'clsx';
import type { ReactElement } from 'react';
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/20/solid';
type Props = Readonly<{
current: number;
end: number;
label: string;
onSelect: (page: number, event: React.MouseEvent<HTMLElement>) => void;
pagePadding?: number;... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Banner/Banner.tsx | apps/portal/src/ui/Banner/Banner.tsx | import clsx from 'clsx';
import React from 'react';
import { XMarkIcon } from '@heroicons/react/24/outline';
export type BannerSize = 'md' | 'sm' | 'xs';
type Props = Readonly<{
children: React.ReactNode;
onHide?: () => void;
size?: BannerSize;
}>;
export default function Banner({ children, size = 'md', onHide... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Typeahead/Typeahead.tsx | apps/portal/src/ui/Typeahead/Typeahead.tsx | import clsx from 'clsx';
import type { InputHTMLAttributes } from 'react';
import { useId } from 'react';
import { Fragment, useState } from 'react';
import { Combobox, Transition } from '@headlessui/react';
import { CheckIcon, ChevronDownIcon } from '@heroicons/react/20/solid';
import { Spinner } from '..';
export t... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/CheckboxList/CheckboxList.tsx | apps/portal/src/ui/CheckboxList/CheckboxList.tsx | import clsx from 'clsx';
import { useId } from 'react';
import type CheckboxInput from '../CheckboxInput/CheckboxInput';
export type CheckboxListOrientation = 'horizontal' | 'vertical';
type Props = Readonly<{
children: ReadonlyArray<React.ReactElement<typeof CheckboxInput>>;
description?: string;
isLabelHidde... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Spinner/Spinner.tsx | apps/portal/src/ui/Spinner/Spinner.tsx | import clsx from 'clsx';
export type SpinnerColor = 'default' | 'inherit';
export type SpinnerSize = 'lg' | 'md' | 'sm' | 'xs';
export type SpinnerDisplay = 'block' | 'inline';
type Props = Readonly<{
className?: string;
color?: SpinnerColor;
display?: SpinnerDisplay;
label?: string;
size: SpinnerSize;
}>;
... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Collapsible/Collapsible.tsx | apps/portal/src/ui/Collapsible/Collapsible.tsx | import clsx from 'clsx';
import type { ReactNode } from 'react';
import { Disclosure } from '@headlessui/react';
import { ChevronDownIcon } from '@heroicons/react/20/solid';
type Props = Readonly<{
children: ReactNode;
defaultOpen?: boolean;
label: ReactNode;
}>;
export default function Collapsible({ children, ... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Button/Button.tsx | apps/portal/src/ui/Button/Button.tsx | import clsx from 'clsx';
import Link from 'next/link';
import type { HTMLAttributeAnchorTarget } from 'react';
import type { UrlObject } from 'url';
import { Spinner } from '../';
export type ButtonAddOnPosition = 'end' | 'start';
export type ButtonDisplay = 'block' | 'inline';
export type ButtonSize = 'lg' | 'md' | ... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Badge/Badge.tsx | apps/portal/src/ui/Badge/Badge.tsx | import clsx from 'clsx';
export type BadgeVariant =
| 'danger'
| 'info'
| 'primary'
| 'success'
| 'warning';
type Props = Readonly<{
endAddOn?: React.ComponentType<React.ComponentProps<'svg'>>;
label: string;
startAddOn?: React.ComponentType<React.ComponentProps<'svg'>>;
variant: BadgeVariant;
}>;
... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/TextInput/TextInput.tsx | apps/portal/src/ui/TextInput/TextInput.tsx | import clsx from 'clsx';
import type {
ChangeEvent,
FocusEvent,
ForwardedRef,
InputHTMLAttributes,
} from 'react';
import React, { forwardRef, useId } from 'react';
type Attributes = Pick<
InputHTMLAttributes<HTMLInputElement>,
| 'autoComplete'
| 'disabled'
| 'max'
| 'maxLength'
| 'min'
| 'minLen... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/Tabs/Tabs.tsx | apps/portal/src/ui/Tabs/Tabs.tsx | import clsx from 'clsx';
import Link from 'next/link';
import type { UrlObject } from 'url';
export type TabItem<T> = Readonly<{
href?: UrlObject | string;
label: string;
value: T;
}>;
type Props<T> = Readonly<{
label: string;
onChange?: (value: T) => void;
tabs: ReadonlyArray<TabItem<T>>;
value: T;
}>;... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/ui/CheckboxInput/CheckboxInput.tsx | apps/portal/src/ui/CheckboxInput/CheckboxInput.tsx | import clsx from 'clsx';
import type { ChangeEvent } from 'react';
import type { ForwardedRef } from 'react';
import { forwardRef, useId } from 'react';
type Props = Readonly<{
defaultValue?: boolean;
description?: string;
disabled?: boolean;
errorMessage?: string;
label: string;
name?: string;
onChange?... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/src/constants/file-storage-keys.ts | apps/portal/src/constants/file-storage-keys.ts | export const RESUME_STORAGE_KEY = 'resumes';
| typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/prisma/seed-questions.ts | apps/portal/prisma/seed-questions.ts | import { PrismaClient } from '@prisma/client';
import { JobTitleLabels } from '../src/components/shared/JobTitles';
const prisma = new PrismaClient();
type QuestionCreateData = Parameters<
typeof prisma.questionsQuestion.create
>[0]['data'];
function selectRandomRole() {
const roles = Object.keys(JobTitleLabels... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/prisma/seed.ts | apps/portal/prisma/seed.ts | const { PrismaClient } = require('@prisma/client');
const cities = require('./data/cities.json');
const countries = require('./data/countries.json');
const states = require('./data/states.json');
const prisma = new PrismaClient();
async function main() {
console.log('Seeding started...');
console.info('Seeding ... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/prisma/seed-companies.ts | apps/portal/prisma/seed-companies.ts | import * as fs from 'fs';
const { PrismaClient } = require('@prisma/client');
const { parse } = require('csv-parse/sync');
const prisma = new PrismaClient();
async function main() {
console.log('Seeding started...');
const file = fs.readFileSync('prisma/companies.csv');
const companies = parse(file, {
colu... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/prisma/seed-salaries.ts | apps/portal/prisma/seed-salaries.ts | import reader from 'xlsx';
import { PrismaClient } from '@prisma/client';
import crypto from 'crypto';
import { baseCurrencyString } from '../src/utils/offers/currency';
import { convert } from '../src/utils/offers/currency/currencyExchange';
import {
generateRandomName,
generateRandomStringForToken,
} from '../sr... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/portal/prisma/seed-analysis.ts | apps/portal/prisma/seed-analysis.ts | import { PrismaClient } from '@prisma/client';
import { generateAnalysis } from '../src/utils/offers/analysis/analysisGeneration';
const prisma = new PrismaClient();
const seedAnalysis = async () => {
console.log('Busy crunching analysis.....');
const profilesWithoutAnalysis = await prisma.offersProfile.findMany... | typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
yangshun/tech-interview-handbook | https://github.com/yangshun/tech-interview-handbook/blob/9430396f989730fab83f3ccba16b4955577f107d/apps/website/src/theme/DocSidebar/Mobile/index.d.ts | apps/website/src/theme/DocSidebar/Mobile/index.d.ts | import React from 'react';
import type { Props } from '@theme/DocSidebar/Mobile';
declare function DocSidebarMobile(props: Props): JSX.Element;
declare const _default: React.MemoExoticComponent<typeof DocSidebarMobile>;
export default _default;
| typescript | MIT | 9430396f989730fab83f3ccba16b4955577f107d | 2026-01-04T15:25:31.531135Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/nitro.config.ts | apps/api/nitro.config.ts | //https://nitro.unjs.io/config
export default defineNitroConfig({
srcDir: "server",
preset: 'heroku',
routeRules: {
'/api/**': { cors: true, headers: { 'access-control-allow-methods': '*' } },
}
});
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/prisma/seed.ts | apps/api/prisma/seed.ts | import {
randEmail,
randFullName,
randLines,
randParagraph,
randPassword,
randPhrase,
randWord,
} from '@ngneat/falso';
import { PrismaClient } from '@prisma/client';
import { RegisteredUser } from '../app/models/registered-user.model';
import { createUser } from '../app/services/auth.service';
import { a... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/auth-event-handler.ts | apps/api/server/auth-event-handler.ts | import {default as jwt} from "jsonwebtoken";
export interface PrivateContext {
auth: {
id: number;
}
}
export function definePrivateEventHandler<T>(
handler: (event: H3Event, cxt: PrivateContext) => T,
options: { requireAuth: boolean } = {requireAuth: true}
) {
return defineEventHandler(as... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/[...].options.ts | apps/api/server/routes/api/[...].options.ts | export default defineEventHandler(async (event) => {
setResponseStatus(event, 200);
return "";
});
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/user/index.put.ts | apps/api/server/routes/api/user/index.put.ts | import * as bcrypt from 'bcryptjs';
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const {user} = await readBody(event);
const {email, username, password, image, bio} = user;
let hashedPassword;
if (password) {
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/user/index.get.ts | apps/api/server/routes/api/user/index.get.ts | import {User} from "~/models/user.model";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const user = (await usePrisma().user.findUnique({
where: {
id: auth.id,
},
select: {
id: true... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/tags/index.get.ts | apps/api/server/routes/api/tags/index.get.ts | import {Tag} from "~/models/tag.model";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const queries = [];
queries.push({demo: true});
if (auth) {
queries.push({
id: {
equals: auth.id,
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/index.post.ts | apps/api/server/routes/api/articles/index.post.ts | import articleMapper from "~/utils/article.mapper";
import HttpException from "~/models/http-exception.model";
import slugify from 'slugify';
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const {article} = await readBody(event);
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/feed.get.ts | apps/api/server/routes/api/articles/feed.get.ts | import articleMapper from "~/utils/article.mapper";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const query = getQuery(event);
const articlesCount = await usePrisma().article.count({
where: {
author: {
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/index.get.ts | apps/api/server/routes/api/articles/index.get.ts | import articleMapper from "~/utils/article.mapper";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const query = getQuery(event);
const andQueries = buildFindAllQuery(query, auth);
const articlesCount = await usePrisma().... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/index.delete.ts | apps/api/server/routes/api/articles/[slug]/index.delete.ts | import HttpException from "~/models/http-exception.model";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const slug = getRouterParam(event, 'slug');
const existingArticle = await usePrisma().article.findFirst({
where: {
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/index.put.ts | apps/api/server/routes/api/articles/[slug]/index.put.ts | import HttpException from "~/models/http-exception.model";
import articleMapper from "~/utils/article.mapper";
import slugify from 'slugify';
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const {article} = await readBody(event);
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/index.get.ts | apps/api/server/routes/api/articles/[slug]/index.get.ts | import HttpException from "~/models/http-exception.model";
import articleMapper from "~/utils/article.mapper";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const slug = getRouterParam(event, 'slug');
const article = await usePr... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/favorite/index.post.ts | apps/api/server/routes/api/articles/[slug]/favorite/index.post.ts | import profileMapper from "~/utils/profile.utils";
import {Tag} from "~/models/tag.model";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const slug = getRouterParam(event, "slug");
const { _count, ...article } = await usePri... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/favorite/index.delete.ts | apps/api/server/routes/api/articles/[slug]/favorite/index.delete.ts | import profileMapper from "~/utils/profile.utils";
import {Tag} from "~/models/tag.model";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const slug = getRouterParam(event, "slug");
const { _count, ...article } = await usePri... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/comments/index.post.ts | apps/api/server/routes/api/articles/[slug]/comments/index.post.ts | import HttpException from "~/models/http-exception.model";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const {comment} = await readBody(event);
const slug = getRouterParam(event, 'slug');
if (!comment.body) {
t... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/comments/index.get.ts | apps/api/server/routes/api/articles/[slug]/comments/index.get.ts | import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const slug = getRouterParam(event, 'slug');
const queries = [];
queries.push({
author: {
demo: true,
},
});
if (auth?.id) {
quer... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/articles/[slug]/comments/[id].delete.ts | apps/api/server/routes/api/articles/[slug]/comments/[id].delete.ts | import HttpException from "~/models/http-exception.model";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const id = Number(getRouterParam(event, 'id'));
const comment = await usePrisma().comment.findFirst({
where: {
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/profiles/[username]/index.get.ts | apps/api/server/routes/api/profiles/[username]/index.get.ts | import HttpException from "~/models/http-exception.model";
import profileMapper from "~/utils/profile.utils";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const username = getRouterParam(event, 'username');
const profile = ... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/profiles/[username]/follow/index.post.ts | apps/api/server/routes/api/profiles/[username]/follow/index.post.ts | import profileMapper from "~/utils/profile.utils";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const username = getRouterParam(event, 'username');
const profile = await usePrisma().user.update({
where: {
us... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/profiles/[username]/follow/index.delete.ts | apps/api/server/routes/api/profiles/[username]/follow/index.delete.ts | import profileMapper from "~/utils/profile.utils";
import {definePrivateEventHandler} from "~/auth-event-handler";
export default definePrivateEventHandler(async (event, {auth}) => {
const username = getRouterParam(event, 'username');
const profile = await usePrisma().user.update({
where: {
us... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/users/index.post.ts | apps/api/server/routes/api/users/index.post.ts | import HttpException from "~/models/http-exception.model";
import {default as bcrypt} from 'bcryptjs';
export default defineEventHandler(async (event) => {
const {user} = await readBody(event);
const email = user.email?.trim();
const username = user.username?.trim();
const password = user.password?.tr... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/users/login.post.ts | apps/api/server/routes/api/users/login.post.ts | import HttpException from "~/models/http-exception.model";
import {default as bcrypt} from 'bcryptjs';
export default defineEventHandler(async (event) => {
const {user} = await readBody(event);
const email = user.email?.trim();
const password = user.password?.trim();
if (!email) {
throw new H... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/v2/auth/login.post.ts | apps/api/server/routes/api/v2/auth/login.post.ts | import {z} from "zod";
import {useDecrypt} from "~/utils/hash-password";
const userSchema = z.object({
email: z.string().email("This is not a valid email"),
password: z.string().min(8).max(20),
});
export default defineEventHandler(async (event) => {
const {email, password} = await readValidatedBody(event... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/v2/auth/logout.post.ts | apps/api/server/routes/api/v2/auth/logout.post.ts | export default defineEventHandler(async (event) => {
deleteCookie(event, 'auth_token');
return "Logged out";
});
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/v2/auth/signup.post.ts | apps/api/server/routes/api/v2/auth/signup.post.ts | import {z} from "zod";
const userSchema = z.object({
username: z.string().min(3).max(20),
email: z.string().email("This is not a valid email"),
password: z.string().min(8).max(20),
});
export default defineEventHandler(async (event) => {
const {username, email, password} = await readValidatedBody(even... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/v2/profile/[id].put.ts | apps/api/server/routes/api/v2/profile/[id].put.ts | import {z} from "zod";
const profileSchema = z.object({
image: z.string().url().optional(),
bio: z.string().optional(),
});
export default defineEventHandler(async (event) => {
useCheckAuth('required');
const id = getRouterParam(event, 'id');
const body = readValidatedBody(event, profileSchema.pa... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/routes/api/v2/profile/[id].get.ts | apps/api/server/routes/api/v2/profile/[id].get.ts | export default defineEventHandler(async (event) => {
const id = getRouterParam(event, 'id');
const profile = await usePrisma().profile.findUnique({
where: {
id
},
select: {
id: true,
username: true,
bio: true,
image: true,
... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/models/http-exception.model.ts | apps/api/server/models/http-exception.model.ts | class HttpException extends Error {
errorCode: number;
constructor(
errorCode: number,
public readonly message: string | any,
) {
super(message);
this.errorCode = errorCode;
}
}
export default HttpException;
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/models/user.model.ts | apps/api/server/models/user.model.ts | import { Article } from './article.model';
import { Comment } from './comment.model';
export interface User {
id: number;
username: string;
email: string;
password: string;
bio: string | null;
image: any | null;
articles: Article[];
favorites: Article[];
followedBy: User[];
following: User[];
com... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/models/comment.model.ts | apps/api/server/models/comment.model.ts | import { Article } from './article.model';
export interface Comment {
id: number;
createdAt: Date;
updatedAt: Date;
body: string;
article?: Article;
}
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/models/profile.model.ts | apps/api/server/models/profile.model.ts | export interface Profile {
username: string;
bio: string;
image: string;
following: boolean;
}
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/models/tag.model.ts | apps/api/server/models/tag.model.ts | export interface Tag {
name: string;
}
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/models/article.model.ts | apps/api/server/models/article.model.ts | import { Comment } from './comment.model';
export interface Article {
id: number;
title: string;
slug: string;
description: string;
comments: Comment[];
favorited: boolean;
}
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/article.mapper.ts | apps/api/server/utils/article.mapper.ts | import authorMapper from './author.mapper';
const articleMapper = (article: any, id?: number) => ({
slug: article.slug,
title: article.title,
description: article.description,
body: article.body,
tagList: article.tagList.map((tag: any) => tag.name),
createdAt: article.createdAt,
updatedAt: article.update... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/generate-token.ts | apps/api/server/utils/generate-token.ts | import jwt from 'jsonwebtoken';
export const useGenerateToken = (id: number): string =>
jwt.sign({user: {id}}, process.env.JWT_SECRET, {
expiresIn: '60d',
});
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/author.mapper.ts | apps/api/server/utils/author.mapper.ts | import { User } from '~/models/user.model';
const authorMapper = (author: any, id?: number) => ({
username: author.username,
bio: author.bio,
image: author.image,
following: id
? author?.followedBy.some((followingUser: Partial<User>) => followingUser.id === id)
: false,
});
export default authorMapper... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/profile.utils.ts | apps/api/server/utils/profile.utils.ts | import { User } from '~/models/user.model';
import { Profile } from '~/models/profile.model';
const profileMapper = (user: any, id: number | undefined): Profile => ({
username: user.username,
bio: user.bio,
image: user.image,
following: id
? user?.followedBy.some((followingUser: Partial<User>) => following... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/auth.ts | apps/api/server/utils/auth.ts | import {default as jwt} from "jsonwebtoken";
export const useCheckAuth = (mode: 'optional' | 'required') => (event) => {
// const token = getCookie(event, 'auth_token');
const header = getHeader(event, 'authorization');
let token;
if (
(header && header.split(' ')[0] === 'Token') ||
(h... | typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/prisma.ts | apps/api/server/utils/prisma.ts | import { PrismaClient } from '@prisma/client';
let _prisma;
export const usePrisma = () => {
if (!_prisma) {
_prisma = new PrismaClient();
}
return _prisma;
}
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/hash-password.ts | apps/api/server/utils/hash-password.ts | import bcrypt from 'bcryptjs';
export const useHashPassword = (password: string) => {
return bcrypt.hash(password, 10);
}
export const useDecrypt = (input: string, password: string) => {
return bcrypt.compare(input, password);
}
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/api/server/utils/foo.ts | apps/api/server/utils/foo.ts | export const useFoo = () => {
console.log('done')
}
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/documentation/src/env.d.ts | apps/documentation/src/env.d.ts | /// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
gothinkster/realworld | https://github.com/gothinkster/realworld/blob/32a16a622b0c7138385d6584dfa14269f13d9932/apps/documentation/src/content/config.ts | apps/documentation/src/content/config.ts | import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
export const collections = {
docs: defineCollection({ schema: docsSchema() }),
};
| typescript | MIT | 32a16a622b0c7138385d6584dfa14269f13d9932 | 2026-01-04T15:25:31.893560Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/vitest.config.ts | vitest.config.ts | import { resolve as _resolve } from 'path'
import { defineConfig } from 'vitest/config'
const resolve = (p: string) => _resolve(__dirname, p)
export default defineConfig({
resolve: {
alias: {
compiler: resolve('src/compiler'),
core: resolve('src/core'),
server: resolve('packages/server-rendere... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/global.d.ts | src/global.d.ts | declare const __DEV__: boolean
declare const __TEST__: boolean
declare const __GLOBAL__: boolean
interface Window {
__VUE_DEVTOOLS_GLOBAL_HOOK__: DevtoolsHook
}
// from https://github.com/vuejs/vue-devtools/blob/bc719c95a744614f5c3693460b64dc21dfa339a8/packages/app-backend-api/src/global-hook.ts#L3
interface Devtoo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/entry-compiler.ts | src/platforms/web/entry-compiler.ts | export { parseComponent } from 'sfc/parseComponent'
export { compile, compileToFunctions } from './compiler/index'
export { ssrCompile, ssrCompileToFunctions } from 'server/compiler'
export { generateCodeFrame } from 'compiler/codeframe'
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/entry-runtime-with-compiler.ts | src/platforms/web/entry-runtime-with-compiler.ts | import Vue from './runtime-with-compiler'
import * as vca from 'v3'
import { extend } from 'shared/util'
extend(Vue, vca)
import { effect } from 'v3/reactivity/effect'
Vue.effect = effect
export default Vue
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/entry-runtime-with-compiler-esm.ts | src/platforms/web/entry-runtime-with-compiler-esm.ts | import Vue from './runtime-with-compiler'
export default Vue
export * from 'v3'
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime-with-compiler.ts | src/platforms/web/runtime-with-compiler.ts | import config from 'core/config'
import { warn, cached } from 'core/util/index'
import { mark, measure } from 'core/util/perf'
import Vue from './runtime/index'
import { query } from './util/index'
import { compileToFunctions } from './compiler/index'
import {
shouldDecodeNewlines,
shouldDecodeNewlinesForHref
} fr... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/entry-runtime-esm.ts | src/platforms/web/entry-runtime-esm.ts | import Vue from './runtime/index'
export default Vue
export * from 'v3'
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/entry-runtime.ts | src/platforms/web/entry-runtime.ts | import Vue from './runtime/index'
import * as vca from 'v3'
import { extend } from 'shared/util'
extend(Vue, vca)
export default Vue
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/util/compat.ts | src/platforms/web/util/compat.ts | import { inBrowser } from 'core/util/index'
// check whether current browser encodes a char inside attribute values
let div
function getShouldDecode(href: boolean): boolean {
div = div || document.createElement('div')
div.innerHTML = href ? `<a href="\n"/>` : `<div a="\n"/>`
return div.innerHTML.indexOf(' ')... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/util/class.ts | src/platforms/web/util/class.ts | import VNode from 'core/vdom/vnode'
import { isDef, isObject } from 'shared/util'
import type { VNodeData, VNodeWithData } from 'types/vnode'
export function genClassForVnode(vnode: VNodeWithData): string {
let data = vnode.data
let parentNode: VNode | VNodeWithData | undefined = vnode
let childNode: VNode | VNo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/util/attrs.ts | src/platforms/web/util/attrs.ts | import { makeMap } from 'shared/util'
// these are reserved for web because they are directly compiled away
// during template compilation
export const isReservedAttr = makeMap('style,class')
// attributes that should be using props for binding
const acceptValue = makeMap('input,textarea,option,select,progress')
expo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/util/index.ts | src/platforms/web/util/index.ts | import { warn } from 'core/util/index'
export * from './attrs'
export * from './class'
export * from './element'
/**
* Query an element selector if it's not an element already.
*/
export function query(el: string | Element): Element {
if (typeof el === 'string') {
const selected = document.querySelector(el)
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/util/style.ts | src/platforms/web/util/style.ts | import VNode from 'core/vdom/vnode'
import { cached, extend, toObject } from 'shared/util'
import type { VNodeData, VNodeWithData } from 'types/vnode'
export const parseStyleText = cached(function (cssText) {
const res = {}
const listDelimiter = /;(?![^(]*\))/g
const propertyDelimiter = /:(.+)/
cssText.split(l... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/util/element.ts | src/platforms/web/util/element.ts | import { inBrowser } from 'core/util/env'
import { makeMap } from 'shared/util'
export const namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML'
}
export const isHTMLTag = makeMap(
'html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime/class-util.ts | src/platforms/web/runtime/class-util.ts | const whitespaceRE = /\s+/
/**
* Add class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
export function addClass(el: HTMLElement, cls?: string) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList)... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime/patch.ts | src/platforms/web/runtime/patch.ts | import * as nodeOps from 'web/runtime/node-ops'
import { createPatchFunction } from 'core/vdom/patch'
import baseModules from 'core/vdom/modules/index'
import platformModules from 'web/runtime/modules/index'
// the directive module should be applied last, after all
// built-in modules have been applied.
const modules ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime/index.ts | src/platforms/web/runtime/index.ts | import Vue from 'core/index'
import config from 'core/config'
import { extend, noop } from 'shared/util'
import { mountComponent } from 'core/instance/lifecycle'
import { devtools, inBrowser } from 'core/util/index'
import {
query,
mustUseProp,
isReservedTag,
isReservedAttr,
getTagNamespace,
isUnknownEleme... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime/node-ops.ts | src/platforms/web/runtime/node-ops.ts | import VNode from 'core/vdom/vnode'
import { namespaceMap } from 'web/util/index'
export function createElement(tagName: string, vnode: VNode): Element {
const elm = document.createElement(tagName)
if (tagName !== 'select') {
return elm
}
// false or null will remove the attribute but undefined will not
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime/transition-util.ts | src/platforms/web/runtime/transition-util.ts | import { inBrowser, isIE9 } from 'core/util/index'
import { addClass, removeClass } from 'web/runtime/class-util'
import { remove, extend, cached } from 'shared/util'
export function resolveTransition(
def?: string | Record<string, any>
): Record<string, any> | undefined {
if (!def) {
return
}
/* istanbul ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime/components/transition.ts | src/platforms/web/runtime/components/transition.ts | // Provides transition support for a single element/component.
// supports transition mode (out-in / in-out)
import { warn } from 'core/util/index'
import { camelize, extend, isPrimitive } from 'shared/util'
import {
mergeVNodeHook,
isAsyncPlaceholder,
getFirstComponentChild
} from 'core/vdom/helpers/index'
impo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/platforms/web/runtime/components/transition-group.ts | src/platforms/web/runtime/components/transition-group.ts | // Provides transition support for list items.
// supports move transitions using the FLIP technique.
// Because the vdom's children update algorithm is "unstable" - i.e.
// it doesn't guarantee the relative positioning of removed elements,
// we force transition-group to update its children into two passes:
// in the... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.