text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```xml import { vol } from 'memfs'; import { DirectPackageInstallCheck, directPackageInstallCheckItems, } from '../DirectPackageInstallCheck'; jest.mock('fs'); const projectRoot = '/tmp/project'; // required by runAsync const additionalProjectProps = { exp: { name: 'name', slug: 'slug', sdkVersion: '50.0.0', }, projectRoot, hasUnusedStaticConfig: false, staticConfigPath: null, dynamicConfigPath: null, }; describe('runAsync', () => { beforeEach(() => { vol.fromJSON({ [projectRoot + '/node_modules/.bin/expo']: 'test', }); }); it('returns result with isSuccessful = true if empty dependencies, devDependencies, scripts', async () => { const check = new DirectPackageInstallCheck(); const result = await check.runAsync({ pkg: { name: 'name', version: '1.0.0' }, ...additionalProjectProps, }); expect(result.isSuccessful).toBeTruthy(); }); it(`returns result with isSuccessful = true if package.json contains a dependency that is on list, but SDK requirement is not met`, async () => { const check = new DirectPackageInstallCheck(); const result = await check.runAsync({ pkg: { name: 'name', version: '1.0.0', dependencies: { '@types/react-native': '17.0.1' } }, ...additionalProjectProps, exp: { name: 'name', slug: 'slug', sdkVersion: '47.0.0', }, }); expect(result.isSuccessful).toBeTruthy(); }); const dependencyLocations = ['dependencies', 'devDependencies']; dependencyLocations.forEach((dependencyLocation) => { it(`returns result with isSuccessful = true if ${dependencyLocation} does not contain a dependency that should only be installed by another Expo package`, async () => { const check = new DirectPackageInstallCheck(); const result = await check.runAsync({ pkg: { name: 'name', version: '1.0.0', [dependencyLocation]: { somethingjs: '17.0.1' } }, ...additionalProjectProps, }); expect(result.isSuccessful).toBeTruthy(); }); directPackageInstallCheckItems.forEach((transitiveOnlyDependency) => { it(`returns result with isSuccessful = false if ${dependencyLocation} contains ${transitiveOnlyDependency.packageName}`, async () => { const check = new DirectPackageInstallCheck(); const result = await check.runAsync({ pkg: { name: 'name', version: '1.0.0', [dependencyLocation]: { [transitiveOnlyDependency.packageName]: '1.0.0' }, }, ...additionalProjectProps, }); expect(result.isSuccessful).toBeFalsy(); }); }); }); }); ```
/content/code_sandbox/packages/expo-doctor/src/checks/__tests__/DirectPackageInstallCheck.test.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
617
```xml import spawnAsync from '@expo/spawn-async'; import fs from 'fs'; import { vol } from 'memfs'; import path from 'path'; import { normalizeOptionsAsync } from '../../Options'; import { getBareAndroidSourcesAsync, getBareIosSourcesAsync, getPackageJsonScriptSourcesAsync, getRncliAutolinkingSourcesAsync, } from '../Bare'; import { SourceSkips } from '../SourceSkips'; jest.mock('@expo/spawn-async'); jest.mock('fs/promises'); jest.mock('/app/package.json', () => ({}), { virtual: true }); describe('getBareSourcesAsync', () => { afterEach(() => { vol.reset(); }); it('should contain android and ios folders in bare react-native project', async () => { vol.fromJSON(require('./fixtures/BareReactNative70Project.json')); let sources = await getBareAndroidSourcesAsync('/app', await normalizeOptionsAsync('/app')); expect(sources).toContainEqual(expect.objectContaining({ filePath: 'android', type: 'dir' })); sources = await getBareIosSourcesAsync('/app', await normalizeOptionsAsync('/app')); expect(sources).toContainEqual(expect.objectContaining({ filePath: 'ios', type: 'dir' })); }); }); describe(getPackageJsonScriptSourcesAsync, () => { it('by default, should skip package.json scripts if items does not contain "run"', async () => { await jest.isolateModulesAsync(async () => { const scripts = { android: 'expo start --android', ios: 'expo start --ios', web: 'expo start --web', }; jest.doMock( '/app/package.json', () => ({ scripts: { ...scripts }, }), { virtual: true, } ); const sources = await getPackageJsonScriptSourcesAsync( '/app', await normalizeOptionsAsync('/app') ); expect(sources).toContainEqual( expect.objectContaining({ id: 'packageJson:scripts', contents: JSON.stringify({ web: 'expo start --web' }), }) ); }); }); it('by default, should not touch pacakge.json scripts if items contain "run" with custom scripts', async () => { await jest.isolateModulesAsync(async () => { const scripts = { android: 'test-cli run:android', ios: 'test-cli run:ios', web: 'expo start --web', }; jest.doMock( '/app/package.json', () => ({ scripts: { ...scripts }, }), { virtual: true, } ); const sources = await getPackageJsonScriptSourcesAsync( '/app', await normalizeOptionsAsync('/app') ); expect(sources).toContainEqual( expect.objectContaining({ id: 'packageJson:scripts', contents: JSON.stringify(scripts), }) ); }); }); it('when sourceSkips=None, should not touch pacakge.json scripts if items contain "run"', async () => { await jest.isolateModulesAsync(async () => { const scripts = { android: 'expo start --android', ios: 'expo start --ios', web: 'expo start --web', }; jest.doMock( '/app/package.json', () => ({ scripts: { ...scripts }, }), { virtual: true, } ); const options = await normalizeOptionsAsync('/app', { sourceSkips: SourceSkips.None, }); const sources = await getPackageJsonScriptSourcesAsync('/app', options); expect(sources).toContainEqual( expect.objectContaining({ id: 'packageJson:scripts', contents: JSON.stringify(scripts), }) ); }); }); }); describe(getRncliAutolinkingSourcesAsync, () => { afterEach(() => { vol.reset(); }); it('should contain rn-cli autolinking projects', async () => { const mockSpawnAsync = spawnAsync as jest.MockedFunction<typeof spawnAsync>; const fixture = fs.readFileSync( path.join(__dirname, 'fixtures', 'RncliAutoLinking.json'), 'utf8' ); mockSpawnAsync.mockResolvedValue({ stdout: fixture, stderr: '', status: 0, signal: null, output: [fixture, ''], }); const sources = await getRncliAutolinkingSourcesAsync( '/root/apps/demo', await normalizeOptionsAsync('/app') ); expect(sources).toContainEqual( expect.objectContaining({ type: 'dir', filePath: '../../node_modules/react-native-reanimated', }) ); expect(sources).toContainEqual( expect.objectContaining({ type: 'dir', filePath: '../../node_modules/react-native-navigation-bar-color', }) ); expect(sources).toMatchSnapshot(); }); it('should not contain absolute paths', async () => { const mockSpawnAsync = spawnAsync as jest.MockedFunction<typeof spawnAsync>; const fixture = fs.readFileSync( path.join(__dirname, 'fixtures', 'RncliAutoLinking.json'), 'utf8' ); mockSpawnAsync.mockResolvedValue({ stdout: fixture, stderr: '', status: 0, signal: null, output: [fixture, ''], }); const sources = await getRncliAutolinkingSourcesAsync( '/root/apps/demo', await normalizeOptionsAsync('/app') ); for (const source of sources) { if (source.type === 'dir' || source.type === 'file') { expect(source.filePath).not.toMatch(/^\/root/); } else { expect(source.contents).not.toMatch(/"\/root\//); } } }); it('should gracefully ignore react-native-cli dependencies with a bad form', async () => { const mockSpawnAsync = spawnAsync as jest.MockedFunction<typeof spawnAsync>; const fixture = fs.readFileSync( path.join(__dirname, 'fixtures', 'RncliAutoLinkingBadDependency.json'), 'utf8' ); mockSpawnAsync.mockResolvedValue({ stdout: fixture, stderr: '', status: 0, signal: null, output: [fixture, ''], }); const sources = await getRncliAutolinkingSourcesAsync( '/root/apps/demo', await normalizeOptionsAsync('/app') ); expect(sources).toContainEqual( expect.objectContaining({ type: 'dir', filePath: '../../node_modules/react-native-reanimated', }) ); expect(sources).not.toContainEqual( expect.objectContaining({ type: 'dir', filePath: '../../node_modules/react-native-navigation-bar-color', }) ); }); }); ```
/content/code_sandbox/packages/@expo/fingerprint/src/sourcer/__tests__/Bare-test.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
1,467
```xml import { existsSync, unlinkSync, writeFileSync } from "fs"; import { join } from "path"; import { afterEach, beforeEach, describe, expect, it } from "vitest"; import type { Settings } from "../Settings"; import { SettingsFileReader } from "./SettingsFileReader"; const settingsFilePath = join(__dirname, "settings.json"); const settings: Settings = { key1: "value1", key2: "value2", key3: "value3", }; const removeFileIfExists = (filePath: string) => { if (existsSync(filePath)) { unlinkSync(filePath); } }; describe(SettingsFileReader, () => { beforeEach(() => removeFileIfExists(settingsFilePath)); afterEach(() => removeFileIfExists(settingsFilePath)); it("should read settings from a json file", () => { writeFileSync(settingsFilePath, JSON.stringify(settings), "utf-8"); const settingsFileReader = new SettingsFileReader(settingsFilePath); expect(settingsFileReader.readSettings()).toEqual(settings); }); it("should return an empty object if the settings file does not exist", () => { const settingsFileReader = new SettingsFileReader(settingsFilePath); expect(settingsFileReader.readSettings()).toEqual({}); }); }); ```
/content/code_sandbox/src/main/Core/SettingsReader/SettingsFileReader.test.ts
xml
2016-10-11T04:59:52
2024-08-16T11:53:31
ueli
oliverschwendener/ueli
3,543
261
```xml 'use client' import base from './base.module.css' import styles from './inner2.module.css' export default async function Inner2() { if (typeof window === 'undefined') { throw new Error('Expected error to opt out of server rendering') } return ( <p id="inner2" className={`global-class ${base.class} ${styles.class}`}> Hello Inner 2 </p> ) } ```
/content/code_sandbox/test/e2e/app-dir/next-dynamic-css/app/page/inner2.tsx
xml
2016-10-05T23:32:51
2024-08-16T19:44:30
next.js
vercel/next.js
124,056
91
```xml import type { StaticallyComposableHTML, ValuesOf } from '../utils/index.js'; import { ProgressBar } from './progress-bar.js'; /** * ProgressBarThickness Constants * @public */ export const ProgressBarThickness = { medium: 'medium', large: 'large', } as const; /** * Applies bar thickness to the content * @public */ export type ProgressBarThickness = ValuesOf<typeof ProgressBarThickness>; /** * ProgressBarShape Constants * @public */ export const ProgressBarShape = { rounded: 'rounded', square: 'square', } as const; /** * Applies bar shape to the content * @public */ export type ProgressBarShape = ValuesOf<typeof ProgressBarShape>; /** * ProgressBarValidationState Constants * @public */ export const ProgressBarValidationState = { success: 'success', warning: 'warning', error: 'error', } as const; /** * Applies validation state to the content * @public */ export type ProgressBarValidationState = ValuesOf<typeof ProgressBarValidationState>; ```
/content/code_sandbox/packages/web-components/src/progress-bar/progress-bar.options.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
213
```xml /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at path_to_url */ export * from './directives/label'; export * from './directives/error'; export * from './directives/hint'; export * from './directives/prefix'; export * from './directives/suffix'; export * from './form-field'; export * from './module'; export * from './form-field-control'; export * from './form-field-errors'; export * from './form-field-animations'; ```
/content/code_sandbox/src/material/form-field/public-api.ts
xml
2016-01-04T18:50:02
2024-08-16T11:21:13
components
angular/components
24,263
118
```xml import { Link, TableCell, TableRow } from "@mui/material"; import React from "react"; import { Link as RouterLink } from "react-router-dom"; import { CodeDialogButton, CodeDialogButtonWithPreview, } from "../../common/CodeDialogButton"; import { DurationText } from "../../common/DurationText"; import { formatDateFromTimeMs } from "../../common/formatUtils"; import { StatusChip } from "../../components/StatusChip"; import { ServeApplication, ServeDeployment, ServeReplica, } from "../../type/serve"; import { useViewServeDeploymentMetricsButtonUrl } from "./ServeDeploymentMetricsSection"; export type ServeDeploymentRowProps = { deployment: ServeDeployment; application: ServeApplication; // Optional prop to control the visibility of the first column. // This is used to display an expand/collapse button on the applications page, but not the deployment page. showExpandColumn?: boolean; }; export const ServeDeploymentRow = ({ deployment, application: { last_deployed_time_s, name: applicationName }, showExpandColumn = false, }: ServeDeploymentRowProps) => { const { name, status, message, deployment_config, replicas } = deployment; const metricsUrl = useViewServeDeploymentMetricsButtonUrl(name); return ( <React.Fragment> <TableRow> {showExpandColumn && ( <TableCell> {/* Empty column for expand/unexpand button in the row of the parent Serve application. */} </TableCell> )} <TableCell align="center" sx={{ fontWeight: showExpandColumn ? 500 : 400 }} > <Link component={RouterLink} to={`/serve/applications/${encodeURIComponent( applicationName, )}/${encodeURIComponent(name)}`} > {name} </Link> </TableCell> <TableCell align="center"> <StatusChip type="serveDeployment" status={status} /> </TableCell> <TableCell align="center"> {message ? ( <CodeDialogButtonWithPreview sx={{ maxWidth: 400, display: "inline-flex" }} title="Message details" code={message} /> ) : ( "-" )} </TableCell> <TableCell align="center"> {" "} <Link component={RouterLink} to={`/serve/applications/${encodeURIComponent( applicationName, )}/${encodeURIComponent(name)}`} > {replicas.length} </Link> </TableCell> <TableCell align="center"> <CodeDialogButton title={`Deployment config for ${name}`} code={deployment_config} buttonText="View config" /> <br /> <Link component={RouterLink} to={`/serve/applications/${encodeURIComponent( applicationName, )}/${encodeURIComponent(name)}`} > Logs </Link> {metricsUrl && ( <React.Fragment> <br /> <Link href={metricsUrl} target="_blank" rel="noreferrer"> Metrics </Link> </React.Fragment> )} </TableCell> <TableCell align="center"> {/* placeholder for route_prefix, which does not apply to a deployment */} - </TableCell> <TableCell align="center"> {formatDateFromTimeMs(last_deployed_time_s * 1000)} </TableCell> <TableCell align="center"> <DurationText startTime={last_deployed_time_s * 1000} /> </TableCell> </TableRow> </React.Fragment> ); }; export type ServeReplicaRowProps = { replica: ServeReplica; deployment: ServeDeployment; }; export const ServeReplicaRow = ({ replica, deployment, }: ServeReplicaRowProps) => { const { replica_id, state, start_time_s } = replica; const { name } = deployment; const metricsUrl = useViewServeDeploymentMetricsButtonUrl(name, replica_id); return ( <TableRow> <TableCell align="center"> <Link component={RouterLink} to={`${encodeURIComponent(replica_id)}`}> {replica_id} </Link> </TableCell> <TableCell align="center"> <StatusChip type="serveReplica" status={state} /> </TableCell> <TableCell align="center"> <Link component={RouterLink} to={`${encodeURIComponent(replica_id)}`}> Log </Link> {metricsUrl && ( <React.Fragment> <br /> <Link href={metricsUrl} target="_blank" rel="noreferrer"> Metrics </Link> </React.Fragment> )} </TableCell> <TableCell align="center"> {formatDateFromTimeMs(start_time_s * 1000)} </TableCell> <TableCell align="center"> <DurationText startTime={start_time_s * 1000} /> </TableCell> </TableRow> ); }; ```
/content/code_sandbox/python/ray/dashboard/client/src/pages/serve/ServeDeploymentRow.tsx
xml
2016-10-25T19:38:30
2024-08-16T19:46:34
ray
ray-project/ray
32,670
1,046
```xml import * as React from 'react'; import { CSSModule } from './utils'; import { FadeProps } from './Fade'; export type Direction = 'start' | 'end' | 'bottom' | 'top'; export interface OffcanvasProps extends React.HTMLAttributes<HTMLElement> { [key: string]: any; autoFocus?: boolean; backdrop?: boolean | 'static'; backdropClassName?: string; backdropTransition?: FadeProps; container?: string | HTMLElement | React.RefObject<HTMLElement>; contentClassName?: string; cssModule?: CSSModule; fade?: boolean; innerRef?: React.Ref<HTMLElement>; isOpen?: boolean; keyboard?: boolean; labelledBy?: string; offcanvasClassName?: string; offcanvasTransition?: FadeProps; onClosed?: () => void; onEnter?: () => void; onExit?: () => void; onOpened?: () => void; direction?: Direction; returnFocusAfterClose?: boolean; scrollable?: boolean; toggle?: React.KeyboardEventHandler<any> | React.MouseEventHandler<any>; trapFocus?: boolean; unmountOnClose?: boolean; wrapClassName?: string; zIndex?: number | string; } declare class Offcanvas extends React.Component<OffcanvasProps> {} export default Offcanvas; ```
/content/code_sandbox/types/lib/Offcanvas.d.ts
xml
2016-02-19T08:01:36
2024-08-16T11:48:48
reactstrap
reactstrap/reactstrap
10,591
274
```xml import clsx from '@proton/utils/clsx'; import type { LayoutCardProps } from './LayoutCard'; import LayoutCard from './LayoutCard'; interface Props { list: LayoutCardProps[]; className?: string; liClassName?: string; describedByID: string; } const LayoutCards = ({ list = [], className, liClassName, describedByID }: Props) => { return ( <ul className={clsx(['unstyled m-0 flex', className])}> {list.map(({ selected, label, src, onChange, disabled }, index) => { return ( <li className={liClassName} key={label}> <LayoutCard key={index.toString()} selected={selected} label={label} src={src} onChange={onChange} disabled={disabled} describedByID={describedByID} /> </li> ); })} </ul> ); }; export default LayoutCards; ```
/content/code_sandbox/packages/components/components/input/LayoutCards.tsx
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
202
```xml import { debugError, debugInfo } from '@erxes/api-utils/src/debuggers'; import { IMessageDocument } from '../../models/definitions/conversationMessages'; import { MESSAGE_TYPES } from '../../models/definitions/constants'; import { sendCommonMessage, sendIntegrationsMessage, } from '../../messageBroker'; import { IContext } from '../../connectionResolver'; export default { user(message: IMessageDocument) { return message.userId && { __typename: 'User', _id: message.userId }; }, customer(message: IMessageDocument) { return ( message.customerId && { __typename: 'Customer', _id: message.customerId } ); }, async mailData( message: IMessageDocument, _args, { models, subdomain }: IContext, ) { const conversation = await models.Conversations.findOne({ _id: message.conversationId, }).lean(); if (!conversation || message.internal) { return null; } const integration = await models.Integrations.findOne({ _id: conversation.integrationId, }); if (!integration) { return null; } const { kind } = integration; // Not mail if (!kind.includes('nylas') && kind !== 'gmail') { return null; } const path = kind.includes('nylas') ? `/nylas/get-message` : `/${kind}/get-message`; return sendIntegrationsMessage({ subdomain, action: 'api_to_integrations', data: { action: 'getMessage', erxesApiMessageId: message._id, integrationId: integration._id, path, }, isRPC: true, }); }, async videoCallData( message: IMessageDocument, _args, { models, subdomain }: IContext, ) { const conversation = await models.Conversations.findOne({ _id: message.conversationId, }).lean(); if (!conversation || message.internal) { return null; } if (message.contentType !== MESSAGE_TYPES.VIDEO_CALL) { return null; } try { const response = await sendCommonMessage({ serviceName: 'dailyco', subdomain, action: 'getDailyRoom', data: { contentType: 'inbox:conversations', contentTypeId: message.conversationId, messageId: message._id, }, isRPC: true, }); return response; } catch (e) { debugError(e); return null; } }, }; ```
/content/code_sandbox/packages/plugin-inbox-api/src/graphql/resolvers/conversationMessage.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
548
```xml import { SchemaOf, boolean, mixed, number, object } from 'yup'; import { staggerConfigValidation } from '@/react/edge/edge-stacks/components/StaggerFieldset'; import { relativePathValidation } from '@/react/portainer/gitops/RelativePathFieldset/validation'; import { EdgeTemplateSettings } from '@/react/portainer/templates/custom-templates/types'; import { isBE } from '@/react/portainer/feature-flags/feature-flags.service'; export function edgeFieldsetValidation(): SchemaOf<EdgeTemplateSettings> { if (!isBE) { return mixed().default(undefined) as SchemaOf<EdgeTemplateSettings>; } return object({ RelativePathSettings: relativePathValidation(), PrePullImage: boolean().default(false), RetryDeploy: boolean().default(false), PrivateRegistryId: number().default(undefined), StaggerConfig: staggerConfigValidation(), }); } ```
/content/code_sandbox/app/react/portainer/templates/custom-templates/CreateView/EdgeSettingsFieldset.validation.ts
xml
2016-05-19T20:15:28
2024-08-16T19:15:14
portainer
portainer/portainer
30,083
188
```xml // TODO: check if related stages are selected in client portal config import { paginate } from "@erxes/api-utils/src"; import { IContext, IModels } from "../../../connectionResolver"; import { sendCommonMessage, sendKbMessage, sendTasksMessage, sendTicketsMessage } from "../../../messageBroker"; import { getCards, getUserCards } from "../../../utils"; const getByHost = async (models: IModels, requestInfo, clientPortalName?) => { const origin = requestInfo.headers.origin; const pattern = `.*${origin}.*`; let config = await models.ClientPortals.findOne({ url: { $regex: pattern } }); if (clientPortalName) { config = await models.ClientPortals.findOne({ name: clientPortalName }); } if (!config) { throw new Error("Not found"); } return config; }; const configClientPortalQueries = { async clientPortalGetConfigs( _root, args: { kind?: string; page?: number; perPage?: number }, { models }: IContext ) { const { kind = "client" } = args; return paginate(models.ClientPortals.find({ kind }), args); }, async clientPortalConfigsTotalCount(_root, _args, { models }: IContext) { return models.ClientPortals.countDocuments(); }, /** * Get last config */ async clientPortalGetLast(_root, { kind }, { models }: IContext) { return models.ClientPortals.findOne({ kind }).sort({ createdAt: -1 }); }, async clientPortalGetConfig( _root, { _id }: { _id: string }, { models }: IContext ) { return models.ClientPortals.findOne({ _id }); }, async clientPortalGetConfigByDomain( _root, { clientPortalName }, { models, requestInfo }: IContext ) { return await getByHost(models, requestInfo, clientPortalName); }, async clientPortalGetTaskStages( _root, _args, { models, subdomain, requestInfo }: IContext ) { const config = await getByHost(models, requestInfo); return sendTasksMessage({ subdomain, action: "stages.find", data: { pipelineId: config.taskPublicPipelineId }, isRPC: true }); }, async clientPortalGetTasks( _root, { stageId }, { models, subdomain, requestInfo }: IContext ) { const config = await getByHost(models, requestInfo); const stage = await sendTasksMessage({ subdomain, action: "stages.findOne", data: { _id: stageId }, isRPC: true }); if (config.taskPublicPipelineId !== stage.pipelineId) { throw new Error("Invalid request"); } return sendTasksMessage({ subdomain, action: "tasks.find", data: { stageId }, isRPC: true }); }, async clientPortalKnowledgeBaseTopicDetail( _root, { _id }, { subdomain }: IContext ) { return sendKbMessage({ subdomain, action: "topics.findOne", data: { query: { _id } }, isRPC: true }); }, async clientPortalTickets(_root, _args, context: IContext) { return getCards("ticket", context, _args); }, async clientPortalTasks(_root, _args, context: IContext) { return getCards("task", context, _args); }, async clientPortalDeals(_root, _args, context: IContext) { return getCards("deal", context, _args); }, async clientPortalPurchase(_root, _args, context: IContext) { return getCards("purchase", context, _args); }, async clientPortalTicket( _root, { _id }: { _id: string }, { subdomain }: IContext ) { return sendTicketsMessage({ subdomain, action: "tickets.findOne", data: { _id }, isRPC: true }); }, /** * knowledgebase article list */ async clientPortalKnowledgeBaseArticles( _root, { categoryIds, searchValue, topicId, isPrivate }: { searchValue?: string; categoryIds: string[]; topicId?: string; isPrivate: Boolean; }, { subdomain }: IContext ) { const selector: any = {}; if (searchValue && searchValue.trim() && topicId && topicId.trim()) { selector.$and = [ { $or: [ { title: { $regex: `.*${searchValue.trim()}.*`, $options: "i" } }, { content: { $regex: `.*${searchValue.trim()}.*`, $options: "i" } }, { summary: { $regex: `.*${searchValue.trim()}.*`, $options: "i" } } ] }, { topicId } ]; } if (categoryIds && categoryIds.length > 0) { selector.categoryId = { $in: categoryIds }; } if (!isPrivate) { selector.isPrivate = { $in: [null, false] }; } if (isPrivate) { selector.isPrivate = { $in: [null, false, true] }; } return sendKbMessage({ subdomain, action: "articles.find", data: { query: { ...selector, status: { $ne: "draft" } }, sort: { createdDate: -1 } }, isRPC: true, defaultValue: [] }); }, async clientPortalGetAllowedFields( _root, { _id }: { _id: string }, { models, subdomain }: IContext ) { const configs = await models.FieldConfigs.find({ allowedClientPortalIds: _id }); const required = await models.FieldConfigs.find({ allowedClientPortalIds: _id, requiredOn: _id }); if (!configs || configs.length === 0) { return []; } const fieldIds = configs.map(config => config.fieldId); const fields = await sendCommonMessage({ subdomain, serviceName: "forms", action: "fields.find", data: { query: { _id: { $in: fieldIds }, contentType: "clientportal:user" } }, isRPC: true, defaultValue: [] }); if (!required.length || required.length === 0) { return fields; } return fields.map(field => { const found = required.find(config => config.fieldId === field._id); if (!found) { return field; } return { ...field, isRequired: true }; }); }, async clientPortalCardUsers( _root, { contentType, contentTypeId, userKind }, { models }: IContext ) { const userIds = await models.ClientPortalUserCards.getUserIds( contentType, contentTypeId ); if (!userIds || userIds.length === 0) { return []; } const users = await models.ClientPortalUsers.aggregate([ { $match: { _id: { $in: userIds } } }, { $lookup: { from: "client_portals", localField: "clientPortalId", foreignField: "_id", as: "clientPortal" } }, { $unwind: "$clientPortal" }, { $match: { "clientPortal.kind": userKind } } ]); return users; }, async clientPortalUserTickets( _root, { userId }: { userId: string }, { models, cpUser, subdomain }: IContext ) { const id = userId || (cpUser && cpUser._id); if (!id) { return []; } return getUserCards(id, "ticket", models, subdomain); }, async clientPortalUserDeals( _root, { userId }: { userId: string }, { models, cpUser, subdomain }: IContext ) { const id = userId || (cpUser && cpUser._id); if (!id) { return []; } return getUserCards(id, "deal", models, subdomain); }, async clientPortalUserPurchases( _root, { userId }: { userId: string }, { models, cpUser, subdomain }: IContext ) { const id = userId || (cpUser && cpUser._id); if (!id) { return []; } return getUserCards(id, "purchase", models, subdomain); }, async clientPortalUserTasks( _root, { userId }: { userId: string }, { models, cpUser, subdomain }: IContext ) { const id = userId || (cpUser && cpUser._id); if (!id) { return []; } return getUserCards(id, "task", models, subdomain); }, async clientPortalParticipantDetail( _root, { _id, contentType, contentTypeId, cpUserId }: { _id: string; contentType: string; contentTypeId: string; cpUserId: string; }, { models, cpUser, subdomain }: IContext ) { const filter = {} as any; if (_id) filter._id = _id; if (contentType) filter.contentType = contentType; if (contentTypeId) filter.contentTypeId = contentTypeId; if (cpUserId) filter.cpUserId = cpUserId; return models.ClientPortalUserCards.findOne(filter); }, async clientPortalParticipants( _root, { contentType, contentTypeId, userKind }: { contentType: string; contentTypeId: string; userKind: string; }, { models, cpUser, subdomain }: IContext ) { const userIds = await models.ClientPortalUserCards.getUserIds( contentType, contentTypeId ); if (!userIds || userIds.length === 0) { return []; } const users = await models.ClientPortalUsers.aggregate([ { $match: { _id: { $in: userIds } } }, { $lookup: { from: "client_portals", localField: "clientPortalId", foreignField: "_id", as: "clientPortal" } }, { $unwind: "$clientPortal" }, { $match: { "clientPortal.kind": userKind } } ]); const filter = {} as any; if (contentType) filter.contentType = contentType; if (contentTypeId) filter.contentTypeId = contentTypeId; if (users?.length > 0) filter.cpUserId = { $in: users.map(d => d._id) }; else return []; return models.ClientPortalUserCards.find(filter); } }; export default configClientPortalQueries; ```
/content/code_sandbox/packages/plugin-clientportal-api/src/graphql/resolvers/queries/clientPortal.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
2,494
```xml import { useRouter, useSearchParams } from "next/navigation" import { ChevronUp } from "lucide-react" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" type Props = { count?: number } const PerPageChooser = (props: Props) => { const router = useRouter() const searchParams = useSearchParams() const currentPerPage = Number(searchParams.get("perPage")) || 10 const onClick = (perPage: number) => { if (perPage !== currentPerPage) { const queryParams = new URLSearchParams() queryParams.append("perPage", perPage.toString()) queryParams.append("page", '1') router.push(`?${queryParams.toString()}`, { scroll: false, }) const storageValue = window.localStorage.getItem("pagination:perPage") let items: any = {} if (storageValue) { items = JSON.parse(storageValue) } items[window.location.pathname] = perPage window.localStorage.setItem("pagination:perPage", JSON.stringify(items)) } } const renderOption = (n: number) => { return ( <DropdownMenuItem onClick={onClick.bind(null, n)} className="cursor-pointer w-full flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-300 dark:focus:bg-gray-700" > <a href="#number">{n}</a> </DropdownMenuItem> ) } return ( <DropdownMenu> <DropdownMenuTrigger className="h-full hs-dropdown-toggle py-1.5 px-2 inline-flex items-center gap-x-2 text-sm rounded-lg border border-gray-200 text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-gray-700 dark:text-white dark:hover:bg-gray-700 dark:focus:bg-gray-700"> {currentPerPage} {"per page"} <ChevronUp size={16} /> </DropdownMenuTrigger> <DropdownMenuContent> {renderOption(10)} {renderOption(50)} {renderOption(100)} {renderOption(200)} </DropdownMenuContent> </DropdownMenu> ) } export default PerPageChooser ```
/content/code_sandbox/exm-web/components/ui/perpage-chooser.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
537
```xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url"> <parent> <artifactId>saturn-job</artifactId> <groupId>com.vip.saturn</groupId> <version>master-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>saturn-springboot</artifactId> <properties> <springboot.version>1.5.16.RELEASE</springboot.version> </properties> <dependencies> <dependency> <groupId>com.vip.saturn</groupId> <artifactId>saturn-spring</artifactId> <version>${project.parent.version}</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <version>${springboot.version}</version> </dependency> </dependencies> </project> ```
/content/code_sandbox/saturn-springboot/pom.xml
xml
2016-11-30T08:06:30
2024-08-15T02:26:21
Saturn
vipshop/Saturn
2,272
277
```xml <?xml version="1.0" encoding="UTF-8"?> <!-- *** GENERATED FROM project.xml - DO NOT EDIT *** *** EDIT ../build.xml INSTEAD *** For the purpose of easier reading the script is divided into following sections: - initialization - profiling - applet profiling --> <project name="-profiler-impl" default="profile" basedir=".."> <target name="default" depends="profile" description="Build and profile the project."/> <!-- ====================== INITIALIZATION SECTION ====================== --> <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/> <target name="-profile-pre-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> <target name="-profile-post-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> <target name="-profile-init-macrodef-profile"> <macrodef name="resolve"> <attribute name="name"/> <attribute name="value"/> <sequential> <property name="@{name}" value="${env.@{value}}"/> </sequential> </macrodef> <macrodef name="profile"> <attribute name="classname" default="${main.class}"/> <element name="customize" optional="true"/> <sequential> <property environment="env"/> <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> <java fork="true" classname="@{classname}" dir="${profiler.info.dir}" jvm="${profiler.info.jvm}"> <jvmarg value="${profiler.info.jvmargs.agent}"/> <jvmarg line="${profiler.info.jvmargs}"/> <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> <arg line="${application.args}"/> <classpath> <path path="${run.classpath}"/> </classpath> <syspropertyset> <propertyref prefix="run-sys-prop."/> <mapper type="glob" from="run-sys-prop.*" to="*"/> </syspropertyset> <customize/> </java> </sequential> </macrodef> </target> <target name="-profile-init-check" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile"> <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> </target> <!-- ================= PROFILING SECTION ================= --> <target name="profile" if="netbeans.home" depends="profile-init,compile" description="Profile a project in the IDE."> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> </classpath> </nbprofiledirect> <profile/> </target> <target name="profile-single" if="netbeans.home" depends="profile-init,compile-single" description="Profile a selected class in the IDE."> <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> </classpath> </nbprofiledirect> <profile classname="${profile.class}"/> </target> <!-- ========================= APPLET PROFILING SECTION ========================= --> <target name="profile-applet" if="netbeans.home" depends="profile-init,compile-single"> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> </classpath> </nbprofiledirect> <profile classname="sun.applet.AppletViewer"> <customize> <arg value="${applet.url}"/> </customize> </profile> </target> <!-- ========================= TESTS PROFILING SECTION ========================= --> <target name="profile-test-single" if="netbeans.home" depends="profile-init,compile-test-single"> <nbprofiledirect> <classpath> <path path="${run.test.classpath}"/> </classpath> </nbprofiledirect> <junit showoutput="true" fork="true" dir="${profiler.info.dir}" jvm="${profiler.info.jvm}" failureproperty="tests.failed" errorproperty="tests.failed"> <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> <jvmarg value="${profiler.info.jvmargs.agent}"/> <jvmarg line="${profiler.info.jvmargs}"/> <test name="${profile.class}"/> <classpath> <path path="${run.test.classpath}"/> </classpath> <syspropertyset> <propertyref prefix="test-sys-prop."/> <mapper type="glob" from="test-sys-prop.*" to="*"/> </syspropertyset> <formatter type="brief" usefile="false"/> <formatter type="xml"/> </junit> </target> </project> ```
/content/code_sandbox/visualvm/libs.profiler/lib.profiler/test/qa-functional/data/projects/j2se-simple/nbproject/profiler-build-impl.xml
xml
2016-09-12T14:44:30
2024-08-16T14:41:50
visualvm
oracle/visualvm
2,821
1,186
```xml export interface IChecklistDoc { contentType: string; contentTypeId: string; title: string; } export interface IChecklist extends IChecklistDoc { _id: string; createdUserId: string; createdDate: Date; items: IChecklistItem[]; percent: number; } export interface IChecklistsParam { contentType: string; contentTypeId: string; } export type ChecklistsQueryResponse = { tasksChecklists: IChecklist[]; loading: boolean; refetch: () => void; subscribeToMore: any; }; export type AddMutationResponse = ({ variables: IChecklistDoc }) => Promise<any>; export type EditMutationVariables = { _id: string; title: string; } & IChecklistsParam; export type EditMutationResponse = ({ variables: EditMutationVariables }) => Promise<any>; export type RemoveMutationResponse = ({ variables: MutationVariables }) => Promise<any>; // checklists items export interface IChecklistItemDoc { checklistId: string; isChecked?: boolean; content: string; } export interface IChecklistItemsUpdateOrderDoc { _id: string; destinationIndex: number; } export interface IChecklistItem extends IChecklistItemDoc { _id: string; } export type AddItemMutationResponse = ({ variables: IChecklistItemDoc }) => Promise<any>; export type UpdateItemsOrderMutationResponse = ({ variables: IChecklistItemsUpdateOrderDoc }) => Promise<any>; export type EditItemMutationVariables = { _id: string; } & IChecklistItemDoc; export type EditItemMutationResponse = ({ variables: EditItemMutationVariables }) => Promise<any>; ```
/content/code_sandbox/packages/ui-tasks/src/checklists/types.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
370
```xml export interface IQuestion { id: number; question: string; options:IOption[]; answer?:IAnswer; selectedOption?:string; } export interface IOption { key: string; text: string; } export interface IAnswer{ allAnswers:number[]; isCurrentUserAnswered:boolean; } export interface ISelectedOption{ selectedQuestionId:number; selectedOption:string; } ```
/content/code_sandbox/samples/react-poll/src/models/models.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
88
```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>zh_CN</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIconFile</key> <string></string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string></string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>$(MARKETING_VERSION)</string> <key>CFBundleVersion</key> <string>1</string> <key>LSMinimumSystemVersion</key> <string>$(MACOSX_DEPLOYMENT_TARGET)</string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> <key>NSMainStoryboardFile</key> <string>Main</string> <key>NSPrincipalClass</key> <string>NSApplication</string> </dict> </plist> ```
/content/code_sandbox/magnetX/Info.plist
xml
2016-10-20T10:23:11
2024-08-12T06:59:52
magnetX
youusername/magnetX
1,967
322
```xml const epsilon = 0.1; const almostEqual = (a: number, b: number) => a > b - epsilon && a < b + epsilon; const almostZero = (a: number) => almostEqual(a, 0); /*** * Simple Spring implementation -- this implements a damped spring using a symbolic integration * of Hooke's law: F = -kx - cv. This solution is significantly more performant and less code than * a numerical approach such as Facebook Rebound which uses RK4. * * This physics textbook explains the model: * path_to_url * * A critically damped spring has: damping*damping - 4 * mass * springConstant == 0. If it's greater than zero * then the spring is overdamped, if it's less than zero then it's underdamped. */ const getSolver = ( mass: number, springConstant: number, damping: number ): (( initial: number, velocity: number ) => { x: (t: number) => number; dx: (t: number) => number }) => { const c = damping; const m = mass; const k = springConstant; const cmk = c * c - 4 * m * k; if (cmk == 0) { // The spring is critically damped. // x = (c1 + c2*t) * e ^(-c/2m)*t const r = -c / (2 * m); return (initial, velocity) => { const c1 = initial; const c2 = velocity / (r * initial); return { x: (dt) => (c1 + c2 * dt) * Math.pow(Math.E, r * dt), dx: (dt) => (r * (c1 + c2 * dt) + c2) * Math.pow(Math.E, r * dt), }; }; } else if (cmk > 0) { // The spring is overdamped; no bounces. // x = c1*e^(r1*t) + c2*e^(r2t) // Need to find r1 and r2, the roots, then solve c1 and c2. const r1 = (-c - Math.sqrt(cmk)) / (2 * m); const r2 = (-c + Math.sqrt(cmk)) / (2 * m); return (initial, velocity) => { const c2 = (velocity - r1 * initial) / (r2 - r1); const c1 = initial - c2; return { x: (dt) => c1 * Math.pow(Math.E, r1 * dt) + c2 * Math.pow(Math.E, r2 * dt), dx: (dt) => c1 * r1 * Math.pow(Math.E, r1 * dt) + c2 * r2 * Math.pow(Math.E, r2 * dt), }; }; } else { // The spring is underdamped, it has imaginary roots. // r = -(c / 2*m) +- w*i // w = sqrt(4mk - c^2) / 2m // x = (e^-(c/2m)t) * (c1 * cos(wt) + c2 * sin(wt)) const w = Math.sqrt(4 * m * k - c * c) / (2 * m); const r = -((c / 2) * m); return (initial, velocity) => { const c1 = initial; const c2 = (velocity - r * initial) / w; return { x: (dt) => Math.pow(Math.E, r * dt) * (c1 * Math.cos(w * dt) + c2 * Math.sin(w * dt)), dx: (dt) => { const power = Math.pow(Math.E, r * dt); const cos = Math.cos(w * dt); const sin = Math.sin(w * dt); return ( power * (c2 * w * cos - c1 * w * sin) + r * power * (c2 * sin + c1 * cos) ); }, }; }; } }; class Spring { private _solver: ( initial: number, velocity: number ) => { x: (dt: number) => number; dx: (dt: number) => number; }; private _solution: { x: (dt: number) => number; dx: (dt: number) => number; } | null; private _endPosition: number; private _startTime: number; constructor(mass: number, springConstant: number, damping: number) { this._solver = getSolver(mass, springConstant, damping); this._solution = null; this._endPosition = 0; this._startTime = 0; } x(t: number) { if (!this._solution) return 0; const dt = (t - this._startTime) / 1000.0; return this._endPosition + this._solution.x(dt); } dx(t: number) { if (!this._solution) return 0; const dt = (t - this._startTime) / 1000.0; return this._solution.dx(dt); } set(endPosition: number, x: number, velocity: number, t?: number) { if (!t) t = Date.now(); this._endPosition = endPosition; if (x == endPosition && almostZero(velocity)) return; this._solution = this._solver(x - endPosition, velocity); this._startTime = t; } done(t: number) { if (!t) t = Date.now(); return almostEqual(this.x(t), this._endPosition) && almostZero(this.dx(t)); } } export default Spring; ```
/content/code_sandbox/src/component/recycleScroller/scroll/spring.ts
xml
2016-04-27T03:33:45
2024-08-16T15:29:33
vConsole
Tencent/vConsole
16,699
1,304
```xml <ValueWrapper StringValue="{MyExtension6 'Quoted string: \'test\'; Embedded braces: {test\}; Two Backslashes: \\\\ (test after last escape)'}" xmlns:x="path_to_url" xmlns="clr-namespace:MonoTests.System.Xaml;assembly=System.Xaml.TestCases" /> ```
/content/code_sandbox/src/Test/System.Xaml.TestCases/XmlFiles/CustomExtensionWithEscapeChars.xml
xml
2016-08-25T20:07:20
2024-08-13T22:23:35
CoreWF
UiPath/CoreWF
1,126
69
```xml import { getHostname, isExternal, isMailTo, isSubDomain, isURLProtonInternal, punycodeUrl, } from '@proton/components/helpers/url'; const windowHostname = 'mail.proton.me'; describe('isSubDomain', function () { it('should detect that same hostname is a subDomain', () => { const hostname = 'mail.proton.me'; expect(isSubDomain(hostname, hostname)).toBeTruthy(); }); it('should detect that domain is a subDomain', () => { const hostname = 'mail.proton.me'; const domain = 'proton.me'; expect(isSubDomain(hostname, domain)).toBeTruthy(); }); it('should detect that domain is not a subDomain', () => { const hostname = 'mail.proton.me'; const domain = 'whatever.com'; expect(isSubDomain(hostname, domain)).toBeFalsy(); }); }); describe('getHostname', function () { it('should give the correct hostname', () => { const hostname = 'mail.proton.me'; const url = `path_to_url{hostname}/u/0/inbox`; expect(getHostname(url)).toEqual(hostname); }); }); describe('isMailTo', function () { it('should detect that the url is a mailto link', () => { const url = 'mailto:mail@proton.me'; expect(isMailTo(url)).toBeTruthy(); }); it('should detect that the url is not a mailto link', () => { const url = 'path_to_url expect(isMailTo(url)).toBeFalsy(); }); }); describe('isExternal', function () { it('should detect that the url is not external', () => { const url1 = 'path_to_url expect(isExternal(url1, windowHostname)).toBeFalsy(); }); it('should detect that the url is external', () => { const url = 'path_to_url expect(isExternal(url, windowHostname)).toBeTruthy(); }); it('should detect that the mailto link is not external', () => { const url = 'mailto:mail@proton.me'; expect(isExternal(url, windowHostname)).toBeFalsy(); }); }); describe('isProtonInternal', function () { it('should detect that the url is proton internal', () => { const url1 = 'path_to_url const url2 = 'path_to_url expect(isURLProtonInternal(url1, windowHostname)).toBeTruthy(); expect(isURLProtonInternal(url2, windowHostname)).toBeTruthy(); }); it('should detect that the url is not proton internal', () => { const url = 'path_to_url expect(isURLProtonInternal(url, windowHostname)).toBeFalsy(); }); }); describe('punycodeUrl', () => { it('should encode the url with punycode', () => { // reference: path_to_url const url = 'path_to_url.com'; const encodedUrl = punycodeUrl(url); expect(encodedUrl).toEqual('path_to_url }); it('should encode url with punycode and keep pathname, query parameters and fragment', () => { const url = 'path_to_url.com/mlts?=&=#mlts'; const encodedUrl = punycodeUrl(url); expect(encodedUrl).toEqual( 'path_to_url#%C3%BCml%C3%A4%C3%BCts' ); }); it('should not encode url already punycode', () => { const url = 'path_to_url const encodedUrl = punycodeUrl(url); expect(encodedUrl).toEqual(url); }); it('should not encode url with no punycode', () => { const url = 'path_to_url const encodedUrl = punycodeUrl(url); expect(encodedUrl).toEqual(url); }); it('should keep the trailing slash', () => { const url = 'path_to_url.com/EDEQWE/'; const encodedUrl = punycodeUrl(url); expect(encodedUrl).toEqual('path_to_url }); it('should keep the port', () => { const url = 'path_to_url.com:8080'; const encodedUrl = punycodeUrl(url); expect(encodedUrl).toEqual('path_to_url }); it('should keep the trailing slash if hash or search after', () => { const sUrl = 'path_to_url const encodedSUrl = punycodeUrl(sUrl); expect(encodedSUrl).toEqual('path_to_url const hUrl = 'path_to_url#dude'; const encodedHUrl = punycodeUrl(hUrl); expect(encodedHUrl).toEqual('path_to_url#dude'); }); it('should keep the trailing slash if string has no punycode', () => { const url = 'path_to_url const encodedUrl = punycodeUrl(url); expect(encodedUrl).toEqual(url); }); }); ```
/content/code_sandbox/packages/components/helpers/url.test.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
1,074
```xml // See LICENSE in the project root for license information. /** * This file is a little program that prints all of the colors to the console. * * Run this program with `node write-colors.js` */ import { Terminal, ConsoleTerminalProvider, Colorize } from '../index'; import { createColorGrid } from './createColorGrid'; const terminal: Terminal = new Terminal(new ConsoleTerminalProvider()); function writeColorGrid(colorGrid: string[][]): void { for (const line of colorGrid) { terminal.writeLine(...line); } } writeColorGrid(createColorGrid()); terminal.writeLine(); writeColorGrid(createColorGrid(Colorize.bold)); terminal.writeLine(); writeColorGrid(createColorGrid(Colorize.dim)); terminal.writeLine(); writeColorGrid(createColorGrid(Colorize.underline)); terminal.writeLine(); writeColorGrid(createColorGrid(Colorize.blink)); terminal.writeLine(); writeColorGrid(createColorGrid(Colorize.invertColor)); terminal.writeLine(); writeColorGrid(createColorGrid(Colorize.hidden)); terminal.writeLine(); terminal.write('Normal text...'); terminal.writeLine(Colorize.green('done')); terminal.writeError('Error...'); terminal.writeErrorLine(Colorize.green('done')); terminal.writeWarning('Warning...'); terminal.writeWarningLine(Colorize.green('done')); ```
/content/code_sandbox/libraries/terminal/src/test/write-colors.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
261
```xml import * as React from "react"; import * as data from "./data"; import * as simulator from "./simulator"; import { DebuggerTable, DebuggerTableRow } from "./debuggerTable"; const MAX_VARIABLE_LENGTH = 20; interface ScopeVariables { title: string; variables: Variable[]; key?: string; } interface Variable { name: string; value: any; id?: number; prevValue?: any; children?: Variable[]; } interface PreviewState { id: number; top: number; left: number; } interface DebuggerVariablesProps { apis: pxt.Map<pxtc.SymbolInfo>; sequence: number; breakpoint?: pxsim.DebuggerBreakpointMessage; filters?: string[] activeFrame?: number; includeAllVariables?: boolean; } interface DebuggerVariablesState { globalFrame: ScopeVariables; stackFrames: ScopeVariables[]; nextID: number; renderedSequence?: number; frozen?: boolean; preview: PreviewState | null; } export class DebuggerVariables extends data.Component<DebuggerVariablesProps, DebuggerVariablesState> { constructor(props: DebuggerVariablesProps) { super(props); this.state = { globalFrame: { title: lf("Globals"), variables: [] }, stackFrames: [], nextID: 0, preview: null }; } clear() { this.setState({ globalFrame: { title: this.state.globalFrame.title, variables: [] }, stackFrames: [], preview: null }); } update(frozen = false) { this.setState({ frozen, preview: frozen ? null : this.state.preview }); } componentDidUpdate(prevProps: DebuggerVariablesProps) { if (this.props.breakpoint) { if (this.props.sequence != this.state.renderedSequence) { this.updateVariables(this.props.breakpoint, this.props.filters); } } else if (!this.state.frozen) { this.update(true); } } renderCore() { const { globalFrame, stackFrames, frozen, preview } = this.state; const { activeFrame, breakpoint } = this.props; const variableTableHeader = lf("Variables"); let variables = globalFrame.variables; // Add in the local variables. // TODO: Handle callstack if (stackFrames && stackFrames.length && activeFrame !== undefined) { variables = stackFrames[activeFrame].variables.concat(variables); } let placeholderText: string; if (frozen) { placeholderText = lf("Code is running..."); } else if (!variables.length && !breakpoint?.exceptionMessage) { placeholderText = lf("No variables to show"); } const tableRows = placeholderText ? [] : this.renderVars(variables); if (breakpoint?.exceptionMessage && !frozen) { tableRows.unshift(<DebuggerTableRow leftText={lf("Exception:")} leftClass="exception" key="exception-message" rightText={truncateLength(breakpoint.exceptionMessage)} rightTitle={breakpoint.exceptionMessage} />); } const previewVar = this.getVariableById(preview?.id); const previewLabel = previewVar && lf("Current value for '{0}'", previewVar.name); return <div> <DebuggerTable header={variableTableHeader} placeholderText={placeholderText}> {tableRows} </DebuggerTable> { preview && <div id="debugger-preview" role="tooltip" className="debugger-preview" ref={this.handlePreviewRef} tabIndex={0} aria-label={previewLabel} style={{ top: `${preview.top}px`, left: `${preview.left}px` }}> {renderValue(previewVar.value)} </div> } </div> } renderVars(vars: Variable[], depth = 0, result: JSX.Element[] = []) { const previewed = this.state.preview?.id; vars.forEach(varInfo => { const valueString = renderValue(varInfo.value); const typeString = variableType(varInfo); result.push(<DebuggerTableRow key={varInfo.id} describedBy={varInfo.id === previewed ? "debugger-preview" : undefined} refID={varInfo.id} icon={(varInfo.value && varInfo.value.hasFields) ? (varInfo.children ? "down triangle" : "right triangle") : undefined} leftText={varInfo.name + ":"} leftTitle={varInfo.name} leftClass={varInfo.prevValue !== undefined ? "changed" : undefined} rightText={truncateLength(valueString)} rightTitle={shouldShowValueOnHover(typeString) ? valueString : undefined} rightClass={typeString} onClick={this.handleComponentClick} onValueClick={this.handleValueClick} depth={depth} />) if (varInfo.children) { this.renderVars(varInfo.children, depth + 1, result); } }); return result; } updateVariables( breakpoint: pxsim.DebuggerBreakpointMessage, filters?: string[] ) { const { globals, environmentGlobals, stackframes } = breakpoint; if (!globals && !environmentGlobals) { // freeze the ui this.update(true) return; } let nextId = 0; const updatedGlobals = updateScope(this.state.globalFrame, globals); if (filters) { updatedGlobals.variables = updatedGlobals.variables.filter(v => filters.indexOf(v.name) !== -1) } // inject unfiltered environment variables if (environmentGlobals) updatedGlobals.variables = updatedGlobals.variables.concat(variablesToVariableList(environmentGlobals)); assignVarIds(updatedGlobals.variables); let updatedFrames: ScopeVariables[]; if (stackframes) { const oldFrames = this.state.stackFrames; updatedFrames = stackframes.map((sf, index) => { const key = sf.breakpointId + "_" + index; for (const frame of oldFrames) { if (frame.key === key) return updateScope(frame, sf.locals, getArgArray(sf.arguments)); } return updateScope({ key, title: sf.funcInfo.functionName, variables: [] }, sf.locals, getArgArray(sf.arguments)) }); updatedFrames.forEach(sf => assignVarIds(sf.variables)); } this.setState({ globalFrame: updatedGlobals, stackFrames: updatedFrames || [], nextID: nextId, renderedSequence: this.props.sequence, frozen: false }); function getArgArray(info: pxsim.FunctionArgumentsInfo): Variable[] { if (info) { if (info.thisParam != null) { return [{ name: "this", value: info.thisParam }, ...info.params] } else { return info.params; } } return [] } function assignVarIds(vars: Variable[]) { vars.forEach(v => { v.id = nextId++ if (v.children) assignVarIds(v.children) }); } } protected getVariableById(id: number) { if (id === null) return null; for (const v of this.getFullVariableList()) { if (v.id === id) { return v; } } return null; } protected handleComponentClick = (e: React.SyntheticEvent<HTMLDivElement>, component: DebuggerTableRow) => { if (this.state.frozen) return; const variable = this.getVariableById(component.props.refID as number); if (variable) { this.toggle(variable); if (this.state.preview !== null) { this.setState({ preview: null }); } } } protected handleValueClick = (e: React.SyntheticEvent<HTMLDivElement>, component: DebuggerTableRow) => { if (this.state.frozen) return; const id = component.props.refID; const bb = (e.target as HTMLDivElement).getBoundingClientRect(); this.setState({ preview: { id: id as number, top: bb.top, left: bb.left } }); } protected handlePreviewRef = (ref: HTMLDivElement) => { if (ref) { const previewed = this.state.preview; ref.focus(); ref.addEventListener("blur", () => { if (this.state.preview?.id === previewed.id) { this.setState({ preview: null }); } }); const select = window.getSelection(); select.removeAllRanges(); const range = document.createRange(); range.selectNodeContents(ref); select.addRange(range); } } protected getFullVariableList() { let result: Variable[] = []; collectVariables(this.state.globalFrame.variables); if (this.state.stackFrames) this.state.stackFrames.forEach(sf => collectVariables(sf.variables)); return result; function collectVariables(vars: Variable[]) { vars.forEach(v => { result.push(v); if (v.children) { collectVariables(v.children) } }); } } private toggle(v: Variable) { // We have to take care of the logic for nested looped variables. Currently they break this implementation. if (v.children) { delete v.children; this.setState({ globalFrame: this.state.globalFrame }) } else { if (!v.value || !v.value.id) return; // We filter the getters we want to call for this variable. let allApis = this.props.apis; let matcher = new RegExp("^((.+\.)?" + v.value.type + ")\."); let potentialKeys = Object.keys(allApis).filter(key => matcher.test(key)); let fieldsToGet: string[] = []; potentialKeys.forEach(key => { let symbolInfo = allApis[key]; if (!key.endsWith("@set") && symbolInfo && symbolInfo.attributes.callInDebugger) { fieldsToGet.push(key); } }); simulator.driver.variablesAsync(v.value.id, fieldsToGet, !!this.props.includeAllVariables) .then((msg: pxsim.VariablesMessage) => { if (msg && msg.variables) { let nextID = this.state.nextID; const variables = Object.keys(msg.variables).map(key => ({ name: key, value: msg.variables[key], id: nextID++ })); variables.sort((a, b) => { const aInternal = a.name.charAt(0) === "_"; const bInternal = b.name.charAt(0) === "_" if (aInternal === bInternal) return 0; else if (aInternal) return 1; else return -1; }) v.children = variables; this.setState({ globalFrame: this.state.globalFrame, nextID }) } }) } } } function variablesToVariableList(newVars: pxsim.Variables) { const current = Object.keys(newVars).map(varName => ({ name: fixVarName(varName), value: newVars[varName] })); return current; } function updateScope(lastScope: ScopeVariables, newVars: pxsim.Variables, params?: Variable[]): ScopeVariables { let current = variablesToVariableList(newVars); if (params) { current = params.concat(current); } return { ...lastScope, variables: getUpdatedVariables(lastScope.variables, current) }; } function fixVarName(name: string) { return name.replace(/___\d+$/, ""); } function getUpdatedVariables(previous: Variable[], current: Variable[]): Variable[] { return current.map(v => { const prev = getVariable(previous, v); if (prev && prev.value && !prev.value.id && prev.value !== v.value) { return { ...v, prevValue: prev.value } } return v }); }; function getVariable(variables: Variable[], value: Variable) { for (let i = 0; i < variables.length; i++) { if (variables[i].name === value.name) { return variables[i]; } } return undefined; } function renderValue(v: any): string { let sv = ''; let type = typeof v; switch (type) { case "undefined": sv = "undefined"; break; case "number": sv = v + ""; break; case "boolean": sv = v + ""; break; case "string": sv = JSON.stringify(v); break; case "object": if (v == null) sv = "null"; else if (v.text) sv = v.text; else if (v.id && v.preview) return v.preview; else if (v.id !== undefined) sv = "(object)" else sv = "(unknown)" break; } return sv; } function truncateLength(varstr: string) { let remaining = MAX_VARIABLE_LENGTH - 3; // acount for ... let hasQuotes = false; if (varstr.indexOf('"') == 0) { remaining -= 2; hasQuotes = true; varstr = varstr.substring(1, varstr.length - 1); } if (varstr.length > remaining) varstr = varstr.substring(0, remaining) + '...'; if (hasQuotes) { varstr = '"' + varstr + '"' } return varstr; } function variableType(variable: Variable): string { let val = variable.value; if (val == null) return "undefined"; let type = typeof val switch (type) { case "string": case "number": case "boolean": return type; case "object": if (val.type) return val.type; if (val.preview) return val.preview; if (val.text) return val.text; return "object"; default: return "unknown"; } } function shouldShowValueOnHover(type: string): boolean { switch (type) { case "string": case "number": case "boolean": case "array": return true; default: return false; } } ```
/content/code_sandbox/webapp/src/debuggerVariables.tsx
xml
2016-01-24T19:35:52
2024-08-16T16:39:39
pxt
microsoft/pxt
2,069
3,024
```xml import React from 'react'; type IconProps = React.SVGProps<SVGSVGElement>; export declare const IcFolderOpenFilled: (props: IconProps) => React.JSX.Element; export {}; ```
/content/code_sandbox/packages/icons/lib/icFolderOpenFilled.d.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
44
```xml /*your_sha256_hash----------------------------- *your_sha256_hash----------------------------*/ export const mssqlActivityBarButton = 'a[class^="action-label activity-workbench-view-extension-objectExplorer"]'; export const addConnectionButton = 'div[aria-label="Add Connection"]'; ```
/content/code_sandbox/test/e2e/utils/commonSelectors.ts
xml
2016-06-26T04:38:04
2024-08-16T20:04:12
vscode-mssql
microsoft/vscode-mssql
1,523
54
```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url"> <plist version="1.0"> <dict> <key>ACPI</key> <dict> <key>AutoMerge</key> <true/> <key>#Comment-SortedOrder</key> <string>SortedOrder may be required if you have patched SSDTs in ACPI/patched</string> <key>#SortedOrder</key> <array> <string>SSDT.aml</string> <string>SSDT-0.aml</string> <string>SSDT-1.aml</string> <string>SSDT-2.aml</string> <string>SSDT-3.aml</string> <string>SSDT-4.aml</string> <string>SSDT-5.aml</string> <string>SSDT-6.aml</string> <string>SSDT-7.aml</string> <string>SSDT-8.aml</string> <string>SSDT-9.aml</string> <string>SSDT-10.aml</string> <string>SSDT-11.aml</string> <string>SSDT-12.aml</string> <string>SSDT-13.aml</string> <string>SSDT-14.aml</string> <string>SSDT-15.aml</string> <string>SSDT-16.aml</string> <string>SSDT-17.aml</string> <string>SSDT-18.aml</string> <string>SSDT-19.aml</string> <string>SSDT-XOSI.aml</string> <string>SSDT-LPC.aml</string> <string>SSDT-UIAC.aml</string> <string>SSDT-PNLF.aml</string> </array> <key>DSDT</key> <dict> <key>Fixes</key> <dict> <key>AddDTGP_0001</key> <true/> <key>AddIMEI_80000</key> <true/> <key>FixRegions_10000000</key> <false/> <key>NewWay_80000000</key> <true/> <key>#Comment-IRQ Fix</key> <string>The following fixes may be needed for onboard audio/USB/etc</string> <key>FIX_TMR_40000</key> <false/> <key>FIX_RTC_20000</key> <false/> <key>FixIPIC_0040</key> <false/> <key>FixHPET_0010</key> <false/> <key>FixHeaders_20000000</key> <true/> </dict> <key>Patches</key> <array> <dict> <key>Comment</key> <string>change OSID to XSID (to avoid match against _OSI XOSI patch)</string> <key>Disabled</key> <true/> <key>Find</key> <data>T1NJRA==</data> <key>Replace</key> <data>WFNJRA==</data> </dict> <dict> <key>Comment</key> <string>change _OSI to XOSI</string> <key>Disabled</key> <true/> <key>Find</key> <data>X09TSQ==</data> <key>Replace</key> <data>WE9TSQ==</data> </dict> <dict> <key>Comment</key> <string>change _DSM to XDSM</string> <key>Disabled</key> <true/> <key>Find</key> <data>X0RTTQ==</data> <key>Replace</key> <data>WERTTQ==</data> </dict> <dict> <key>Comment</key> <string>change EC0 to EC</string> <key>Disabled</key> <true/> <key>Find</key> <data>RUMwXw==</data> <key>Replace</key> <data>RUNfXw==</data> </dict> <dict> <key>Comment</key> <string>change H_EC to EC</string> <key>Disabled</key> <true/> <key>Find</key> <data>SF9FQw==</data> <key>Replace</key> <data>RUNfXw==</data> </dict> <dict> <key>Comment</key> <string>change EHC1 to EH01</string> <key>Find</key> <data>RUhDMQ==</data> <key>Replace</key> <data>RUgwMQ==</data> </dict> <dict> <key>Comment</key> <string>change EHC2 to EH02</string> <key>Find</key> <data>RUhDMg==</data> <key>Replace</key> <data>RUgwMg==</data> </dict> <dict> <key>Comment</key> <string>change GFX0 to IGPU</string> <key>Find</key> <data>R0ZYMA==</data> <key>Replace</key> <data>SUdQVQ==</data> </dict> <dict> <key>Comment</key> <string>change PCI0.VID to IGPU #1 (Thinkpad)</string> <key>Find</key> <data>UENJMFZJRF8=</data> <key>Replace</key> <data>UENJMElHUFU=</data> </dict> <dict> <key>Comment</key> <string>change PCI0.VID to IGPU #2 (Thinkpad)</string> <key>Find</key> <data>VklEXwhfQURSDAAAAgA=</data> <key>Replace</key> <data>SUdQVQhfQURSDAAAAgA=</data> </dict> </array> </dict> <key>DropTables</key> <array> <dict> <key>Signature</key> <string>#MCFG</string> </dict> <dict> <key>Signature</key> <string>DMAR</string> </dict> </array> <key>#DropTables</key> <array> <dict> <key>Signature</key> <string>MCFG</string> </dict> <dict> <key>Signature</key> <string>DMAR</string> </dict> <dict> <key>Signature</key> <string>SSDT</string> <key>TableId</key> <string>CpuPm</string> </dict> <dict> <key>Signature</key> <string>SSDT</string> <key>TableId</key> <string>Cpu0Cst</string> </dict> <dict> <key>Signature</key> <string>SSDT</string> <key>TableId</key> <string>Cpu0Ist</string> </dict> <dict> <key>Signature</key> <string>SSDT</string> <key>TableId</key> <string>ApCst</string> </dict> <dict> <key>Signature</key> <string>SSDT</string> <key>TableId</key> <string>ApIst</string> </dict> </array> <key>SSDT</key> <dict> <key>DropOem</key> <false/> <key>Generate</key> <dict> <key>CStates</key> <false/> <key>PStates</key> <false/> <key>APSN</key> <false/> <key>APLF</key> <false/> <key>PluginType</key> <false/> </dict> <key>NoOemTableId</key> <true/> <key>NoDynamicExtract</key> <true/> </dict> </dict> <key>Boot</key> <dict> <key>Arguments</key> <string>kext-dev-mode=1 dart=0 slide=0 nv_disable=1</string> <key>DefaultVolume</key> <string>LastBootedVolume</string> <key>NeverHibernate</key> <true/> <key>Secure</key> <false/> <key>Timeout</key> <integer>5</integer> <key>XMPDetection</key> <false/> </dict> <key>Devices</key> <dict> <key>AddProperties</key> <array> <dict> <key>Device</key> <string>NVidia</string> <key>Key</key> <string>name</string> <key>Value</key> <data>I2Rpc3BsYXkA</data> <key>Comment</key> <string>Inject &quot;name&quot; as (data)&quot;#display&quot; to disable graphics drivers on NVidia</string> </dict> <dict> <key>Device</key> <string>NVidia</string> <key>Key</key> <string>IOName</string> <key>Value</key> <string>#display</string> <key>Comment</key> <string>Inject &quot;IOName&quot; as &quot;#display&quot; to disable graphics drivers on NVidia</string> </dict> <dict> <key>Device</key> <string>NVidia</string> <key>Key</key> <string>class-code</string> <key>Value</key> <data>/////w==</data> <key>Comment</key> <string>Inject bogus class-code to prevent graphics drivers loading for NVidia</string> </dict> </array> <key>#AddProperties</key> <array> <dict> <key>Device</key> <string>IntelGFX</string> <key>Key</key> <string>hda-gfx</string> <key>Value</key> <data>b25ib2FyZC0xAA==</data> <key>Comment</key> <string>hda-gfx=onboard-1 for HDMI audio</string> </dict> <dict> <key>Device</key> <string>HDA</string> <key>Key</key> <string>hda-gfx</string> <key>Value</key> <data>b25ib2FyZC0xAA==</data> <key>Comment</key> <string>hda-gfx=onboard-1 for HDMI audio</string> </dict> <dict> <key>Device</key> <string>HDA</string> <key>Key</key> <string>layout-id</string> <key>Value</key> <data>AwAAAA==</data> <key>Comment</key> <string>layout-id=3</string> </dict> <dict> <key>Device</key> <string>HDA</string> <key>Key</key> <string>PinConfigurations</string> <key>Value</key> <data></data> </dict> </array> <key>FakeID</key> <dict> <key>IMEI</key> <string>0x1e3a8086</string> </dict> <key>Audio</key> <dict> <key>Inject</key> <integer>0</integer> </dict> <key>USB</key> <dict> <key>FixOwnership</key> <true/> <key>AddClockID</key> <true/> <key>Inject</key> <true/> </dict> <key>UseIntelHDMI</key> <false/> </dict> <key>DisableDrivers</key> <array> <string>VBoxHfs</string> </array> <key>GUI</key> <dict> <key>Custom</key> <dict> <key>Entries</key> <array> <dict> <key>Hidden</key> <false/> <key>Type</key> <string>OSXRecovery</string> </dict> <dict> <key>Type</key> <string>Windows</string> <key>Title</key> <string>Windows</string> </dict> </array> </dict> <key>Hide</key> <array> <string>Preboot</string> </array> <key>Mouse</key> <dict> <key>Enabled</key> <false/> </dict> <key>Scan</key> <dict> <key>Entries</key> <true/> <key>Legacy</key> <false/> <key>Linux</key> <true/> <key>Tool</key> <true/> </dict> <key>#ScreenResolution</key> <string>1366x768</string> <key>Theme</key> <string>BGM</string> </dict> <key>Graphics</key> <dict> <key>ig-platform-id</key> <string>0x01660003</string> <key>Inject</key> <dict> <key>ATI</key> <false/> <key>Intel</key> <true/> <key>NVidia</key> <true/> </dict> <key>InjectEDID</key> <false/> </dict> <key>KernelAndKextPatches</key> <dict> <key>AsusAICPUPM</key> <true/> <key>AppleRTC</key> <true/> <key>DellSMBIOSPatch</key> <false/> <key>KernelIvyXCPM</key> <false/> <key>KernelLapic</key> <true/> <key>KernelPm</key> <true/> <key>ForceKextsToLoad</key> <array> <string>\System\Library\Extensions\IONetworkingFamily.kext</string> </array> <key>KextsToPatch</key> <array> <dict> <key>Comment</key> <string>HDMI-audio HD4000 0x01660003, port 0205</string> <key>Disabled</key> <true/> <key>Name</key> <string>com.apple.driver.AppleIntelFramebufferCapri</string> <key>Find</key> <data>AgUAAAAEAAAHBAAA</data> <key>Replace</key> <data>AgUAAAAIAAAGAAAA</data> </dict> <dict> <key>Comment</key> <string>HDMI-audio HD4000 0x01660003, port 0304</string> <key>Disabled</key> <true/> <key>Name</key> <string>com.apple.driver.AppleIntelFramebufferCapri</string> <key>Find</key> <data>AwQAAAAEAACBAAAA</data> <key>Replace</key> <data>AwQAAAAIAAAGAAAA</data> </dict> <dict> <key>Comment</key> <string>HDMI-audio HD4000 0x01660003, port 0406</string> <key>Disabled</key> <true/> <key>Name</key> <string>com.apple.driver.AppleIntelFramebufferCapri</string> <key>Find</key> <data>BAYAAAAEAACBAAAA</data> <key>Replace</key> <data>BAYAAAAIAAAGAAAA</data> </dict> </array> <key>KernelToPatch</key> <array> <dict> <key>Comment</key> <string>Disable panic kext logging on 10.13 Debug kernel</string> <key>Disabled</key> <false/> <key>Find</key> <data> sABMi1Xw </data> <key>MatchOS</key> <string>10.13</string> <key>Replace</key> <data> SIPEQF3D </data> </dict> <dict> <key>Comment</key> <string>Disable panic kext logging on 10.13 Release kernel</string> <key>Disabled</key> <false/> <key>Find</key> <data> igKEwHRE </data> <key>MatchOS</key> <string>10.13</string> <key>Replace</key> <data> igKEwOtE </data> </dict> </array> </dict> <key>RtVariables</key> <dict> <key>CsrActiveConfig</key> <string>0x67</string> <key>BooterConfig</key> <string>0x28</string> </dict> <key>SMBIOS</key> <dict> <key>ProductName</key> <string>MacBookPro9,2</string> <key>Trust</key> <true/> </dict> <key>SystemParameters</key> <dict> <key>#BacklightLevel</key> <integer>0</integer> <key>InjectKexts</key> <string>Detect</string> </dict> </dict> </plist> ```
/content/code_sandbox/Clover-Configs/XiaoMi/i5-with-fingerprint/CLOVER/config_HD4000_1366x768_6series.plist
xml
2016-11-05T04:22:54
2024-08-12T19:25:53
Hackintosh-Installer-University
huangyz0918/Hackintosh-Installer-University
3,937
4,601
```xml /* * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import variance = require( './index' ); // TESTS // // The function returns a number... { variance( 8, 2 ); // $ExpectType number } // The compiler throws an error if the function is provided values other than two numbers... { variance( true, 3 ); // $ExpectError variance( false, 2 ); // $ExpectError variance( '5', 1 ); // $ExpectError variance( [], 1 ); // $ExpectError variance( {}, 2 ); // $ExpectError variance( ( x: number ): number => x, 2 ); // $ExpectError variance( 9, true ); // $ExpectError variance( 9, false ); // $ExpectError variance( 5, '5' ); // $ExpectError variance( 8, [] ); // $ExpectError variance( 9, {} ); // $ExpectError variance( 8, ( x: number ): number => x ); // $ExpectError variance( [], true ); // $ExpectError variance( {}, false ); // $ExpectError variance( false, '5' ); // $ExpectError variance( {}, [] ); // $ExpectError variance( '5', ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { variance(); // $ExpectError variance( 3 ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/base/dists/erlang/variance/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
379
```xml import { initializeFocusRects } from './initializeFocusRects'; import { IsFocusHiddenClassName, IsFocusVisibleClassName } from './setFocusVisibility'; import { KeyCodes } from './KeyCodes'; import { addDirectionalKeyCode } from './keyboard'; describe('initializeFocusRects', () => { let classNames: string[] = []; // eslint-disable-next-line @typescript-eslint/no-explicit-any const mockWindow: { [key: string]: any } = { addEventListener: (name: string, callback: Function) => { mockWindow[name] = callback; }, document: { body: { classList: { contains: (name: string) => classNames.indexOf(name) > -1, add: (name: string) => classNames.indexOf(name) < 0 && classNames.push(name), remove: (name: string) => classNames.indexOf(name) > -1 && classNames.splice(classNames.indexOf(name), 1), toggle: (name: string, val: boolean) => { const hasClass = classNames.indexOf(name) > -1; if (hasClass !== val) { if (hasClass) { classNames.splice(classNames.indexOf(name), 1); } else { classNames.push(name); } } }, }, }, }, }; const mockTarget = { ownerDocument: { defaultView: mockWindow, }, }; beforeEach(() => { classNames = []; // eslint-disable-next-line deprecation/deprecation initializeFocusRects(mockWindow as Window); }); it('can hint to show focus when you press a directional key', () => { mockWindow.keydown({ target: mockTarget, which: KeyCodes.up }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.down }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.left }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.right }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.tab }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.pageUp }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.pageDown }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.home }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); classNames = []; mockWindow.keydown({ target: mockTarget, which: KeyCodes.end }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); }); it('no-ops when you press a non-directional key', () => { mockWindow.keydown({ target: mockTarget, which: 127 }); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(false); // don't care about the state of the "hidden" class in this case }); it('can hint to hide focus on mouse click', () => { mockWindow.keydown({ target: mockTarget, which: KeyCodes.down }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); mockWindow.mousedown({ target: mockTarget }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(true); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(false); }); it('can hint to show focus when you press a custom directional key', () => { mockWindow.keydown({ target: mockTarget, which: KeyCodes.f6 }); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(false); // don't care about the state of the "hidden" class in this case addDirectionalKeyCode(KeyCodes.f6); mockWindow.keydown({ target: mockTarget, which: KeyCodes.f6 }); expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false); expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true); }); }); ```
/content/code_sandbox/packages/utilities/src/initializeFocusRects.test.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
1,167
```xml import * as React from 'react'; import { defaultMappedProps, ComposePreparedOptions, GenericDictionary, MergePropsResult } from './consts'; import { mergeSlotProp } from './mergeSlotProp'; export const NullRender = () => null; /** * Helper utility which resolves the slots and slot props derived from user input. */ export function resolveSlotProps<TProps extends {}, TState extends {} = TProps>( result: MergePropsResult<TState>, options: ComposePreparedOptions<TProps, TState>, ): MergePropsResult<TState> { const { state, slots, slotProps } = result; // Derive the default slot props from the config, if provided. options.slotProps.forEach(definition => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const nextSlotProps = definition(state as any); Object.keys(nextSlotProps).forEach(key => { slotProps[key] = { ...slotProps[key], ...nextSlotProps[key] }; }); }); // Mix unrecognized props onto root, appropriate, excluding the handled props. assignToMapObject(slotProps, 'root', getUnhandledProps(state, options)); // Iterate through slots and resolve shorthand values. Object.keys(slots).forEach((slotName: string) => { const slot = slots[slotName]; // eslint-disable-next-line @typescript-eslint/no-explicit-any const slotProp = (state as any)[slotName]; if (slot && slotProp !== undefined && slotProp !== null) { const mergedSlotProp = mergeSlotProp( slotProp, slotProps[slotName], (slot && slot.shorthandConfig && slot.shorthandConfig.mappedProp) || defaultMappedProps[slot], ); if (typeof mergedSlotProp.children === 'function') { const { children, ...restProps } = slotProp; // If the children is a function, replace the slot. slots[slotName] = React.Fragment; slotProps[slotName] = { children: slotProp.children(slot, { ...slotProps[slotName], ...restProps }), }; } else { slotProps[slotName] = mergedSlotProp; } } // Ensure no slots are falsey if (!slots[slotName] || slotProp === null) { slots[slotName] = NullRender; } }); return result; } function assignToMapObject(map: Record<string, {}>, key: string, value: {}) { if (value) { if (!map[key]) { map[key] = {}; } map[key] = { ...map[key], ...value }; } } function getUnhandledProps<TProps, TState>( props: GenericDictionary, options: ComposePreparedOptions<TProps, TState>, ): GenericDictionary { const unhandledProps: GenericDictionary = {}; const slots = Object.keys(options.slots); for (const key of Object.keys(props)) { if ( key !== 'className' && key !== 'as' && options.handledProps.indexOf(key as keyof TProps) === -1 && slots.indexOf(key) === -1 ) { unhandledProps[key] = props[key]; } } return unhandledProps; } ```
/content/code_sandbox/packages/fluentui/react-bindings/src/compose/resolveSlotProps.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
694
```xml import { StrictStyleOptions } from 'botframework-webchat-api'; export default function createSendBoxStyle({ sendBoxBackground, sendBoxBorderBottom, sendBoxBorderLeft, sendBoxBorderRight, sendBoxBorderTop, sendBoxHeight }: StrictStyleOptions) { return { '&.webchat__send-box': { '& .webchat__send-box__button--align-bottom': { alignSelf: 'flex-end' }, '& .webchat__send-box__button--align-stretch': { alignSelf: 'stretch' }, '& .webchat__send-box__button--align-top': { alignSelf: 'flex-start' }, '& .webchat__send-box__main': { alignItems: 'stretch', backgroundColor: sendBoxBackground, borderBottom: sendBoxBorderBottom, borderLeft: sendBoxBorderLeft, borderRight: sendBoxBorderRight, borderTop: sendBoxBorderTop, minHeight: sendBoxHeight } } }; } ```
/content/code_sandbox/packages/component/src/Styles/StyleSet/SendBox.ts
xml
2016-07-07T23:16:57
2024-08-16T00:12:37
BotFramework-WebChat
microsoft/BotFramework-WebChat
1,567
215
```xml import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; // path_to_url export default defineConfig({ plugins: [react()] }); ```
/content/code_sandbox/samples/browser-esm-vite-react/vite.config.ts
xml
2016-06-07T16:56:31
2024-08-16T17:17:05
monaco-editor
microsoft/monaco-editor
39,508
38
```xml <UserControl x:Class="Telegram.Controls.Cells.InlineResultMediaCell" xmlns="path_to_url" xmlns:x="path_to_url" xmlns:local="using:Telegram.Controls.Cells" xmlns:d="path_to_url" xmlns:mc="path_to_url" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid> <Image x:Name="Texture" Stretch="UniformToFill" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </UserControl> ```
/content/code_sandbox/Telegram/Controls/Cells/InlineResultMediaCell.xaml
xml
2016-05-23T09:03:33
2024-08-16T16:17:48
Unigram
UnigramDev/Unigram
3,744
124
```xml // See LICENSE.txt for license information. import {MM_TABLES} from '@constants/database'; import BaseDataOperator from '@database/operator/base_data_operator'; import {shouldUpdateFileRecord} from '@database/operator/server_data_operator/comparators/files'; import { transformConfigRecord, transformCustomEmojiRecord, transformFileRecord, transformRoleRecord, transformSystemRecord, } from '@database/operator/server_data_operator/transformers/general'; import {getUniqueRawsBy} from '@database/operator/utils/general'; import {logWarning} from '@utils/log'; import {sanitizeReactions} from '../../utils/reaction'; import {transformReactionRecord} from '../transformers/reaction'; import type {Model} from '@nozbe/watermelondb'; import type {HandleConfigArgs, HandleCustomEmojiArgs, HandleFilesArgs, HandleReactionsArgs, HandleRoleArgs, HandleSystemArgs, OperationArgs} from '@typings/database/database'; import type CustomEmojiModel from '@typings/database/models/servers/custom_emoji'; import type FileModel from '@typings/database/models/servers/file'; import type ReactionModel from '@typings/database/models/servers/reaction'; import type RoleModel from '@typings/database/models/servers/role'; import type SystemModel from '@typings/database/models/servers/system'; const {SERVER: {CONFIG, CUSTOM_EMOJI, FILE, ROLE, SYSTEM, REACTION}} = MM_TABLES; export default class ServerDataOperatorBase extends BaseDataOperator { handleRole = async ({roles, prepareRecordsOnly = true}: HandleRoleArgs) => { if (!roles?.length) { logWarning( 'An empty or undefined "roles" array has been passed to the handleRole', ); return []; } return this.handleRecords({ fieldName: 'id', transformer: transformRoleRecord, prepareRecordsOnly, createOrUpdateRawValues: getUniqueRawsBy({raws: roles, key: 'id'}), tableName: ROLE, }, 'handleRole') as Promise<RoleModel[]>; }; handleCustomEmojis = async ({emojis, prepareRecordsOnly = true}: HandleCustomEmojiArgs) => { if (!emojis?.length) { logWarning( 'An empty or undefined "emojis" array has been passed to the handleCustomEmojis', ); return []; } return this.handleRecords({ fieldName: 'name', transformer: transformCustomEmojiRecord, prepareRecordsOnly, createOrUpdateRawValues: getUniqueRawsBy({raws: emojis, key: 'name'}), tableName: CUSTOM_EMOJI, }, 'handleCustomEmojis') as Promise<CustomEmojiModel[]>; }; handleSystem = async ({systems, prepareRecordsOnly = true}: HandleSystemArgs) => { if (!systems?.length) { logWarning( 'An empty or undefined "systems" array has been passed to the handleSystem', ); return []; } return this.handleRecords({ fieldName: 'id', transformer: transformSystemRecord, prepareRecordsOnly, createOrUpdateRawValues: getUniqueRawsBy({raws: systems, key: 'id'}), tableName: SYSTEM, }, 'handleSystem') as Promise<SystemModel[]>; }; handleConfigs = async ({configs, configsToDelete, prepareRecordsOnly = true}: HandleConfigArgs) => { if (!configs?.length && !configsToDelete?.length) { logWarning( 'An empty or undefined "configs" and "configsToDelete" arrays has been passed to the handleConfigs', ); return []; } return this.handleRecords({ fieldName: 'id', transformer: transformConfigRecord, prepareRecordsOnly, createOrUpdateRawValues: getUniqueRawsBy({raws: configs, key: 'id'}), tableName: CONFIG, deleteRawValues: configsToDelete, }, 'handleConfigs'); }; /** * handleReactions: Handler responsible for the Create/Update operations occurring on the Reaction table from the 'Server' schema * @param {HandleReactionsArgs} handleReactions * @param {ReactionsPerPost[]} handleReactions.postsReactions * @param {boolean} handleReactions.prepareRecordsOnly * @param {boolean} handleReactions.skipSync * @returns {Promise<Array<(ReactionModel | CustomEmojiModel)>>} */ handleReactions = async ({postsReactions, prepareRecordsOnly, skipSync}: HandleReactionsArgs): Promise<ReactionModel[]> => { const batchRecords: ReactionModel[] = []; if (!postsReactions?.length) { logWarning( 'An empty or undefined "postsReactions" array has been passed to the handleReactions method', ); return []; } for await (const postReactions of postsReactions) { const {post_id, reactions} = postReactions; const { createReactions, deleteReactions, } = await sanitizeReactions({ database: this.database, post_id, rawReactions: reactions, skipSync, }); if (createReactions?.length) { // Prepares record for model Reactions const reactionsRecords = (await this.prepareRecords({ createRaws: createReactions, transformer: transformReactionRecord, tableName: REACTION, })) as ReactionModel[]; batchRecords.push(...reactionsRecords); } if (deleteReactions?.length && !skipSync) { deleteReactions.forEach((outCast) => outCast.prepareDestroyPermanently()); batchRecords.push(...deleteReactions); } } if (prepareRecordsOnly) { return batchRecords; } if (batchRecords?.length) { await this.batchRecords(batchRecords, 'handleReactions'); } return batchRecords; }; /** * handleFiles: Handler responsible for the Create/Update operations occurring on the File table from the 'Server' schema * @param {HandleFilesArgs} handleFiles * @param {RawFile[]} handleFiles.files * @param {boolean} handleFiles.prepareRecordsOnly * @returns {Promise<FileModel[]>} */ handleFiles = async ({files, prepareRecordsOnly}: HandleFilesArgs): Promise<FileModel[]> => { if (!files?.length) { logWarning( 'An empty or undefined "files" array has been passed to the handleFiles method', ); return []; } const raws = files.reduce<{createOrUpdateFiles: FileInfo[]; deleteFiles: FileInfo[]}>((res, f) => { if (f.delete_at) { res.deleteFiles.push(f); } else { res.createOrUpdateFiles.push(f); } return res; }, {createOrUpdateFiles: [], deleteFiles: []}); const processedFiles = (await this.processRecords<FileModel>({ createOrUpdateRawValues: raws.createOrUpdateFiles, tableName: FILE, fieldName: 'id', deleteRawValues: raws.deleteFiles, shouldUpdate: shouldUpdateFileRecord, })); const preparedFiles = await this.prepareRecords<FileModel>({ createRaws: processedFiles.createRaws, updateRaws: processedFiles.updateRaws, deleteRaws: processedFiles.deleteRaws, transformer: transformFileRecord, tableName: FILE, }); if (prepareRecordsOnly) { return preparedFiles; } if (preparedFiles?.length) { await this.batchRecords(preparedFiles, 'handleFiles'); } return preparedFiles; }; /** * execute: Handles the Create/Update operations on an table. * @param {OperationArgs} execute * @param {string} execute.tableName * @param {RecordValue[]} execute.createRaws * @param {RecordValue[]} execute.updateRaws * @param {(TransformerArgs) => Promise<Model>} execute.recordOperator * @returns {Promise<void>} */ async execute<T extends Model>({createRaws, transformer, tableName, updateRaws}: OperationArgs<T>, description: string): Promise<T[]> { const models = await this.prepareRecords({ tableName, createRaws, updateRaws, transformer, }); if (models?.length > 0) { await this.batchRecords(models, description); } return models; } } ```
/content/code_sandbox/app/database/operator/server_data_operator/handlers/index.ts
xml
2016-10-07T16:52:32
2024-08-16T12:08:38
mattermost-mobile
mattermost/mattermost-mobile
2,155
1,790
```xml export interface BundledLocales { [locale: string]: string; } export interface LoadableLocales { [locale: string]: () => Promise<string>; } /** * This type describes the shape of the generated code from our `locales-loader`. * Please check `./src/loaders` and the webpack config for more information. */ export interface LocalesData { readonly defaultLocale: string; readonly fallbackLocale: string; readonly availableLocales: ReadonlyArray<string>; readonly bundled: BundledLocales; readonly loadables: LoadableLocales; } ```
/content/code_sandbox/client/src/core/client/framework/lib/i18n/locales.ts
xml
2016-10-31T16:14:05
2024-08-06T16:15:57
talk
coralproject/talk
1,881
121
```xml import { Injectable } from '@angular/core'; import { GlobalService } from './global.service'; import { EndpointsService } from './endpoints.service'; import { ApiService } from './api.service'; import { BehaviorSubject } from 'rxjs'; import { Router } from '@angular/router'; @Injectable() export class AuthService { authState = { isLoggedIn: false }; private authStateSource = new BehaviorSubject(this.authState); change = this.authStateSource.asObservable(); isAuth = false; isMail = true; // getUser for signup regUser = {}; // useDetails for login getUser = {}; // color to show password strength color = {}; isResetPassword = false; // form error isFormError = false; FormError = {}; // default parameters isLoader = false; regMsg = ''; wrnMsg = {}; isValid = {}; deliveredMsg = ''; canShowPassword = false; canShowConfirmPassword = false; /** * Constructor. * @param globalService GlobalService Injection. * @param apiService ApiService Injection. * @param endpointsService EndpointsService Injection. */ constructor( private globalService: GlobalService, private apiService: ApiService, private endpointsService: EndpointsService, private router: Router ) {} /** * Call this to update authentication state. * @param state New Authentication state */ authStateChange(state) { this.authState = state; this.authStateSource.next(this.authState); this.isAuth = this.authState.isLoggedIn; } /** * To affirm that user is logged in * @param autoFetchUserDetails User details fetch flag */ loggedIn(autoFetchUserDetails = false) { this.authStateChange({ isLoggedIn: true, username: '' }); if (autoFetchUserDetails) { this.fetchUserDetails(); } } /** * Log Out Trigger */ logOut() { const temp = { isLoggedIn: false }; const routePath = ''; this.globalService.deleteData(this.globalService.authStorageKey); this.authStateChange(temp); this.router.navigate([routePath]); this.globalService.showToast('info', 'Successfully logged out!'); } /** * User Details fetch Trigger */ fetchUserDetails() { const API_PATH = 'auth/user/'; const SELF = this; this.apiService.getUrl(API_PATH).subscribe( (data) => { const TEMP = Object.assign({ isLoggedIn: true }, SELF.authState, data); SELF.authStateChange(TEMP); }, (err) => { this.globalService.showToast('info', 'Timeout, Please login again to continue!'); this.globalService.resetStorage(); this.authState = { isLoggedIn: false }; SELF.globalService.handleApiError(err, false); }, () => {} ); } /** * Calculating Password Strength (Not being called as of now) * TODO: make use of it */ passwordStrength(password) { // Regular Expressions. const REGEX = new Array(); REGEX.push('[A-Z]', '[a-z]', '[0-9]', '[$$!%*#?&]'); let passed = 0; // Validate for each Regular Expression. for (let i = 0; i < REGEX.length; i++) { if (new RegExp(REGEX[i]).test(password)) { passed++; } } // Validate for length of Password. if (passed > 2 && password.length > 8) { passed++; } let color = ''; let strength = ''; if (passed === 1) { strength = 'Weak'; color = 'red'; } else if (passed === 2) { strength = 'Average'; color = 'darkorange'; } else if (passed === 3) { strength = 'Good'; color = 'green'; } else if (passed === 4) { strength = 'Strong'; color = 'darkgreen'; } else if (passed === 5) { strength = 'Very Strong'; color = 'darkgreen'; } return [strength, color]; } /** * Check if user is loggedIn and trigger logIn if token present but not loggedIn */ isLoggedIn() { const token = this.globalService.getAuthToken(); if (token) { if (!this.authState['isLoggedIn']) { this.loggedIn(true); } return true; } else { if (this.authState['isLoggedIn']) { this.logOut(); } } } /** * User Details fetch Trigger * @param token * @param success * @param error */ verifyEmail(token, success = () => {}, error = () => {}) { const API_PATH = this.endpointsService.verifyEmailURL(); const SELF = this; const BODY = JSON.stringify({ key: token, }); this.apiService.postUrl(API_PATH, BODY).subscribe( (data) => { success(); }, (err) => { error(); SELF.globalService.handleApiError(err); }, () => {} ); } /** * Fetch JWT for submission Auth Token */ setRefreshJWT() { const API_PATH = 'accounts/user/get_auth_token'; this.apiService.getUrl(API_PATH).subscribe( (data) => { this.globalService.storeData('refreshJWT', data['token']); }, (err) => { this.globalService.showToast('info', 'Could not fetch Auth Token'); return false; }, () => {} ); } // toggle password visibility togglePasswordVisibility() { this.canShowPassword = !this.canShowPassword; } // toggle confirm password visibility toggleConfirmPasswordVisibility() { this.canShowConfirmPassword = !this.canShowConfirmPassword; } resetForm() { // getUser for signup this.regUser = {}; // useDetails for login this.getUser = {}; // reset error msg this.wrnMsg = {}; // switch off form errors this.isFormError = false; // reset form when link sent for reset password this.isMail = true; // reset the eye icon and type to password this.canShowPassword = false; this.canShowConfirmPassword = false; } } ```
/content/code_sandbox/frontend_v2/src/app/services/auth.service.ts
xml
2016-10-21T00:51:45
2024-08-16T14:41:56
EvalAI
Cloud-CV/EvalAI
1,736
1,399
```xml <?xml version="1.0"?> <!DOCTYPE mbeans-descriptors PUBLIC "-//Apache Software Foundation//DTD Model MBeans Configuration File" "path_to_url"> <mbeans-descriptors> <mbean name="QuartzScheduler" description="A Quartz Scheduler." domain="quartz" type="org.quartz.core.QuartzScheduler"> <!-- ATTRIBUTES --> <attribute name="schedulerName" description="The name of the scheduler." type="java.lang.String" writeable="false"/> <attribute name="schedulerInstanceId" description="The instance Id of the scheduler." type="java.lang.String" writeable="false"/> <attribute name="schedulerContext" description="The SchedulerContext of the scheduler." type="org.quartz.SchedulerContext" writeable="false"/> <attribute name="inStandbyMode" description="Whether the scheduler is currently in standby (paused)." type="boolean" writeable="false" is="true"/> <attribute name="shutdown" description="Whether the scheduler has been shutdown." type="boolean" writeable="false" is="true"/> <attribute name="jobFactory" description="The JobFactory that will be responsible for producing instances of Job classes." type="org.quartz.spi.JobFactory" readable="false" writeable="true"/> <attribute name="version" description="Quartz version." type="java.lang.String" writeable="false"/> <attribute name="jobStoreClass" description="Class of this scheduler's JobStore." type="java.lang.Class" writeable="false"/> <attribute name="threadPoolClass" description="Class of this scheduler's ThreadPool." type="java.lang.Class" writeable="false"/> <attribute name="threadPoolSize" description="Number of threads in this scheduler's ThreadPool." type="int" writeable="false"/> <!-- OPERATIONS--> <operation name="start" description="Starts the scheduler's threads that fire Triggers." impact="ACTION" returnType="void"/> <operation name="standby" description="Temporarily halts the scheduler's firing of Triggers." impact="ACTION" returnType="void"/> <operation name="shutdown" description="Halts the scheduler's firing of Triggers, and cleans up all resources associated with the scheduler." impact="ACTION" returnType="void"/> <operation name="shutdown" description="Halts the scheduler's firing of Triggers, and cleans up all resources associated with the scheduler." impact="ACTION" returnType="void"> <parameter name="waitForJobsToComplete" description="If true the scheduler will not allow this method to return until all currently executing jobs have completed." type="boolean"/> </operation> <operation name="runningSince" description="Get Date scheduler was first started." impact="INFO" returnType="java.util.Date"/> <operation name="numJobsExecuted" description="Get total number of jobs executed by this scheduler." impact="INFO" returnType="int"/> <operation name="supportsPersistence" description="Get whether this scheduler's JobStore supports persistence." impact="INFO" returnType="boolean"/> <operation name="getCurrentlyExecutingJobs" description="Get a list of JobExecutionContext objects that represent all currently executing Jobs in this scheduler instance." impact="INFO" returnType="java.util.List"/> <operation name="scheduleJob" description="Add the given JobDetail to the Scheduler, and associate the given Trigger with it." impact="ACTION" returnType="java.util.Date"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobDetail" type="org.quartz.JobDetail" description="The JobDetail to schedule."/> <parameter name="trigger" type="org.quartz.Trigger" description="The Trigger to schedule."/> </operation> <operation name="scheduleJob" description="Schedule the given Trigger with the Job identified by the Trigger's settings." impact="ACTION" returnType="java.util.Date"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="trigger" type="org.quartz.Trigger" description="The Trigger to schedule."/> </operation> <operation name="unscheduleJob" description="Remove the indicated Triggerfrom the scheduler." impact="ACTION" returnType="boolean"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerName" type="java.lang.String" description="The name of the Trigger to unschedule."/> <parameter name="triggerGroupName" type="java.lang.String" description="The group name of the Trigger to unschedule."/> </operation> <operation name="rescheduleJob" description="Remove (delete) the Trigger with the given name, and store the new given one - which must be associated with the same job (the new trigger must have the job name and group specified) - however, the new trigger need not have the same name as the old trigger." impact="ACTION" returnType="java.util.Date"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerName" type="java.lang.String" description="The name of the Trigger to be replaced."/> <parameter name="triggerGroupName" type="java.lang.String" description="The group name of the Trigger to be replaced."/> <parameter name="newTrigger" type="org.quartz.Trigger" description="The new Trigger to be stored."/> </operation> <operation name="addJob" description="Add the given Job to the Scheduler - with no associated Trigger." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobDetail" type="org.quartz.JobDetail" description="The JobDetail to add."/> <parameter name="replace" type="boolean" description="Whether or not to replace an existing Job with the given one."/> </operation> <operation name="deleteJob" description="Delete the identified Job from the Scheduler - and any associated Triggers." impact="ACTION" returnType="boolean"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobName" type="java.lang.String" description="The name of the Job to delete."/> <parameter name="jobGroupName" type="java.lang.String" description="The group name of the Job to delete."/> </operation> <operation name="triggerJob" description="Trigger the identified JobDetail (execute it now) - the generated trigger will be non-volatile." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobName" type="java.lang.String" description="The name of the Job to trigger."/> <parameter name="jobGroupName" type="java.lang.String" description="The group name of the Job to trigger."/> <parameter name="jobDataMap" type="org.quartz.JobDataMap" description="The (possibly null) JobDataMap to be associated with the trigger that fires the job immediately."/> </operation> <operation name="triggerJobWithVolatileTrigger" description="Trigger the identified JobDetail (execute it now) - the generated trigger will be volatile." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobName" type="java.lang.String" description="The name of the Job to trigger."/> <parameter name="jobGroupName" type="java.lang.String" description="The group name of the Job to trigger."/> <parameter name="jobDataMap" type="org.quartz.JobDataMap" description="The (possibly null) JobDataMap to be associated with the trigger that fires the job immediately."/> </operation> <operation name="interrupt" description="Request the interruption, within this scheduler instance, of all currently executing instances of the identified Job, which must be an implementor of the InterruptableJob interface." impact="ACTION" returnType="boolean"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerName" type="java.lang.String" description="The name of the trigger to interrupt."/> <parameter name="triggerGroupName" type="java.lang.String" description="The name of the trigger group to interrupt."/> </operation> <operation name="pauseJob" description="Pause the JobDetail with the given name - by pausing all of its current Triggers." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobName" type="java.lang.String" description="The name of the Job to pause."/> <parameter name="jobGroupName" type="java.lang.String" description="The group name of the Job to pause."/> </operation> <operation name="pauseJobGroup" description="Pause all of the JobDetails in the given group - by pausing all of theirTriggers." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobGroupName" type="java.lang.String" description="The group name of the Jobs to pause."/> </operation> <operation name="pauseTrigger" description="Pause the Trigger with the given name." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerName" type="java.lang.String" description="The name of the Trigger to pause."/> <parameter name="triggerGroupName" type="java.lang.String" description="The group name of the Trigger to pause."/> </operation> <operation name="pauseTriggerGroup" description="Pause all of the Triggers in the given group." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerGroupName" type="java.lang.String" description="The group name of the Triggers to pause."/> </operation> <operation name="resumeJob" description="Resume (un-pause) the JobDetail with the given name." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobName" type="java.lang.String" description="The name of the Job to resume."/> <parameter name="jobGroupName" type="java.lang.String" description="The group name of the Job to resume."/> </operation> <operation name="resumeJobGroup" description="Resume (un-pause) all of the JobDetails in the given group." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobGroupName" type="java.lang.String" description="The group name of the Jobs to resume."/> </operation> <operation name="resumeTrigger" description="Resume (un-pause) the Trigger with the given name." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerName" type="java.lang.String" description="The name of the Trigger to resume."/> <parameter name="triggerGroupName" type="java.lang.String" description="The group name of the Trigger to resume."/> </operation> <operation name="resumeTriggerGroup" description="Resume (un-pause) all of the Triggers in the given group." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerGroupName" type="java.lang.String" description="The group name of the Triggers to resume."/> </operation> <operation name="pauseAll" description="Pause all triggers - similar to calling pauseTriggerGroup(group) on every group, however, after using this method resumeAll() must be called to clear the scheduler's state of 'remembering' that all new triggers will be paused as they are added." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> </operation> <operation name="resumeAll" description="Resume (un-pause) all triggers - similar to calling resumeTriggerGroup(group) on every group." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> </operation> <operation name="getPausedTriggerGroups" description="Get the names of all Trigger groups that are paused." impact="INFO" returnType="java.util.Set"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> </operation> <operation name="getJobGroupNames" description="Get the names of all known JobDetail groups." impact="INFO" returnType="[Ljava.lang.String;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> </operation> <operation name="getJobNames" description="Get the names of all the JobDetails in the given group." impact="INFO" returnType="[Ljava.lang.String;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobGroupName" type="java.lang.String" description="The job group name."/> </operation> <operation name="getTriggersOfJob" description="Get all Triggers that are associated with the identified JobDetail." impact="INFO" returnType="[Lorg.quartz.Trigger;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobName" type="java.lang.String" description="The name of the job."/> <parameter name="jobGroupName" type="java.lang.String" description="The name of the job group."/> </operation> <operation name="getTriggerGroupNames" description="Get the names of all known Trigger groups." impact="INFO" returnType="[Ljava.lang.String;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> </operation> <operation name="getTriggerNames" description="Get the names of all the Triggers in the given group." impact="INFO" returnType="[Ljava.lang.String;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerGroupName" type="java.lang.String" description="The trigger group name."/> </operation> <operation name="getJobDetail" description="Get the JobDetail for the Job instance with the given name and group." impact="INFO" returnType="[Lorg.quartz.JobDetail;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="jobName" type="java.lang.String" description="The name of the job."/> <parameter name="jobGroupName" type="java.lang.String" description="The name of the job group."/> </operation> <operation name="getTrigger" description="Get the Trigger instance with the given name and group." impact="INFO" returnType="[Lorg.quartz.Trigger;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerName" type="java.lang.String" description="The name of the trigger."/> <parameter name="triggerGroupName" type="java.lang.String" description="The name of the trigger group."/> </operation> <operation name="getTriggerState" description="Get the current state of the identified Trigger." impact="INFO" returnType="int"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="triggerName" type="java.lang.String" description="The name of the trigger."/> <parameter name="triggerGroupName" type="java.lang.String" description="The name of the trigger group."/> </operation> <operation name="addCalendar" description="Add (register) the given Calendar to the scheduler." impact="ACTION" returnType="void"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="calendarName" type="java.lang.String" description="Name of the calendar to add."/> <parameter name="calendar" type="org.quartz.Calendar" description="The Calendar instance to add."/> <parameter name="replace" type="boolean" description="Whether to allow replacing an existing Calendar instance."/> <parameter name="updateTriggers" type="boolean" description="Whether or not to update existing triggers that referenced the already existing calendar so that they are 'correct' based on the new trigger."/> </operation> <operation name="deleteCalendar" description="Delete the identified Calendar from the scheduler." impact="ACTION" returnType="boolean"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="calendarName" type="java.lang.String" description="Name of the Calendar to delete."/> </operation> <operation name="getCalendar" description="Get the Calendar instance with the given name." impact="INFO" returnType="org.quartz.Calendar"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> <parameter name="calendarName" type="java.lang.String" description="Name of the Calendar to get."/> </operation> <operation name="getCalendarNames" description="Get the names of all registered Calendars." impact="INFO" returnType="[Ljava.lang.String;"> <parameter name="schedulingContext" type="org.quartz.core.SchedulingContext" description="The scheduling context."/> </operation> <operation name="addGlobalJobListener" description="Add the given JobListener to the scheduler's global list." impact="ACTION" returnType="void"> <parameter name="jobListener" type="org.quartz.JobListener" description="Job listener to add."/> </operation> <operation name="addJobListener" description="Add the given JobListener to the scheduler's list, of registered JobListeners." impact="ACTION" returnType="void"> <parameter name="jobListener" type="org.quartz.JobListener" description="Job listener to add."/> </operation> <operation name="removeGlobalJobListener" description="Remove the identifed JobListener from the scheduler's list of global listeners." impact="ACTION" returnType="boolean"> <parameter name="jobListenerName" type="java.lang.String" description="Name of the global JobListener to remove."/> </operation> <operation name="removeJobListener" description="Remove the identifed JobListener from the scheduler's list of registered listeners." impact="ACTION" returnType="boolean"> <parameter name="jobListenerName" type="java.lang.String" description="Name of the JobListener to remove."/> </operation> <operation name="getGlobalJobListeners" description="Get a List containing all of the JobListeners in the scheduler's global list." impact="INFO" returnType="java.util.List"/> <operation name="getJobListenerNames" description="Get a Set containing the names of all the non-global JobListeners registered with the scheduler." impact="INFO" returnType="java.util.Set"/> <operation name="getGlobalJobListener" description="Get the global JobListener that has the given name." impact="INFO" returnType="org.quartz.JobListener"> <parameter name="jobListenerName" type="java.lang.String" description="Name of the global JobListener to get."/> </operation> <operation name="getJobListener" description="Get the non-global JobListener that has the given name." impact="INFO" returnType="org.quartz.JobListener"> <parameter name="jobListenerName" type="java.lang.String" description="Name of the JobListener to get."/> </operation> <operation name="addGlobalTriggerListener" description="Add the given TriggerListener to the scheduler's global list." impact="ACTION" returnType="void"> <parameter name="triggerListener" type="org.quartz.TriggerListener" description="Trigger listener to add."/> </operation> <operation name="addTriggerListener" description="Add the given TriggerListener to the scheduler's list, of registered TriggerListeners." impact="ACTION" returnType="void"> <parameter name="triggerListener" type="org.quartz.TriggerListener" description="Trigger listener to add."/> </operation> <operation name="removeGlobalTriggerListener" description="Remove the identifed TriggerListener from the scheduler's list of global listeners." impact="ACTION" returnType="boolean"> <parameter name="triggerListenerName" type="java.lang.String" description="Name of the global TriggerListener to remove."/> </operation> <operation name="removeTriggerListener" description="Remove the identifed TriggerListener from the scheduler's list of registered listeners." impact="ACTION" returnType="boolean"> <parameter name="triggerListenerName" type="java.lang.String" description="Name of the TriggerListener to remove."/> </operation> <operation name="getGlobalTriggerListeners" description="Get a List containing all of the TriggerListeners in the scheduler's global list." impact="INFO" returnType="java.util.List"/> <operation name="getTriggerListenerNames" description="Get a Set containing the names of all the non-global TriggerListeners registered with the scheduler." impact="INFO" returnType="java.util.Set"/> <operation name="getGlobalTriggerListener" description="Get the global TriggerListener that has the given name." impact="INFO" returnType="org.quartz.TriggerListener"> <parameter name="triggerListenerName" type="java.lang.String" description="Name of the global TriggerListener to get."/> </operation> <operation name="getTriggerListener" description="Get the non-global TriggerListener that has the given name." impact="INFO" returnType="org.quartz.TriggerListener"> <parameter name="triggerListenerName" type="java.lang.String" description="Name of the TriggerListener to get."/> </operation> <operation name="addSchedulerListener" description="Register the given SchedulerListener with the scheduler." impact="ACTION" returnType="void"> <parameter name="schedulerListener" type="org.quartz.SchedulerListener" description="Scheduler listener to add."/> </operation> <operation name="removeSchedulerListener" description="Remove the given SchedulerListener from the scheduler." impact="ACTION" returnType="boolean"> <parameter name="schedulerListener" type="org.quartz.SchedulerListener" description="Scheduler listener to remove."/> </operation> <operation name="getSchedulerListeners" description="Get a List containing all of the SchedulerListeners registered with the scheduler." impact="INFO" returnType="java.util.List"/> </mbean> </mbeans-descriptors> ```
/content/code_sandbox/quartz/src/main/java/org/quartz/core/mbeans-descriptors.xml
xml
2016-03-07T14:05:37
2024-08-16T17:43:10
quartz
quartz-scheduler/quartz
6,197
5,349
```xml <Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.Shell" xmlns="path_to_url" xmlns:x="path_to_url" xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:d="path_to_url" xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp" xmlns:mc="path_to_url" xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media" xmlns:ui="using:Microsoft.Toolkit.Uwp.UI" xmlns:winui="using:Microsoft.UI.Xaml.Controls" ui:TitleBarExtensions.BackgroundColor="{StaticResource Brand-Color}" ui:TitleBarExtensions.ButtonBackgroundColor="{StaticResource Brand-Color}" ui:TitleBarExtensions.ButtonForegroundColor="{StaticResource Titlebar-Foreground}" ui:TitleBarExtensions.ForegroundColor="{StaticResource Titlebar-Foreground}" SizeChanged="Page_SizeChanged" mc:Ignorable="d"> <Page.Resources> <DataTemplate x:Key="CategoryTemplate" x:DataType="local:SampleCategory"> <Grid> <TextBlock VerticalAlignment="Center" FontFamily="Segoe UI" FontSize="15px" FontWeight="Normal" Text="{x:Bind Name}" /> </Grid> </DataTemplate> </Page.Resources> <Grid> <winui:NavigationView x:Name="NavView" IsSettingsVisible="False" ItemInvoked="NavView_ItemInvoked" MenuItemTemplate="{StaticResource CategoryTemplate}" PaneDisplayMode="Top" SelectionFollowsFocus="Disabled"> <winui:NavigationView.Resources> <CornerRadius x:Key="NavigationViewContentGridCornerRadius">0,0,0,0</CornerRadius> </winui:NavigationView.Resources> <winui:NavigationView.AutoSuggestBox> <AutoSuggestBox x:Name="SearchBox" MinWidth="150" VerticalAlignment="Center" KeyDown="SearchBox_KeyDown" QueryIcon="Find" QuerySubmitted="SearchBox_QuerySubmitted" TextChanged="SearchBox_TextChanged" /> </winui:NavigationView.AutoSuggestBox> <winui:NavigationView.PaneFooter> <!-- Not sure why we can't get to display properly with FooterMenuItems --> <winui:NavigationViewItem x:Name="SettingsTopNavPaneItem" Icon="Home" PointerReleased="SettingsTopNavPaneItem_PointerReleased" Style="{ThemeResource MUX_NavigationViewSettingsItemStyleWhenOnTopPane}" /> </winui:NavigationView.PaneFooter> <Grid> <winui:ParallaxView x:Name="Parallax" VerticalShift="50"> <Image Source="Assets/Photos/Backgrounds/hero.jpg" Stretch="UniformToFill" /> </winui:ParallaxView> <Frame x:Name="NavigationFrame" /> <Grid> <Border x:Name="ContentShadow" Background="{ThemeResource BackingTint}" Tapped="ContentShadow_Tapped" Visibility="{Binding Visibility, ElementName=SamplePickerGrid}"> <media:UIElementExtensions.VisualFactory> <media:PipelineVisualFactory Source="{media:BackdropSource}"> <media:BlurEffect Amount="8" /> </media:PipelineVisualFactory> </media:UIElementExtensions.VisualFactory> <animations:Implicit.ShowAnimations> <animations:OpacityAnimation From="0" To="1" Duration="0:0:0.3" /> </animations:Implicit.ShowAnimations> <animations:Implicit.HideAnimations> <animations:OpacityAnimation From="1" To="0" Duration="0:0:0.2" /> </animations:Implicit.HideAnimations> </Border> <Grid x:Name="SamplePickerGrid" VerticalAlignment="Top" x:DeferLoadStrategy="Lazy" Visibility="Collapsed"> <controls:DropShadowPanel Margin="0,0,0,-3" VerticalAlignment="Bottom" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" BlurRadius="10" ShadowOpacity="0.7" Color="Black"> <Border Height="1" /> </controls:DropShadowPanel> <Border Background="{ThemeResource Menu-DropDown-Background}" /> <GridView x:Name="SamplePickerGridView" animations:ItemsReorderAnimation.Duration="0:0:0.200" ChoosingItemContainer="SamplePickerGridView_ChoosingItemContainer" IsItemClickEnabled="True" ItemClick="SamplePickerGridView_ItemClick" ItemContainerStyle="{StaticResource SamplePickerItemStyle}" ItemContainerTransitions="{x:Null}" ItemTemplate="{StaticResource SampleTemplate}" SelectionMode="Single" Transitions="{x:Null}"> <GridView.GroupStyle> <GroupStyle> <GroupStyle.HeaderTemplate> <DataTemplate> <TextBlock Text="{Binding Key}" /> </DataTemplate> </GroupStyle.HeaderTemplate> </GroupStyle> </GridView.GroupStyle> <animations:Implicit.ShowAnimations> <animations:OpacityAnimation Delay="0:0:0.2" From="0" To="1" Duration="0:0:0.3" /> </animations:Implicit.ShowAnimations> </GridView> <animations:Implicit.ShowAnimations> <animations:OpacityAnimation From="0" To="1" Duration="0:0:0.3" /> <animations:TranslationAnimation From="0, -1000, 0" To="0" Duration="0:0:0.3" /> </animations:Implicit.ShowAnimations> <animations:Implicit.HideAnimations> <animations:OpacityAnimation From="1" To="0" Duration="0:0:0.5" /> <animations:TranslationAnimation From="0" To="0, -1000, 0" Duration="0:0:0.5" /> </animations:Implicit.HideAnimations> </Grid> </Grid> </Grid> </winui:NavigationView> <Canvas x:Name="MoreInfoCanvas" Grid.RowSpan="2" Background="Transparent" Tapped="MoreInfoCanvas_Tapped" Visibility="Collapsed"> <Grid x:Name="MoreInfoContent" Width="260" Height="320" ui:VisualExtensions.NormalizedCenterPoint="0.5"> <Grid VerticalAlignment="Top"> <controls:DropShadowPanel HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" BlurRadius="60" OffsetY="6" ShadowOpacity="0.6" Color="Black"> <Border Background="{ThemeResource Menu-DropDown-Background}" Opacity="0.96"> <media:UIElementExtensions.VisualFactory> <media:PipelineVisualFactory Source="{media:BackdropSource}"> <media:BlurEffect Amount="8" /> </media:PipelineVisualFactory> </media:UIElementExtensions.VisualFactory> </Border> </controls:DropShadowPanel> <Grid Padding="10"> <Grid.RowDefinitions> <RowDefinition Height="160" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid Grid.Row="0" Background="{ThemeResource SampleIconBacking}"> <Image x:Name="MoreInfoImage" Width="240" Height="160" Source="{Binding Icon}" /> </Grid> <StackPanel Grid.Row="1"> <TextBlock Margin="0,10" FontSize="14" FontWeight="SemiBold" Text="{Binding Name}" TextTrimming="CharacterEllipsis" /> <TextBlock FontSize="12" Text="{Binding About}" TextWrapping="Wrap" /> <Border Margin="0,10,0,0" HorizontalAlignment="Left" Background="{StaticResource Brush-Blue-01}" Opacity="1" Visibility="{Binding BadgeUpdateVersionRequired, Converter={StaticResource EmptyStringToObject}}"> <TextBlock Margin="2" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="10" Foreground="{ThemeResource Brush-Main}" Text="{Binding BadgeUpdateVersionRequired}" /> <animations:Implicit.HideAnimations> <animations:OpacityAnimation To="0" Duration="0:0:0.01" /> </animations:Implicit.HideAnimations> <animations:Implicit.ShowAnimations> <animations:OpacityAnimation Delay="0:0:0.2" From="0" To="1" Duration="0:0:0.4" /> <animations:TranslationAnimation Delay="0:0:0.2" From="0, 20, 0" To="0" Duration="0:0:0.3" /> </animations:Implicit.ShowAnimations> </Border> <animations:Implicit.ShowAnimations> <animations:OpacityAnimation Delay="0:0:0.2" From="0" To="1" Duration="0:0:0.4" /> <animations:TranslationAnimation Delay="0:0:0.2" From="0, 20, 0" To="0" Duration="0:0:0.3" /> </animations:Implicit.ShowAnimations> </StackPanel> </Grid> </Grid> <animations:Implicit.ShowAnimations> <animations:OpacityAnimation From="0" To="1" Duration="0:0:0.3" /> <animations:ScaleAnimation From="0.5" To="1" Duration="0:0:0.3" /> </animations:Implicit.ShowAnimations> <animations:Implicit.HideAnimations> <animations:OpacityAnimation From="1" To="0" Duration="0:0:0.2" /> <animations:ScaleAnimation From="1" To="0.5" Duration="0:0:0.2" /> </animations:Implicit.HideAnimations> </Grid> </Canvas> </Grid> </Page> ```
/content/code_sandbox/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml
xml
2016-06-17T21:29:46
2024-08-16T09:32:00
WindowsCommunityToolkit
CommunityToolkit/WindowsCommunityToolkit
5,842
2,199
```xml export * from './NumberTextField'; export * from './NumberTextField.types'; ```
/content/code_sandbox/samples/react-chartcontrol/src/webparts/chartinator/controls/NumberTextField/index.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
16
```xml import * as path from 'path'; import { env } from '../env'; import { FuseBoxLogAdapter } from '../fuseLog/FuseBoxLogAdapter'; import { ensureAbsolutePath, ensureDir, ensureFuseBoxPath, path2RegexPattern, readFile, readFileAsBuffer, removeFile, writeFile, } from '../utils/utils'; import { bumpVersion, IBumpVersion } from './bumpVersion'; import { sparky_src } from './sparky_src'; import { TscOptions, tsc } from './tsc'; export interface ISparkyChain { bumpVersion: (mask: RegExp | string, opts: IBumpVersion) => ISparkyChain; clean: () => ISparkyChain; contentsOf: (mask: RegExp | string, fn: (contents: string) => string) => ISparkyChain; dest: (target: string, base: string) => ISparkyChain; exec: () => Promise<Array<string>>; filter: (a: ((file: string) => any) | RegExp) => ISparkyChain; src: (glob: string) => ISparkyChain; tsc: (opts: TscOptions) => ISparkyChain; write: () => ISparkyChain; } export function sparkyChain(log: FuseBoxLogAdapter): ISparkyChain { const activities = []; const readFiles = {}; let newLocation, newLocationBase; const runActivities = async () => { let latest: any; for (const fn of activities) { latest = await fn(latest); } if (newLocation && newLocationBase) { const root = ensureAbsolutePath(newLocation, env.SCRIPT_PATH); for (const i in latest) { const file = latest[i]; readFiles[file] = readFiles[file] || readFileAsBuffer(file); // normalize path so split works with windows path const s = path.normalize(ensureFuseBoxPath(file)).split(path.normalize(newLocationBase)); if (!s.length || !s[s.length -1]) { log.error(`Can't find base of ${newLocationBase} of ${file}`); return; } else { const newFileLocation = path.join(root, s[s.length -1]); ensureDir(path.dirname(newFileLocation)); await writeFile(newFileLocation, readFiles[file]); } } } return latest; }; const chain = { __scope: () => { return { readFiles }; }, // grabs the files by glob src: (glob: string) => { activities.push(() => sparky_src(glob)); return chain; }, bumpVersion: (mask: RegExp | string, opts: IBumpVersion) => { const re: RegExp = typeof mask === 'string' ? path2RegexPattern(mask) : mask; activities.push(async (files: Array<string>) => { const target = files.find(file => re.test(file)); if (target) { readFiles[target] = readFiles[target] || readFile(target); readFiles[target] = bumpVersion(readFiles[target], opts); } return files; }); return chain; }, clean: () => { activities.push(async (files: Array<string>) => { files.forEach(file => { removeFile(file); }); return files; }); return chain; }, // can be used to replace the contents of a file contentsOf: (mask: RegExp | string, fn: (contents: string) => string) => { const re: RegExp = typeof mask === 'string' ? path2RegexPattern(mask) : mask; activities.push(async (files: Array<string>) => { const target = files.find(file => re.test(file)); if (target) { readFiles[target] = readFiles[target] || readFile(target); readFiles[target] = fn(readFiles[target]); } return files; }); return chain; }, dest: (target: string, base: string) => { newLocation = target; newLocationBase = base; return chain; }, // runs all the activities (used mainly for testing) exec: async () => runActivities(), // filters out unwanted files // accepts function and a regexp filter: input => { activities.push((files: Array<string>) => { const filtered = files.filter(file => { if (typeof input === 'function') { return !!input(file); } else if (input && typeof input.test === 'function') { return input.test(file); } return true; }); return filtered; }); return chain; }, tsc: (options?: TscOptions) => { activities.push(async (files: Array<string>) => { await tsc({ files: files, ...options }); }); return chain; }, write: () => { activities.push(async (files: Array<string>) => { const _ = []; for (const file in readFiles) { _.push(writeFile(file, readFiles[file])); } return Promise.all(_).then(() => { return files; }); }); return chain; }, }; return chain; } ```
/content/code_sandbox/src/sparky/sparky_chain.ts
xml
2016-10-28T10:37:16
2024-07-27T15:17:43
fuse-box
fuse-box/fuse-box
4,003
1,135
```xml import { erxesSubdomainHeaderName } from '@erxes/api-utils/src/headers'; import getHostnameZeroTrust from '@erxes/api-utils/src/headers/get-hostname'; import { IncomingMessage } from 'http'; export const getSubdomain = (req: IncomingMessage): string => { let hostname = req.headers['nginx-hostname'] || getHostnameZeroTrust(req); if (!hostname) { throw new Error('Hostname not found'); } if (Array.isArray(hostname)) { hostname = hostname[0]; } const subdomain = hostname.replace(/(^\w+:|^)\/\//, '').split('.')[0]; return subdomain; }; export const setSubdomainHeader = (req: IncomingMessage): void => { const subdomain = getSubdomain(req); req.headers[erxesSubdomainHeaderName] = subdomain; }; ```
/content/code_sandbox/packages/gateway/src/util/subdomain.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
185
```xml /* eslint-disable @typescript-eslint/no-explicit-any */ import { useCallback } from 'react'; import { Vote } from '@prisma/client'; import { trpc } from '../../trpc'; type UseVoteOptions = { setDownVote: () => void; setNoVote: () => void; setUpVote: () => void; }; type BackendVote = { id: string; vote: Vote; }; const createVoteCallbacks = ( vote: BackendVote | null, opts: UseVoteOptions, ) => { const { setDownVote, setNoVote, setUpVote } = opts; const handleUpvote = () => { // Either upvote or remove upvote if (vote && vote.vote === 'UPVOTE') { setNoVote(); } else { setUpVote(); } }; const handleDownvote = () => { // Either downvote or remove downvote if (vote && vote.vote === 'DOWNVOTE') { setNoVote(); } else { setDownVote(); } }; return { handleDownvote, handleUpvote }; }; type MutationKey = Parameters<typeof trpc.useMutation>[0]; type QueryKey = Parameters<typeof trpc.useQuery>[0][0]; const getVoteValue = (vote: Vote | null) => { if (vote === Vote.UPVOTE) { return 1; } if (vote === Vote.DOWNVOTE) { return -1; } return 0; }; type RevertFunction = () => void; type InvalidateFunction = (voteValueChange: number) => Promise<RevertFunction>; type VoteProps<VoteQueryKey extends QueryKey = QueryKey> = { idKey: string; invalidateKeys: Array<QueryKey>; onMutate?: InvalidateFunction; query: VoteQueryKey; setDownVoteKey: MutationKey; setNoVoteKey: MutationKey; setUpVoteKey: MutationKey; }; type UseVoteMutationContext = { currentData: any; previousData: any; revert: RevertFunction | undefined; }; export default function useVote<VoteQueryKey extends QueryKey = QueryKey>( id: string, opts: VoteProps<VoteQueryKey>, ) { const { idKey, invalidateKeys, onMutate, query, setDownVoteKey, setNoVoteKey, setUpVoteKey, } = opts; const utils = trpc.useContext(); const onVoteUpdateSettled = useCallback(() => { // TODO: Optimise query invalidation // utils.invalidateQueries([query, { [idKey]: id } as any]); for (const invalidateKey of invalidateKeys) { utils.invalidateQueries(invalidateKey); // If (invalidateFunction === null) { // utils.invalidateQueries([invalidateKey as QueryKey]); // } else { // invalidateFunction(utils, previousVote, currentVote); // } } }, [utils, invalidateKeys]); const { data } = trpc.useQuery([ query, { [idKey]: id, }, ] as any); const backendVote = data as BackendVote; const { mutate: setUpVote } = trpc.useMutation<any, UseVoteMutationContext>( setUpVoteKey, { onError: (_error, _variables, context) => { if (context !== undefined) { utils.setQueryData([query], context.previousData); context.revert?.(); } }, onMutate: async (vote) => { await utils.queryClient.cancelQueries([query, { [idKey]: id } as any]); const previousData = utils.queryClient.getQueryData<BackendVote | null>( [query, { [idKey]: id } as any], ); const currentData = { ...(vote as any), vote: Vote.UPVOTE, } as BackendVote; utils.setQueryData( [ query, { [idKey]: id, } as any, ], currentData as any, ); const voteValueChange = getVoteValue(currentData?.vote ?? null) - getVoteValue(previousData?.vote ?? null); const revert = await onMutate?.(voteValueChange); return { currentData, previousData, revert }; }, onSettled: onVoteUpdateSettled, }, ); const { mutate: setDownVote } = trpc.useMutation<any, UseVoteMutationContext>( setDownVoteKey, { onError: (_error, _variables, context) => { if (context !== undefined) { utils.setQueryData([query], context.previousData); context.revert?.(); } }, onMutate: async (vote) => { await utils.queryClient.cancelQueries([query, { [idKey]: id } as any]); const previousData = utils.queryClient.getQueryData<BackendVote | null>( [query, { [idKey]: id } as any], ); const currentData = { ...vote, vote: Vote.DOWNVOTE, } as BackendVote; utils.setQueryData( [ query, { [idKey]: id, } as any, ], currentData as any, ); const voteValueChange = getVoteValue(currentData?.vote ?? null) - getVoteValue(previousData?.vote ?? null); const revert = await onMutate?.(voteValueChange); return { currentData, previousData, revert }; }, onSettled: onVoteUpdateSettled, }, ); const { mutate: setNoVote } = trpc.useMutation<any, UseVoteMutationContext>( setNoVoteKey, { onError: (_error, _variables, context) => { if (context !== undefined) { utils.setQueryData([query], context.previousData); context.revert?.(); } }, onMutate: async () => { await utils.queryClient.cancelQueries([query, { [idKey]: id } as any]); const previousData = utils.queryClient.getQueryData<BackendVote | null>( [query, { [idKey]: id } as any], ); const currentData: BackendVote | null = null; utils.queryClient.setQueryData<BackendVote | null>( [ query, { [idKey]: id, } as any, ], currentData, ); const voteValueChange = getVoteValue(null) - getVoteValue(previousData?.vote ?? null); const revert = await onMutate?.(voteValueChange); return { currentData, previousData, revert }; }, onSettled: onVoteUpdateSettled, }, ); const { handleDownvote, handleUpvote } = createVoteCallbacks( backendVote ?? null, { setDownVote: () => { setDownVote({ [idKey]: id, }); }, setNoVote: () => { setNoVote({ [idKey]: id, }); }, setUpVote: () => { setUpVote({ [idKey]: id, }); }, }, ); return { handleDownvote, handleUpvote, vote: backendVote ?? null }; } ```
/content/code_sandbox/apps/portal/src/utils/questions/vote/useVote.ts
xml
2016-07-05T05:00:48
2024-08-16T19:01:19
tech-interview-handbook
yangshun/tech-interview-handbook
115,302
1,599
```xml /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { I18NService } from '@core'; import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; import { NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; import { Resources } from '../../../../entity/Resources'; import { ResourcesService } from '../../../../service/resources.service'; @Component({ selector: 'app-resource-editer', templateUrl: './resource-editer.component.html', styles: [ ` nz-form-item, nz-tabset { width: 90%; } ` ], styleUrls: ['./resource-editer.component.less'] }) export class ResourceEditerComponent implements OnInit { @Input() id?: String; @Input() appId?: String; @Input() appName?: String; @Input() parentNode?: NzTreeNode; @Input() isEdit?: boolean; form: { submitting: boolean; model: Resources; } = { submitting: false, model: new Resources() }; formGroup: FormGroup = new FormGroup({}); constructor( private modalRef: NzModalRef, private resourcesService: ResourcesService, private fb: FormBuilder, private msg: NzMessageService, @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) {} ngOnInit(): void { if (this.isEdit) { this.resourcesService.get(`${this.id}`).subscribe(res => { this.form.model.init(res.data); this.cdr.detectChanges(); }); } else { if (this.parentNode) { this.form.model.appId = this.appId || ''; this.form.model.appName = this.appName || ''; this.form.model.parentId = this.parentNode?.key; this.form.model.parentName = this.parentNode?.title; } } } onClose(e: MouseEvent): void { e.preventDefault(); this.modalRef.destroy({ refresh: false }); } onSubmit(e: MouseEvent): void { e.preventDefault(); this.form.submitting = true; this.form.model.trans(); (this.isEdit ? this.resourcesService.update(this.form.model) : this.resourcesService.add(this.form.model)).subscribe(res => { if (res.code == 0) { this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); this.cdr.detectChanges(); }); } } ```
/content/code_sandbox/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resource-editer/resource-editer.component.ts
xml
2016-11-16T03:06:50
2024-08-16T09:22:42
MaxKey
dromara/MaxKey
1,423
697
```xml <?xml version="1.0" encoding="utf-8"?> <model xmlns="smlif.xsd"> <_locDefinition xmlns="urn:locstudio"> <_locDefault _loc="locNone" /> <_locTag _loc="locData">DMF:Name</_locTag> <_locTag _loc="locData">DMF:Description</_locTag> <_locTag _loc="locData">DMF:Condition</_locTag> <_locTag _loc="locData">DMF:ObjectSet</_locTag> <_locTag _loc="locData">DMF:RootCondition</_locTag> <_locTag _loc="locData">DMF:PolicyCategory</_locTag> <_locTag _loc="locData">DMF:HelpText</_locTag> </_locDefinition> <identity> <name>urn:uuid:96fe1236-abf6-4a57-b54d-e9baab394fd1</name> <baseURI>path_to_url </identity> <xs:bufferSchema xmlns:xs="path_to_url"> <definitions xmlns:sfc="path_to_url"> <document> <docinfo> <aliases> <alias>/system/schema/DMF</alias> </aliases> <sfc:version DomainVersion="3" /> </docinfo> <data> <xs:schema targetNamespace="path_to_url" xmlns:sfc="path_to_url" xmlns:sml="sml.xsd" xmlns:xs="path_to_url" elementFormDefault="qualified"> <xs:element name="Policy"> <xs:complexType> <xs:sequence> <xs:any namespace="path_to_url" processContents="skip" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ObjectSet"> <xs:complexType> <xs:sequence> <xs:any namespace="path_to_url" processContents="skip" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Condition"> <xs:complexType> <xs:sequence> <xs:any namespace="path_to_url" processContents="skip" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="PolicyCategory"> <xs:complexType> <xs:sequence> <xs:any namespace="path_to_url" processContents="skip" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="TargetSet"> <xs:complexType> <xs:sequence> <xs:any namespace="path_to_url" processContents="skip" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> <DMF:bufferData xmlns:DMF="path_to_url"> <instances xmlns:sfc="path_to_url"> <document> <docinfo> <aliases> <alias>/PolicyStore/Policy/SQL Server Blocked Process Threshold</alias> </aliases> <sfc:version DomainVersion="3" /> </docinfo> <data> <DMF:Policy xmlns:DMF="path_to_url" xmlns:sfc="path_to_url" xmlns:sml="sml.xsd" xmlns:xs="path_to_url"> <DMF:Parent> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore</sml:Uri> </sfc:Reference> </DMF:Parent> <DMF:PolicyCondition> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore/Condition/Blocked Process Threshold Optimized</sml:Uri> </sfc:Reference> </DMF:PolicyCondition> <DMF:PolicyObjectSet> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore/ObjectSet/SQL Server Blocked Process Threshold__ObjectSet</sml:Uri> </sfc:Reference> </DMF:PolicyObjectSet> <DMF:PolicyRootCondition> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore/Condition/SQL Server 2005 or a Later Version</sml:Uri> </sfc:Reference> </DMF:PolicyRootCondition> <DMF:PolicyPolicyCategory> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore/PolicyCategory/Microsoft Best Practices_b Performance</sml:Uri> </sfc:Reference> </DMF:PolicyPolicyCategory> <DMF:Name type="string">SQL Server Blocked Process Threshold</DMF:Name> <DMF:Description type="string">Checks whether the blocked process threshold option is set lower than 5 and is not disabled (0). Setting the blocked process threshold option to a value from 1 to 4 can cause the deadlock monitor to run constantly. Values 1 to 4 should only be used for troubleshooting and never long term or in a production environment without the assistance of Microsoft Customer Service and Support.</DMF:Description> <DMF:Condition type="string">Blocked Process Threshold Optimized</DMF:Condition> <DMF:ObjectSet type="string">SQL Server Blocked Process Threshold_ObjectSet</DMF:ObjectSet> <DMF:RootCondition type="string">SQL Server 2005 or a Later Version</DMF:RootCondition> <DMF:PolicyCategory type="string">Microsoft Best Practices: Performance</DMF:PolicyCategory> <DMF:Enabled type="boolean">false</DMF:Enabled> <DMF:AutomatedPolicyEvaluationMode type="AutomatedPolicyEvaluationMode">None</DMF:AutomatedPolicyEvaluationMode> <DMF:HelpText type="string" /> <DMF:HelpLink type="string">path_to_url <DMF:ActiveEndDate type="dateTime">0001-01-01T00:00:00</DMF:ActiveEndDate> <DMF:ActiveStartDate type="dateTime">0001-01-01T00:00:00</DMF:ActiveStartDate> </DMF:Policy> </data> </document> <document> <docinfo> <aliases> <alias>/PolicyStore/ObjectSet/SQL Server Blocked Process Threshold__ObjectSet</alias> </aliases> <sfc:version DomainVersion="3" /> </docinfo> <data> <DMF:ObjectSet xmlns:DMF="path_to_url" xmlns:sfc="path_to_url" xmlns:sml="sml.xsd" xmlns:xs="path_to_url"> <DMF:TargetSets> <sfc:Collection> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore/ObjectSet/SQL Server Blocked Process Threshold__ObjectSet/TargetSet/Server</sml:Uri> </sfc:Reference> </sfc:Collection> </DMF:TargetSets> <DMF:Parent> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore</sml:Uri> </sfc:Reference> </DMF:Parent> <DMF:Name type="string">SQL Server Blocked Process Threshold_ObjectSet</DMF:Name> <DMF:Facet type="string">IServerPerformanceFacet</DMF:Facet> </DMF:ObjectSet> </data> </document> <document> <docinfo> <aliases> <alias>/PolicyStore/Condition/Blocked Process Threshold Optimized</alias> </aliases> <sfc:version DomainVersion="3" /> </docinfo> <data> <DMF:Condition xmlns:DMF="path_to_url" xmlns:sfc="path_to_url" xmlns:sml="sml.xsd" xmlns:xs="path_to_url"> <DMF:Parent> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore</sml:Uri> </sfc:Reference> </DMF:Parent> <DMF:Expression type="string"> &lt;Operator&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Bool&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;OpType&gt;OR&lt;/OpType&gt;&lt;?char 13?&gt; &lt;Count&gt;2&lt;/Count&gt;&lt;?char 13?&gt; &lt;Operator&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Bool&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;OpType&gt;GE&lt;/OpType&gt;&lt;?char 13?&gt; &lt;Count&gt;2&lt;/Count&gt;&lt;?char 13?&gt; &lt;Attribute&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Numeric&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;Name&gt;BlockedProcessThreshold&lt;/Name&gt;&lt;?char 13?&gt; &lt;/Attribute&gt;&lt;?char 13?&gt; &lt;Constant&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Numeric&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;ObjType&gt;System.Int32&lt;/ObjType&gt;&lt;?char 13?&gt; &lt;Value&gt;5&lt;/Value&gt;&lt;?char 13?&gt; &lt;/Constant&gt;&lt;?char 13?&gt; &lt;/Operator&gt;&lt;?char 13?&gt; &lt;Operator&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Bool&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;OpType&gt;EQ&lt;/OpType&gt;&lt;?char 13?&gt; &lt;Count&gt;2&lt;/Count&gt;&lt;?char 13?&gt; &lt;Attribute&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Numeric&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;Name&gt;BlockedProcessThreshold&lt;/Name&gt;&lt;?char 13?&gt; &lt;/Attribute&gt;&lt;?char 13?&gt; &lt;Constant&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Numeric&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;ObjType&gt;System.Int32&lt;/ObjType&gt;&lt;?char 13?&gt; &lt;Value&gt;0&lt;/Value&gt;&lt;?char 13?&gt; &lt;/Constant&gt;&lt;?char 13?&gt; &lt;/Operator&gt;&lt;?char 13?&gt; &lt;/Operator&gt; </DMF:Expression> <DMF:Name type="string">Blocked Process Threshold Optimized</DMF:Name> <DMF:Description type="string">Confirms that the blocked process threshold property is set higher than 4, or is disabled (0).</DMF:Description> <DMF:Facet type="string">IServerPerformanceFacet</DMF:Facet> </DMF:Condition> </data> </document> <document> <docinfo> <aliases> <alias>/PolicyStore/Condition/SQL Server 2005 or a Later Version</alias> </aliases> <sfc:version DomainVersion="3" /> </docinfo> <data> <DMF:Condition xmlns:DMF="path_to_url" xmlns:sfc="path_to_url" xmlns:sml="sml.xsd" xmlns:xs="path_to_url"> <DMF:Parent> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore</sml:Uri> </sfc:Reference> </DMF:Parent> <DMF:Expression type="string"> &lt;Operator&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Bool&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;OpType&gt;GE&lt;/OpType&gt;&lt;?char 13?&gt; &lt;Count&gt;2&lt;/Count&gt;&lt;?char 13?&gt; &lt;Attribute&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Numeric&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;Name&gt;VersionMajor&lt;/Name&gt;&lt;?char 13?&gt; &lt;/Attribute&gt;&lt;?char 13?&gt; &lt;Constant&gt;&lt;?char 13?&gt; &lt;TypeClass&gt;Numeric&lt;/TypeClass&gt;&lt;?char 13?&gt; &lt;ObjType&gt;System.Int32&lt;/ObjType&gt;&lt;?char 13?&gt; &lt;Value&gt;9&lt;/Value&gt;&lt;?char 13?&gt; &lt;/Constant&gt;&lt;?char 13?&gt; &lt;/Operator&gt; </DMF:Expression> <DMF:Name type="string">SQL Server 2005 or a Later Version</DMF:Name> <DMF:Description type="string">Confirms that the version of SQL Server is 2005 or a later version.</DMF:Description> <DMF:Facet type="string">Server</DMF:Facet> </DMF:Condition> </data> </document> <document> <docinfo> <aliases> <alias>/PolicyStore/PolicyCategory/Microsoft Best Practices_b Performance</alias> </aliases> <sfc:version DomainVersion="3" /> </docinfo> <data> <DMF:PolicyCategory xmlns:DMF="path_to_url" xmlns:sfc="path_to_url" xmlns:sml="sml.xsd" xmlns:xs="path_to_url"> <DMF:Parent> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore</sml:Uri> </sfc:Reference> </DMF:Parent> <DMF:Name type="string">Microsoft Best Practices: Performance</DMF:Name> </DMF:PolicyCategory> </data> </document> <document> <docinfo> <aliases> <alias>/PolicyStore/ObjectSet/SQL Server Blocked Process Threshold__ObjectSet/TargetSet/Server</alias> </aliases> <sfc:version DomainVersion="3" /> </docinfo> <data> <DMF:TargetSet xmlns:DMF="path_to_url" xmlns:sfc="path_to_url" xmlns:sml="sml.xsd" xmlns:xs="path_to_url"> <DMF:Parent> <sfc:Reference sml:ref="true"> <sml:Uri>/PolicyStore/ObjectSet/SQL Server Blocked Process Threshold__ObjectSet</sml:Uri> </sfc:Reference> </DMF:Parent> <DMF:TargetTypeSkeleton type="string">Server</DMF:TargetTypeSkeleton> <DMF:Enabled type="boolean">true</DMF:Enabled> </DMF:TargetSet> </data> </document> </instances> </DMF:bufferData> </xs:schema> </data> </document> </definitions> </xs:bufferSchema> </model> ```
/content/code_sandbox/samples/features/epm-framework/sample-policies/SQL Server Blocked Process Threshold.xml
xml
2016-03-11T21:42:56
2024-08-16T09:31:00
sql-server-samples
microsoft/sql-server-samples
9,855
3,695
```xml <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0"> <Import Project="..\..\PowerShell.Common.props" /> <PropertyGroup> <Description>Assembly containing WPF code for Out-GridView, HelpWindow, and Show-Command</Description> <NoWarn>$(NoWarn);CS1570</NoWarn> <RootNamespace>Microsoft.Management.UI.Internal</RootNamespace> <AssemblyName>Microsoft.PowerShell.GraphicalHost</AssemblyName> <RunAnalyzers>false</RunAnalyzers> <TargetPlatformIdentifier>Windows</TargetPlatformIdentifier> <TargetPlatformVersion>8.0</TargetPlatformVersion> <UseWindowsForms>true</UseWindowsForms> <UseWPF>True</UseWPF> </PropertyGroup> <PropertyGroup> <DefineConstants>$(DefineConstants);CORECLR</DefineConstants> </PropertyGroup> <ItemGroup> <Resource Include="resources\Graphics\Add16.png" /> <Resource Include="resources\Graphics\CloseTile16.png" /> <Resource Include="resources\Graphics\Delete16.png" /> <Resource Include="resources\Graphics\down.ico" /> <Resource Include="resources\Graphics\Error16.png" /> <Resource Include="resources\Graphics\Help.ico" /> <Resource Include="resources\Graphics\Rename16.png" /> <Resource Include="resources\Graphics\Save16.png" /> <Resource Include="resources\Graphics\SortAdornerAscending.png" /> <Resource Include="resources\Graphics\SortAdornerDescending.png" /> <Resource Include="resources\Graphics\SpyGlass10.png" /> <Resource Include="resources\Graphics\SpyGlass16.png" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" /> <ProjectReference Include="..\Microsoft.PowerShell.Commands.Utility\Microsoft.PowerShell.Commands.Utility.csproj" /> </ItemGroup> </Project> ```
/content/code_sandbox/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj
xml
2016-01-13T23:41:35
2024-08-16T19:59:07
PowerShell
PowerShell/PowerShell
44,388
429
```xml import { BoardHeader } from '@erxes/ui-cards/src/settings/boards/styles'; import { __, ControlLabel, FormGroup } from '@erxes/ui/src'; import { IUser, UsersQueryResponse } from '@erxes/ui/src/auth/types'; import Table from '@erxes/ui/src/components/table'; import { FlexContent, FlexItem } from '@erxes/ui/src/layout/styles'; import dayjs from 'dayjs'; import React from 'react'; import { IGoalType } from '../types'; type Props = { goalType: IGoalType; // Adjust the type of goalTypes as per your boardName: string; pipelineName: string; stageName: string; usersQuery: UsersQueryResponse; emailName: string; _id: string; users: IUser[]; }; const GoalView = (props: Props) => { const { goalType: data, boardName, pipelineName, stageName, emailName, } = props; const nestedProgressValue = data.progress.progress; const current = data.progress.current; return ( <div> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}>Monthly:</span>{' '} {__(' ' + data.entity + ', ' + emailName)} </ControlLabel> <FlexContent> <FlexItem> <BoardHeader> <FormGroup> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> Contributor: </span>{' '} {__(' ' + data.contribution)} </ControlLabel> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> Goal Type: </span>{' '} {__(' ' + data.goalTypeChoose)} </ControlLabel> <FormGroup> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> Board: </span>{' '} {boardName} </ControlLabel> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> Pipeline: </span>{' '} {pipelineName} </ControlLabel> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> Stage: </span>{' '} {stageName} </ControlLabel> </FormGroup> </FormGroup> </BoardHeader> </FlexItem> <FlexItem> <FormGroup> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> Duration: </span>{' '} {dayjs(data.startDate).format('YYYY-MM-DD ')}-{' '} {dayjs(data.endDate).format('YYYY-MM-DD ')} </ControlLabel> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Current:')} </span>{' '} {current} </ControlLabel> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Target:')} </span>{' '} {data.target} </ControlLabel> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Progress:')} </span>{' '} {nestedProgressValue}% </ControlLabel> </FormGroup> </FlexItem> </FlexContent> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Month')} </span>{' '} {data.entity} </ControlLabel> <FlexContent> <FlexItem> <BoardHeader> <FormGroup> <ControlLabel> {__( data.entity + ' progressed: ' + pipelineName + ', ' + stageName, )} </ControlLabel> </FormGroup> </BoardHeader> </FlexItem> </FlexContent> <FlexContent> <FlexItem> <BoardHeader> <FormGroup> <ControlLabel> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Segment:')} </span>{' '} {data.segmentCount} </ControlLabel> </FormGroup> </BoardHeader> </FlexItem> </FlexContent> <FlexContent> <FlexItem> <BoardHeader> <Table> <thead> <tr> <th> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Target')} </span> </th> <th> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Current')} </span> </th> <th> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('progress(%)')} </span> </th> <th> <span style={{ fontWeight: 'bold', color: 'black' }}> {__('Month')} </span> </th> </tr> </thead> <tbody> {data.specificPeriodGoals.map((element, index) => ( <tr key={index}> <td>{element.addTarget}</td> <td>{current}</td> <td>{element.progress + '%'}</td> <td>{element.addMonthly}</td> </tr> ))} </tbody> </Table> </BoardHeader> </FlexItem> </FlexContent> </div> ); }; export default GoalView; ```
/content/code_sandbox/packages/plugin-goals-ui/src/components/goalView.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
1,226
```xml declare interface IImageMagnifierWebPartStrings { PropertyPaneDescription: string; BasicGroupName: string; DescriptionFieldLabel: string; SmallImgUrlFieldLabel: string, SmallImgWidthFieldLabel: string, SmallImgHeightFieldLabel: string, LargeImgUrlFieldLabel: string, LargeImgWidthFieldLabel: string, LargeImgHeightFieldLabel: string, CursorOffsetXFieldLabel: string, CursorOffsetYFieldLabel: string, SizeFieldLabel: string, } declare module 'ImageMagnifierWebPartStrings' { const strings: IImageMagnifierWebPartStrings; export = strings; } ```
/content/code_sandbox/samples/react-image-magnifier/src/webparts/imageMagnifier/loc/mystrings.d.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
140
```xml import { describe, expect, it } from "vitest"; import { Formatter } from "@export/formatter"; import { MathRun } from "../math-run"; import { MathFunction } from "./math-function"; describe("MathFunction", () => { describe("#constructor()", () => { it("should create a MathFunction with correct root key", () => { const mathFunction = new MathFunction({ name: [new MathRun("sin")], children: [new MathRun("60")], }); const tree = new Formatter().format(mathFunction); expect(tree).to.deep.equal({ "m:func": [ { "m:funcPr": {}, }, { "m:fName": [ { "m:r": [ { "m:t": ["sin"], }, ], }, ], }, { "m:e": [ { "m:r": [ { "m:t": ["60"], }, ], }, ], }, ], }); }); }); }); ```
/content/code_sandbox/src/file/paragraph/math/function/math-function.spec.ts
xml
2016-03-26T23:43:56
2024-08-16T13:02:47
docx
dolanmiu/docx
4,139
229
```xml import * as React from 'react'; import { getTriggerChild } from './getTriggerChild'; import type { FluentTriggerComponent } from './types'; const TestTrigger: React.FC<{ id?: string }> & FluentTriggerComponent = props => <>{props.children}</>; TestTrigger.displayName = 'TestTrigger'; TestTrigger.isFluentTriggerComponent = true; describe('getTriggerChild', () => { const child: React.ReactElement = <div>This is a valid React element</div>; it('returns the child if a valid element is sent as the child', () => { expect(getTriggerChild(child)).toBe(child); }); it('returns null if a non-valid element is sent as the child', () => { const nonValid = () => child; expect(getTriggerChild(nonValid)).toBe(null); }); it('returns the child of a trigger', () => { const trigger = <TestTrigger>{child}</TestTrigger>; expect(getTriggerChild(trigger)).toBe(child); }); it('returns the nested child of multiple layers of triggers', () => { const nestedTriggers = ( <TestTrigger> <TestTrigger> <TestTrigger>{child}</TestTrigger> </TestTrigger> </TestTrigger> ); expect(getTriggerChild(nestedTriggers)).toBe(child); }); }); ```
/content/code_sandbox/packages/react-components/react-utilities/src/trigger/getTriggerChild.test.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
283
```xml import * as React from 'react'; import styles from './../SharedStyles.module.scss'; import { IList } from './../interfaces'; import { ServiceScope } from '@microsoft/sp-core-library'; import { IListsService, ListsService } from './../services'; import * as strings from 'CopyViewsSharedStrings'; import { Stack } from 'office-ui-fabric-react/lib/Stack'; import { Label } from 'office-ui-fabric-react/lib/Label'; import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox'; import { BaseType } from '../enums'; interface ITargetListPickerProps { serviceScope: ServiceScope; baseType?: BaseType; exclude?: IList; searchTerm?: string; resultSourceId?: string; onChange: (lists?:IList[]) => void; onError: (error: Error) => void; } interface ITargetListPickerState { foundLists?: IList[]; selectedLists: IList[]; loading: boolean; error?: boolean; } export class TargetListPicker extends React.Component<ITargetListPickerProps, ITargetListPickerState> { private _listsService: IListsService; public constructor(props: ITargetListPickerProps) { super(props); this._listsService = props.serviceScope.consume(ListsService.serviceKey); this.state = { loading: false, selectedLists: [] } } public componentDidUpdate(prevProps: Readonly<ITargetListPickerProps>): void { if (this.props.baseType !== undefined) { if (prevProps.searchTerm !== this.props.searchTerm || (prevProps.baseType !== this.props.baseType) || (prevProps.exclude !== this.props.exclude)) { if (prevProps.baseType !== this.props.baseType) { this.setState({ selectedLists: []}, () => { this._searchLists(); }); } else { this._searchLists(); } } } } public render(): React.ReactElement<ITargetListPickerProps> { const { baseType } = this.props; const { foundLists, selectedLists, loading } = this.state; const hiddenSelectedLists = selectedLists?.filter(sl => foundLists.every(fl => fl.uniqueKey !== sl.uniqueKey)); const disabled = baseType === undefined; return <div> <Label>{strings.SelectListsToCopyViewsTo} {foundLists ? `(${foundLists.length})` : ''}</Label> <div className={styles.checkboxSelectionContainer}> { !disabled && <> { hiddenSelectedLists.length > 0 && <Stack style={{ marginBottom: 5}} tokens={{ childrenGap: 5 }} id="SelectedLists"> { hiddenSelectedLists.map((list) => <><Checkbox key={list.uniqueKey} label={list.title} defaultChecked={true} id={list.uniqueKey} /></>) } </Stack> } { foundLists?.length > 0 ? <> <Stack tokens={{ childrenGap: 5 }} id="FoundLists"> { foundLists?.map((list) => <><Checkbox key={list.uniqueKey} label={list.title} id={list.uniqueKey} defaultChecked={selectedLists.some(sl => sl.uniqueKey === list.uniqueKey)} onChange={this._onChangeListSelected} /></>) } </Stack> </> : <em>{!loading && strings.NoListsFound}</em> } </> } </div> </div>; } private _onChangeListSelected = (ev?: React.FormEvent<HTMLElement | HTMLInputElement>, checked?: boolean): void => { const { foundLists, selectedLists } = this.state; const uniqueKey = ev.currentTarget.id; const list = foundLists.filter(l => l.uniqueKey === uniqueKey)[0]; const lists = selectedLists.filter(l => l.uniqueKey !== uniqueKey); if (checked) { lists.push(list); } this.setState({ selectedLists: lists }, () => { this.props.onChange(lists); }); } private _searchLists = (): void => { const { searchTerm, resultSourceId, baseType, exclude } = this.props; const { error } = this.state; if (error) { this.props.onError(undefined); } this.setState({ loading: true, error: undefined }); this._listsService.search(baseType, searchTerm, resultSourceId).then(foundLists => { this.setState({ loading: false, foundLists: foundLists.filter(l => l.uniqueKey !== exclude.uniqueKey) }); }, (error) => { this.setState({ error }); this.props.onError(error); }); } } ```
/content/code_sandbox/samples/react-copy-views/src/shared/components/TargetListPicker.tsx
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
1,008
```xml import { ActivityDate, FlexBody, FlexCenterContent } from '@erxes/ui-log/src/activityLogs/styles'; import { IActivityLogItemProps } from '@erxes/ui-log/src/activityLogs/types'; import { Link } from 'react-router-dom'; import React from 'react'; import Tip from '@erxes/ui/src/components/Tip'; import dayjs from 'dayjs'; import { renderUserFullName } from '@erxes/ui/src/utils'; class AssigneeLog extends React.Component<IActivityLogItemProps> { renderContent = () => { const { activity } = this.props; const { contentDetail, createdByDetail } = activity; let userName = 'Unknown'; if (createdByDetail && createdByDetail.type === 'user') { const { content } = createdByDetail; if (content && content.details) { userName = renderUserFullName(createdByDetail.content); } } const { addedUsers = [], removedUsers = [] } = contentDetail; const addedUserNames = addedUsers.map(user => { return ( <Link to={`/settings/team/details/${user._id}`} target="_blank" key={Math.random()} > &nbsp;{user.details.fullName || user.email}&nbsp; </Link> ); }); const removedUserNames = removedUsers.map(user => { return ( <Link to={`/settings/team/details/${user._id}`} target="_blank" key={Math.random()} > &nbsp;{user.details.fullName || user.email}&nbsp; </Link> ); }); if (addedUserNames.length > 0 && removedUserNames.length === 0) { return ( <span> {userName} assigned {addedUserNames} </span> ); } if (removedUserNames && !addedUserNames) { return ( <span> {userName} removed assignee of {removedUserNames} </span> ); } return ( <span> {userName} removed assignee of {removedUserNames} </span> ); }; render() { const { createdAt } = this.props.activity; return ( <FlexCenterContent> <FlexBody>{this.renderContent()}</FlexBody> <Tip text={dayjs(createdAt).format('llll')}> <ActivityDate> {dayjs(createdAt).format('MMM D, h:mm A')} </ActivityDate> </Tip> </FlexCenterContent> ); } } export default AssigneeLog; ```
/content/code_sandbox/packages/ui-log/src/components/items/boardItems/AssigneeLog.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
556
```xml import { AllRenderTypes, ScenarioRenderTypes } from '@fluentui/scripts-tasks'; /** * You don't have to add scenarios to this structure unless * you want their render types to differ from the default (mount only). * * Note: * You should not need to have virtual-rerender tests in most cases because mount test provides enough coverage. * It is mostly usefual for cases where component has memoization logics. And in case of re-rendering, * memoization logic help avoid certain code paths. */ export const scenarioRenderTypes: ScenarioRenderTypes = { FluentProviderWithTheme: AllRenderTypes, }; ```
/content/code_sandbox/apps/perf-test-react-components/config/perf-test/scenarioRenderTypes.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
133
```xml export const getZoneIdFromLocation = ( map: maplibregl.Map, coordinates: [number, number], zoneSource: string ) => { const point = map.project(coordinates); // Query a larger area around the point const buffer = 1; const features = map.queryRenderedFeatures( [ [point.x - buffer, point.y - buffer], [point.x + buffer, point.y + buffer], ], { layers: ['zones-clickable-layer'], } ); return features.find((feature) => feature.source === zoneSource); }; ```
/content/code_sandbox/web/src/features/map/map-utils/getZoneIdFromLocation.ts
xml
2016-05-21T16:36:17
2024-08-16T17:56:07
electricitymaps-contrib
electricitymaps/electricitymaps-contrib
3,437
129
```xml <vector xmlns:android="path_to_url" android:width="128dp" android:height="128dp" android:viewportWidth="128.0" android:viewportHeight="128.0"> <path android:pathData="m119.44,95.97c-17.67,30.61 -56.82,41.1 -87.43,23.43 -30.61,-17.67 -41.1,-56.82 -23.43,-87.43 17.67,-30.61 56.82,-41.1 87.43,-23.43 30.61,17.67 41.1,56.82 23.43,87.43" android:fillColor="#ffdd55"/> <path android:pathData="m54.56,4.75 l-2.97,5.14 8.66,5 -6,10.39 -8.66,-5 -8,13.86 8.66,5 -6,10.39 -8.66,-5 -8,13.86 8.66,5 -6,10.39 -8.66,-5 -8,13.86 8.66,5 -6,10.39 52.61,29.19 5.35,-9.58 8.66,5 8,-13.86 -8.66,-5 6,-10.39 8.66,5 8,-13.86 -8.66,-5 6,-10.39 8.66,5 8,-13.86 -8.66,-5 6,-10.39 8.66,5 3.76,-6.38c-14.25,-26.65 -41.77,-42.97 -70.07,-38.76zM70.65,20.89 L101.83,38.89 95.83,49.28 64.65,31.28zM56.65,45.14 L87.83,63.14 81.83,73.53 50.65,55.53zM42.65,69.38 L73.83,87.38 67.83,97.78 36.65,79.78zM28.65,93.63 L59.83,111.63 53.83,122.02 22.65,104.02z" android:fillAlpha="0.2" android:fillColor="#000"/> <path android:pathData="m5.85,90.32c0.87,1.92 1.84,3.82 2.91,5.69 12.98,22.48 37.54,34.09 61.8,31.68z" android:fillColor="#a07a53"/> <path android:pathData="M17.6,64.78l69.28,40l-8,13.86l-69.28,-40z" android:fillColor="#a07a53"/> <path android:pathData="M31.6,40.53l69.28,40l-8,13.86l-69.28,-40z" android:fillColor="#a07a53"/> <path android:pathData="M45.6,16.28l69.28,40l-8,13.86l-69.28,-40z" android:fillColor="#a07a53"/> <path android:pathData="m75.04,0.94c-6.71,-1.16 -13.62,-1.24 -20.47,-0.2l-2.97,5.14 69.28,40 2.96,-5.12c-1.16,-2.98 -2.56,-5.9 -4.21,-8.75 -1.85,-3.2 -3.95,-6.17 -6.23,-8.93z" android:fillColor="#a07a53"/> <path android:pathData="m79.31,1.89c-4.02,-1.1 -8.29,-1.7 -12.79,-1.84l-56.57,97.99c2.62,4.35 5.71,7.77 7.99,10.17z" android:fillColor="#bbb"/> <path android:pathData="m118.46,30.08c-2.48,-4.08 -5.19,-7.25 -7.93,-10.26l-61.42,106.39c3.49,0.79 7.3,1.6 12.83,1.78z" android:fillColor="#bbb"/> <path android:pathData="m79.34,1.83c-1.4,-0.32 -2.75,-0.63 -4.12,-0.86l-60.12,104.14c0.92,1.03 1.7,2.04 2.81,3.13z" android:fillColor="#999"/> <path android:pathData="m118.46,30.08c-0.76,-1.34 -1.64,-2.49 -2.49,-3.68L57.5,127.65c1.4,0.14 2.66,0.33 4.43,0.34z" android:fillColor="#999"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_quest_railway.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
1,253
```xml import { fireEvent, render, screen, waitFor, waitForElementToBeRemoved } from '@testing-library/react'; import React from 'react'; import { sleep } from '../../../tests/utils'; import Toast from '../index'; const waitForContentShow = async (content: string) => { await waitFor(() => { screen.getByText(content); }); }; describe('Toast', () => { test('string', async () => { const { getByText } = render( <button onClick={() => { Toast.show('content'); }} > open </button>, ); fireEvent.click(getByText('open')); await waitForContentShow('content'); expect(getByText('content')).toBeInTheDocument(); }); test('with icon success', async () => { const { getByText } = render( <button onClick={() => { Toast.show({ icon: 'success', content: 'success' }); }} > open </button>, ); fireEvent.click(getByText('open')); await waitForContentShow('success'); expect(getByText('success')).toBeInTheDocument(); }); test('with icon fail', async () => { const { getByText } = render( <button onClick={() => { Toast.show({ icon: 'fail', content: 'fail' }); }} > open </button>, ); fireEvent.click(getByText('open')); await waitForContentShow('fail'); expect(getByText('fail')).toBeInTheDocument(); }); test('with icon loading', async () => { const { getByText } = render( <button onClick={() => { Toast.show({ icon: 'loading', content: 'loading' }); }} > open </button>, ); fireEvent.click(getByText('open')); await waitForContentShow('loading'); expect(getByText('loading')).toBeInTheDocument(); }); test('custom icon', async () => { const { getByText } = render( <button onClick={() => { Toast.show({ icon: <div>custom icon</div> }); }} > open </button>, ); fireEvent.click(getByText('open')); await waitForContentShow('custom icon'); expect(getByText('custom icon')).toBeInTheDocument(); }); test('config', async () => { Toast.config({ duration: 6000 }); const { getByText } = render( <button onClick={() => { Toast.show({ icon: 'loading', content: 'loading' }); }} > open </button>, ); fireEvent.click(getByText('open')); await sleep(5000); expect(getByText('loading')).toBeInTheDocument(); }); test('clear', async () => { const { getByText } = render( <div> <button onClick={() => { // Toast.show({ icon: 'loading', content: 'loading-clear' }); Toast.show({ icon: 'success', content: 'success-clear', className: 'clear-test' }); }} > open-clear </button> <button onClick={() => { // Toast.show({ icon: 'loading', content: 'loading-clear' }); Toast.clear(); }} > clear </button> </div> ); fireEvent.click(getByText('open-clear')); await waitForContentShow('success-clear'); fireEvent.click(getByText('clear')); }); }); ```
/content/code_sandbox/packages/zarm/src/toast/__tests__/index.test.tsx
xml
2016-07-13T11:45:37
2024-08-12T19:23:48
zarm
ZhongAnTech/zarm
1,707
739
```xml /** A list of options for the sort order of the feed */ export enum FeedType { /** Sort by a combination of freshness and score, using Reddit's algorithm */ Hot = 'HOT', /** Newest entries first */ New = 'NEW', /** Highest score entries first */ Top = 'TOP', } /** The type of vote to record, when submitting a vote */ export enum VoteType { Cancel = 'CANCEL', Down = 'DOWN', Up = 'UP', } ```
/content/code_sandbox/dev-test/githunt/types.onlyEnums.ts
xml
2016-12-05T19:15:11
2024-08-15T14:56:08
graphql-code-generator
dotansimha/graphql-code-generator
10,759
105
```xml import type { SQLiteOpenOptions } from './NativeDatabase'; import type { DatabaseChangeEvent } from './SQLiteDatabase'; declare const _default: { NativeDatabase(databaseName: string, options?: SQLiteOpenOptions, serializedData?: Uint8Array): void; NativeStatement(): void; deleteDatabaseAsync(databaseName: string): Promise<void>; deleteDatabaseSync(databaseName: string): void; importAssetDatabaseAsync(databaseName: string, assetDatabasePath: string, forceOverwrite: boolean): Promise<void>; addListener(eventName: string, listener: (event: DatabaseChangeEvent) => void): never; removeListeners(): never; }; export default _default; //# sourceMappingURL=ExpoSQLiteNext.d.ts.map ```
/content/code_sandbox/packages/expo-sqlite/build/ExpoSQLiteNext.d.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
149
```xml /* * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ // TypeScript Version: 4.1 /// <reference types="@stdlib/types"/> import { Collection } from '@stdlib/types/array'; /** * Computes `x - n/2 = r`. * * ## Notes * * - The function returns `n` and stores the remainder `r` as the two numbers `y[0]` and `y[1]`, such that `y[0] + y[1] = r`. * - For input values larger than `2^20 * /2` in magnitude, the function only returns the last three binary digits of `n` and not the full result. * * @param x - input value * @param y - remainder elements * @returns factor of `/2` * * @example * var y = [ 0.0, 0.0 ]; * var n = rempio2( 128.0, y ); * // returns 81 * * var y1 = y[ 0 ]; * // returns ~0.765 * * var y2 = y[ 1 ]; * // returns ~3.618e-17 * * @example * var y = [ 0.0, 0.0 ]; * var n = rempio2( NaN, y ); * // returns 0 * * var y1 = y[ 0 ]; * // returns NaN * * var y2 = y[ 1 ]; * // returns NaN */ declare function rempio2( x: number, y: Collection<number> ): number; // EXPORTS // export = rempio2; ```
/content/code_sandbox/lib/node_modules/@stdlib/math/base/special/rempio2/docs/types/index.d.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
387
```xml export type OsNameOptions = | 'windows' | 'macos' | 'unix' | 'linux' | 'unknown' | 'ios' | 'android' function getOsName(): OsNameOptions { if (navigator.userAgent.indexOf('Android') != -1) return 'android' if (navigator.userAgent.indexOf('iPhone') != -1) return 'ios' if (navigator.userAgent.indexOf('Win') != -1) return 'windows' if (navigator.userAgent.indexOf('Mac') != -1) return 'macos' if (navigator.userAgent.indexOf('X11') != -1) return 'unix' if (navigator.userAgent.indexOf('Linux') != -1) return 'linux' return 'unknown' } export const osName = getOsName() ```
/content/code_sandbox/src/design/lib/platform.ts
xml
2016-11-19T14:30:34
2024-08-16T03:13:45
BoostNote-App
BoostIO/BoostNote-App
3,745
171
```xml <refentry id="refsslcertio"> <refmeta> <refentrytitle>ne_ssl_cert_read</refentrytitle> <manvolnum>3</manvolnum> </refmeta> <refnamediv> <refname id="ne_ssl_cert_read">ne_ssl_cert_read</refname> <refname id="ne_ssl_cert_write">ne_ssl_cert_write</refname> <refname id="ne_ssl_cert_import">ne_ssl_cert_import</refname> <refname id="ne_ssl_cert_export">ne_ssl_cert_export</refname> <refpurpose>functions to read or write certificates to and from files or strings</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo>#include &lt;ne_ssl.h&gt;</funcsynopsisinfo> <funcprototype> <funcdef>ne_ssl_certificate *<function>ne_ssl_cert_read</function></funcdef> <paramdef>const char *<parameter>filename</parameter></paramdef> </funcprototype> <funcprototype> <funcdef>int <function>ne_ssl_cert_write</function></funcdef> <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef> <paramdef>const char *<parameter>filename</parameter></paramdef> </funcprototype> <funcprototype> <funcdef>ne_ssl_certificate *<function>ne_ssl_cert_import</function></funcdef> <paramdef>const char *<parameter>data</parameter></paramdef> </funcprototype> <funcprototype> <funcdef>char *<function>ne_ssl_cert_export</function></funcdef> <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1> <title>Description</title> <para>The <function>ne_ssl_cert_write</function> function writes a certificate to a file using the PEM encoding. The <function>ne_ssl_cert_export</function> function returns a base64-encoded &nul;-terminated string representing the certificate. This string is malloc-allocated and should be destroyed using <function>free</function> by the caller.</para> <para>The <function>ne_ssl_cert_read</function> function reads a certificate from a PEM-encoded file, and returns a certificate object. The <function>ne_ssl_cert_import</function> function returns a certificate object from a base64-encoded string, <parameter>data</parameter>, as returned by <function>ne_ssl_cert_export</function>. The certificate object returned by these functions should be destroyed using <xref linkend="ne_ssl_cert_free"/> after use.</para> </refsect1> <refsect1> <title>Return value</title> <para><function>ne_ssl_cert_read</function> returns &null; if a certificate could not be read from the file. <function>ne_ssl_cert_write</function> returns non-zero if the certificate could not be written to the file. <function>ne_ssl_cert_export</function> always returns a &nul;-terminated string, and never &null;. <function>ne_ssl_cert_import</function> returns &null; if the string was not a valid base64-encoded certificate.</para> </refsect1> <refsect1> <title>Encoding Formats</title> <para>The string produced by <function>ne_ssl_cert_export</function> is the base64 encoding of the DER representation of the certificate. The file written by <function>ne_ssl_cert_write</function> uses the PEM format: this is the base64 encoding of the DER representation with newlines every 64 characters, and start and end marker lines.</para> </refsect1> </refentry> ```
/content/code_sandbox/libs/neon/doc/ref/sslcertio.xml
xml
2016-06-22T17:19:44
2024-08-16T02:15:29
winscp
winscp/winscp
2,528
893
```xml import {Configuration, Injectable, Opts, ProviderScope, Scope} from "@tsed/di"; import low from "lowdb"; import Memory from "lowdb/adapters/Memory"; import {AdapterModel, LowDbAdapter} from "./LowDbAdapter.js"; @Injectable() @Scope(ProviderScope.INSTANCE) export class MemoryAdapter<T extends AdapterModel> extends LowDbAdapter<T> { constructor(@Opts options: any, @Configuration() configuration: Configuration) { super(options, configuration); this.db = low(new Memory<{collection: T[]}>(this.dbFilePath)); this.db .defaults({ collection: [] }) .write(); } } ```
/content/code_sandbox/packages/orm/adapters/src/adapters/MemoryAdapter.ts
xml
2016-02-21T18:38:47
2024-08-14T21:19:48
tsed
tsedio/tsed
2,817
141
```xml // luma.gl import type {ShaderProps, CompilerMessage} from '@luma.gl/core'; import {Shader, log} from '@luma.gl/core'; import type {WebGPUDevice} from '../webgpu-device'; /** * Immutable shader */ export class WebGPUShader extends Shader { readonly device: WebGPUDevice; readonly handle: GPUShaderModule; constructor(device: WebGPUDevice, props: ShaderProps) { super(device, props); this.device = device; this.device.handle.pushErrorScope('validation'); this.handle = this.props.handle || this.createHandle(); this.handle.label = this.props.id; this._checkCompilationError(this.device.handle.popErrorScope()); } get asyncCompilationStatus(): Promise<any> { return this.getCompilationInfo().then(() => this.compilationStatus); } async _checkCompilationError(errorScope: Promise<GPUError | null>): Promise<void> { const error = (await errorScope) as GPUValidationError; if (error) { // The `Shader` base class will determine if debug window should be opened based on props this.debugShader(); const shaderLog = await this.getCompilationInfo(); log.error(`Shader compilation error: ${error.message}`, shaderLog)(); // Note: Even though this error is asynchronous and thrown after the constructor completes, // it will result in a useful stack trace leading back to the constructor throw new Error(`Shader compilation error: ${error.message}`); } } override destroy(): void { // Note: WebGPU does not offer a method to destroy shaders // this.handle.destroy(); // @ts-expect-error readonly this.handle = null; } /** Returns compilation info for this shader */ async getCompilationInfo(): Promise<readonly CompilerMessage[]> { const compilationInfo = await this.handle.getCompilationInfo(); return compilationInfo.messages; } // PRIVATE METHODS protected createHandle(): GPUShaderModule { const {source} = this.props; const isGLSL = source.includes('#version'); if (this.props.language === 'glsl' || isGLSL) { throw new Error('GLSL shaders are not supported in WebGPU'); } return this.device.handle.createShaderModule({code: source}); } } ```
/content/code_sandbox/modules/webgpu/src/adapter/resources/webgpu-shader.ts
xml
2016-01-25T09:41:59
2024-08-16T10:03:05
luma.gl
visgl/luma.gl
2,280
487
```xml /* * * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file. */ import { QWidget } from "@nodegui/nodegui"; import { Event } from "extraterm-event-emitter"; import { Tab } from "./Tab.js"; import { TerminalEnvironment } from "./TerminalEnvironment.js"; import { SessionConfiguration } from "./Sessions.js"; import { Block, ExtensionBlock } from "./Block.js"; import { ScreenWithCursor } from "./Screen.js"; import { ListPickerOptions } from "./ListPickerOptions.js"; export type ExtensionBlockFactory = (extensionBlock: ExtensionBlock, args?: any) => void; // TODO: Rename this file to Terminals.ts export interface Terminals { readonly terminals: Terminal[]; readonly onDidCreateTerminal: Event<Terminal>; // onWillDestroyTerminal: Event<Terminal>; /** * Register the extension block factory for a given block name. * * @param name The name of the block type as defined in `package.json`. * @param factory The factory function itself. */ registerBlock(name: string, factory: ExtensionBlockFactory): void; } /** * An active terminal with connected TTY. * * A Terminal is the contents of a typical terminal tab. From a terminal * emulation point of view the terminal consists of a `screen` which is the * area where terminal applications can render output to, and a scrollback * area where rows of text which have "scrolled off" the top of the screen * are kept. * * Extraterm's model for the contents of the terminal is slightly more complex * than traditional terminal emulators. The contents of a terminal in Extraterm * is a stack of "blocks" of content which can be a mix of framed terminal * output and "viewers" holding different data like images and downloads. The * `blocks` property exposes this stack. New terminal output from applications * appears the last terminal output block. A terminal output block contains a * bunch of rows in its `scrollback` property. When a terminal output block is * the target of emulation, the contents of the `screen` visually appear as * part of this block. * * In the common case where no shell integration is being used, there will be * just one terminal output block, much like a traditional terminal emulator. */ export interface Terminal { /** * Type a string of text into the terminal. * * This is effectively the same as though the user typed into the terminal. * Note that the enter key should be represented as `\r`. */ type(text: string): void; /** * List of blocks shown inside this terminal. */ readonly blocks: Block[]; /** * Event fired after a block is appended to the terminal. * * The contents of the event is the new block itself. */ readonly onDidAppendBlock: Event<Block>; /** * The active part of the screen/grid which the terminal emulation controls * and terminals applications can access and render into. */ readonly screen: ScreenWithCursor; /** * Event fired when lines in the screen are changed. * * This event is fired whenever rows on the screen are changed and rendered * to the window. It is not fired for every change made to a row. The * process of updating the contents of the screen internally and the process * of showing that in the window to the user, are decoupled for performance * reasons. Many updates to the screen internally may result in just one * update to the window itself. */ readonly onDidScreenChange: Event<LineRangeChange>; /** * Fired when a lines are added to the scrollback area of a block. */ readonly onDidAppendScrollbackLines: Event<LineRangeChange>; /** * The tab which holds this terminal */ readonly tab: Tab; /** * The value of the Extraterm terminal integration cookie specific to this * terminal. */ readonly extratermCookieValue: string; /** * The name of the Extraterm terminal integration cookie. */ readonly extratermCookieName: string; createTerminalBorderWidget(name: string): TerminalBorderWidget; readonly environment: TerminalEnvironment; /** * The session configuration associated with this terminal. * * Use `getSessionSettings()` to fetch extension settings. */ readonly sessionConfiguration: SessionConfiguration; /** * Get the extension settings associated with this terminal. * * @param name the same `name` passed to `Window.registerSessionSettingsEditor()`. */ getSessionSettings(name: string): Object; /** * True if this terminal is still open. * * Once the uesr closes a terminal tab and the tab disappears, then this will return `false`. */ readonly isAlive: boolean; /** * Show a list picker at the cursor and allow an item to be selected. * * This shows the given list of strings and lets the user select one or * them or cancel the picker. The index of the item in the list is return * if an item is selected. `undefined` is returned if the user canceled the * picker by pressing escape, for example. The picker appears with in this * tab. * * See `ListPickerOptions` for more details about how to configure this. * * @return a promise which resolves to the selected item index or * undefined if it was canceled. */ showOnCursorListPicker(options: ListPickerOptions): Promise<number | undefined>; /** * Get the current working directory of locally running shell process * connected to this terminal. * * Note: This can be unreliable for certain session types and should be considered a best effort. * * @return a promise which resolves to the path of the working directory or null. */ getWorkingDirectory(): Promise<string | null>; /** * True if the terminal is connected to a live TTY. */ readonly isConnected: boolean; /** * Geometry of the terminal viewport shown in the window. */ readonly viewport: Viewport; /** * Append a block to the bottom of the terminal. * * @param name The name of the block type as defined in `package.json`. * @param args Option arguments object. */ appendBlock(name: string, args?: any): Block; } export interface Viewport { /** * The height of the viewport in pixels. */ readonly height: number; /** * The position of the top of the viewport relative to the contents. * * Setting this changes the position of the viewport. */ position: number; /** * The total height of the content inside the viewport. */ readonly contentHeight: number; /** * Event fired when the size or position of the viewport changes. */ readonly onDidChange: Event<void>; } /** * Describes a range of lines. */ export interface LineRangeChange { /** * The block which received the new scrollback lines. * * Its type will be `TerminalOutputType`. */ block: Block; /** * The index into the scrollback area of the first line added. * * The complete range of affected lines is from `startLine` up to but not including `endLine`. */ startLine: number; /** * The index after the last affected line. * * The range of affected lines is from `startLine` up to but not including `endLine`. */ endLine: number; } export interface TerminalBorderWidget { contentWidget: QWidget; open(): void; close(): void; readonly isOpen: boolean; } ```
/content/code_sandbox/packages/extraterm-extension-api/src/Terminal.ts
xml
2016-03-04T12:39:59
2024-08-16T18:44:37
extraterm
sedwards2009/extraterm
2,501
1,677
```xml // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; import * as utilities from "./utilities"; export class Provider extends pulumi.ProviderResource { /** @internal */ public static readonly __pulumiType = 'alpha'; /** * Returns true if the given object is an instance of Provider. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ public static isInstance(obj: any): obj is Provider { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType; } /** * Create a Provider resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: ProviderArgs, opts?: pulumi.ResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; { } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Provider.__pulumiType, name, resourceInputs, opts); } } /** * The set of arguments for constructing a Provider resource. */ export interface ProviderArgs { } ```
/content/code_sandbox/sdk/nodejs/cmd/pulumi-language-nodejs/testdata/tsc/sdks/alpha-3.0.0-alpha.1.internal/provider.ts
xml
2016-10-31T21:02:47
2024-08-16T19:47:04
pulumi
pulumi/pulumi
20,743
338
```xml // Utilities import { describe, expect, it } from '@jest/globals' import { extractColor } from '../' const red = { h: 0, s: 1, v: 1, a: 1 } describe('VColorPicker Utils', () => { describe('Extract color', () => { const cases = [ [red, null, '#FF0000'], [red, '#FF0000', '#FF0000'], [red, '#FF0000FF', '#FF0000'], [{ ...red, a: 0.5 }, '#FF000000', '#FF000080'], [red, { r: 255, g: 0, b: 0 }, { r: 255, g: 0, b: 0 }], [red, { r: 255, g: 0, b: 0, a: 0 }, { r: 255, g: 0, b: 0, a: 1 }], [red, { h: 0, s: 1, l: 0.5 }, { h: 0, s: 1, l: 0.5 }], [red, { h: 0, s: 1, l: 0.5, a: 1 }, { h: 0, s: 1, l: 0.5, a: 1 }], [red, { h: 0, s: 1, v: 1 }, { h: 0, s: 1, v: 1 }], [red, { h: 0, s: 1, v: 1, a: 0.5 }, { h: 0, s: 1, v: 1, a: 1 }], [red, undefined, '#FF0000'], ] as const it.each(cases)('When given %p and %p, extractColor util should return %p', (...args) => { const [color, input, result] = args expect(extractColor(color, input)).toEqual(result) }) }) }) ```
/content/code_sandbox/packages/vuetify/src/components/VColorPicker/util/__tests__/index.spec.ts
xml
2016-09-12T00:39:35
2024-08-16T20:06:39
vuetify
vuetifyjs/vuetify
39,539
465
```xml export * from './ripple'; ```
/content/code_sandbox/src/app/components/ripple/public_api.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
7
```xml <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="path_to_url"> <ItemGroup> <Filter Include="Source Files"> </Filter> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\SnippetCommon\SnippetCommon.h"> <Filter>Source Files</Filter> </ClInclude> <ClCompile Include="..\..\SnippetHelloWorld\SnippetHelloWorld.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> </Project> ```
/content/code_sandbox/APEX_1.4/snippets/compiler/vc14win64-PhysX_3.4/SnippetHelloWorld.vcxproj.filters
xml
2016-10-12T16:34:31
2024-08-16T09:40:38
PhysX-3.4
NVIDIAGameWorks/PhysX-3.4
2,343
131
```xml <annotation> <folder>toy_images</folder> <filename>toy70.jpg</filename> <path>/home/animesh/Documents/grocery_detection/toy_exptt/toy_images/toy70.jpg</path> <source> <database>Unknown</database> </source> <size> <width>500</width> <height>300</height> <depth>3</depth> </size> <segmented>0</segmented> <object> <name>toy</name> <pose>Unspecified</pose> <truncated>0</truncated> <difficult>0</difficult> <bndbox> <xmin>176</xmin> <ymin>110</ymin> <xmax>305</xmax> <ymax>235</ymax> </bndbox> </object> </annotation> ```
/content/code_sandbox/Custom_Mask_RCNN/annotations/xmls/toy70.xml
xml
2016-08-17T18:29:12
2024-08-12T19:24:24
Deep-Learning
priya-dwivedi/Deep-Learning
3,346
210
```xml /* eslint-env jest */ import { remove } from 'fs-extra' import stripAnsi from 'next/dist/compiled/strip-ansi' import { fetchViaHTTP, findPort, killApp, launchApp, nextBuild, waitFor, } from 'next-test-utils' import { join } from 'path' jest.setTimeout(1000 * 60 * 2) const unsupportedFunctions = [ 'setImmediate', 'clearImmediate', // no need to test all of the process methods 'process.cwd', 'process.cpuUsage', 'process.getuid', ] const undefinedProperties = [ // no need to test all of the process properties 'process.arch', 'process.version', ] const unsupportedClasses = [ 'BroadcastChannel', 'ByteLengthQueuingStrategy', 'CompressionStream', 'CountQueuingStrategy', 'DecompressionStream', 'DomException', 'MessageChannel', 'MessageEvent', 'MessagePort', 'ReadableByteStreamController', 'ReadableStreamBYOBRequest', 'ReadableStreamDefaultController', 'TransformStreamDefaultController', 'WritableStreamDefaultController', ] describe.each([ { title: 'Middleware', computeRoute(useCase) { return `/${useCase}` }, }, { title: 'Edge route', computeRoute(useCase) { return `/api/route?case=${useCase}` }, }, ])('$title using Node.js API', ({ computeRoute }) => { const appDir = join(__dirname, '..') ;(process.env.TURBOPACK_BUILD ? describe.skip : describe)( 'development mode', () => { let output = '' let appPort: number let app = null beforeAll(async () => { output = '' appPort = await findPort() app = await launchApp(appDir, appPort, { env: { __NEXT_TEST_WITH_DEVTOOL: '1' }, onStdout(msg) { output += msg }, onStderr(msg) { output += msg }, }) }) afterAll(() => killApp(app)) it.each(undefinedProperties.map((api) => ({ api })))( 'does not throw on using $api', async ({ api }) => { const res = await fetchViaHTTP(appPort, computeRoute(api)) expect(res.status).toBe(200) await waitFor(500) expect(output).not.toInclude(`A Node.js API is used (${api})`) } ) it.each([ ...unsupportedFunctions.map((api) => ({ api, errorHighlight: `${api}(`, })), ...unsupportedClasses.map((api) => ({ api, errorHighlight: `new ${api}(`, })), ])(`throws error when using $api`, async ({ api, errorHighlight }) => { const res = await fetchViaHTTP(appPort, computeRoute(api)) expect(res.status).toBe(500) await waitFor(500) expect(output) .toInclude(`A Node.js API is used (${api}) which is not supported in the Edge Runtime. Learn more: path_to_url`) expect(stripAnsi(output)).toInclude(errorHighlight) }) } ) ;(process.env.TURBOPACK_DEV ? describe.skip : describe)( 'production mode', () => { let buildResult beforeAll(async () => { await remove(join(appDir, '.next')) buildResult = await nextBuild(appDir, undefined, { stderr: true, stdout: true, }) }) it.each( [...unsupportedFunctions, ...unsupportedClasses].map((api, index) => ({ api, })) )(`warns for $api during build`, ({ api }) => { expect(buildResult.stderr).toContain(`A Node.js API is used (${api}`) }) it.each([...undefinedProperties].map((api) => ({ api })))( 'does not warn on using $api', ({ api }) => { expect(buildResult.stderr).toContain(`A Node.js API is used (${api}`) } ) } ) }) ```
/content/code_sandbox/test/integration/edge-runtime-with-node.js-apis/test/index.test.ts
xml
2016-10-05T23:32:51
2024-08-16T19:44:30
next.js
vercel/next.js
124,056
904
```xml <vector xmlns:android="path_to_url" android:height="34.0dp" android:tint="?attr/colorControlNormal" android:viewportHeight="15" android:viewportWidth="15" android:width="34.0dp"> <path android:fillColor="@android:color/white" android:pathData="M6 4C6 2 9 2 9 4C9 4.5 6 4.5 6 4zM6 4.5C6 4 6 11.5 6 12C6 12.5 9 12.5 9 12C9 11.5 9 4 9 4.5C9 5 6 5 6 4.5z"/> <path android:fillColor="@android:color/white" android:pathData="M1.5 4C1.5 2 4.5 2 4.5 4C4.5 4.5 1.5 4.5 1.5 4zM1.5 4.5C1.5 4 1.5 11.5 1.5 12C1.5 12.5 4.5 12.5 4.5 12C4.5 11.5 4.5 4 4.5 4.5C4.5 5 1.5 5 1.5 4.5z"/> <path android:fillColor="@android:color/white" android:pathData="M10.5 4C10.5 2 13.5 2 13.5 4C13.5 4.5 10.5 4.5 10.5 4zM10.5 4.5C10.5 4 10.5 11.5 10.5 12C10.5 12.5 13.5 12.5 13.5 12C13.5 11.5 13.5 4 13.5 4.5C13.5 5 10.5 5 10.5 4.5z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_preset_temaki_bollard_row.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
488
```xml import type { WithDeleted } from './rx-storage.d.ts'; /** * Notice that the conflict handler input/output * does not work on RxDocumentData<RxDocType>, but only on WithDeleted<RxDocType>. * This is because the _meta attributes are meant for the local storing of document data, they not replicated * and therefore cannot be used to resolve conflicts. */ export type RxConflictHandlerInput<RxDocType> = { assumedMasterState?: WithDeleted<RxDocType>; realMasterState: WithDeleted<RxDocType>; newDocumentState: WithDeleted<RxDocType>; }; /** * The conflict handler either returns: * - The resolved new document state * - A flag to identify the given 'realMasterState' and 'newDocumentState' * as being exactly equal, so no conflict has to be resolved. */ export type RxConflictHandlerOutput<RxDocType> = { isEqual: false; documentData: WithDeleted<RxDocType>; } | { isEqual: true; }; export type RxConflictHandler<RxDocType> = ( i: RxConflictHandlerInput<RxDocType>, context: string ) => Promise<RxConflictHandlerOutput<RxDocType>>; export type RxConflictResultionTask<RxDocType> = { /** * Unique id for that single task. */ id: string; /** * Tasks must have a context * which makes it easy to filter/identify them again * with plugins or other hacky stuff. */ context: string; input: RxConflictHandlerInput<RxDocType>; }; export type RxConflictResultionTaskSolution<RxDocType> = { /** * Id of the RxConflictResultionTask */ id: string; output: RxConflictHandlerOutput<RxDocType>; }; ```
/content/code_sandbox/src/types/conflict-handling.d.ts
xml
2016-12-02T19:34:42
2024-08-16T15:47:20
rxdb
pubkey/rxdb
21,054
395
```xml /// /// /// /// path_to_url /// /// Unless required by applicable law or agreed to in writing, software /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// import { AggKey, IndexedSubscriptionData, } from '@app/shared/models/telemetry/telemetry.models'; import { AggregationType, calculateAggIntervalWithSubscriptionTimeWindow, calculateIntervalComparisonEndTime, calculateIntervalEndTime, calculateIntervalStartEndTime, getCurrentTime, getTime, IntervalMath, SubscriptionTimewindow } from '@shared/models/time/time.models'; import { UtilsService } from '@core/services/utils.service'; import { deepClone, isDefinedAndNotNull, isNumber, isNumeric } from '@core/utils'; import { DataEntry, DataSet, IndexedData } from '@shared/models/widget.models'; import BTree from 'sorted-btree'; import Timeout = NodeJS.Timeout; export declare type onAggregatedData = (data: IndexedData, detectChanges: boolean) => void; interface AggData { count: number; sum: number; aggValue: any; ts: number; interval: [number, number]; } class AggDataMap { private map = new BTree<number, AggData>(); private reusePair: [number, AggData] = [undefined, undefined]; constructor( private subsTw: SubscriptionTimewindow, private endTs: number, private aggType: AggregationType ){}; set(ts: number, data: AggData) { this.map.set(ts, data); } get(ts: number): AggData { return this.map.get(ts); } delete(ts: number) { this.map.delete(ts); } findDataForTs(ts: number): AggData | undefined { if (ts >= this.endTs) { this.updateLastInterval(ts + 1); } const pair = this.map.getPairOrNextLower(ts, this.reusePair); if (pair) { const data = pair[1]; const interval = data.interval; if (ts < interval[1]) { return data; } } } calculateAggInterval(timestamp: number): [number, number] { return calculateAggIntervalWithSubscriptionTimeWindow(this.subsTw, this.endTs, timestamp, this.aggType); } updateLastInterval(endTs: number) { if (endTs > this.endTs) { this.endTs = endTs; const lastTs = this.map.maxKey(); if (lastTs) { const data = this.map.get(lastTs); const interval = calculateAggIntervalWithSubscriptionTimeWindow(this.subsTw, endTs, data.ts, this.aggType); data.interval = interval; data.ts = interval[0] + Math.floor((interval[1] - interval[0]) / 2); } } } forEach(callback: (value: AggData, key: number, map: BTree<number, AggData>) => void, thisArg?: any) { this.map.forEach(callback, thisArg); } size(): number { return this.map.size; } } class AggregationMap { aggMap: {[id: number]: AggDataMap} = {}; } declare type AggFunction = (aggData: AggData, value?: any) => void; const avg: AggFunction = (aggData: AggData, value?: any) => { aggData.count++; if (isNumber(value)) { aggData.sum = aggData.aggValue * (aggData.count - 1) + value; aggData.aggValue = aggData.sum / aggData.count; } else { aggData.aggValue = value; } }; const min: AggFunction = (aggData: AggData, value?: any) => { if (isNumber(value)) { aggData.aggValue = Math.min(aggData.aggValue, value); } else { aggData.aggValue = value; } }; const max: AggFunction = (aggData: AggData, value?: any) => { if (isNumber(value)) { aggData.aggValue = Math.max(aggData.aggValue, value); } else { aggData.aggValue = value; } }; const sum: AggFunction = (aggData: AggData, value?: any) => { if (isNumber(value)) { aggData.aggValue = aggData.aggValue + value; } else { aggData.aggValue = value; } }; const count: AggFunction = (aggData: AggData) => { aggData.count++; aggData.aggValue = aggData.count; }; const none: AggFunction = (aggData: AggData, value?: any) => { aggData.aggValue = value; }; const MAX_INTERVAL_TIMEOUT = Math.pow(2,31)-1; export class DataAggregator { constructor(private onDataCb: onAggregatedData, private tsKeys: AggKey[], private isLatestDataAgg: boolean, private subsTw: SubscriptionTimewindow, private utils: UtilsService, private ignoreDataUpdateOnIntervalTick: boolean) { this.tsKeys.forEach((key) => { if (!this.dataBuffer[key.id]) { this.dataBuffer[key.id] = []; } }); if (this.subsTw.aggregation.stateData) { this.lastPrevKvPairData = {}; } } private dataBuffer: IndexedData = []; private data: IndexedData; private readonly lastPrevKvPairData: {[id: number]: DataEntry}; private aggregationMap: AggregationMap; private dataReceived = false; private resetPending = false; private updatedData = false; private aggregationTimeout = this.isLatestDataAgg ? 1000 : Math.max(IntervalMath.numberValue(this.subsTw.aggregation.interval), 1000); private intervalTimeoutHandle: Timeout; private intervalScheduledTime: number; private startTs: number; private endTs: number; private elapsed: number; private static convertValue(val: string, noAggregation: boolean): any { if (val && isNumeric(val) && (!noAggregation || noAggregation && Number(val).toString() === val)) { return Number(val); } return val; } private static getAggFunction(aggType: AggregationType): AggFunction { switch (aggType) { case AggregationType.MIN: return min; case AggregationType.MAX: return max; case AggregationType.AVG: return avg; case AggregationType.SUM: return sum; case AggregationType.COUNT: return count; case AggregationType.NONE: return none; default: return avg; } } public updateOnDataCb(newOnDataCb: onAggregatedData): onAggregatedData { const prevOnDataCb = this.onDataCb; this.onDataCb = newOnDataCb; return prevOnDataCb; } public reset(subsTw: SubscriptionTimewindow) { if (this.intervalTimeoutHandle) { clearTimeout(this.intervalTimeoutHandle); this.intervalTimeoutHandle = null; } this.subsTw = subsTw; this.intervalScheduledTime = this.utils.currentPerfTime(); this.calculateStartEndTs(); this.elapsed = 0; this.aggregationTimeout = this.isLatestDataAgg ? 1000 : Math.max(IntervalMath.numberValue(this.subsTw.aggregation.interval), 1000); this.resetPending = true; this.updatedData = false; this.intervalTimeoutHandle = setTimeout(this.onInterval.bind(this), Math.min(this.aggregationTimeout, MAX_INTERVAL_TIMEOUT)); } public destroy() { if (this.intervalTimeoutHandle) { clearTimeout(this.intervalTimeoutHandle); this.intervalTimeoutHandle = null; } this.aggregationMap = null; } public onData(data: IndexedSubscriptionData, update: boolean, history: boolean, detectChanges: boolean) { this.updatedData = true; if (!this.dataReceived || this.resetPending) { let updateIntervalScheduledTime = true; if (!this.dataReceived) { this.elapsed = 0; this.dataReceived = true; this.calculateStartEndTs(); } if (this.resetPending) { this.resetPending = false; updateIntervalScheduledTime = false; } if (update) { this.aggregationMap = new AggregationMap(); this.updateAggregatedData(data); } else { this.aggregationMap = this.processAggregatedData(data); } if (updateIntervalScheduledTime) { this.intervalScheduledTime = this.utils.currentPerfTime(); } this.onInterval(history, detectChanges); } else { this.updateAggregatedData(data); if (history) { this.intervalScheduledTime = this.utils.currentPerfTime(); this.onInterval(history, detectChanges); } else { this.onInterval(false, detectChanges, true); } } } private calculateStartEndTs() { this.startTs = this.subsTw.startTs + this.subsTw.tsOffset; if (this.subsTw.quickInterval) { if (this.subsTw.timeForComparison === 'previousInterval') { const startDate = getTime(this.subsTw.startTs, this.subsTw.timezone); const currentDate = getCurrentTime(this.subsTw.timezone); this.endTs = calculateIntervalComparisonEndTime(this.subsTw.quickInterval, startDate, currentDate) + this.subsTw.tsOffset; } else { const startDate = getTime(this.subsTw.startTs, this.subsTw.timezone); this.endTs = calculateIntervalEndTime(this.subsTw.quickInterval, startDate, this.subsTw.timezone) + this.subsTw.tsOffset; } } else { this.endTs = this.startTs + this.subsTw.aggregation.timeWindow; } } private onInterval(history?: boolean, detectChanges?: boolean, dataChanged?: boolean) { const now = this.utils.currentPerfTime(); this.elapsed += now - this.intervalScheduledTime; this.intervalScheduledTime = now; if (this.intervalTimeoutHandle) { clearTimeout(this.intervalTimeoutHandle); this.intervalTimeoutHandle = null; } const intervalTimeout = dataChanged ? this.aggregationTimeout - this.elapsed : this.aggregationTimeout; if (!history) { const delta = Math.floor(this.elapsed / this.aggregationTimeout); if (delta || !this.data || dataChanged) { const tickTs = delta * this.aggregationTimeout; if (this.subsTw.quickInterval) { const startEndTime = calculateIntervalStartEndTime(this.subsTw.quickInterval, this.subsTw.timezone); this.startTs = startEndTime[0] + this.subsTw.tsOffset; this.endTs = startEndTime[1] + this.subsTw.tsOffset; } else { this.startTs += tickTs; this.endTs += tickTs; } if (this.subsTw.aggregation.type !== AggregationType.NONE) { this.updateLastInterval(); } this.data = this.updateData(); this.elapsed = this.elapsed - delta * this.aggregationTimeout; } } else { this.data = this.updateData(); } if (this.onDataCb && (!this.ignoreDataUpdateOnIntervalTick || this.updatedData)) { this.onDataCb(this.data, detectChanges); this.updatedData = false; } if (!history) { this.intervalTimeoutHandle = setTimeout(this.onInterval.bind(this), Math.min(intervalTimeout, MAX_INTERVAL_TIMEOUT)); } } private updateData(): IndexedData { this.dataBuffer = []; this.tsKeys.forEach((key) => { if (!this.dataBuffer[key.id]) { this.dataBuffer[key.id] = []; } }); for (const idStr of Object.keys(this.aggregationMap.aggMap)) { const id = Number(idStr); const aggKeyData = this.aggregationMap.aggMap[id]; const aggKey = this.aggKeyById(id); const noAggregation = aggKey.agg === AggregationType.NONE; let keyData = this.dataBuffer[id]; const deletedKeys: number[] = []; aggKeyData.forEach((aggData, aggStartTs) => { if (aggStartTs < this.startTs) { if (this.subsTw.aggregation.stateData && (!this.lastPrevKvPairData[id] || this.lastPrevKvPairData[id][0] < aggData.ts)) { this.lastPrevKvPairData[id] = [aggData.ts, aggData.aggValue, aggData.interval]; } deletedKeys.push(aggStartTs); this.updatedData = true; } else if (aggData.ts < this.endTs || noAggregation) { const kvPair: DataEntry = [aggData.ts, aggData.aggValue, aggData.interval]; keyData.push(kvPair); } }); deletedKeys.forEach(ts => aggKeyData.delete(ts)); keyData.sort((set1, set2) => set1[0] - set2[0]); if (this.subsTw.aggregation.stateData) { this.updateStateBounds(keyData, deepClone(this.lastPrevKvPairData[id])); } if (keyData.length > this.subsTw.aggregation.limit) { keyData = keyData.slice(keyData.length - this.subsTw.aggregation.limit); } this.dataBuffer[id] = keyData; } return this.dataBuffer; } private updateStateBounds(keyData: DataSet, lastPrevKvPair: DataEntry) { if (lastPrevKvPair) { lastPrevKvPair[0] = this.startTs; lastPrevKvPair[2] = [this.startTs, this.startTs]; } let firstKvPair: DataEntry; if (!keyData.length) { if (lastPrevKvPair) { firstKvPair = lastPrevKvPair; keyData.push(firstKvPair); } } else { firstKvPair = keyData[0]; } if (firstKvPair && firstKvPair[0] > this.startTs) { if (lastPrevKvPair) { keyData.unshift(lastPrevKvPair); } } if (keyData.length) { let lastKvPair = keyData[keyData.length - 1]; if (lastKvPair[0] < this.endTs) { lastKvPair = deepClone(lastKvPair); lastKvPair[0] = this.endTs; lastKvPair[2] = [this.endTs, this.endTs]; keyData.push(lastKvPair); } } } private processAggregatedData(data: IndexedSubscriptionData): AggregationMap { const aggregationMap = new AggregationMap(); for (const idStr of Object.keys(data)) { const id = Number(idStr); const aggKey = this.aggKeyById(id); const aggType = aggKey.agg; const isCount = aggType === AggregationType.COUNT; const noAggregation = aggType === AggregationType.NONE; let aggKeyData = aggregationMap.aggMap[id]; if (!aggKeyData) { aggKeyData = new AggDataMap(this.subsTw, this.endTs, aggType); aggregationMap.aggMap[id] = aggKeyData; } const keyData = data[id]; keyData.forEach((kvPair) => { const timestamp = kvPair[0]; const value = DataAggregator.convertValue(kvPair[1], noAggregation); let interval: [number, number] = [timestamp, timestamp]; if (!noAggregation) { interval = aggKeyData.calculateAggInterval(timestamp); } const ts = interval[0] + Math.floor((interval[1] - interval[0]) / 2); const aggData: AggData = { count: isCount ? value : isDefinedAndNotNull(kvPair[2]) ? kvPair[2] : 1, sum: value, aggValue: value, ts, interval }; aggKeyData.set(interval[0], aggData); }); } return aggregationMap; } private updateAggregatedData(data: IndexedSubscriptionData) { for (const idStr of Object.keys(data)) { const id = Number(idStr); const aggKey = this.aggKeyById(id); const aggType = aggKey.agg; const isCount = aggType === AggregationType.COUNT; const noAggregation = aggType === AggregationType.NONE; let aggKeyData = this.aggregationMap.aggMap[id]; if (!aggKeyData) { aggKeyData = new AggDataMap(this.subsTw, this.endTs, aggType); this.aggregationMap.aggMap[id] = aggKeyData; } const keyData = data[id]; keyData.forEach((kvPair) => { const timestamp = kvPair[0]; const value = DataAggregator.convertValue(kvPair[1], noAggregation); let aggData = aggKeyData.findDataForTs(timestamp); if (!aggData) { let interval: [number, number] = [timestamp, timestamp]; if (!noAggregation) { interval = aggKeyData.calculateAggInterval(timestamp); } const ts = interval[0] + Math.floor((interval[1] - interval[0]) / 2); aggData = { count: isDefinedAndNotNull(kvPair[2]) ? kvPair[2] : 1, sum: value, aggValue: isCount ? 1 : value, ts, interval }; aggKeyData.set(interval[0], aggData); } else { DataAggregator.getAggFunction(aggType)(aggData, value); } }); } } private updateLastInterval() { for (const idStr of Object.keys(this.aggregationMap.aggMap)) { const id = Number(idStr); const aggKeyData = this.aggregationMap.aggMap[id]; aggKeyData.updateLastInterval(this.endTs); } } private aggKeyById(id: number): AggKey { return this.tsKeys.find(key => key.id === id); } } ```
/content/code_sandbox/ui-ngx/src/app/core/api/data-aggregator.ts
xml
2016-12-01T09:33:30
2024-08-16T19:58:25
thingsboard
thingsboard/thingsboard
16,820
4,063
```xml import React from 'react'; const routes = () => { return null; }; export default routes; ```
/content/code_sandbox/packages/plugin-imap-ui/src/routes.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
22
```xml /* * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import noneByRightAsync = require( './index' ); const isPositive = ( v: number ): boolean => { return ( v > 0 ); }; const done = ( error: Error | null, bool: boolean ) => { if ( error ) { throw error; } if ( bool === void 0 ) { throw new Error( '`bool` is not a boolean.' ); } }; // TESTS // // The function does not return a value... { noneByRightAsync( [ 0, 1, 1 ], isPositive, done ); // $ExpectType void noneByRightAsync( [ -1, 1, 2 ], isPositive, done ); // $ExpectType void const opts = { 'series': true }; noneByRightAsync( [ -1, 1, 2 ], opts, isPositive, done ); // $ExpectType void } // The compiler throws an error if the function is provided a first argument which is not a collection... { noneByRightAsync( 2, isPositive, done ); // $ExpectError noneByRightAsync( false, isPositive, done ); // $ExpectError noneByRightAsync( true, isPositive, done ); // $ExpectError noneByRightAsync( {}, isPositive, done ); // $ExpectError } // The compiler throws an error if the function is provided a predicate argument which is not a predicate function... { noneByRightAsync( [ 1, 2, 3 ], 2, done ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], false, done ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], true, done ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], 'abc', done ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], {}, done ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], [], done ); // $ExpectError } // The compiler throws an error if the function is provided a done callback argument which is not a function having a supported signature... { noneByRightAsync( [ 1, 2, 3 ], isPositive, 2 ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], isPositive, false ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], isPositive, true ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], isPositive, 'abc' ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], isPositive, {} ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], isPositive, [] ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], isPositive, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided an invalid number of arguments... { noneByRightAsync(); // $ExpectError noneByRightAsync( [ 1, 2, 3 ] ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], isPositive ); // $ExpectError noneByRightAsync( [ 1, 2, 3 ], {}, isPositive, done, {} ); // $ExpectError } // Attached to main export is a `factory` method which returns a function... { noneByRightAsync.factory( isPositive ); // $ExpectType FactoryFunction<number> noneByRightAsync.factory( { 'series': true }, isPositive ); // $ExpectType FactoryFunction<number> } // The compiler throws an error if the `factory` method is provided an options argument which is not an object... { noneByRightAsync.factory( [], isPositive ); // $ExpectError noneByRightAsync.factory( 123, isPositive ); // $ExpectError noneByRightAsync.factory( 'abc', isPositive ); // $ExpectError noneByRightAsync.factory( false, isPositive ); // $ExpectError noneByRightAsync.factory( true, isPositive ); // $ExpectError } // The compiler throws an error if the `factory` method is provided a last argument which is not a predicate function... { noneByRightAsync.factory( {} ); // $ExpectError noneByRightAsync.factory( true ); // $ExpectError noneByRightAsync.factory( false ); // $ExpectError noneByRightAsync.factory( {}, 123 ); // $ExpectError noneByRightAsync.factory( {}, 'abc' ); // $ExpectError } // The compiler throws an error if the function returned by the `factory` method is provided invalid arguments... { const fcn1 = noneByRightAsync.factory( isPositive ); fcn1( 12, done ); // $ExpectError fcn1( true, done ); // $ExpectError fcn1( false, done ); // $ExpectError fcn1( {}, done ); // $ExpectError fcn1( [ 1, 2, 3 ], 12 ); // $ExpectError fcn1( [ 1, 2, 3 ], true ); // $ExpectError fcn1( [ 1, 2, 3 ], false ); // $ExpectError fcn1( [ 1, 2, 3 ], '5' ); // $ExpectError fcn1( [ 1, 2, 3 ], {} ); // $ExpectError fcn1( [ 1, 2, 3 ], [] ); // $ExpectError fcn1( [ 1, 2, 3 ], ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function returned by the `factory` method is provided an unsupported number of arguments... { const fcn1 = noneByRightAsync.factory( isPositive ); fcn1(); // $ExpectError fcn1( [ 1, 2, 3 ] ); // $ExpectError fcn1( [ 1, 2, 3 ], done, {} ); // $ExpectError } // The compiler throws an error if the `factory` method is provided a `limit` option which is not a number... { noneByRightAsync.factory( { 'limit': '12' }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'limit': true }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'limit': false }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'limit': {} }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'limit': [] }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'limit': ( x: number ): number => x }, isPositive ); // $ExpectError } // The compiler throws an error if the `factory` method is provided a `series` option which is not a boolean... { noneByRightAsync.factory( { 'series': '12' }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'series': 12 }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'series': {} }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'series': [] }, isPositive ); // $ExpectError noneByRightAsync.factory( { 'series': ( x: number ): number => x }, isPositive ); // $ExpectError } // The compiler throws an error if the `factory` method is provided an invalid number of arguments... { noneByRightAsync.factory(); // $ExpectError noneByRightAsync.factory( {}, isPositive, {} ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/utils/async/none-by-right/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
1,803
```xml import { Component } from '@angular/core'; import { Code } from '@domain/code'; @Component({ selector: 'avatar-badge-demo', template: ` <app-docsectiontext> <p>A <i>badge</i> can be added to an Avatar with the <a href="#" [routerLink]="['/badge']">Badge</a> directive.</p> </app-docsectiontext> <div class="card flex justify-content-center"> <p-avatar image="path_to_url" pBadge value="4" severity="danger" /> </div> <app-code [code]="code" selector="avatar-badge-demo"></app-code> ` }) export class BadgeDoc { code: Code = { basic: `<p-avatar image="path_to_url" pBadge value="4" severity="danger" />`, html: `<div class="card flex justify-content-center"> <p-avatar image="path_to_url" pBadge value="4" severity="danger" /> </div>`, typescript: `import { Component } from '@angular/core'; import { AvatarModule } from 'primeng/avatar'; import { BadgeModule } from 'primeng/badge'; @Component({ selector: 'avatar-badge-demo', templateUrl: './avatar-badge-demo.html', standalone: true, imports: [AvatarModule, BadgeModule] }) export class AvatarBadgeDemo {}` }; } ```
/content/code_sandbox/src/app/showcase/doc/avatar/badgedoc.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
314
```xml <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="path_to_url" xmlns:bpmndi="path_to_url" xmlns:omgdc="path_to_url" xmlns:omgdi="path_to_url" id="sid-2a927919-7050-4a4d-a0e9-4a408adeb093" targetNamespace="Examples"> <process id="myProcess" > <startEvent id="theStart" /> <sequenceFlow id="flowStartToTask1" sourceRef="theStart" targetRef="task1" /> <task id="task1" /> <sequenceFlow id="flowTask1ToGateway1" sourceRef="task1" targetRef="gateway1" /> <exclusiveGateway id="gateway1" default="flowGateway1ToTask2"/> <sequenceFlow id="flowGateway1ToTask2" sourceRef="gateway1" targetRef="task2" /> <sequenceFlow id="flowGateway1ToTask3" sourceRef="gateway1" targetRef="task3"> <conditionExpression id="condition">some condition</conditionExpression> </sequenceFlow> <task id="task2" /> <sequenceFlow id="flowTask2ToGateway2" sourceRef="task2" targetRef="gateway2" /> <task id="task3" /> <sequenceFlow id="flowTask3ToGateway2" sourceRef="task3" targetRef="gateway2" /> <exclusiveGateway id="gateway2" /> <sequenceFlow id="flowGateway2ToEnd" sourceRef="gateway2" targetRef="theEnd" /> <endEvent id="theEnd" /> </process> <bpmndi:BPMNDiagram id="sid-6822053f-a7b5-488b-b37e-0616458073ec"> <bpmndi:BPMNPlane bpmnElement="myProcess" id="diagram"> <bpmndi:BPMNShape bpmnElement="theStart" id="theStart_gui"> <omgdc:Bounds height="30.0" width="30.0" x="70.0" y="255.0" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="task1" id="task1_gui"> <omgdc:Bounds height="80.0" width="100.0" x="176.0" y="230.0" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="gateway1" id="gateway1_gui" isMarkerVisible="true"> <omgdc:Bounds height="40.0" width="40.0" x="340.0" y="250.0" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="task2" id="task2_gui"> <omgdc:Bounds height="80.0" width="100.0" x="445.0" y="138.0" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="gateway2" id="gateway2_gui" isMarkerVisible="true"> <omgdc:Bounds height="40.0" width="40.0" x="620.0" y="250.0" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="task3" id="task3_gui"> <omgdc:Bounds height="80.0" width="100.0" x="453.0" y="304.0" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="theEnd" id="theEnd_gui"> <omgdc:Bounds height="28.0" width="28.0" x="713.0" y="256.0" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="flowTask1ToGateway1" id="flowTask1ToGateway1_gui"> <omgdi:waypoint x="276.0" y="270.0" /> <omgdi:waypoint x="340.0" y="270.0" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flowTask2ToGateway2" id="flowTask2ToGateway2_gui"> <omgdi:waypoint x="545.0" y="178.0" /> <omgdi:waypoint x="640.5" y="178.0" /> <omgdi:waypoint x="640.0" y="250.0" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flowGateway1ToTask2" id="flowGateway1ToTask2_gui"> <omgdi:waypoint x="360.0" y="250.0" /> <omgdi:waypoint x="360.5" y="178.0" /> <omgdi:waypoint x="445.0" y="178.0" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flowGateway2ToEnd" id="flowGateway2ToEnd_gui"> <omgdi:waypoint x="660.0" y="270.0" /> <omgdi:waypoint x="713.0" y="270.0" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flowStartToTask1" id="flowStartToTask1_gui"> <omgdi:waypoint x="100.0" y="270.0" /> <omgdi:waypoint x="176.0" y="270.0" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flowGateway1ToTask3" id="flowGateway1ToTask3_gui"> <omgdi:waypoint x="360.0" y="290.0" /> <omgdi:waypoint x="360.5" y="344.0" /> <omgdi:waypoint x="453.0" y="344.0" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flowTask3ToGateway2" id="flowTask3ToGateway2_gui"> <omgdi:waypoint x="553.0" y="344.0" /> <omgdi:waypoint x="640.0" y="344.0" /> <omgdi:waypoint x="640.0" y="290.0" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions> ```
/content/code_sandbox/modules/flowable5-test/src/test/resources/org/activiti/engine/test/bpmn/parse/BpmnParseTest.testParseDiagramInterchangeElements.bpmn20.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
1,660
```xml /** * @license * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import { HashMapUint64 } from "#src/gpu_hash/hash_table.js"; import { GPUHashTable, HashMapShaderManager, HashSetShaderManager, } from "#src/gpu_hash/shader.js"; import { SegmentColorShaderManager, SegmentStatedColorShaderManager, } from "#src/segment_color.js"; import { getVisibleSegments } from "#src/segmentation_display_state/base.js"; import type { SegmentationDisplayState } from "#src/segmentation_display_state/frontend.js"; import { registerRedrawWhenSegmentationDisplayStateChanged } from "#src/segmentation_display_state/frontend.js"; import type { SliceViewSourceOptions } from "#src/sliceview/base.js"; import type { SliceView, SliceViewSingleResolutionSource, } from "#src/sliceview/frontend.js"; import type { MultiscaleVolumeChunkSource, VolumeChunkSource, } from "#src/sliceview/volume/frontend.js"; import type { RenderLayerBaseOptions } from "#src/sliceview/volume/renderlayer.js"; import { SliceViewVolumeRenderLayer } from "#src/sliceview/volume/renderlayer.js"; import type { WatchableValueInterface } from "#src/trackable_value.js"; import { AggregateWatchableValue, makeCachedDerivedWatchableValue, } from "#src/trackable_value.js"; import type { Uint64Map } from "#src/uint64_map.js"; import type { DisjointUint64Sets } from "#src/util/disjoint_sets.js"; import type { ShaderBuilder, ShaderProgram } from "#src/webgl/shader.js"; export class EquivalencesHashMap { generation = Number.NaN; hashMap = new HashMapUint64(); constructor(public disjointSets: DisjointUint64Sets) {} update() { const { disjointSets } = this; const { generation } = disjointSets; if (this.generation !== generation) { this.generation = generation; const { hashMap } = this; hashMap.clear(); for (const [objectId, minObjectId] of disjointSets.mappings()) { hashMap.set(objectId, minObjectId); } } } } export interface SliceViewSegmentationDisplayState extends SegmentationDisplayState, RenderLayerBaseOptions { selectedAlpha: WatchableValueInterface<number>; notSelectedAlpha: WatchableValueInterface<number>; hideSegmentZero: WatchableValueInterface<boolean>; ignoreNullVisibleSet: WatchableValueInterface<boolean>; } interface ShaderParameters { hasEquivalences: boolean; baseSegmentColoring: boolean; baseSegmentHighlighting: boolean; hasSegmentStatedColors: boolean; hideSegmentZero: boolean; hasSegmentDefaultColor: boolean; hasHighlightColor: boolean; } const HAS_SELECTED_SEGMENT_FLAG = 1; const SHOW_ALL_SEGMENTS_FLAG = 2; export class SegmentationRenderLayer extends SliceViewVolumeRenderLayer<ShaderParameters> { public readonly segmentationGroupState = this.displayState.segmentationGroupState.value; protected segmentColorShaderManager = new SegmentColorShaderManager( "segmentColorHash", ); protected segmentStatedColorShaderManager = new SegmentStatedColorShaderManager("segmentStatedColor"); private gpuSegmentStatedColorHashTable: | GPUHashTable<HashMapUint64> | undefined; private hashTableManager = new HashSetShaderManager("visibleSegments"); private gpuHashTable = this.registerDisposer( GPUHashTable.get( this.gl, this.segmentationGroupState.visibleSegments.hashTable, ), ); private gpuTemporaryHashTable = GPUHashTable.get( this.gl, this.segmentationGroupState.temporaryVisibleSegments.hashTable, ); private equivalencesShaderManager = new HashMapShaderManager("equivalences"); private equivalencesHashMap = new EquivalencesHashMap( this.segmentationGroupState.segmentEquivalences.disjointSets, ); private temporaryEquivalencesHashMap = new EquivalencesHashMap( this.segmentationGroupState.temporarySegmentEquivalences.disjointSets, ); private gpuEquivalencesHashTable = this.registerDisposer( GPUHashTable.get(this.gl, this.equivalencesHashMap.hashMap), ); private gpuTemporaryEquivalencesHashTable = this.registerDisposer( GPUHashTable.get(this.gl, this.temporaryEquivalencesHashMap.hashMap), ); constructor( multiscaleSource: MultiscaleVolumeChunkSource, public displayState: SliceViewSegmentationDisplayState, ) { super(multiscaleSource, { shaderParameters: new AggregateWatchableValue((refCounted) => ({ hasEquivalences: refCounted.registerDisposer( makeCachedDerivedWatchableValue( (x) => x.size !== 0, [displayState.segmentationGroupState.value.segmentEquivalences], ), ), hasSegmentStatedColors: refCounted.registerDisposer( makeCachedDerivedWatchableValue( ( segmentStatedColors: Uint64Map, tempSegmentStatedColors2d: Uint64Map, useTempSegmentStatedColors2d: boolean, ) => { const releventMap = useTempSegmentStatedColors2d ? tempSegmentStatedColors2d : segmentStatedColors; return releventMap.size !== 0; }, [ displayState.segmentStatedColors, displayState.tempSegmentStatedColors2d, displayState.useTempSegmentStatedColors2d, ], ), ), hasSegmentDefaultColor: refCounted.registerDisposer( makeCachedDerivedWatchableValue( (segmentDefaultColor, tempSegmentDefaultColor2d) => { return ( segmentDefaultColor !== undefined || tempSegmentDefaultColor2d !== undefined ); }, [ displayState.segmentDefaultColor, displayState.tempSegmentDefaultColor2d, ], ), ), hasHighlightColor: refCounted.registerDisposer( makeCachedDerivedWatchableValue( (x) => x !== undefined, [displayState.highlightColor], ), ), hideSegmentZero: displayState.hideSegmentZero, baseSegmentColoring: displayState.baseSegmentColoring, baseSegmentHighlighting: displayState.baseSegmentHighlighting, })), transform: displayState.transform, renderScaleHistogram: displayState.renderScaleHistogram, renderScaleTarget: displayState.renderScaleTarget, localPosition: displayState.localPosition, }); this.registerDisposer( this.shaderParameters as AggregateWatchableValue<ShaderParameters>, ); registerRedrawWhenSegmentationDisplayStateChanged(displayState, this); this.registerDisposer( displayState.selectedAlpha.changed.add(this.redrawNeeded.dispatch), ); this.registerDisposer( displayState.notSelectedAlpha.changed.add(this.redrawNeeded.dispatch), ); this.registerDisposer( displayState.ignoreNullVisibleSet.changed.add(this.redrawNeeded.dispatch), ); } disposed() { this.gpuSegmentStatedColorHashTable?.dispose(); } getSources( options: SliceViewSourceOptions, ): SliceViewSingleResolutionSource<VolumeChunkSource>[][] { return this.multiscaleSource.getSources({ ...options, discreteValues: true, }); } defineShader(builder: ShaderBuilder, parameters: ShaderParameters) { this.hashTableManager.defineShader(builder); let getUint64Code = ` uint64_t getUint64DataValue() { uint64_t x = toUint64(getDataValue()); `; getUint64Code += `return x; } `; builder.addFragmentCode(getUint64Code); if (parameters.hasEquivalences) { this.equivalencesShaderManager.defineShader(builder); builder.addFragmentCode(` uint64_t getMappedObjectId(uint64_t value) { uint64_t mappedValue; if (${this.equivalencesShaderManager.getFunctionName}(value, mappedValue)) { return mappedValue; } return value; } `); } else { builder.addFragmentCode(` uint64_t getMappedObjectId(uint64_t value) { return value; } `); } builder.addUniform("highp uvec2", "uSelectedSegment"); builder.addUniform("highp uint", "uFlags"); builder.addUniform("highp float", "uSelectedAlpha"); builder.addUniform("highp float", "uNotSelectedAlpha"); builder.addUniform("highp float", "uSaturation"); let fragmentMain = ` uint64_t baseValue = getUint64DataValue(); uint64_t value = getMappedObjectId(baseValue); uint64_t valueForColor = ${ parameters.baseSegmentColoring ? "baseValue" : "value" }; uint64_t valueForHighlight = ${ parameters.baseSegmentHighlighting ? "baseValue" : "value" }; float alpha = uSelectedAlpha; float saturation = uSaturation; `; if (parameters.hideSegmentZero) { fragmentMain += ` if (value.value[0] == 0u && value.value[1] == 0u) { emit(vec4(vec4(0, 0, 0, 0))); return; } `; } fragmentMain += ` bool has = (uFlags & ${SHOW_ALL_SEGMENTS_FLAG}u) != 0u ? true : ${this.hashTableManager.hasFunctionName}(value); if ((uFlags & ${HAS_SELECTED_SEGMENT_FLAG}u) != 0u && uSelectedSegment == valueForHighlight.value) { float adjustment = has ? 0.5 : 0.75; if (saturation > adjustment) { saturation -= adjustment; } else { saturation += adjustment; } `; if (parameters.hasHighlightColor) { builder.addUniform("highp vec4", "uHighlightColor"); fragmentMain += ` emit(uHighlightColor); return; `; } fragmentMain += ` } else if (!has) { alpha = uNotSelectedAlpha; } `; let getMappedIdColor = `vec4 getMappedIdColor(uint64_t value) { `; // If the value has a mapped color, use it; otherwise, compute the color. if (parameters.hasSegmentStatedColors) { this.segmentStatedColorShaderManager.defineShader(builder); getMappedIdColor += ` vec4 rgba; if (${this.segmentStatedColorShaderManager.getFunctionName}(value, rgba)) { return rgba; } `; } if (parameters.hasSegmentDefaultColor) { builder.addUniform("highp vec4", "uSegmentDefaultColor"); getMappedIdColor += ` return uSegmentDefaultColor; `; } else { this.segmentColorShaderManager.defineShader(builder); getMappedIdColor += ` return vec4(segmentColorHash(value), 0.0); `; } getMappedIdColor += ` } `; builder.addFragmentCode(getMappedIdColor); fragmentMain += ` vec4 rgba = getMappedIdColor(valueForColor); if (rgba.a > 0.0) { alpha = rgba.a; } emit(vec4(mix(vec3(1.0,1.0,1.0), vec3(rgba), saturation), alpha)); `; builder.setFragmentMain(fragmentMain); } initializeShader( _sliceView: SliceView, shader: ShaderProgram, parameters: ShaderParameters, ) { const { gl } = this; const { displayState, segmentationGroupState } = this; const { segmentSelectionState } = this.displayState; const { segmentDefaultColor: { value: segmentDefaultColor }, segmentColorHash: { value: segmentColorHash }, highlightColor: { value: highlightColor }, tempSegmentDefaultColor2d: { value: tempSegmentDefaultColor2d }, } = this.displayState; const visibleSegments = getVisibleSegments(segmentationGroupState); const ignoreNullSegmentSet = this.displayState.ignoreNullVisibleSet.value; let selectedSegmentLow = 0; let selectedSegmentHigh = 0; let flags = 0; if ( segmentSelectionState.hasSelectedSegment && displayState.hoverHighlight.value ) { const seg = displayState.baseSegmentHighlighting.value ? segmentSelectionState.baseSelectedSegment : segmentSelectionState.selectedSegment; selectedSegmentLow = seg.low; selectedSegmentHigh = seg.high; flags |= HAS_SELECTED_SEGMENT_FLAG; } gl.uniform1f( shader.uniform("uSelectedAlpha"), displayState.selectedAlpha.value, ); gl.uniform1f(shader.uniform("uSaturation"), displayState.saturation.value); gl.uniform1f( shader.uniform("uNotSelectedAlpha"), displayState.notSelectedAlpha.value, ); gl.uniform2ui( shader.uniform("uSelectedSegment"), selectedSegmentLow, selectedSegmentHigh, ); if (visibleSegments.hashTable.size === 0 && ignoreNullSegmentSet) { flags |= SHOW_ALL_SEGMENTS_FLAG; } gl.uniform1ui(shader.uniform("uFlags"), flags); this.hashTableManager.enable( gl, shader, segmentationGroupState.useTemporaryVisibleSegments.value ? this.gpuTemporaryHashTable : this.gpuHashTable, ); if (parameters.hasEquivalences) { const useTemp = segmentationGroupState.useTemporarySegmentEquivalences.value; (useTemp ? this.temporaryEquivalencesHashMap : this.equivalencesHashMap ).update(); this.equivalencesShaderManager.enable( gl, shader, useTemp ? this.gpuTemporaryEquivalencesHashTable : this.gpuEquivalencesHashTable, ); } const activeSegmentDefaultColor = tempSegmentDefaultColor2d || segmentDefaultColor; if (activeSegmentDefaultColor) { const [r, g, b, a] = activeSegmentDefaultColor; gl.uniform4f( shader.uniform("uSegmentDefaultColor"), r, g, b, a === undefined ? 0 : a, ); } else { this.segmentColorShaderManager.enable(gl, shader, segmentColorHash); } if (parameters.hasSegmentStatedColors) { const segmentStatedColors = displayState.useTempSegmentStatedColors2d .value ? displayState.tempSegmentStatedColors2d.value : displayState.segmentStatedColors.value; let { gpuSegmentStatedColorHashTable } = this; if ( gpuSegmentStatedColorHashTable === undefined || gpuSegmentStatedColorHashTable.hashTable !== segmentStatedColors.hashTable ) { gpuSegmentStatedColorHashTable?.dispose(); this.gpuSegmentStatedColorHashTable = gpuSegmentStatedColorHashTable = GPUHashTable.get(gl, segmentStatedColors.hashTable); } this.segmentStatedColorShaderManager.enable( gl, shader, gpuSegmentStatedColorHashTable, ); } if (highlightColor !== undefined) { gl.uniform4fv(shader.uniform("uHighlightColor"), highlightColor); } } endSlice( sliceView: SliceView, shader: ShaderProgram, parameters: ShaderParameters, ) { const { gl } = this; this.hashTableManager.disable(gl, shader); if (parameters.hasEquivalences) { this.equivalencesShaderManager.disable(gl, shader); } if (parameters.hasSegmentStatedColors) { this.segmentStatedColorShaderManager.disable(gl, shader); } super.endSlice(sliceView, shader, parameters); } } ```
/content/code_sandbox/src/sliceview/volume/segmentation_renderlayer.ts
xml
2016-05-27T02:37:25
2024-08-16T07:24:25
neuroglancer
google/neuroglancer
1,045
3,384
```xml import { addressesThunk, initEvent, serverEvent, userSettingsThunk, userThunk, welcomeFlagsActions, } from '@proton/account'; import * as bootstrap from '@proton/account/bootstrap'; import { WasmProtonWalletApiClient } from '@proton/andromeda'; import { type NotificationsManager } from '@proton/components/containers/notifications/manager'; import { setupGuestCrossStorage } from '@proton/cross-storage/account-impl/guestInstance'; import { FeatureCode, fetchFeatures } from '@proton/features'; import createApi from '@proton/shared/lib/api/createApi'; import { getSilentApi } from '@proton/shared/lib/api/helpers/customConfig'; import { getClientID } from '@proton/shared/lib/apps/helper'; import { getAppFromPathnameSafe } from '@proton/shared/lib/apps/slugHelper'; import { createDrawerApi } from '@proton/shared/lib/drawer/createDrawerApi'; import { getIsAuthorizedApp } from '@proton/shared/lib/drawer/helpers'; import { getAppVersionStr } from '@proton/shared/lib/fetch/headers'; import { getIsIframe } from '@proton/shared/lib/helpers/browser'; import { initElectronClassnames } from '@proton/shared/lib/helpers/initElectronClassnames'; import type { ProtonConfig } from '@proton/shared/lib/interfaces'; import noop from '@proton/utils/noop'; import locales from './locales'; import { extendStore, setupStore } from './store/store'; const getAppContainer = () => import(/* webpackChunkName: "MainContainer" */ './containers/MainContainer').then((result) => result.default); export const bootstrapApp = async ({ config, signal, notificationsManager, }: { config: ProtonConfig; signal?: AbortSignal; notificationsManager: NotificationsManager; }) => { const pathname = window.location.pathname; const searchParams = new URLSearchParams(window.location.search); const isIframe = getIsIframe(); const parentApp = getAppFromPathnameSafe(pathname); const isDrawerApp = isIframe && parentApp && getIsAuthorizedApp(parentApp); const api = isDrawerApp ? createDrawerApi({ parentApp, appVersion: config.APP_VERSION }) : createApi({ config }); const silentApi = getSilentApi(api); const authentication = bootstrap.createAuthentication(); bootstrap.init({ config, authentication, locales }); setupGuestCrossStorage(); initElectronClassnames(); const appName = config.APP_NAME; const run = async () => { const appContainerPromise = getAppContainer(); const sessionResult = (isDrawerApp ? await bootstrap.loadDrawerSession({ authentication, api, parentApp, pathname, }) : undefined) || (await bootstrap.loadSession({ authentication, api, pathname, searchParams })); const appVersion = getAppVersionStr(getClientID(config.APP_NAME), config.APP_VERSION); const walletApi = new WasmProtonWalletApiClient( appVersion, navigator.userAgent, authentication.UID, window.location.origin, config.API_URL ); const history = bootstrap.createHistory({ sessionResult, pathname }); const unleashClient = bootstrap.createUnleash({ api: silentApi }); extendStore({ config, api, authentication, unleashClient, history, walletApi, notificationsManager }); const store = setupStore(); const dispatch = store.dispatch; if (sessionResult.session?.User) { dispatch(initEvent({ User: sessionResult.session.User })); } const loadUser = async () => { const [user, userSettings, features] = await Promise.all([ dispatch(userThunk()), dispatch(userSettingsThunk()), dispatch(fetchFeatures([FeatureCode.EarlyAccessScope])), ]); dispatch(welcomeFlagsActions.initial(userSettings)); const [scopes] = await Promise.all([ bootstrap.initUser({ appName, user, userSettings }), bootstrap.loadLocales({ userSettings, locales }), ]); return { user, userSettings, earlyAccessScope: features[FeatureCode.EarlyAccessScope], scopes }; }; const loadPreload = () => { return Promise.all([dispatch(addressesThunk())]); }; const userPromise = loadUser(); const preloadPromise = loadPreload(); const evPromise = bootstrap.eventManager({ api: silentApi }); const unleashPromise = bootstrap.unleashReady({ unleashClient }).catch(noop); await unleashPromise; // Needs unleash to be loaded. await bootstrap.loadCrypto({ appName, unleashClient }); const [MainContainer, userData, eventManager] = await Promise.all([ appContainerPromise, userPromise, evPromise, ]); // Needs everything to be loaded. await bootstrap.postLoad({ appName, authentication, ...userData, history }); // Preloaded models are not needed until the app starts, and also important do it postLoad as these requests might fail due to missing scopes. await preloadPromise; extendStore({ eventManager }); const unsubscribeEventManager = eventManager.subscribe((event) => { dispatch(serverEvent(event)); }); eventManager.start(); bootstrap.onAbort(signal, () => { unsubscribeEventManager(); eventManager.reset(); unleashClient.stop(); store.unsubscribe(); }); return { ...userData, eventManager, unleashClient, history, store, MainContainer, }; }; return bootstrap.wrap({ appName, authentication }, run()); }; ```
/content/code_sandbox/applications/wallet/src/app/bootstrap.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
1,154
```xml import { TypeORMError } from "./TypeORMError" /** * Thrown if custom repository inherits Repository class however entity is not set in @EntityRepository decorator. */ export class CustomRepositoryCannotInheritRepositoryError extends TypeORMError { constructor(repository: any) { super( `Custom entity repository ${ typeof repository === "function" ? repository.name : repository.constructor.name } ` + ` cannot inherit Repository class without entity being set in the @EntityRepository decorator.`, ) } } ```
/content/code_sandbox/src/error/CustomRepositoryCannotInheritRepositoryError.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
109
```xml <clickhouse> <storage_configuration> <disks> <s3_plain_native_copy> <type>s3_plain</type> <endpoint>path_to_url <access_key_id>clickhouse</access_key_id> <secret_access_key>clickhouse</secret_access_key> <s3_allow_native_copy>true</s3_allow_native_copy> </s3_plain_native_copy> <s3_plain_another> <type>s3_plain</type> <endpoint>path_to_url <access_key_id>clickhouse</access_key_id> <secret_access_key>clickhouse</secret_access_key> <s3_allow_native_copy>true</s3_allow_native_copy> </s3_plain_another> <s3_plain_no_native_copy> <type>s3_plain</type> <endpoint>path_to_url <access_key_id>clickhouse</access_key_id> <secret_access_key>clickhouse</secret_access_key> <s3_allow_native_copy>false</s3_allow_native_copy> </s3_plain_no_native_copy> </disks> </storage_configuration> </clickhouse> ```
/content/code_sandbox/tests/queries/0_stateless/02802_clickhouse_disks_s3_copy.xml
xml
2016-06-02T08:28:18
2024-08-16T18:39:33
ClickHouse
ClickHouse/ClickHouse
36,234
253
```xml <?xml version="1.0" encoding="utf-8"?> <!-- ~ ~ ~ path_to_url ~ ~ Unless required by applicable law or agreed to in writing, software ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <resources> <string name="error_a11y_label">Fejl: ugyldig</string> <string name="mtrl_checkbox_state_description_checked">Markeret</string> <string name="mtrl_checkbox_state_description_unchecked">Ikke markeret</string> <string name="mtrl_checkbox_state_description_indeterminate">Delvist markeret</string> </resources> ```
/content/code_sandbox/lib/java/com/google/android/material/checkbox/res/values-da/strings.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
148
```xml import { ModuleWithProviders, NgModule } from '@angular/core'; import { HumanizePipe } from './HumanizePipe'; import { TranslateStatusPipe } from './TranslateStatus'; import { ThousandShortPipe } from './ThousandShortPipe'; import { SafePipe } from './SafePipe'; import { QualityPipe } from './QualityPipe'; import { OrderPipe } from './OrderPipe'; import { OmbiDatePipe } from './OmbiDatePipe'; import { FormatPipeModule, FormatPipe } from 'ngx-date-fns'; @NgModule({ imports: [FormatPipeModule], declarations: [HumanizePipe, ThousandShortPipe, SafePipe, QualityPipe, TranslateStatusPipe, OrderPipe, OmbiDatePipe], exports: [HumanizePipe, ThousandShortPipe, SafePipe, QualityPipe, TranslateStatusPipe, OrderPipe, OmbiDatePipe], providers: [FormatPipe], }) export class PipeModule { public static forRoot(): ModuleWithProviders<PipeModule> { return { ngModule: PipeModule, providers: [], }; } } ```
/content/code_sandbox/src/Ombi/ClientApp/src/app/pipes/pipe.module.ts
xml
2016-02-25T12:14:54
2024-08-14T22:56:44
Ombi
Ombi-app/Ombi
3,674
232
```xml import { Observable } from '../Observable'; /** * Tests to see if the object is an RxJS {@link Observable} * @param obj the object to test */ export declare function isObservable<T>(obj: any): obj is Observable<T>; ```
/content/code_sandbox/deps/node-10.15.3/tools/node_modules/eslint/node_modules/rxjs/internal/util/isObservable.d.ts
xml
2016-09-05T10:18:44
2024-08-11T13:21:40
LiquidCore
LiquidPlayer/LiquidCore
1,010
51
```xml import React from 'react'; import { createIcon } from '../createIcon'; import { G, Path } from '../nbSvg'; export const WarningIcon = createIcon({ viewBox: '0 0 24 24', d: 'M11.9836 0.00267822C8.77744 0.0551662 5.72075 1.36728 3.47427 3.65538C2.35024 4.77447 1.46338 6.10869 0.866705 7.57831C0.270027 9.04793 -0.0242179 10.6228 0.00155827 12.2087C-0.000286057 13.7583 0.303697 15.2931 0.896087 16.7251C1.48848 18.1571 2.35763 19.458 3.45373 20.5535C4.54983 21.6489 5.85133 22.5173 7.28365 23.1089C8.71596 23.7004 10.2509 24.0035 11.8006 24.0007H12.0146C15.2217 23.9677 18.2847 22.6638 20.5316 20.3751C22.7785 18.0864 24.0257 14.9999 23.9996 11.7927C24.0033 10.2243 23.6933 8.6709 23.0879 7.22398C22.4825 5.77706 21.5939 4.4658 20.4744 3.36731C19.3548 2.26882 18.0269 1.40527 16.5688 0.827453C15.1106 0.249636 13.5517 -0.0307856 11.9836 0.00267822ZM10.5007 16.5433C10.4935 16.3473 10.5254 16.1517 10.5947 15.9682C10.6639 15.7846 10.7691 15.6167 10.904 15.4742C11.0389 15.3318 11.2009 15.2177 11.3804 15.1386C11.5599 15.0594 11.7534 15.0169 11.9496 15.0135H11.9766C12.3712 15.0142 12.7501 15.1677 13.034 15.4417C13.3179 15.7157 13.4847 16.089 13.4995 16.4833C13.5068 16.6794 13.4749 16.875 13.4057 17.0586C13.3365 17.2423 13.2314 17.4102 13.0965 17.5527C12.9615 17.6952 12.7995 17.8093 12.6199 17.8884C12.4403 17.9674 12.2468 18.0099 12.0506 18.0132H12.0236C11.6291 18.0119 11.2505 17.8583 10.9667 17.5844C10.6829 17.3105 10.5159 16.9375 10.5007 16.5433ZM11.0007 12.5017V6.50215C11.0007 6.23695 11.106 5.98262 11.2935 5.7951C11.481 5.60758 11.7354 5.50223 12.0006 5.50223C12.2658 5.50223 12.5201 5.60758 12.7076 5.7951C12.8951 5.98262 13.0005 6.23695 13.0005 6.50215V12.5017C13.0005 12.7669 12.8951 13.0212 12.7076 13.2087C12.5201 13.3962 12.2658 13.5016 12.0006 13.5016C11.7354 13.5016 11.481 13.3962 11.2935 13.2087C11.106 13.0212 11.0007 12.7669 11.0007 12.5017Z', }); export const WarningTwoIcon = createIcon({ viewBox: '0 0 24 24', path: ( <G> <Path d="M13.9193 18.4271C13.8992 17.9392 13.6816 17.4813 13.3178 17.1478C12.9545 16.8148 12.4731 16.631 11.975 16.6304H11.9746H11.945V16.6304L11.9392 16.6305C11.6898 16.6348 11.4434 16.6864 11.2142 16.7827L11.333 17.0655L11.2142 16.7827C10.9851 16.879 10.7773 17.0183 10.6035 17.1931C10.4296 17.368 10.2932 17.5751 10.2031 17.8026C10.113 18.0302 10.0712 18.2732 10.0806 18.5171L10.0807 18.5176C10.1001 19.0055 10.3169 19.4638 10.6802 19.7979C11.043 20.1315 11.5241 20.3162 12.0222 20.3177H12.0233H12.0529V20.3178L12.058 20.3177C12.3081 20.3138 12.5552 20.2624 12.785 20.1661C13.0148 20.0698 13.2232 19.9303 13.3974 19.7549C13.5716 19.5795 13.7081 19.3718 13.7981 19.1436C13.8881 18.9153 13.9295 18.6716 13.9193 18.4271ZM13.9193 18.4271L13.5863 18.4408M13.9193 18.4271C13.9193 18.4271 13.9193 18.4271 13.9193 18.427L13.5863 18.4408M13.5863 18.4408C13.5945 18.6386 13.5611 18.836 13.488 19.0213C13.415 19.2066 13.3037 19.3762 13.1609 19.52C13.018 19.6638 12.8464 19.779 12.6561 19.8587C12.4658 19.9385 12.2607 19.9812 12.0529 19.9844H12.0233C11.6062 19.9831 11.2058 19.8284 10.9059 19.5525C10.6059 19.2767 10.4296 18.9011 10.4137 18.5043C10.4061 18.3069 10.4399 18.1101 10.513 17.9254C10.5862 17.7406 10.6973 17.5715 10.8399 17.4281C10.9824 17.2847 11.1536 17.1698 11.3434 17.09C11.5331 17.0103 11.7376 16.9674 11.945 16.9638H11.9746C12.3916 16.9642 12.7922 17.1182 13.0926 17.3936C13.393 17.6689 13.5699 18.0442 13.5863 18.4408ZM23.4665 20.2125L23.4665 20.2125C23.6068 20.4676 23.6751 20.7517 23.6658 21.0376C23.6566 21.3234 23.57 21.6033 23.4131 21.8501C23.2562 22.097 23.0337 22.3031 22.7658 22.4469C22.4978 22.5907 22.1942 22.6667 21.8847 22.6667H21.8846H2.11538H2.11533C1.80576 22.6667 1.50222 22.5907 1.23422 22.4469C0.96631 22.3031 0.743845 22.097 0.586879 21.8501L0.305565 22.0289L0.586879 21.8501C0.429998 21.6033 0.343434 21.3234 0.334166 21.0376C0.324898 20.7517 0.393165 20.4676 0.533517 20.2125L0.53353 20.2125L10.4192 2.23977C10.5681 1.96911 10.7933 1.74021 11.0721 1.5796C11.3511 1.41893 11.6722 1.33333 12.0005 1.33333C12.3289 1.33333 12.65 1.41893 12.9289 1.5796C13.2078 1.74021 13.4329 1.96911 13.5819 2.23977L23.4665 20.2125ZM11.0224 7.44182C10.7599 7.69176 10.6091 8.03434 10.6091 8.39521V14.4365C10.6091 14.7974 10.7599 15.1399 11.0224 15.3899C11.2843 15.6393 11.6363 15.7767 12 15.7767C12.3637 15.7767 12.7157 15.6393 12.9776 15.3899C13.2401 15.1399 13.3909 14.7974 13.3909 14.4365V8.39521C13.3909 8.03434 13.2401 7.69176 12.9776 7.44182C12.7157 7.19242 12.3637 7.05499 12 7.05499C11.6363 7.05499 11.2843 7.19242 11.0224 7.44182Z" stroke="currentColor" strokeWidth="0.666667" /> </G> ), }); ```
/content/code_sandbox/src/components/primitives/Icon/Icons/Warning.tsx
xml
2016-04-15T11:37:23
2024-08-14T16:16:44
NativeBase
GeekyAnts/NativeBase
20,132
2,739
```xml import {Store} from "@tsed/core"; import {Broadcast} from "../index.js"; describe("Broadcast", () => { it("should set metadata", () => { class Test {} Broadcast("eventName")(Test, "test", {} as any); const store = Store.from(Test); expect(store.get("socketIO")).toEqual({ handlers: { test: { returns: { eventName: "eventName", type: "broadcast" } } } }); }); }); ```
/content/code_sandbox/packages/third-parties/socketio/src/decorators/broadcast.spec.ts
xml
2016-02-21T18:38:47
2024-08-14T21:19:48
tsed
tsedio/tsed
2,817
108
```xml import * as React from 'react'; import { ReactElement } from 'react'; import { ListBase, ListControllerProps, RaRecord } from 'ra-core'; import { ListView, ListViewProps } from './ListView'; /** * List page component * * The <List> component renders the list layout (title, buttons, filters, pagination), * and fetches the list of records from the REST API. * * It then delegates the rendering of the list of records to its child component. * Usually, it's a <Datagrid>, responsible for displaying a table with one row for each post. * * The <List> component accepts the following props: * * - actions * - aside: Side Component * - children: List Layout * - component * - disableAuthentication * - disableSyncWithLocation * - empty: Empty Page Component * - emptyWhileLoading * - exporter * - filters: Filter Inputs * - filter: Permanent Filter * - filterDefaultValues * - pagination: Pagination Component * - perPage: Pagination Size * - queryOptions * - sort: Default Sort Field & Order * - title * - sx: CSS API * * @example * const postFilters = [ * <TextInput label="Search" source="q" alwaysOn />, * <TextInput label="Title" source="title" /> * ]; * export const PostList = () => ( * <List * title="List of posts" * sort={{ field: 'published_at' }} * filter={{ is_published: true }} * filters={postFilters} * > * <Datagrid> * <TextField source="id" /> * <TextField source="title" /> * <EditButton /> * </Datagrid> * </List> * ); */ export const List = <RecordType extends RaRecord = any>({ debounce, disableAuthentication, disableSyncWithLocation, exporter, filter = defaultFilter, filterDefaultValues, perPage = 10, queryOptions, resource, sort, storeKey, ...rest }: ListProps<RecordType>): ReactElement => ( <ListBase<RecordType> debounce={debounce} disableAuthentication={disableAuthentication} disableSyncWithLocation={disableSyncWithLocation} exporter={exporter} filter={filter} filterDefaultValues={filterDefaultValues} perPage={perPage} queryOptions={queryOptions} resource={resource} sort={sort} storeKey={storeKey} > <ListView<RecordType> {...rest} /> </ListBase> ); export interface ListProps<RecordType extends RaRecord = any> extends ListControllerProps<RecordType>, ListViewProps {} const defaultFilter = {}; ```
/content/code_sandbox/packages/ra-ui-materialui/src/list/List.tsx
xml
2016-07-13T07:58:54
2024-08-16T18:32:27
react-admin
marmelab/react-admin
24,624
595
```xml <?xml version="1.0" encoding="utf-8"?> <!-- path_to_url Unless required by applicable law or agreed to in writing, software WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <selector xmlns:android="path_to_url"> <!-- Disabled --> <item android:alpha="@dimen/material_emphasis_disabled_background" android:color="?attr/colorOnSurface" android:state_enabled="false"/> <!-- Selected --> <item android:color="@android:color/transparent" android:state_selected="true"/> <item android:color="@android:color/transparent" android:state_checked="true"/> <!-- Focused --> <item android:color="?attr/colorOnSurface" android:state_focused="true"/> <!-- Other states --> <item android:color="?attr/colorOutline"/> </selector> ```
/content/code_sandbox/lib/java/com/google/android/material/chip/res/color/m3_assist_chip_stroke_color.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
185
```xml <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Global string --> <string name="ok">OK</string> <string name="cancel">Avbryt</string> <string name="yes">Ja</string> <string name="no">Nej</string> <string name="error">Fel</string> <string name="warning">Varning</string> <string name="shutdown">Avsluta</string> <string name="replace">Erstt</string> <string name="add">Lgg till</string> <string name="delete">Radera</string> <string name="deleting">Tar bort</string> <string name="select_all">Markera allt</string> <string name="save">Spara</string> <string name="search">Sk</string> <string name="not_available">---</string> <!-- 1 d. 1 h. 1 m --> <string name="elapsed_time_format_d_h_mm">%1$d d. %2$d h %3$d m</string> <!-- 1 h. 1 m. 1 s --> <string name="elapsed_time_format_h_mm_ss">%1$d tim. %2$d m %3$d s</string> <!-- 1 m. 1 s --> <string name="elapsed_time_format_mm_ss">%1$d m. %2$d s</string> <!-- 1 s --> <string name="elapsed_time_format_ss">%1$d s</string> <string name="def">Frvalt</string> <string name="foreground_notification">Meddelande i frgrunden</string> <string name="link">Lnk</string> <string name="filter">Filtrera</string> <string name="refresh">Uppdatera</string> <string name="edit">Redigera</string> <string name="menu">Meny</string> <string name="open_navigation_drawer">ppna navigeringspanelen</string> <string name="close_navigation_drawer">Stng navigeringspanelen</string> <string name="file">Fil</string> <string name="folder">Mapp</string> <string name="finished">Slutfrd</string> <string name="pause_all">Pausa alla</string> <string name="resume_all">teruppta alla</string> <string name="all">Alla</string> <string name="details">Detaljer</string> <string name="stats">Statistik</string> <string name="filters">Filter</string> <string name="apply">Verkstll</string> <string name="clipboard">Urklipp</string> <string name="switch_on">P</string> <string name="switch_off">Av</string> <!-- Main window --> <string name="delete_torrent_with_downloaded_files">Radera med hmtade filer</string> <string name="delete_selected_torrent">Ta bort vald torrent? (Kan inte ngras.)</string> <string name="delete_selected_torrents">Ta bort valda torrenter? (Kan inte ngras.)</string> <string name="force_announce_torrent">Tvinga tillknnagivande</string> <string name="add_link">Lgg till lnk</string> <string name="dialog_add_link_title">Ange infohash-vrdet, magnet-lnk eller HTTP/S-lnk</string> <string name="torrent_list_empty">Inga torrenter</string> <string name="select_or_add_torrent">Vlj eller lgg till en torrent</string> <string name="error_empty_link">Ange lnken</string> <string name="error_invalid_link">Ogiltig lnk</string> <string name="error_open_torrent_file">Det gr inte att ppna .torrent-filen</string> <string name="open_file">ppna fil</string> <string name="settings">Instllningar</string> <string name="ip_filter_add_error">Det gick inte att lgga till IP-filtret (%1$d misslyckades). Kanske r filen skadad eller har fel format?</string> <string name="ip_filter_add_success">IP-filtret lades till</string> <string name="proxy_settings_applied">Anvnder de nya instllningarna fr proxyservern.</string> <string name="proxy_settings_apply_after_reboot">Starta om appen fr att anvnda de nya instllningarna fr proxyservern.</string> <string name="theme_settings_apply_after_reboot">Starta om appen fr att anvnda det nya temat.</string> <!-- Navigation drawer --> <!-- total download/upload download/upload speed --> <string name="session_stats_download_upload">%1$s %2$s/s</string> <!-- Status --> <string name="drawer_status">Status</string> <string name="drawer_status_downloading">Hmtar</string> <string name="drawer_status_downloading_metadata">Hmtar metadata</string> <string name="drawer_status_error">Fel</string> <!-- Sorting --> <string name="drawer_sorting_name">Namn</string> <string name="drawer_sorting_progress">Frlopp</string> <string name="drawer_sorting_ETA">ETA</string> <!-- Date added --> <!-- Tags --> <string name="tags">Taggar</string> <string name="add_tag">Lgg till tagg</string> <string name="tag_name">Taggnamn</string> <string name="tag_color">Taggfrg</string> <string name="add_tag_failed">Kunde inte lgga till tagg</string> <string name="tag_deleting_failed">Kunde inte ta bort tagg</string> <string name="tag_already_exists">Den hr taggen finns redan</string> <string name="no_tags">Inga taggar</string> <!-- Foreground notification --> <!-- percent ETA download speed name --> <string name="downloading_torrent_notify_template">%1$d%% %2$s %3$s/s %4$s</string> <!-- status upload speed name --> <string name="seeding_torrent_notify_template">%1$s %2$s/s %3$s</string> <!-- status name --> <string name="other_torrent_notify_template">%1$s %2$s</string> <string name="network_online">Uppkopplad</string> <string name="network_offline">Nerkopplad</string> <!-- Error notification --> <string name="error_template">Fel: %1$s</string> <string name="restore_torrent_error">Det gr inte att terstlla torrent frn fregende session.</string> <!-- ip_address:port, type (error: error_msg)--> <string name="nat_error_title">NAT-fel</string> <!-- Finish notification --> <!-- Torrents move notification --> <string name="torrent_moving_content">Vnligen vnta medans %1$s flyttas</string> <string name="torrent_move_success">Torrent flyttades</string> <string name="torrent_move_fail">Kunde inte flytta torrent</string> <!-- Added notification --> <!-- Torrent list item --> <!-- downloaded/total (percent) --> <string name="download_counter_template">%1$s/%2$s (%3$d%%)</string> <!-- download speed | upload speed --> <string name="download_upload_speed_template"> %1$s/s | %2$s/s</string> <!-- downloaded/total percent ETA --> <string name="download_counter_ETA_template">%1$s/%2$s %3$d%% %4$s</string> <!-- connected/total --> <string name="peers_template">%1$d/%2$d</string> <string name="torrent_status_downloading">Hmtar</string> <string name="torrent_status_seeding">Distribuerar</string> <string name="torrent_status_paused">Pausad</string> <string name="torrent_status_stopped">Stoppad</string> <string name="torrent_status_checking">Kontrollerar</string> <string name="torrent_status_finished">Slutfrd</string> <string name="torrent_status_downloading_metadata">Hmtar metadata</string> <!-- Permission dialog --> <string name="perm_denied_title">tkomst nekad</string> <string name="perm_denied_warning">Lagringstillstnd krvs fr att hmta torrenter och komma t .torrent-filer. Vill du verkligen avfrda detta tillstnd?</string> <!-- Add torrent dialog --> <string name="add_torrent_title">Lgg till torrent</string> <string name="error_decode_torrent">Det gick inte att avkoda .torrent-filen. Den kanske r skadad eller i ett felaktigt format?</string> <string name="error_io_torrent">Det gick inte att lsa .torrent-filen</string> <string name="error_fetch_link">Det gick inte att hmta data frn lnken</string> <string name="error_invalid_link_or_path">Ogiltig lnk eller torrentskvg</string> <string name="error_add_torrent">Det gick inte att lgga till torrenten</string> <string name="error_file_not_found_add_torrent">Det gick inte att lgga till torrenten. Kanske har .torrent-filen flyttats eller tagits bort?</string> <string name="error_io_add_torrent">Det gr inte att lgga till torrenten p grund av ett I/O-fel.</string> <string name="torrent_exist">Eftersom att torrenten redan finns s slogs de ihop.</string> <string name="error_field_required">Obligatoriskt flt</string> <string name="error_no_files_selected">Inga filer valda</string> <string name="free_space">%1$s ledigt</string> <string name="error_free_space">Det finns inte tillrckligt med ledigt utrymme fr att hmta de valda filerna.</string> <string name="files_size">%1$s av %2$s valdes</string> <string name="start_torrent">Starta torrent</string> <string name="file_is_too_large_error">Filen r fr stor</string> <string name="unable_to_open_folder">Kan inte ppna den valda mappen. Prova vlj en annan.</string> <string name="error_empty_name">Ange ett namn</string> <string name="ignore_free_space">Ignorera lgt diskutrymme</string> <!-- Torrent info --> <string name="torrent_info">Information</string> <string name="torrent_files">Filer</string> <string name="torrent_name">Namn</string> <string name="upload_torrent_into">Skicka till</string> <string name="torrent_size">Storlek</string> <string name="torrent_file_count">Antal filer</string> <string name="torrent_hash_sum">Kontrollsumma</string> <string name="torrent_comment">Kommentar</string> <string name="torrent_create_date">Skapad</string> <string name="torrent_created_in_program">Skapad i programmet</string> <string name="sequential_download">Sekventiell hmtning</string> <!-- Filemanager dialog --> <string name="dir_chooser_title">Val av mapp</string> <string name="file_chooser_title">Val av fil</string> <string name="torrent_file_chooser_title">Val av Torrent</string> <string name="dialog_new_folder_title">Ny mapp</string> <string name="error_dialog_new_folder">Det gick inte att skapa ny mapp</string> <string name="error_open_dir">Det gick inte att ppna mappen</string> <string name="home_directory">Home</string> <!-- name (size) --> <string name="storage_name_and_size" formatted="false">%1$s (%2$s)</string> <string name="file_name">Filnamn</string> <string name="error_file_exists">Filen finns redan</string> <string name="file_name_is_empty">Ange ett namn frst</string> <!-- Error dialog --> <string name="report">Report</string> <!-- Detail torrent dialog --> <!-- priority downloaded/total percent availability --> <string name="file_priority_normal">Normal</string> <string name="file_priority_low">Ignore</string> <string name="file_priority_high">High</string> <string name="file_priority_mixed">Mixed</string> <string name="change_priority_low">Low (ignore file)</string> <string name="change_priority_normal">Normal</string> <string name="change_priority_high">High</string> <string name="torrent_ETA">ETA</string> <!-- connected (total) --> <string name="torrent_peers_template">%1$d (%2$d)</string> <!-- downloaded/total (piece length) --> <string name="torrent_pieces_template">%1$d/%2$d (%3$s)</string> <string name="dialog_add_trackers">(En per rad)</string> <string name="peer_port">Port: %1$d</string> <string name="peer_connection_type">Anslutning: %1$s</string> <!-- total download total upload --> <string name="peer_total_download_upload"> %1$s %2$s</string> <string name="peer_client">Klient: %1$s</string> <string name="peer_connection_type_bittorrent">BT</string> <string name="peer_connection_type_web">Webb</string> <string name="pause_torrent">Pausa</string> <string name="save_torrent_file_successfully">.torrent-filen sparades</string> <string name="error_save_torrent_file">Det gick inte att spara torrentfilen</string> <string name="upload_speed">Skicka</string> <string name="download_speed">Hmta</string> <string name="magnet_more_about_bep53">path_to_url fr mer information</string> <!-- Send text to clipboard --> <string name="text_copied_to_clipboard">Kopierades till klippbordet</string> <!-- Error report --> <string name="app_error_occurred">Ett appfel intrffade. Du kan rapportera det till utvecklarna.</string> <string name="error_comment_prompt">Lgg till extra information och kommentarer hr:</string> <!-- Feeds --> <string name="feed">RSS</string> <string name="feed_filter_prompt">Ange orden (separerat med \"|\")varav en av varje mste finnas i namnet eller ange ett vanligt uttryck. Torrenterna lggs endast till om det hr filtret matchar torrentens namn.</string> <string name="feed_filter_prompt_one_per_line">Ange ett filter per rad.</string> <string name="feed_auto_download">Hmtar torrenter automatiskt</string> <string name="delete_selected_channel">Ta bort vald kanal?</string> <string name="link_copied_to_clipboard">Kopierades till klippbordet</string> <string name="backup_feeds_successfully">Kanaler sparades</string> <string name="restore_feeds_backup_successfully">Kanaler terstlldes</string> <string name="error_backup_feeds">Det gick inte att spara kanaler</string> <string name="error_restore_feeds_backup">Det gick inte att terstlla kanaler</string> <!-- Create torrent dialog --> <string name="creating_torrent_progress">Vnligen vnta medan torrenten skapas</string> <string name="file_or_folder_for_seeding">Fil eller mapp att distribuera</string> <string name="error_please_select_file_or_folder_for_seeding_first">Vlj en fil eller mapp att distribuera frst.</string> <string name="web_seed_urls">URL:er fr webbdistribution</string> <string name="tracker_urls_hint">(Valfritt) ange en sprare per rad i prioriteringsordningen.</string> <string name="web_seed_urls_hint">(Valfritt) en per rad</string> <string name="optional_hint">(Valfritt)</string> <string name="create_torrent_options">Alternativ</string> <!-- piece_size_entries --> <string name="piece_size_entries_0">Automatisk</string> <string name="piece_size_entries_1">16 KiB</string> <string name="piece_size_entries_2">32 KiB</string> <string name="piece_size_entries_3">64 KiB</string> <string name="piece_size_entries_4">128 KiB</string> <string name="piece_size_entries_5">256 KiB</string> <string name="piece_size_entries_6">512 KiB</string> <string name="piece_size_entries_7">1 MiB</string> <string name="piece_size_entries_8">2 MiB</string> <string name="piece_size_entries_9">4 MiB</string> <string name="piece_size_entries_10">8 MiB</string> <string name="piece_size_entries_11">16 MiB</string> <string name="piece_size_entries_12">32 MiB</string> <string name="folder_is_empty">Den valda mappen r tom eller s exkluderas dess filer av filtret.</string> <string name="error_create_torrent">Det gick inte att skapa torrent</string> <string name="skip_files_hint">Ange filnamn separerade med \"|\".</string> <string name="select_folder_to_save">Vlj en mapp att spara.</string> <string name="unable_to_open_file">Kunde inte ppna den valda filen</string> <string name="unable_to_create_file">Kunde inte skapa fil</string> <!-- Log --> <string name="journal_save_log_failed">Kunde spara logg</string> <string name="journal_save_log_success">Logg sparades: %1$s</string> <!-- Log settings --> <!-- Settings --> <!-- Headers --> <string name="pref_header_network">Ntverk</string> <string name="pref_header_feed">RSS</string> <!-- Storage settings --> <string name="pref_save_torrent_files_summary">Spara .torrent-filer nr hmtningen startar.</string> <string name="pref_watch_dir_summary">.torrent-filerna i den hr mappen lggs automatiskt till och tas sedan bort.</string> <!-- Limitations settings --> <string name="pref_max_download_speed_title">Max. -hastighet</string> <string name="pref_max_upload_speed_title">Max. -hastighet</string> <string name="pref_max_connections_title">Max. antalet anslutningar</string> <string name="pref_max_connections_summary">(Min. 2 anslutningar.)</string> <string name="pref_max_active_uploads_title">Max. antalet aktiva sndningar</string> <string name="pref_max_active_downloads_title">Max. antalet aktiva hmtningar</string> <string name="pref_max_active_torrents_title">Max. antalet aktiva torrenter</string> <string name="pref_max_connections_per_torrent_title">Max. antalet anslutningar per torrent</string> <string name="pref_max_connections_per_torrent_summary">(Min. 2 anslutningar.)</string> <string name="pref_max_uploads_per_torrent_title">Max. antal sndningsplatser per torrent</string> <string name="pref_auto_manage_title">Hantera automatiskt</string> <string name="pref_auto_manage_summary">Torrenten kan terupptas automatiskt eller pausas nr som helst. (Kan sakta ner pausandet/terupptagandet.)</string> <!-- Appearance settings --> <string name="pref_theme_title">Tema</string> <!-- pref_theme_entries --> <string name="pref_theme_entries_0">Ljust</string> <string name="pref_theme_entries_1">Mrkt</string> <string name="pref_theme_entries_2">Svart</string> <string name="pref_torrent_finish_notify_summary">Visa avisering nr en torrent r hmtad.</string> <string name="pref_notify_sound_title">Aviseringsljud</string> <!-- Behavior settings --> <string name="pref_autostart_title">Starta automatiskt</string> <string name="pref_autostart_summary">Kr appen nr enheten startas.</string> <!-- A synonym for word "unmetered" - unlimited--> <string name="pref_umnetered_connections_only_title">Endast obestmda anslutningar</string> <string name="pref_umnetered_connections_only_summary">Anvnd endast anslutningar utan avgift (exempelvis fr Wi-Fi eller Ethernet).</string> <string name="pref_enable_roaming_title">Roaming</string> <string name="pref_enable_roaming_summary">Hmta endast om enheten inte anvnder roaming.</string> <string name="pref_keep_alive_summary">Lter appen kras i bakgrunden. (Respekterar fortfarande att appen stngs nr alla hmtningar r frdiga.)</string> <string name="pref_shutdown_downloads_complete_title">Stng efter att alla hmtningar har avslutats</string> <string name="pref_shutdown_downloads_complete_summary">Avslutar appen nr allting r hmtat.</string> <string name="pref_cpu_do_not_sleep_summary">Anvnd om hmtningshastighet reduceras nr skrmen stngs av. (kar anvndningen av batteriet.)</string> <string name="pref_download_and_upload_only_when_charging_title">Hmta och skicka endast under laddning.</string> <string name="pref_download_and_upload_only_when_charging_summary">Inga filer verfrs om inte enheten laddas. (Pausar alla torrenter nr ingen laddare r ansluten.)</string> <string name="pref_battery_control_title">Batterikontroll</string> <string name="pref_battery_control_summary">Pausar alla torrenter om batterinivn hamnar under %1$d%%. (Grnsen gller inte under laddning.)</string> <string name="pref_custom_battery_control_summary">Stll in batteri-%% att pausa hmtningar vid. (Ignorerar %1$d%% som standard.)</string> <string name="pref_custom_battery_control_dialog_summary">Vill du verkligen stlla in ett batteri-%% att hlla utkik fr? (kar anvndning av batteriet under hmtning.)</string> <!-- Network settings --> <string name="pref_enable_dht_title">DHT</string> <string name="pref_enable_dht_summary">Tillter att hitta andra utan en sprare. (kar anvndningen av batteri.)</string> <string name="pref_enable_lsd_title">LSD</string> <string name="pref_enable_lsd_summary">Designad fr att sttta lokal upptckt med syfte p att minimera trafik.</string> <string name="pref_enable_utp_title">TP</string> <string name="pref_enable_utp_summary">Avsedd att mildra dlig latens och andra problem med verbelastningskontroll som hittas i konventionell BitTorrent ver TCP, samtidigt som den ger en plitlig bestlld leverans.</string> <string name="pref_enable_upnp_title">UPnP</string> <string name="pref_enable_natpmp_title">NAT-PMP</string> <string name="pref_use_random_port_summarty">Stller in startporten slumpmssigt inom intervallet [%1$d, %2$d] och den avslutande porten som den frsta + 10.</string> <string name="pref_port_range_start_title">Start</string> <string name="pref_port_range_end_title">Slut</string> <string name="pref_enc_mode_title">Lge</string> <!-- pref_enc_mode_entries --> <string name="pref_enc_mode_entries_0">Prefer encryption</string> <string name="pref_enc_mode_entries_1">Require encryption</string> <string name="pref_enc_mode_entries_2">Disable encryption</string> <string name="pref_enable_ip_filtering_title">IP-filtrering</string> <string name="pref_enable_ip_filtering_summary">Beroende p filstorleken, att verkstlla filtret vid uppstart kan ta lite tid. (kar minnesanvndningen.)</string> <string name="pref_anonymous_mode_title">Anonymt lge</string> <string name="pref_anonymous_mode_summary">Ingen anvndaragentstrng fr icke-privata torrenter. Endast proxifierade sprare. Lyssningsuttagen stngda. Inkommande anslutningar via SOCKS5 eller I2P-proxy (om det finns en jmlikeproxy p sprarproxydatorn). NAT-PMP, UPnP, DHT och lokal upptckt av.</string> <string name="pref_seeding_outgoing_connections_title">Utgende anslutningar fr distribution</string> <string name="pref_seeding_outgoing_connections_summary">Lter distribuerade torrenter skapa utgende anslutningar. (Kan bli dyrbart.)</string> <!-- Proxy settings --> <string name="pref_proxy_type_title">Typ av proxy</string> <!-- pref_proxy_type_entries --> <string name="pref_proxy_type_entries_0">(Ingen)</string> <string name="pref_proxy_type_entries_1">SOCKS4</string> <string name="pref_proxy_type_entries_2">SOCKS5</string> <string name="pref_proxy_type_entries_3">HTTP</string> <string name="pref_proxy_address_title">Adress</string> <string name="pref_proxy_port_title">Port</string> <string name="pref_proxy_peers_too_summary">Anslutningar till sprare, andra och webbdistributioner r proxifierade. Pverkar inte DHT.</string> <string name="pref_proxy_requires_auth_summary">Varning: Lsenordet sparas som en vanlig fil.</string> <string name="pref_proxy_login_title">Anvndarnamn</string> <string name="pref_proxy_password_title">Lsenord</string> <!-- Schedule settings --> <string name="pref_enable_scheduling_start_summary">Starta appen vid den specifika tiden. Torrenterna krs enligt deras tillstnd innan den sista avslutas.</string> <string name="pref_scheduling_switch_wifi_title">Vxla Wi-Fi</string> <string name="pref_scheduling_switch_wifi_summary">Aktivera Wi-Fi fr schemalagd start och inaktivera fr schemalagd stopp.</string> <!-- Feed settings --> <string name="pref_feed_auto_refresh_title">Uppdatera automatiskt kanaler</string> <string name="pref_feed_auto_refresh_summary">Uppdatera kanaler periodiskt i bakgrunden.</string> <!-- pref_feed_refresh_intervals_entries --> <string name="pref_feed_refresh_intervals_entries_0">15 minuter</string> <string name="pref_feed_refresh_intervals_entries_1">30 minuter</string> <string name="pref_feed_refresh_intervals_entries_2">1 timme</string> <string name="pref_feed_refresh_intervals_entries_3">2 timmar</string> <string name="pref_feed_refresh_intervals_entries_4">6 timmar</string> <string name="pref_feed_refresh_intervals_entries_5">12 timmar</string> <string name="pref_feed_refresh_intervals_entries_6">1 dag</string> <!-- A synonym for word "unmetered" - unlimited--> <string name="pref_feed_auto_refresh_unmetered_connections_only_title">Endast p obestmda anslutningar</string> <string name="pref_feed_auto_refresh_unmetered_connections_only_summary">Uppdatera endast p anslutningar utan en kvot (exempelvis Wi-Fi eller Ethernet).</string> <string name="pref_feed_auto_refresh_enable_roaming_title">Roaming</string> <!-- pref_feed_keep_items_time_entries --> <string name="pref_feed_keep_items_time_entries_0">1 dag</string> <string name="pref_feed_keep_items_time_entries_1">2 dagar</string> <string name="pref_feed_keep_items_time_entries_2">4 dagar</string> <string name="pref_feed_keep_items_time_entries_3">1 vecka</string> <string name="pref_feed_keep_items_time_entries_4">2 veckor</string> <string name="pref_feed_keep_items_time_entries_5">1 mnad</string> <string name="pref_feed_keep_items_time_entries_6">2 mnader</string> <string name="pref_feed_keep_items_time_entries_7">3 mnader</string> <string name="pref_feed_keep_items_time_entries_8">Always</string> <string name="pref_feed_start_torrents_title">Starta torrenter automatiskt</string> <string name="pref_feed_start_torrents_summary">Hmtar tillagda torrenter.</string> <string name="pref_feed_remove_duplicates_summary">Hoppar ver hmtning av redan nrvarande fil-titlar.</string> <!-- Streaming settings --> <string name="pref_streaming_enable_title">Strmning</string> <string name="pref_streaming_enable_summary">Tillt hmtning av enskilda filer frn en torrent genom att anvnda en webblsare eller mediaspelare via HTTP/S-webbadresser.</string> <string name="pref_streaming_hostname">Vrdnamn</string> <string name="pref_streaming_port">Port</string> <string name="pref_streaming_error">Vlj en port eller ett vrdnamn fr strmningar som inte r upptagna eller felaktiga.</string> <!-- About dialog --> <string name="about_title">Om</string> <string name="about_description">Mer info och hur man hjlper projektet: &lt;a href=path_to_url path_to_url LibreTorrent r en upphovsrttsbefriad fri (&lt;a href=path_to_url torrentklient fr Android 4+, baserad p libtorrent (Java-wrapper &lt;a href=path_to_url bibl.&lt;br&gt;&lt;br&gt;</string> <string name="torrent_moving_title">Flyttar torrent</string> <string name="torrent_finished_notify">Torrent frdig</string> <string name="session_error_title">Sessionsfel</string> <string name="torrent_error_notify_title">Torrentfel</string> <string name="notify_shutting_down">Avslutar</string> <string name="app_running_in_the_background">Krs i bakgrunden</string> <string name="torrent_count_notify_template">%1$d av %2$d</string> <string name="without_tags">Utan taggar</string> <string name="new_tag">Ny tagg</string> <string name="select_tag">Vlj tagg</string> <string name="edit_tag">Redigera tagg</string> <string name="drawer_date_added_year">r</string> <string name="drawer_date_added_month">Mnad</string> <string name="drawer_date_added_week">Vecka</string> <string name="drawer_date_added_yesterday">Igr</string> <string name="drawer_date_added_today">Idag</string> <string name="drawer_sorting_no_sorting">Ingen sortering</string> <string name="drawer_sorting_peers">Popularitet</string> <string name="drawer_sorting_size">Storlek</string> <string name="drawer_sorting">Sortering</string> <string name="session_stats_listen_port">Lyssningsport: %1$s</string> <string name="session_stats_dht_nodes">DHT-jmlikar: %1$d</string> <string name="about">Om</string> <string name="about_changelog">ndringslogg</string> <string name="pref_feed_remove_duplicates_title">Ingen duplicering</string> <string name="pref_feed_keep_items_time_title">Behll artiklar</string> <string name="pref_custom_battery_control_value_title">Procent av batterikontroll</string> <string name="pref_custom_battery_control_title">Anpassad batteriprocent</string> <string name="pref_torrent_queueing_category">Torrentk</string> <string name="pref_watch_dir_title">Bevaka mapp</string> <string name="pref_journal_max_stored_entries">Maximalt lagrade journal-poster</string> <string name="journal_filter_session_log">Sessionslogg</string> <string name="magnet_include_file_priorities">Inkludera prioriterade filer?</string> <string name="torrent_seeding_time">Tid fr distribution</string> <string name="torrent_leechers">Hmtare</string> <string name="drawer_date_added">Datum tillagd</string> <string name="drawer_sorting_date_added">Datum tillagd</string> <string name="pref_feed_refresh_interval_title">Uppdateringsintervall</string> <string name="pref_scheduling_run_only_once_title">Kr endast en gng</string> <string name="pref_enable_scheduling_shutdown_summary">Avsluta appen vid en specifik tid</string> <string name="pref_enable_scheduling_shutdown_title">Tid fr stngning</string> <string name="pref_enable_scheduling_start_title">Starttid</string> <string name="pref_proxy_requires_auth_title">Krver autentisering</string> <string name="pref_proxy_peers_too_title">Anvnd ocks fr anslutningar</string> <string name="pref_show_nat_errors">Visa NAT-fel</string> <string name="pref_ip_filtering_file_title">Genvg till filtreringsfil (.dat, .p2p)</string> <string name="pref_ip_filtering_category">IP-filtrering</string> <string name="pref_enc_out_connections_title">Utgende anslutningar</string> <string name="pref_enc_in_connections_title">Inkommande anslutningar</string> <string name="pref_encryption_category">Kryptering</string> <string name="pref_port_range_title">Portintervall</string> <string name="pref_use_random_port_title">Anvnd anpassad port</string> <string name="pref_port_settings_category">Port-instllningar</string> <string name="pref_proxy_settings_title">Proxyinstllningar</string> <string name="pref_cpu_do_not_sleep_title">Hll enheten vaken</string> <string name="pref_keep_alive_title">Hlla igng</string> <string name="pref_power_management_category">Strmhantering</string> <string name="pref_vibration_notify_title">Vibrering</string> <string name="pref_led_indicator_color_notify_title">Frg p LED-indikator</string> <string name="pref_led_indicator_notify_title">LED-indikator</string> <string name="pref_play_sound_notify_title">Spela ljud</string> <string name="pref_torrent_finish_notify_title">Avisering fr avslutad torrent</string> <string name="pref_notification_category">Aviseringsinstllningar</string> <string name="pref_theme_category">Tema-instllningar</string> <string name="pref_max_active_uploads_downloads_dialog_msg">-1 utan grns</string> <string name="pref_speed_category">Hastighet</string> <string name="pref_dir_to_watch_title">Mapp att bevaka</string> <string name="pref_save_torrent_files_in_title">Spara .torrent-filer i</string> <string name="pref_save_torrent_files_title">Spara .torrent-filer</string> <string name="pref_move_after_download_title">Flytta efter hmtning</string> <string name="pref_save_torrents_in_title">Spara torrenter i</string> <string name="pref_header_streaming">Strmning</string> <string name="pref_header_scheduling">Schemalggning</string> <string name="pref_header_limitations">Begrnsningar</string> <string name="pref_header_storage">Lagring</string> <string name="pref_header_behavior">Beteende</string> <string name="pref_header_appearance">Utseende</string> <string name="pref_journal_save_log_to">Spara logg till</string> <string name="journal_filter_torrent_log">Torrent-logg</string> <string name="journal_filter_portmap_log">UPnP/NAT-PMP-logg</string> <string name="journal_filter_peer_log">Anslutningslogg</string> <string name="journal_filter_dht_log">DHT-logg</string> <string name="journal_started_recording">Startade inspelning</string> <string name="journal_stop_recording">Stoppa inspelning</string> <string name="journal_start_recording">Brja spela in</string> <string name="journal_list_empty">Inga poster</string> <string name="log_journal">Journal</string> <string name="torrent_saved_to">Torrenten sparades till %1$s</string> <string name="skip_files">Hoppa ver filer</string> <string name="invalid_url">Ogiltig URL: %1$s</string> <string name="option_private_torrent">Privat torrent</string> <string name="option_start_seeding">Brja distribuera</string> <string name="piece_size">Storlek p del</string> <string name="comments">Kommentarer</string> <string name="tracker_urls">URL fr sprare</string> <string name="create_torrent">Skapa torrent</string> <string name="feed_item_url_not_found">URL hittades inte</string> <string name="feed_do_not_download_immediately">Hmta inte ner omedelbart</string> <string name="error_import_invalid_format">Ogiltigt format</string> <string name="feeds_backup_selection_dialog_title">Vlj skerhetskopieringsfil</string> <string name="feed_item_open_article_url">ppna artikel</string> <string name="feed_item_list_empty">Inga artiklar</string> <string name="mark_as_unread">Markera som o-lst</string> <string name="mark_as_read">Markera som lst</string> <string name="edit_feed_channel">Redigera kanal</string> <string name="delete_selected_channels">Ta bort valda kanaler?</string> <string name="copy_link">Kopiera lnk</string> <string name="error_cannot_delete_channel">Det gr inte att ta bort kanalen</string> <string name="error_cannot_edit_channel">Det gr inte att redigera kanalen</string> <string name="error_cannot_add_channel">Det gr inte att lgga till en kanal</string> <string name="feed_last_update_never">aldrig</string> <string name="feed_last_update_template">Uppdaterades: %1$s</string> <string name="restore_feed_channels_backup">terstll skerhetskopia</string> <string name="backup_feed_channels">Spara skerhetskopia</string> <string name="feed_use_regex">Anvnd vanligt uttryck</string> <string name="feed_name">(Valfritt) namn</string> <string name="add_feed_channel">Lgg till kanal</string> <string name="select_or_add_feed_channel">Vlj eller lgg till en RSS/Atom-kanal</string> <string name="feed_channel_list_empty">Inga kanaler</string> <string name="send_text_to_clipboard">Kopiera</string> <string name="edit_torrent_name">Redigera namn p torrent</string> <string name="tracker_list_empty">Inga sprare</string> <string name="share_stream_url">Dela strmmens URL</string> <string name="torrent_availability">Tillgnglighet</string> <string name="torrent_added_date">Lades till</string> <string name="speed_limit_dialog">Stll in hastighet i KiB/s (0 - utan grns)</string> <string name="resume_torrent">teruppta</string> <string name="peer_list_empty">Den hr torrenten har inte anslutit till ngon n</string> <string name="peer_connection_type_utp">TP</string> <string name="peer_relevance">Relevans: %1$.1f</string> <string name="open_using">ppna med</string> <string name="add_trackers">Lgg till sprare</string> <string name="delete_selected_trackers">Ta bort valda sprare?</string> <string name="delete_selected_tracker">Ta bort vald sprare?</string> <string name="share_tracker_url">Dela URL</string> <string name="tracker_state_not_contacted">Inte kontaktad nnu</string> <string name="tracker_state_updating">Uppdaterar</string> <string name="tracker_state_not_working">Fungerar inte</string> <string name="tracker_state_working">Fungerar</string> <string name="torrent_trackers">Sprare</string> <string name="torrent_pieces">Delar</string> <string name="torrent_active_time">Aktiv tid</string> <string name="torrent_uploaded">Skickat</string> <string name="torrent_peers">Jmlikar</string> <string name="torrent_seeds">Distributioner</string> <string name="torrent_downloaded">Hmtat</string> <string name="torrent_speed">Hastighet</string> <string name="torrent_state">Status</string> <string name="dialog_change_priority_title">ndra prioritet</string> <string name="change_priority">Prioritet</string> <string name="file_downloading_status_template">%1$s %2$s/%3$s %4$d%% \nTillgngligt: %5$s</string> <string name="more_details">Fler detaljer</string> <string name="parent_folder">Frldra-mapp</string> <string name="replace_file">Erstt fil</string> <string name="save_file">Spara fil</string> <string name="permission_denied">tkomst nekades</string> <string name="external_storage_name" formatted="false">Extern lagring %1$d</string> <string name="internal_storage_name">Intern lagring</string> <string name="drawer_status_downloaded">Hmtade</string> <string name="speed_limit_title">Maxhastighet</string> <string name="share_via">Dela via</string> <string name="torrent_speed_limit">Hastighetsgrns</string> <string name="save_torrent_file">Spara torrent-fil</string> <string name="share_magnet">Dela magnet</string> <string name="torrent_share_ratio">Utdelningskvot</string> <string name="piece_map">Kart-delar</string> <string name="force_recheck_torrent">Tvinga terkontroll</string> <string name="pref_move_after_download_in_title">Flytta efter hmtning till</string> <string name="pref_watch_dir_delete_file_title">Ta bort .torrent-filen efter tillggning</string> <string name="pref_default_trackers_list_summary">Sprarlista, som anvnds i fljande fall: \n1. Nr du lgger till en torrent lggs standardlistan automatiskt till i torrentlistan. \n2. Anvnds fr att hmta magnetlnkar.</string> <string name="pref_default_trackers_list_title">Standard sprare</string> <string name="pref_foreground_notify_combined_pause_button_summary">Kombinerar tv knappar: pausa alla och teruppta alla. Knappen fungerar som en omkopplare. Varning: knappstatusen pverkas inte av manuell pausning/terupptagning av torrenten.</string> <string name="pref_foreground_notify_combined_pause_button_title">Kombinerad pausknapp</string> <string name="pref_foreground_notify_sorting_entries_12">Ingen sortering</string> <string name="pref_foreground_notify_sorting_entries_11">Popularitet (strsta frst)</string> <string name="pref_foreground_notify_sorting_entries_10">Popularitet (minsta frst)</string> <string name="pref_foreground_notify_sorting_entries_9">ETA (strsta frst)</string> <string name="pref_foreground_notify_sorting_entries_8">ETA (minsta frst)</string> <string name="pref_foreground_notify_sorting_entries_7">Framsteg (strsta frst)</string> <string name="pref_foreground_notify_sorting_entries_6">Framsteg (minsta frst)</string> <string name="pref_foreground_notify_sorting_entries_5">Storlek (strsta frst)</string> <string name="pref_foreground_notify_sorting_entries_4">Storlek (minsta frst)</string> <string name="pref_foreground_notify_sorting_entries_3">Datumet lades till (ldst frst)</string> <string name="pref_foreground_notify_sorting_entries_2">Datumet lades till (nyaste frst)</string> <string name="pref_foreground_notify_sorting_entries_1">Namn ( - A)</string> <string name="pref_foreground_notify_sorting_entries_0">Namn (A - )</string> <string name="pref_foreground_notify_sorting">Sortering</string> <string name="pref_foreground_notify_status_filter_entries_4">Fel</string> <string name="pref_foreground_notify_status_filter_entries_3">Hmtar metadata</string> <string name="pref_foreground_notify_status_filter_entries_2">Hmtad</string> <string name="pref_foreground_notify_status_filter_entries_1">Hmtar</string> <string name="pref_foreground_notify_status_filter_entries_0">Alla</string> <string name="pref_foreground_notify_status_filter">Statusfilter</string> <string name="pref_foreground_notification_category">Frgrundsaviseringsinstllningar</string> <string name="error_open_torrent">Det gr inte att ppna torrent</string> <string name="manage_all_files_warning_dialog_title">Varning</string> <string name="manage_all_files_warning_dialog_description">Anvnd inte Google Play-versionen av LibreTorrent om du vill spara torrenter i andra mappar n \"Hmtningar\" och liknande. \nDet finns andra kllor p projektsidan.</string> <string name="exact_alarm_permission_warning">Fr att schemalggaren ska fungera mste du f behrighet i en speciell systemdialog. Fortstt?</string> <string name="perm_denied_warning_android_r">tkomst till alla filer krvs fr att hmta torrenter och komma t .torrent-filer i godtyckliga mappar. Utan detta tillstnd kommer LibreTorrent endast att ha tillgng till ett begrnsat antal mappar. r du sker p att du vill avfrda denna behrighet?</string> <string name="pref_validate_https_trackers_title">Validera HTTPS-sprarcertifikat</string> <string name="download_first_last_pieces">Hmta frsta och sista delarna frst</string> <string name="pref_validate_https_trackers_summary">Certifikatet fr HTTPS-sprare och HTTPS-webbdistributioner kommer att valideras i systemcertifikatarkivet.</string> <string name="torrent_speed_limit_dialog">Stll in hastighet i KiB/s. Observera att om du stller in en hgre grns p en torrent kommer den globala grnsen inte att sidostta den globala grnsen.</string> <string name="apply_settings_after_reboot">ndringar kommer att tillmpas efter omstart av appen.</string> <string name="pref_posix_disk_io_title">I/O fr POSIX-disk</string> <string name="pref_posix_disk_io_summary">Obs: det hr alternativet ska endast anvndas i srskilda situationer, som std fr vissa SD-kortfilsystem. Aktiverar en enkel POSIX Disk I/O, som anvnds fr system som inte har ett 64-bitars virtuellt adressutrymme eller inte stder minnesmappade filer.</string> <string name="torrent_version">Torrent version</string> <string name="torrent_version_entries_v2_only">V2 endast</string> <string name="torrent_version_entries_hybrid">Hybrid</string> <string name="torrent_version_entries_v1_only">V1 endast</string> <string name="go_to_folder">G till mapp</string> </resources> ```
/content/code_sandbox/app/src/main/res/values-sv/strings.xml
xml
2016-10-18T15:38:44
2024-08-16T19:19:31
libretorrent
proninyaroslav/libretorrent
1,973
11,393
```xml import type { ValuesOf } from '../utils/index.js'; /** * The Avatar "active" state */ export const AvatarActive = { active: 'active', inactive: 'inactive', } as const; /** * The types of Avatar active state */ export type AvatarActive = ValuesOf<typeof AvatarActive>; /** * The Avatar Shape */ export const AvatarShape = { circular: 'circular', square: 'square', } as const; /** * The types of Avatar Shape */ export type AvatarShape = ValuesOf<typeof AvatarShape>; /** * The Avatar Appearance when "active" */ export const AvatarAppearance = { ring: 'ring', shadow: 'shadow', ringShadow: 'ring-shadow', } as const; /** * The appearance when "active" */ export type AvatarAppearance = ValuesOf<typeof AvatarAppearance>; /** * A specific named color for the Avatar */ export const AvatarNamedColor = { darkRed: 'dark-red', cranberry: 'cranberry', red: 'red', pumpkin: 'pumpkin', peach: 'peach', marigold: 'marigold', gold: 'gold', brass: 'brass', brown: 'brown', forest: 'forest', seafoam: 'seafoam', darkGreen: 'dark-green', lightTeal: 'light-teal', teal: 'teal', steel: 'steel', blue: 'blue', royalBlue: 'royal-blue', cornflower: 'cornflower', navy: 'navy', lavender: 'lavender', purple: 'purple', grape: 'grape', lilac: 'lilac', pink: 'pink', magenta: 'magenta', plum: 'plum', beige: 'beige', mink: 'mink', platinum: 'platinum', anchor: 'anchor', } as const; /** * An avatar can be one of named colors * @public */ export type AvatarNamedColor = ValuesOf<typeof AvatarNamedColor>; /** * Supported Avatar colors */ export const AvatarColor = { neutral: 'neutral', brand: 'brand', colorful: 'colorful', ...AvatarNamedColor, } as const; /** * The Avatar Color */ export type AvatarColor = ValuesOf<typeof AvatarColor>; /** * The Avatar Sizes * @public */ export const AvatarSize = { _16: 16, _20: 20, _24: 24, _28: 28, _32: 32, _36: 36, _40: 40, _48: 48, _56: 56, _64: 64, _72: 72, _96: 96, _120: 120, _128: 128, } as const; /** * A Avatar can be on of several preset sizes. * @public */ export type AvatarSize = ValuesOf<typeof AvatarSize>; ```
/content/code_sandbox/packages/web-components/src/avatar/avatar.options.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
654
```xml export const enum NodeType { ELEMENT_NODE = 1, ATTRIBUTE_NODE = 2, TEXT_NODE = 3, CDATA_SECTION_NODE = 4, ENTITY_REFERENCE_NODE = 5, COMMENT_NODE = 6, PROCESSING_INSTRUCTION_NODE = 7, DOCUMENT_NODE = 9, } ```
/content/code_sandbox/packages/miniapp-runtime/src/dom/node_types.ts
xml
2016-11-03T06:59:15
2024-08-16T10:11:29
ice
alibaba/ice
17,815
69
```xml /* * Wire * * This program is free software: you can redistribute it and/or modify * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * along with this program. If not, see path_to_url * */ export const isHTMLImageElement = (element: any): element is HTMLImageElement => element.nodeName === 'IMG'; ```
/content/code_sandbox/src/script/guards/HTMLElement.ts
xml
2016-07-21T15:34:05
2024-08-16T11:40:13
wire-webapp
wireapp/wire-webapp
1,125
112
```xml import React from 'react'; import ReactDOM from 'react-dom/client'; import { createClient, Provider } from 'urql'; import './main.css'; import App from './App'; const client = createClient({ url: 'path_to_url }); const root = ReactDOM.createRoot(document.getElementById('app') as HTMLElement); root.render( <React.StrictMode> <Provider value={client}> <App /> </Provider> </React.StrictMode> ); ```
/content/code_sandbox/examples/react/urql/src/main.tsx
xml
2016-12-05T19:15:11
2024-08-15T14:56:08
graphql-code-generator
dotansimha/graphql-code-generator
10,759
98
```xml import * as React from 'react'; import expect from 'expect'; import { render, screen } from '@testing-library/react'; import { useChoices } from './useChoices'; import { TestTranslationProvider } from '../i18n'; import { useRecordContext } from '../controller'; describe('useChoices hook', () => { const defaultProps = { choice: { id: 42, name: 'test' }, optionValue: 'id', optionText: 'name', translateChoice: true, }; const Component = ({ choice, optionText, optionValue, translateChoice, }) => { const { getChoiceText, getChoiceValue } = useChoices({ optionText, optionValue, translateChoice, }); return ( <div data-value={getChoiceValue(choice)}> {getChoiceText(choice)} </div> ); }; it('should use optionValue as value identifier', () => { render(<Component {...defaultProps} />); expect(screen.getByText('test').getAttribute('data-value')).toEqual( '42' ); }); it('should use optionText with a string value as text identifier', () => { render(<Component {...defaultProps} />); expect(screen.queryAllByText('test')).toHaveLength(1); }); it('should use optionText with a function value as text identifier', () => { render( <Component {...defaultProps} optionText={choice => choice.foobar} choice={{ id: 42, foobar: 'test' }} /> ); expect(screen.queryAllByText('test')).toHaveLength(1); }); it('should use optionText with an element value as text identifier', () => { const Foobar = () => { const record = useRecordContext(); return <span>{record.foobar}</span>; }; render( <Component {...defaultProps} optionText={<Foobar />} choice={{ id: 42, foobar: 'test' }} /> ); expect(screen.queryAllByText('test')).toHaveLength(1); }); it('should translate the choice by default', () => { render( <TestTranslationProvider translate={x => `**${x}**`}> <Component {...defaultProps} /> </TestTranslationProvider> ); expect(screen.queryAllByText('test')).toHaveLength(0); expect(screen.queryAllByText('**test**')).toHaveLength(1); }); it('should not translate the choice if translateChoice is false', () => { render( <TestTranslationProvider translate={x => `**${x}**`}> <Component {...defaultProps} translateChoice={false} /> </TestTranslationProvider> ); expect(screen.queryAllByText('test')).toHaveLength(1); expect(screen.queryAllByText('**test**')).toHaveLength(0); }); }); ```
/content/code_sandbox/packages/ra-core/src/form/useChoices.spec.tsx
xml
2016-07-13T07:58:54
2024-08-16T18:32:27
react-admin
marmelab/react-admin
24,624
622
```xml import { __ } from '@erxes/ui/src/utils'; export const EMPTY_CONTENT_FOLDERS = { title: __('Getting Started with Contacts'), description: __('Coordinate and manage all your customer interactions'), steps: [ { title: __('Import your previous contacts'), description: __( 'Use Import feature to bulk import all your previous Customers or Leads' ), url: '/settings/importHistories', urlText: 'Go to Customer Import' }, { title: __('Collect visitor information'), description: __( 'Create your erxes Messenger to start capturing Visitors' ), url: '/settings/integrations/createMessenger', urlText: 'Create Messenger' }, { title: __('Sync email contacts'), description: __( 'Integrate your email address to sync previous email Leads' ), url: '/settings/integrations', urlText: 'Visit AppStore' }, { title: __('Start capturing social media contacts'), description: __( 'Integrate social media website to start capturing Leads' ), url: '/settings/integrations', urlText: 'Visit AppStore' }, { title: __('Generate contacts through Forms'), description: 'Create your forms and start collecting Leads', url: '/forms/create', urlText: 'Create a Popup' } ] }; export const EMPTY_CONTENT_FILES = { title: __('Getting Started with erxes Knowledgebase'), description: __( 'Educate your customers and staff by creating help articles to reach higher levels of satisfaction' ), steps: [ { title: __('Create your knowledgebase'), description: __( '<ul><li>Make sure youve created your Brands</li><li>Click on Add Knowledgebase to create one for a specific Brand</li><li>Click on the Settings button and Add Categories. A good one to get started with would be General, Pricing, etc.</li><li>Click on Add Articles to start adding help articles</li></ul>' ), html: true }, { title: __('Install the script'), description: "<ul><li>Copy the individual script by clicking on the Settings button.</li><li>Use <a href='/settings/scripts'>Script Manager</a> to avoid script duplication errors if youre planning to display this popup along with any other erxes widgets</li></ul>", html: true, url: '/settings/scripts', urlText: __('Go to Script Manager') } ] }; ```
/content/code_sandbox/packages/plugin-filemanager-ui/src/constants.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
545
```xml import { type BaseAnnotations } from 'storybook/internal/types'; import { h } from 'vue'; import { type StoryContext, type VueRenderer } from './public-types'; export const mount: BaseAnnotations<VueRenderer>['mount'] = (context: StoryContext) => { return async (Component, options) => { if (Component) { context.originalStoryFn = () => () => h(Component, options?.props, options?.slots); } await context.renderToCanvas(); return context.canvas; }; }; ```
/content/code_sandbox/code/renderers/vue3/src/mount.ts
xml
2016-03-18T04:23:44
2024-08-16T19:22:08
storybook
storybookjs/storybook
83,755
112
```xml import { IPropertyPaneField, PropertyPaneFieldType, IPropertyPaneCustomFieldProps } from '@microsoft/sp-property-pane'; export interface IPropertyPaneAboutWebPartProps { /** * An UNIQUE key indicates the identity of this control */ key: string; /** * An UNIQUE key indicates the identity of this control */ html: string; } export interface IPropertyWebPartInformationPropsInternal extends IPropertyPaneAboutWebPartProps, IPropertyPaneCustomFieldProps { } class PropertyPaneAboutWebPartBuilder implements IPropertyPaneField<IPropertyPaneAboutWebPartProps> { //Properties defined by IPropertyPaneField public targetProperty: string; public type: PropertyPaneFieldType = PropertyPaneFieldType.Custom; public properties: IPropertyWebPartInformationPropsInternal; private elem: HTMLElement; public constructor(_properties: IPropertyPaneAboutWebPartProps) { this.properties = { key: _properties.key, html: _properties.html, onRender: this.onRender.bind(this) }; } public render(): void { if (!this.elem) { return; } this.onRender(this.elem); } private onRender(elem: HTMLElement, ctx?: any, changeCallback?: (targetProperty?: string, newValue?: any) => void): void { if (!this.elem) { this.elem = elem; } this.elem.innerHTML = this.properties.html; } } export function PropertyPaneAboutWebPart(properties: IPropertyPaneAboutWebPartProps): IPropertyPaneField<IPropertyPaneAboutWebPartProps> { return new PropertyPaneAboutWebPartBuilder(properties); } ```
/content/code_sandbox/samples/react-password-vault/src/webparts/PropertyPaneAboutWebPart.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
346
```xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="path_to_url" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:id="@+id/linearLayout4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="3dp" android:layout_marginRight="8dp" android:paddingBottom="8dp" android:paddingTop="8dp"> <TextView android:id="@+id/tvname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/tvComment" android:layout_alignParentTop="true" android:layout_toEndOf="@+id/avatacomment" android:layout_toRightOf="@+id/avatacomment" android:gravity="center_vertical" android:paddingLeft="4dp" android:text="" android:textColor="@color/black" android:textSize="14sp" android:textStyle="bold"/> <ImageView android:id="@+id/avatacomment" android:layout_width="38dp" android:layout_height="38dp" android:layout_alignParentTop="true" android:scaleType="fitCenter" android:src="@drawable/profile_anonymous_user"/> <TextView android:id="@+id/tvComment" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/avatacomment" android:layout_marginTop="-5dp" android:layout_toEndOf="@+id/avatacomment" android:layout_toRightOf="@+id/avatacomment" android:gravity="center_vertical" android:paddingBottom="8dp" android:paddingLeft="4dp" android:text="" android:textColor="@color/title_color" android:textSize="14sp"/> <TextView android:id="@+id/tvTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/tvComment" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_alignTop="@+id/tvname" android:layout_marginRight="5dp" android:layout_marginTop="1dp" android:gravity="center_vertical|center_horizontal" android:text="3d ago" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="@color/black" android:textSize="11dp"/> <ImageView android:id="@+id/imageView20" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_alignTop="@+id/tvname" android:layout_toLeftOf="@+id/tvTime" android:layout_toStartOf="@+id/tvTime" android:src="@drawable/profile_anonymous_user" android:visibility="gone"/> <TextView android:id="@+id/textView9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/tvname" android:layout_alignTop="@+id/tvTime" android:layout_marginLeft="5dp" android:layout_toEndOf="@+id/tvname" android:layout_toRightOf="@+id/tvname" android:gravity="center_vertical|center_horizontal" android:text="\@user_name" android:textColor="@color/title_color" android:textSize="13dp" android:visibility="gone"/> <TextView android:id="@+id/tvReply" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/tvComment" android:layout_alignStart="@+id/tvComment" android:layout_below="@+id/tvComment" android:text="3 tr li" android:textColor="@color/button_login_color" android:textSize="13sp"/> </RelativeLayout> <ImageView android:id="@+id/item_arrow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:src="@mipmap/arrow_down" android:visibility="gone"/> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/background"/> </LinearLayout> </RelativeLayout> ```
/content/code_sandbox/app/src/main/res/layout/item_comment.xml
xml
2016-05-19T10:12:08
2024-08-02T07:42:36
LRecyclerView
jdsjlzx/LRecyclerView
2,470
1,156
```xml // // // Microsoft Bot Framework: path_to_url // // Bot Framework Emulator Github: // path_to_url // // All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // import * as fs from 'fs'; import { LogLevel, textItem } from '@bfemulator/sdk-shared'; import { Attachment, AttachmentData } from 'botframework-schema'; import * as Formidable from 'formidable'; import * as HttpStatus from 'http-status-codes'; import { Next, Request, Response } from 'restify'; import { BotEndpoint } from '../../../state/botEndpoint'; import { Conversation } from '../../../state/conversation'; import { sendErrorResponse } from '../../../utils/sendErrorResponse'; import { EmulatorRestServer } from '../../../restServer'; import { WebSocketServer } from '../../../webSocketServer'; export function createUploadHandler(emulatorServer: EmulatorRestServer) { const { logger: { logMessage }, state, } = emulatorServer; return (req: Request, res: Response, next: Next): any => { if (req.params.conversationId.includes('transcript')) { res.end(); next(); return; } const conversation: Conversation = (req as any).conversation; const botEndpoint: BotEndpoint = (req as any).botEndpoint; if (!conversation) { res.send(HttpStatus.NOT_FOUND, 'conversation not found'); res.end(); logMessage(req.params.conversationId, textItem(LogLevel.Error, 'Cannot upload file. Conversation not found.')); next(); return; } if (req.getContentType() !== 'multipart/form-data' || (req.getContentLength() === 0 && !req.isChunked())) { next(); return; } const form = new Formidable.IncomingForm({ keepExtensions: true, multiples: true }); // TODO: Override form.onPart handler so it doesn't write temp files to disk. form.parse(req, async (err: any, fields: any, files: any) => { const ROOT_PATH = ''; try { // eslint-disable-next-line security/detect-non-literal-fs-filename const activity = JSON.parse(fs.readFileSync(path.resolve(ROOT_PATH, files.activity.path), 'utf8')); let uploads = files.file; if (!Array.isArray(uploads)) { uploads = [uploads]; } if (uploads && uploads.length) { const serviceUrl = await emulatorServer.getServiceUrl(botEndpoint.botUrl); activity.attachments = []; uploads.forEach(upload1 => { const name = (upload1 as any).name || 'file.dat'; const type = upload1.type; const path = upload1.path; // eslint-disable-next-line security/detect-non-literal-fs-filename const base64EncodedContent = fs.readFileSync(path.resolve(ROOT_PATH, path), { encoding: 'base64' }); const base64Buf = Buffer.from(base64EncodedContent, 'base64'); const attachmentData: AttachmentData = { type, name, originalBase64: new Uint8Array(base64Buf), thumbnailBase64: new Uint8Array(base64Buf), }; const attachmentId = state.attachments.uploadAttachment(attachmentData); const attachment: Attachment = { name, contentType: type, contentUrl: `${serviceUrl}/v3/attachments/${attachmentId}/views/original`, }; activity.attachments.push(attachment); }); try { const { updatedActivity, statusCode, response } = await conversation.postActivityToBot(activity, true); if (~~statusCode === 0 && ~~statusCode > 300) { res.send(statusCode || HttpStatus.INTERNAL_SERVER_ERROR, await response.text()); res.end(); } else { res.send(statusCode, { id: updatedActivity.id }); res.end(); WebSocketServer.sendToSubscribers(conversation.conversationId, updatedActivity); } } catch (err) { sendErrorResponse(req, res, next, err); } } else { res.send(HttpStatus.BAD_REQUEST, 'no file uploaded'); res.end(); } } catch (e) { sendErrorResponse(req, res, next, e); } next(); }); }; } ```
/content/code_sandbox/packages/app/main/src/server/routes/directLine/handlers/upload.ts
xml
2016-11-11T23:15:09
2024-08-16T12:45:29
BotFramework-Emulator
microsoft/BotFramework-Emulator
1,803
1,107
```xml import { Platform } from './Platform'; export declare function yarnInstall(path: string): void; export declare const delay: (ms: number) => Promise<void>; export declare function killEmulatorAsync(): Promise<void>; export declare function killSimulatorAsync(): Promise<void>; export declare function killVirtualDevicesAsync(platform: Platform): Promise<void>; ```
/content/code_sandbox/packages/expo-test-runner/build/Utils.d.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
70
```xml export interface LiveGetQuestionsResponseRootObject { questions: LiveGetQuestionsResponseQuestionsItem[]; status: string; } export interface LiveGetQuestionsResponseQuestionsItem { text: string; qid: string; source: string; user: LiveGetQuestionsResponseUser; story_sticker_text: string; timestamp: number; } export interface LiveGetQuestionsResponseUser { pk: number; username: string; full_name: string; is_private: boolean; profile_pic_url: string; profile_pic_id: string; is_verified: boolean; } ```
/content/code_sandbox/src/responses/live.get-questions.response.ts
xml
2016-06-09T12:14:48
2024-08-16T10:07:22
instagram-private-api
dilame/instagram-private-api
5,877
125
```xml const { toString } = Object.prototype; /** * Deeply clones a value to create a new instance. */ export function cloneDeep<T>(value: T): T { return cloneDeepHelper(value); } function cloneDeepHelper<T>(val: T, seen?: Map<any, any>): T { switch (toString.call(val)) { case "[object Array]": { seen = seen || new Map(); if (seen.has(val)) return seen.get(val); const copy: T & any[] = (val as any).slice(0); seen.set(val, copy); copy.forEach(function (child, i) { copy[i] = cloneDeepHelper(child, seen); }); return copy; } case "[object Object]": { seen = seen || new Map(); if (seen.has(val)) return seen.get(val); // High fidelity polyfills of Object.create and Object.getPrototypeOf are // possible in all JS environments, so we will assume they exist/work. const copy = Object.create(Object.getPrototypeOf(val)); seen.set(val, copy); Object.keys(val as T & Record<string, any>).forEach((key) => { copy[key] = cloneDeepHelper((val as any)[key], seen); }); return copy; } default: return val; } } ```
/content/code_sandbox/src/utilities/common/cloneDeep.ts
xml
2016-02-26T20:25:00
2024-08-16T10:56:57
apollo-client
apollographql/apollo-client
19,304
283