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 React from 'react';
import { cx } from '@emotion/css';
export const Scrollbar = (props) => {
const { children, ...restProps } = props;
return (
<div {...restProps} className={cx(restProps.className)}>
{children}
</div>
);
};
``` | /content/code_sandbox/pmm-app/src/shared/components/Elements/Scrollbar/__mocks__/Scrollbar.tsx | xml | 2016-01-22T07:14:23 | 2024-08-13T13:01:59 | grafana-dashboards | percona/grafana-dashboards | 2,661 | 66 |
```xml
import { Editor, EditorInterface } from '../interfaces/editor'
export const first: EditorInterface['first'] = (editor, at) => {
const path = Editor.path(editor, at, { edge: 'start' })
return Editor.node(editor, path)
}
``` | /content/code_sandbox/packages/slate/src/editor/first.ts | xml | 2016-06-18T01:52:42 | 2024-08-16T18:43:42 | slate | ianstormtaylor/slate | 29,492 | 56 |
```xml
import { SettingsListItem, SidebarList, SidebarListItem } from '@proton/components';
import { getIsSectionAvailable, getSectionPath } from '@proton/components/containers/layout/helper';
import CalendarsSettingsSidebarList from './CalendarsSettingsSidebarList';
import type { getCalendarAppRoutes } from './routes';
interface Props extends ReturnType<typeof getCalendarAppRoutes> {
prefix: string;
}
const CalendarSettingsSidebar = ({ header, routes, prefix }: Props) => {
return (
<SidebarList>
<SidebarListItem className="navigation-link-header-group">
<h3>{header}</h3>
</SidebarListItem>
{getIsSectionAvailable(routes.desktop) && (
<SettingsListItem
to={getSectionPath(prefix, routes.desktop)}
icon={routes.desktop.icon}
notification={routes.desktop.notification}
key={routes.desktop.to}
>
<span className="text-ellipsis" title={routes.desktop.text}>
{routes.desktop.text}
</span>
</SettingsListItem>
)}
{getIsSectionAvailable(routes.general) && (
<SettingsListItem
to={getSectionPath(prefix, routes.general)}
icon={routes.general.icon}
notification={routes.general.notification}
key={routes.general.to}
>
<span className="text-ellipsis" title={routes.general.text}>
{routes.general.text}
</span>
</SettingsListItem>
)}
{getIsSectionAvailable(routes.calendars) && (
<CalendarsSettingsSidebarList prefix={prefix} calendarsSection={routes.calendars} />
)}
{getIsSectionAvailable(routes.interops) && (
<SettingsListItem
to={getSectionPath(prefix, routes.interops)}
icon={routes.interops.icon}
notification={routes.interops.notification}
key={routes.interops.to}
>
<span className="text-ellipsis" title={routes.interops.text}>
{routes.interops.text}
</span>
</SettingsListItem>
)}
</SidebarList>
);
};
export default CalendarSettingsSidebar;
``` | /content/code_sandbox/applications/account/src/app/containers/calendar/CalendarSettingsSidebar.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 432 |
```xml
<GroupPolicyObject><SecurityGroups><Group bkp:Source="FromDACL"><Sid><![CDATA[S-1-5-21-852640682-2439737213-2645099010-519]]></Sid><SamAccountName><![CDATA[Enterprise Admins]]></SamAccountName><Type><![CDATA[UniversalGroup]]></Type><NetBIOSDomainName><![CDATA[IDL]]></NetBIOSDomainName><DnsDomainName><![CDATA[idl.local]]></DnsDomainName><UPN><![CDATA[Enterprise Admins@idl.local]]></UPN></Group><Group bkp:Source="FromDACL"><Sid><![CDATA[S-1-5-21-852640682-2439737213-2645099010-512]]></Sid><SamAccountName><![CDATA[Domain Admins]]></SamAccountName><Type><![CDATA[GlobalGroup]]></Type><NetBIOSDomainName><![CDATA[IDL]]></NetBIOSDomainName><DnsDomainName><![CDATA[idl.local]]></DnsDomainName><UPN><![CDATA[Domain Admins@idl.local]]></UPN></Group></SecurityGroups><FilePaths/><GroupPolicyCoreSettings><ID><![CDATA[{1A7FCF61-585D-4ADE-A5FD-D656899A6D8D}]]></ID><Domain><![CDATA[idl.local]]></Domain><SecurityDescriptor>01 00 04 9c 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 04 00 ec 00 08 00 00 00 05 02 28 00 00 01 00 00 01 00 00 00 8f fd ac ed b3 ff d1 11 b4 1d 00 a0 c9 68 f9 39 01 01 00 00 00 00 00 05 0b 00 00 00 00 00 24 00 ff 00 0f 00 01 05 00 00 00 00 00 05 15 00 00 00 aa 43 d2 32 7d 6f 6b 91 02 02 a9 9d 00 02 00 00 00 02 24 00 ff 00 0f 00 01 05 00 00 00 00 00 05 15 00 00 00 aa 43 d2 32 7d 6f 6b 91 02 02 a9 9d 00 02 00 00 00 02 24 00 ff 00 0f 00 01 05 00 00 00 00 00 05 15 00 00 00 aa 43 d2 32 7d 6f 6b 91 02 02 a9 9d 07 02 00 00 00 02 14 00 94 00 02 00 01 01 00 00 00 00 00 05 09 00 00 00 00 02 14 00 94 00 02 00 01 01 00 00 00 00 00 05 0b 00 00 00 00 02 14 00 ff 00 0f 00 01 01 00 00 00 00 00 05 12 00 00 00 00 0a 14 00 ff 00 0f 00 01 01 00 00 00 00 00 03 00 00 00 00</SecurityDescriptor><DisplayName><![CDATA[DoD IE11 STIG - User (SHB v10.1.0) ]]></DisplayName><Options><![CDATA[2]]></Options><UserVersionNumber><![CDATA[65537]]></UserVersionNumber><MachineVersionNumber><![CDATA[65537]]></MachineVersionNumber><MachineExtensionGuids/><UserExtensionGuids><![CDATA[[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{D02B1F73-3407-48AE-BA88-E8213C6761F1}]]]></UserExtensionGuids><WMIFilter/></GroupPolicyCoreSettings>
<GroupPolicyExtension bkp:ID="{35378EAC-683F-11D2-A89A-00C04FBBCFA2}" bkp:DescName="Registry">
<FSObjectFile bkp:Path="%GPO_USER_FSPATH%\registry.pol" bkp:SourceExpandedPath="\\DC-IDL-01.idl.local\sysvol\idl.local\Policies\{1A7FCF61-585D-4ADE-A5FD-D656899A6D8D}\User\registry.pol" bkp:Location="DomainSysvol\GPO\User\registry.pol"/>
<FSObjectFile bkp:Path="%GPO_FSPATH%\Adm\*.*" bkp:SourceExpandedPath="\\DC-IDL-01.idl.local\sysvol\idl.local\Policies\{1A7FCF61-585D-4ADE-A5FD-D656899A6D8D}\Adm\*.*"/>
</GroupPolicyExtension>
<GroupPolicyExtension bkp:ID="{F15C46CD-82A0-4C2D-A210-5D0D3182A418}" bkp:DescName="Unknown Extension"><FSObjectFile bkp:Path="%GPO_USER_FSPATH%\comment.cmtx" bkp:SourceExpandedPath="\\DC-IDL-01.idl.local\sysvol\idl.local\Policies\{1A7FCF61-585D-4ADE-A5FD-D656899A6D8D}\User\comment.cmtx" bkp:Location="DomainSysvol\GPO\User\comment.cmtx"/></GroupPolicyExtension></GroupPolicyObject>
</GroupPolicyBackupScheme>
``` | /content/code_sandbox/Internet Explorer/Group Policy Objects/User/{AF749E88-41DD-4DA8-8BD7-5CCEBABB6B75}/Backup.xml | xml | 2016-02-26T19:43:51 | 2024-08-16T18:13:11 | Windows-Secure-Host-Baseline | nsacyber/Windows-Secure-Host-Baseline | 1,548 | 1,316 |
```xml
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { SignupPage } from './signup';
import { SignupPageRoutingModule } from './signup-routing.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
SignupPageRoutingModule
],
declarations: [
SignupPage,
]
})
export class SignUpModule { }
``` | /content/code_sandbox/examples/ionic-angular/src/app/pages/signup/signup.module.ts | xml | 2016-09-09T01:12:08 | 2024-08-16T17:39:45 | vercel | vercel/vercel | 12,545 | 97 |
```xml
import * as React from 'react';
import { Shadow } from './ShadowHelper';
import { TextFieldBasicExample } from '../TextField/TextField.Basic.Example';
export const ShadowDOMTextFieldExample: React.FunctionComponent = () => {
return (
<Shadow>
<TextFieldBasicExample />
</Shadow>
);
};
``` | /content/code_sandbox/packages/react-examples/src/react/ShadowDOM/ShadowDOM.TextField.Example.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 67 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~
~ 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.
-->
<project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere</artifactId>
<version>5.5.1-SNAPSHOT</version>
</parent>
<artifactId>shardingsphere-infra</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
<module>spi</module>
<module>exception</module>
<module>database</module>
<module>data-source-pool</module>
<module>common</module>
<module>context</module>
<module>url</module>
<module>algorithm</module>
<module>distsql-handler</module>
<module>parser</module>
<module>binder</module>
<module>checker</module>
<module>route</module>
<module>rewrite</module>
<module>merge</module>
<module>executor</module>
<module>session</module>
<module>expr</module>
<module>util</module>
<module>reachability-metadata</module>
</modules>
</project>
``` | /content/code_sandbox/infra/pom.xml | xml | 2016-01-18T12:49:26 | 2024-08-16T15:48:11 | shardingsphere | apache/shardingsphere | 19,707 | 392 |
```xml
import type { FC, PropsWithChildren } from 'react';
import React, { useState } from 'react';
import { LocationProvider } from '@storybook/core/router';
import { styled } from '@storybook/core/theming';
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
import { action } from '@storybook/addon-actions';
import MobileNavigationStoriesMeta from '../mobile/navigation/MobileNavigation.stories';
import { Layout } from './Layout';
import { LayoutProvider } from './LayoutProvider';
const PlaceholderBlock = styled.div({
width: '100%',
height: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
overflow: 'hidden',
});
const PlaceholderClock: FC<PropsWithChildren> = ({ children }) => {
const [count, setCount] = React.useState(0);
React.useEffect(() => {
const interval = setInterval(() => {
setCount(count + 1);
}, 1000);
return () => clearInterval(interval);
}, [count]);
return (
<PlaceholderBlock>
<h2>{count}</h2>
{children}
</PlaceholderBlock>
);
};
const MockSidebar: FC<any> = () => <PlaceholderClock />;
const MockPreview: FC<any> = () => <PlaceholderClock />;
const MockPanel: FC<any> = () => <PlaceholderClock />;
const MockPage: FC<any> = () => <PlaceholderClock />;
const defaultState = {
navSize: 150,
bottomPanelHeight: 150,
rightPanelWidth: 150,
panelPosition: 'bottom',
viewMode: 'story',
} as const;
const meta = {
title: 'Layout',
component: Layout,
args: {
managerLayoutState: defaultState,
slotMain: <MockPreview />,
slotSidebar: <MockSidebar />,
slotPanel: <MockPanel />,
slotPages: <MockPage />,
setManagerLayoutState: fn(),
hasTab: false,
},
globals: { sb_theme: 'light' },
parameters: { layout: 'fullscreen' },
decorators: [
MobileNavigationStoriesMeta.decorators[0] as any,
(storyFn) => (
<LocationProvider>
<LayoutProvider>{storyFn()}</LayoutProvider>
</LocationProvider>
),
],
render: (args) => {
const [managerLayoutState, setManagerLayoutState] = useState(args.managerLayoutState);
return (
<Layout
{...args}
managerLayoutState={managerLayoutState}
setManagerLayoutState={(nextPartialState) => {
setManagerLayoutState({ ...managerLayoutState, ...nextPartialState });
action('setManagerStoreState')(nextPartialState);
}}
/>
);
},
} satisfies Meta<typeof Layout>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Desktop: Story = {};
export const Dark: Story = {
globals: { sb_theme: 'dark' },
};
export const DesktopHorizontal: Story = {
args: {
managerLayoutState: { ...defaultState, panelPosition: 'right' },
},
};
export const DesktopDocs: Story = {
args: {
managerLayoutState: { ...defaultState, viewMode: 'docs' },
},
};
export const DesktopPages: Story = {
args: {
managerLayoutState: { ...defaultState, viewMode: 'settings' },
},
};
export const Mobile = {
parameters: {
viewport: {
defaultViewport: 'mobile1',
},
chromatic: { viewports: [320] },
},
};
export const MobileDark = {
...Mobile,
globals: { sb_theme: 'dark' },
};
export const MobileDocs = {
...Mobile,
args: {
managerLayoutState: { ...defaultState, viewMode: 'docs' },
},
};
``` | /content/code_sandbox/code/core/src/manager/components/layout/Layout.stories.tsx | xml | 2016-03-18T04:23:44 | 2024-08-16T19:22:08 | storybook | storybookjs/storybook | 83,755 | 835 |
```xml
import React from 'react';
import { Text } from 'native-base';
export const Example = () => {
return (
<Text italic>
<Text bold>Taj Mahal</Text> is in Agra.
</Text>
);
};
``` | /content/code_sandbox/example/storybook/stories/components/primitives/Text/Nested.tsx | xml | 2016-04-15T11:37:23 | 2024-08-14T16:16:44 | NativeBase | GeekyAnts/NativeBase | 20,132 | 54 |
```xml
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
//
// path_to_url
//
// Unless required by applicable law or agreed to in writing,
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// specific language governing permissions and limitations
import { generateRandomTables } from '../../../data/tables.js';
import { ArrowIOTestHelper } from '../helpers.js';
import { validateRecordBatchReader } from '../validate.js';
import { RecordBatchReader } from 'apache-arrow';
for (const table of generateRandomTables([10, 20, 30])) {
const io = ArrowIOTestHelper.json(table);
const name = `[\n ${table.schema.fields.join(',\n ')}\n]`;
describe(`RecordBatchJSONReader (${name})`, () => {
describe(`should read all RecordBatches`, () => {
test(`Uint8Array`, io.buffer((buffer) => {
const json = JSON.parse(Buffer.from(buffer).toString());
validateRecordBatchReader('json', 3, RecordBatchReader.from(json));
}));
});
});
}
``` | /content/code_sandbox/js/test/unit/ipc/reader/json-reader-tests.ts | xml | 2016-02-17T08:00:23 | 2024-08-16T19:00:48 | arrow | apache/arrow | 14,094 | 254 |
```xml
import { IterableX } from '../../iterable/iterablex.js';
import { filter } from '../../iterable/operators/filter.js';
/**
* @ignore
*/
export function filterProto<T, S extends T>(
this: IterableX<T>,
predicate: (value: T, index: number) => value is S,
thisArg?: any
): IterableX<S>;
export function filterProto<T>(
this: IterableX<T>,
predicate: (value: T, index: number) => boolean,
thisArg?: any
): IterableX<T>;
export function filterProto<T>(
this: IterableX<T>,
predicate: (value: T, index: number) => boolean,
thisArg?: any
): IterableX<T> {
return filter(predicate, thisArg)(this);
}
IterableX.prototype.filter = filterProto;
declare module '../../iterable/iterablex' {
interface IterableX<T> {
filter: typeof filterProto;
}
}
``` | /content/code_sandbox/src/add/iterable-operators/filter.ts | xml | 2016-02-22T20:04:19 | 2024-08-09T18:46:41 | IxJS | ReactiveX/IxJS | 1,319 | 205 |
```xml
import * as React from 'react';
import { createSvgIcon } from '../utils/createSvgIcon';
export const PresenceAvailableIcon = createSvgIcon({
svg: ({ classes }) => (
<svg role="presentation" focusable="false" viewBox="0 0 10 10" className={classes.svg}>
<path d="M4.99769 0C2.23754 0 0 2.23754 0 4.99769C0 7.75784 2.23754 9.99538 4.99769 9.99538C7.75784 9.99538 9.99538 7.75784 9.99538 4.99769C9.99538 2.23754 7.75784 0 4.99769 0ZM1 4.99769C1 2.78983 2.78983 1 4.99769 1C7.20555 1 8.99538 2.78983 8.99538 4.99769C8.99538 7.20555 7.20555 8.99538 4.99769 8.99538C2.78983 8.99538 1 7.20555 1 4.99769Z" />
<path d="M7.10355 3.39645C7.29882 3.59171 7.29882 3.90829 7.10355 4.10355L4.85355 6.35355C4.65829 6.54882 4.34171 6.54882 4.14645 6.35355L3.14645 5.35355C2.95118 5.15829 2.95118 4.84171 3.14645 4.64645C3.34171 4.45118 3.65829 4.45118 3.85355 4.64645L4.5 5.29289L6.39645 3.39645C6.59171 3.20118 6.90829 3.20118 7.10355 3.39645Z" />
</svg>
),
displayName: 'PresenceAvailableIcon',
});
``` | /content/code_sandbox/packages/fluentui/react-icons-northstar/src/components/PresenceAvailableIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 516 |
```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="item_view_role_description">Flipi</string>
</resources>
``` | /content/code_sandbox/lib/java/com/google/android/material/resources/res/values-is/strings.xml | xml | 2016-12-05T16:11:29 | 2024-08-16T17:51:42 | material-components-android | material-components/material-components-android | 16,176 | 84 |
```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="M2 2C2.55 2 3 2.45 3 3L3 3.56L12.38 12L13 12C13.55 12 14 12.45 14 13C14 13.55 13.55 14 13 14L2 14C1.45 14 1 13.55 1 13C1 12.45 1.45 12 2 12L2.5 12L4.87 8L3 6.21C2.96 6.73 2.43 6.91 2 7C1.45 7 1 6.55 1 6L1 3C1 2.45 1.45 2 2 2zM6.39 9.3L4.75 12L9.39 12L6.39 9.3z"/>
</vector>
``` | /content/code_sandbox/app/src/main/res/drawable/ic_preset_temaki_buffer_stop.xml | xml | 2016-07-02T10:44:04 | 2024-08-16T18:55:54 | StreetComplete | streetcomplete/StreetComplete | 3,781 | 280 |
```xml
const GQL_QUERY_WITH_CONST = /* GraphQL */ `
query S { shop }
` as const;
const HTML_WITH_CONST = /* HTML */ `
<div>
<h1>foo</h1>
<p>foo</p>
</div>
` as const;
``` | /content/code_sandbox/tests/format/typescript/as/as-const-embedded.ts | xml | 2016-11-29T17:13:37 | 2024-08-16T17:29:57 | prettier | prettier/prettier | 48,913 | 56 |
```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="cat_navigation_rail_title"
description="The title for the navigation rail demo. [CHAR_LIMIT=100]">Navigation Rail</string>
<string name="cat_navigation_rail_description"
description="Brief summary about navigation rail componentdemo. [CHAR_LIMIT=500]">
Navigation Rails make it easy to explore and switch between top-level views in a single
tap. This navigational element resides at the bottom of the screen, and provides direct access
for three to five destinations within an app.
</string>
<string name="cat_navigation_rail_additional_controls_demo_title"
description="Label for the demo that shows how the look and behavior navigation rail may be configured. [CHAR_LIMIT=100]">Additional Controls Demo</string>
<string name="cat_navigation_rail_animated_demo_title"
description="Label the navigation rail demo that shows animated icons [CHAR_LIMIT=100]">Animated Demo</string>
<string name="cat_navigation_rail_compact_demo_title"
description="Label for the demo that shows navigation rail in compact style. [CHAR_LIMIT=100]">Compact Style Demo</string>
<string name="cat_navigation_rail_page_1_name"
description="The title of a page in the navigation rail demo. [CHAR_LIMIT=50]">Page 1</string>
<string name="cat_navigation_rail_page_2_name"
description="The title of a page in the navigation rail demo. [CHAR_LIMIT=50]">Page 2</string>
<string name="cat_navigation_rail_page_3_name"
description="The title of a page in the navigation rail demo. [CHAR_LIMIT=50]">Page 3</string>
<string name="cat_navigation_rail_page_4_name"
description="The title of a page in the navigation rail demo. [CHAR_LIMIT=50]">Page 4</string>
<string name="cat_navigation_rail_page_5_name"
description="The title of a page in the navigation rail demo. [CHAR_LIMIT=50]">Page 5</string>
<string name="cat_navigation_rail_page_6_name"
description="The title of a page in the navigation rail demo. [CHAR_LIMIT=50]">Page 6</string>
<string name="cat_navigation_rail_page_7_name"
description="The title of a page in the navigation rail demo. [CHAR_LIMIT=50]">Page 7</string>
<string name="cat_navigation_rail_add_nav_item"
description="Label for the button that will add a destination to the navigation rail. [CHAR_LIMIT=50]">Add destination</string>
<string name="cat_navigation_rail_remove_nav_item"
description="Label for the button that will the last destination from the navigation rail. [CHAR_LIMIT=50]">Remove destination</string>
<string name="cat_navigation_rail_increment_badge_number"
description="The title of a button to increment the notification number. [CHAR_LIMIT=20]">+Badge number</string>
<string name="cat_navigation_rail_add_header_view"
description="Label for the button that will add a header view to the navigation rail. [CHAR_LIMIT=50]">Add Header View</string>
<string name="cat_navigation_rail_remove_header_view"
description="Label for the button that will remove the header view from the navigation rail. [CHAR_LIMIT=50]">Remove Header View</string>
<string name="cat_navigation_rail_icon_size_slider_title"
description="Label for the current icon size display. [CHAR_LIMIT=50]">Icon size: </string>
<string name="cat_navigation_rail_slider_max" translatable="false">48dp</string>
<string name="cat_navigation_rail_slider_min" translatable="false">0dp</string>
<string name="cat_navigation_rail_menu_gravity_control_title"
description="Label for the group of choices that controls how destinations will be grouped in the navigation rail. [CHAR_LIMIT=100]">Menu Gravity:</string>
<string name="cat_navigation_rail_menu_gravity_top"
description="Label for the choice that will cause the destinations to be grouped at the top of the navigation rail. [CHAR_LIMIT=50]">Top</string>
<string name="cat_navigation_rail_menu_gravity_center"
description="Label for the choice that will cause the destinations to be grouped at the center of the navigation rail. [CHAR_LIMIT=50]">Center</string>
<string name="cat_navigation_rail_menu_gravity_bottom"
description="Label for the choice that will cause the destinations to be grouped at the bottom of the navigation rail. [CHAR_LIMIT=50]">Bottom</string>
<string name="cat_navigation_rail_label_visibility_mode_title"
description="Label for the group of choices that controls if and when the destination labels will be displayed in the navigation rail. [CHAR_LIMIT=100]">Label visibility mode:</string>
<string name="cat_navigation_rail_label_visibility_mode_auto"
description="Label for the choice that will cause the destination lables to be displayed automatically based on the total number of destinations in the navigation rail. [CHAR_LIMIT=50]">Auto</string>
<string name="cat_navigation_rail_label_visibility_mode_selected"
description="Label for the choice that will cause the destination lables to be displayed only for the currently selected destination in the navigation rail. [CHAR_LIMIT=50]">Selected</string>
<string name="cat_navigation_rail_label_visibility_mode_labeled"
description="Label for the choice that will cause the destination lables to be displayed always in the navigation rail. [CHAR_LIMIT=50]">Labeled</string>
<string name="cat_navigation_rail_label_visibility_mode_unlabeled"
description="Label for the choice that will cause the destination lables to be hidden always in the navigation rail. [CHAR_LIMIT=50]">Unlabeled</string>
<string name="cat_navigation_rail_badge_gravity_spinner_label"
description="Label for the dropdown that controls where badges will be positioned relative to the icon. [CHAR_LIMIT=50]">Badge gravity</string>
<string name="cat_navigation_rail_badge_gravity_top_end"
description="Label for the option that will cause badges to be positioned at the end, above the icon. [CHAR_LIMIT=50]">Top end</string>
<string name="cat_navigation_rail_badge_gravity_top_start"
description="Label for the option that will cause badges to be positioned at the start, above the icon. [CHAR_LIMIT=50]">Top start</string>
<string name="cat_navigation_rail_label_active_bold"
description="Label for controlling whether the active label is bold. [CHAR_LIMIT=50]" translatable="false">Bold active label</string>
<string name="cat_navigation_rail_alarm"
description="Label for an alarm icon. [CHAR_LIMIT=50]">Alarm</string>
<string name="cat_navigation_rail_clock"
description="Label for a clock icon. [CHAR_LIMIT=50]">Clock</string>
<string name="cat_navigation_rail_timer"
description="Label for a timer icon. [CHAR_LIMIT=50]">Timer</string>
<string name="cat_navigation_rail_stopwatch"
description="Label for a stopwatch icon. [CHAR_LIMIT=50]">Stopwatch</string>
<string name="cat_navigation_rail_fab_content_desc"
description="Content description for a floating action button in the navigation rail.[CHAR_LIMIT=50]">Navigation Rail FAB</string>
<string name="cat_navigation_rail_compact_message" description="Usage guidance for Navigation Rail advising using a Bottom Navigation Bar on compact screens instead. [CHAR_LIMIT=NONE]">The orientation of this Navigation Rail demo has been locked to portrait mode, because landscape mode results in a compact height on this device. For any compact screen dimensions, use a Bottom Navigation Bar instead.</string>
</resources>
``` | /content/code_sandbox/catalog/java/io/material/catalog/navigationrail/res/values/strings.xml | xml | 2016-12-05T16:11:29 | 2024-08-16T17:51:42 | material-components-android | material-components/material-components-android | 16,176 | 1,773 |
```xml
// See LICENSE in the project root for license information.
module.exports = {
moduleValue: 'zzz'
};
``` | /content/code_sandbox/heft-plugins/heft-jest-plugin/src/test/project1/a/b/mockTransformModule1.ts | xml | 2016-09-30T00:28:20 | 2024-08-16T18:54:35 | rushstack | microsoft/rushstack | 5,790 | 25 |
```xml
export * from "./reference-run";
``` | /content/code_sandbox/src/file/footnotes/footnote/run/index.ts | xml | 2016-03-26T23:43:56 | 2024-08-16T13:02:47 | docx | dolanmiu/docx | 4,139 | 8 |
```xml
import { EMA } from '../moving_averages/EMA';
import { CandleData } from '../StockData';
import { Indicator, IndicatorInput } from '../indicator/indicator';
export class ForceIndexInput extends IndicatorInput {
close : number[];
volume : number[];
period : number = 1;
};
export class ForceIndex extends Indicator {
result : number[]
generator:IterableIterator<number | undefined>;;
constructor(input:ForceIndexInput) {
super(input);
var closes = input.close;
var volumes = input.volume;
var period = input.period || 1
if(!((volumes.length === closes.length))){
throw ('Inputs(volume, close) not of equal size');
}
let emaForceIndex = new EMA({ values : [], period: period })
this.result = [];
this.generator = (function* (){
var previousTick = yield;
var tick = yield;
let forceIndex;
while (true) {
forceIndex = (tick.close - previousTick.close) * tick.volume;
previousTick = tick;
tick = yield emaForceIndex.nextValue(forceIndex);
}
})();
this.generator.next();
volumes.forEach((tick,index) => {
var result = this.generator.next({
close : closes[index],
volume : volumes[index]
});
if(result.value != undefined){
this.result.push(result.value);
}
});
};
static calculate = forceindex;
nextValue(price: CandleData):number | undefined {
let result = this.generator.next(price).value;
if(result != undefined) {
return result;
}
};
}
export function forceindex(input:ForceIndexInput):number[] {
Indicator.reverseInputs(input);
var result = new ForceIndex(input).result;
if(input.reversedInput) {
result.reverse();
}
Indicator.reverseInputs(input);
return result;
};
``` | /content/code_sandbox/src/volume/ForceIndex.ts | xml | 2016-05-02T19:16:32 | 2024-08-15T14:25:09 | technicalindicators | anandanand84/technicalindicators | 2,137 | 404 |
```xml
/**
* @license
*/
import {ArbitraryEqualityMap as ArbitraryEqualityMap_} from '../core/lib/arbitrary-equality-map.js';
import * as Artifacts_ from './artifacts.js';
import Audit_ from './audit.js';
import Config_ from './config.js';
import {Protocol as _Crdp} from 'devtools-protocol/types/protocol.js';
import {ProtocolMapping as _CrdpMappings} from 'devtools-protocol/types/protocol-mapping.js';
import * as Externs from './externs.js';
import Gatherer_ from './gatherer.js';
import * as I18n from './lhr/i18n.js';
import {LighthouseError as LighthouseError_} from '../core/lib/lh-error.js';
import LHResult from './lhr/lhr.js';
import FlowResult_ from './lhr/flow-result.js';
import Protocol_ from './protocol.js';
import * as Settings from './lhr/settings.js';
import Treemap_ from './lhr/treemap.js';
import UserFlow_ from './user-flow.js';
import Puppeteer_ from './puppeteer.js';
import Util_ from './utility-types.js';
// Construct hierarchy of global types under the LH namespace.
export type ArbitraryEqualityMap = ArbitraryEqualityMap_;
export type NavigationRequestor = string | (() => Promise<void> | void);
export import Util = Util_;
export import Puppeteer = Puppeteer_;
// artifacts.d.ts
export import Artifacts = Artifacts_.Artifacts;
export import BaseArtifacts = Artifacts_.BaseArtifacts;
export import GathererArtifacts = Artifacts_.GathererArtifacts;
export import DevtoolsLog = Artifacts_.DevtoolsLog;
export import Trace = Artifacts_.Trace;
export import TraceCpuProfile = Artifacts_.TraceCpuProfile;
export import TraceEvent = Artifacts_.TraceEvent;
export import Audit = Audit_;
export import Config = Config_;
export import Crdp = _Crdp;
export import CrdpEvents = _CrdpMappings.Events;
export import CrdpCommands = _CrdpMappings.Commands;
export import UserFlow = UserFlow_;
// externs.d.ts
export import Flags = Externs.Flags;
export import CliFlags = Externs.CliFlags;
export import RunnerResult = Externs.RunnerResult;
export import DevToolsJsonTarget = Externs.DevToolsJsonTarget;
export import Gatherer = Gatherer_;
export import LighthouseError = LighthouseError_;
export import Result = LHResult;
export import FlowResult = FlowResult_;
// lhr/i18n.d.ts
export import IcuMessage = I18n.IcuMessage;
export import RawIcu = I18n.RawIcu;
export import FormattedIcu = I18n.FormattedIcu;
export import Protocol = Protocol_;
// lhr/settings.d.ts
export import Locale = Settings.Locale;
export import ThrottlingSettings = Settings.ThrottlingSettings;
export import ScreenEmulationSettings = Settings.ScreenEmulationSettings;
export import SharedFlagsSettings = Settings.SharedFlagsSettings;
export import OutputMode = Settings.OutputMode;
export import PrecomputedLanternData = Settings.PrecomputedLanternData;
export import Treemap = Treemap_;
``` | /content/code_sandbox/types/lh.d.ts | xml | 2016-03-08T01:03:11 | 2024-08-16T10:56:56 | lighthouse | GoogleChrome/lighthouse | 28,125 | 673 |
```xml
<?xml version="1.0"?>
<doc>
<assembly>
<name>Microsoft.VisualStudio.Validation</name>
</assembly>
<members>
<member name="T:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute">
<summary>
Marks code to be excluded from code coverage.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute.#ctor">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute"/> class.
</summary>
</member>
<member name="T:System.ComponentModel.LocalizableAttribute">
<summary>
Marks whether a parameter (or other element) is meant to contain localizable text.
</summary>
</member>
<member name="M:System.ComponentModel.LocalizableAttribute.#ctor(System.Boolean)">
<summary>
Initializes a new instance of the <see cref="T:System.ComponentModel.LocalizableAttribute"/> class.
</summary>
</member>
<member name="T:System.Runtime.TargetedPatchingOptOutAttribute">
<summary>
A hint to ngen that it is preferrable that a method's implementation be shared
across assembly boundaries in order to avoid a method call.
</summary>
</member>
<member name="M:System.Runtime.TargetedPatchingOptOutAttribute.#ctor(System.String)">
<summary>
Initializes a new instance of the <see cref="T:System.Runtime.TargetedPatchingOptOutAttribute"/> class.
</summary>
</member>
<member name="T:Microsoft.Strings">
<summary>
A strongly-typed resource class, for looking up localized strings, etc.
</summary>
</member>
<member name="P:Microsoft.Strings.ResourceManager">
<summary>
Returns the cached ResourceManager instance used by this class.
</summary>
</member>
<member name="P:Microsoft.Strings.Culture">
<summary>
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
</summary>
</member>
<member name="P:Microsoft.Strings.Argument_EmptyArray">
<summary>
Looks up a localized string similar to '{0}' must contain at least one element..
</summary>
</member>
<member name="P:Microsoft.Strings.Argument_EmptyString">
<summary>
Looks up a localized string similar to '{0}' cannot be an empty string ("") or start with the null character..
</summary>
</member>
<member name="P:Microsoft.Strings.Argument_NullElement">
<summary>
Looks up a localized string similar to '{0}' cannot contain a null (Nothing in Visual Basic) element..
</summary>
</member>
<member name="P:Microsoft.Strings.Argument_Whitespace">
<summary>
Looks up a localized string similar to The parameter "{0}" cannot consist entirely of white space characters..
</summary>
</member>
<member name="P:Microsoft.Strings.InternalExceptionMessage">
<summary>
Looks up a localized string similar to An internal error occurred. Please contact Microsoft Product Support Services..
</summary>
</member>
<member name="P:Microsoft.Strings.ServiceMissing">
<summary>
Looks up a localized string similar to Cannot find an instance of the {0} service..
</summary>
</member>
<member name="T:Microsoft.Assumes">
<summary>
Common runtime checks that throw public error exceptions upon failure.
</summary>
<content>
Contains the inner exception thrown by Assumes.
</content>
</member>
<member name="M:Microsoft.Assumes.NotNull``1(``0)">
<summary>
Throws an exception if the specified value is null.
</summary>
<typeparam name="T">The type of value to test.</typeparam>
</member>
<member name="M:Microsoft.Assumes.NotNullOrEmpty(System.String)">
<summary>
Throws an exception if the specified value is null or empty.
</summary>
</member>
<member name="M:Microsoft.Assumes.NotNullOrEmpty``1(System.Collections.Generic.ICollection{``0})">
<summary>
Throws an exception if the specified value is null or empty.
</summary>
<typeparam name="T">The type of value to test.</typeparam>
</member>
<member name="M:Microsoft.Assumes.NotNullOrEmpty``1(System.Collections.Generic.IEnumerable{``0})">
<summary>
Throws an exception if the specified value is null or empty.
</summary>
<typeparam name="T">The type of value to test.</typeparam>
</member>
<member name="M:Microsoft.Assumes.Null``1(``0)">
<summary>
Throws an exception if the specified value is not null.
</summary>
<typeparam name="T">The type of value to test.</typeparam>
</member>
<member name="M:Microsoft.Assumes.Is``1(System.Object)">
<summary>
Throws an exception if the specified object is not of a given type.
</summary>
<typeparam name="T">The type the value is expected to be.</typeparam>
<param name="value">The value to test.</param>
</member>
<member name="M:Microsoft.Assumes.False(System.Boolean,System.String)">
<summary>
Throws an public exception if a condition evaluates to true.
</summary>
</member>
<member name="M:Microsoft.Assumes.False(System.Boolean,System.String,System.Object)">
<summary>
Throws an public exception if a condition evaluates to true.
</summary>
</member>
<member name="M:Microsoft.Assumes.False(System.Boolean,System.String,System.Object[])">
<summary>
Throws an public exception if a condition evaluates to true.
</summary>
</member>
<member name="M:Microsoft.Assumes.True(System.Boolean,System.String)">
<summary>
Throws an public exception if a condition evaluates to false.
</summary>
</member>
<member name="M:Microsoft.Assumes.True(System.Boolean,System.String,System.Object)">
<summary>
Throws an public exception if a condition evaluates to false.
</summary>
</member>
<member name="M:Microsoft.Assumes.True(System.Boolean,System.String,System.Object[])">
<summary>
Throws an public exception if a condition evaluates to false.
</summary>
</member>
<member name="M:Microsoft.Assumes.NotReachable">
<summary>
Throws an public exception.
</summary>
</member>
<member name="M:Microsoft.Assumes.Present``1(``0)">
<summary>
Verifies that a value is not null, and throws an exception about a missing service otherwise.
</summary>
<typeparam name="T">The interface of the imported part.</typeparam>
</member>
<member name="M:Microsoft.Assumes.Fail(System.String,System.Boolean)">
<summary>
Throws an public exception.
</summary>
<returns>Nothing, as this method always throws. The signature allows for "throwing" Fail so C# knows execution will stop.</returns>
</member>
<member name="M:Microsoft.Assumes.Fail(System.String,System.Exception,System.Boolean)">
<summary>
Throws an public exception.
</summary>
<returns>Nothing, as this method always throws. The signature allows for "throwing" Fail so C# knows execution will stop.</returns>
</member>
<member name="M:Microsoft.Assumes.Format(System.String,System.Object[])">
<summary>
Helper method that formats string arguments.
</summary>
</member>
<member name="T:Microsoft.Assumes.InternalErrorException">
<summary>
The exception that is thrown when an internal assumption failed.
</summary>
</member>
<member name="M:Microsoft.Assumes.InternalErrorException.#ctor(System.String,System.Boolean)">
<summary>
Initializes a new instance of the <see cref="T:Microsoft.Assumes.InternalErrorException"/> class.
</summary>
</member>
<member name="M:Microsoft.Assumes.InternalErrorException.#ctor(System.String,System.Exception,System.Boolean)">
<summary>
Initializes a new instance of the <see cref="T:Microsoft.Assumes.InternalErrorException"/> class.
</summary>
</member>
<member name="M:Microsoft.Assumes.InternalErrorException.ShowAssertDialog(System.Boolean)">
<summary>
Show the assert if showAssert==true.
</summary>
<param name="showAssert">Whether to show the assert.</param>
<remarks>
The assertion dialog may yet be suppressed if
((DefaultTraceListener)System.Diagnostics.Trace.Listeners["Default"]).AssertUiEnabled == false
</remarks>
</member>
<member name="T:Microsoft.EventHandlerExtensions">
<summary>
Extension methods to make it easier to safely invoke events.
</summary>
</member>
<member name="M:Microsoft.EventHandlerExtensions.Raise(System.Delegate,System.Object,System.EventArgs)">
<summary>
Invokes any event handlers that are hooked to the specified event.
</summary>
<param name="handler">The event. Null is allowed.</param>
<param name="sender">The value to pass as the sender of the event.</param>
<param name="e">Event arguments to include.</param>
</member>
<member name="M:Microsoft.EventHandlerExtensions.Raise(System.EventHandler,System.Object,System.EventArgs)">
<summary>
Invokes any event handlers that are hooked to the specified event.
</summary>
<param name="handler">The event. Null is allowed.</param>
<param name="sender">The value to pass as the sender of the event.</param>
<param name="e">Event arguments to include.</param>
</member>
<member name="M:Microsoft.EventHandlerExtensions.Raise``1(System.EventHandler{``0},System.Object,``0)">
<summary>
Invokes any event handlers that are hooked to the specified event.
</summary>
<typeparam name="T">The type of EventArgs.</typeparam>
<param name="handler">The event. Null is allowed.</param>
<param name="sender">The value to pass as the sender of the event.</param>
<param name="e">Event arguments to include.</param>
</member>
<member name="T:Microsoft.IDisposableObservable">
<summary>
A disposable object that also provides a safe way to query its disposed status.
</summary>
</member>
<member name="P:Microsoft.IDisposableObservable.IsDisposed">
<summary>
Gets a value indicating whether this instance has been disposed.
</summary>
</member>
<member name="T:Microsoft.PrivateErrorHelpers">
<summary>
Common utility methods used by the various error detection and reporting classes.
</summary>
</member>
<member name="M:Microsoft.PrivateErrorHelpers.TrimGenericWrapper(System.Type,System.Type)">
<summary>
Trims away a given surrounding type, returning just the generic type argument,
if the given type is in fact a generic type with just one type argument and
the generic type matches a given wrapper type. Otherwise, it returns the original type.
</summary>
<param name="type">The type to trim, or return unmodified.</param>
<param name="wrapper">The SomeType<> generic type definition to trim away from <paramref name="type"/> if it is present.</param>
<returns><paramref name="type"/>, if it is not a generic type instance of <paramref name="wrapper"/>; otherwise the type argument.</returns>
</member>
<member name="M:Microsoft.PrivateErrorHelpers.Format(System.String,System.Object[])">
<summary>
Helper method that formats string arguments.
</summary>
</member>
<member name="T:Microsoft.Report">
<summary>
Common runtime checks that trace messages and invoke an assertion failure,
but does *not* throw exceptions.
</summary>
</member>
<member name="M:Microsoft.Report.IfNotPresent``1(``0)">
<summary>
Verifies that a value is not null, and reports an error about a missing MEF component otherwise.
</summary>
<typeparam name="T">The interface of the imported part.</typeparam>
</member>
<member name="M:Microsoft.Report.If(System.Boolean,System.String)">
<summary>
Reports an error if a condition evaluates to true.
</summary>
</member>
<member name="M:Microsoft.Report.IfNot(System.Boolean,System.String)">
<summary>
Reports an error if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Report.IfNot(System.Boolean,System.String,System.Object)">
<summary>
Reports an error if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Report.IfNot(System.Boolean,System.String,System.Object,System.Object)">
<summary>
Reports an error if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Report.IfNot(System.Boolean,System.String,System.Object[])">
<summary>
Reports an error if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Report.Fail(System.String)">
<summary>
Reports a certain failure.
</summary>
</member>
<member name="M:Microsoft.Report.Fail(System.String,System.Object[])">
<summary>
Reports a certain failure.
</summary>
</member>
<member name="T:Microsoft.Requires">
<summary>
Common runtime checks that throw ArgumentExceptions upon failure.
</summary>
</member>
<member name="M:Microsoft.Requires.NotNull``1(``0,System.String)">
<summary>
Throws an exception if the specified parameter's value is null.
</summary>
<typeparam name="T">The type of the parameter.</typeparam>
<param name="value">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<returns>The value of the parameter.</returns>
<exception cref="T:System.ArgumentNullException">Thrown if <paramref name="value"/> is <c>null</c></exception>
</member>
<member name="M:Microsoft.Requires.NotNull(System.IntPtr,System.String)">
<summary>
Throws an exception if the specified parameter's value is IntPtr.Zero.
</summary>
<param name="value">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<returns>The value of the parameter.</returns>
<exception cref="T:System.ArgumentNullException">Thrown if <paramref name="value"/> is IntPtr.Zero</exception>
</member>
<member name="M:Microsoft.Requires.NotNull(System.Threading.Tasks.Task,System.String)">
<summary>
Throws an exception if the specified parameter's value is null.
</summary>
<param name="value">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<exception cref="T:System.ArgumentNullException">Thrown if <paramref name="value"/> is <c>null</c></exception>
<remarks>
This method allows async methods to use Requires.NotNull without having to assign the result
to local variables to avoid C# warnings.
</remarks>
</member>
<member name="M:Microsoft.Requires.NotNull``1(System.Threading.Tasks.Task{``0},System.String)">
<summary>
Throws an exception if the specified parameter's value is null.
</summary>
<typeparam name="T">The type of the return value of the task.</typeparam>
<param name="value">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<exception cref="T:System.ArgumentNullException">Thrown if <paramref name="value"/> is <c>null</c></exception>
<remarks>
This method allows async methods to use Requires.NotNull without having to assign the result
to local variables to avoid C# warnings.
</remarks>
</member>
<member name="M:Microsoft.Requires.NotNullAllowStructs``1(``0,System.String)">
<summary>
Throws an exception if the specified parameter's value is null.
</summary>
<typeparam name="T">The type of the parameter.</typeparam>
<param name="value">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<returns>The value of the parameter.</returns>
<exception cref="T:System.ArgumentNullException">Thrown if <paramref name="value"/> is <c>null</c></exception>
<remarks>
This method exists for callers who themselves only know the type as a generic parameter which
may or may not be a class, but certainly cannot be null.
</remarks>
</member>
<member name="M:Microsoft.Requires.NotNullOrEmpty(System.String,System.String)">
<summary>
Throws an exception if the specified parameter's value is null or empty.
</summary>
<param name="value">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<exception cref="T:System.ArgumentException">Thrown if <paramref name="value"/> is <c>null</c> or empty.</exception>
</member>
<member name="M:Microsoft.Requires.NotNullOrWhiteSpace(System.String,System.String)">
<summary>
Throws an exception if the specified parameter's value is null, empty, or whitespace.
</summary>
<param name="value">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<exception cref="T:System.ArgumentException">Thrown if <paramref name="value"/> is <c>null</c> or empty.</exception>
</member>
<member name="M:Microsoft.Requires.NotNullOrEmpty(System.Collections.IEnumerable,System.String)">
<summary>
Throws an exception if the specified parameter's value is null,
has no elements or has an element with a null value.
</summary>
<param name="values">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<exception cref="T:System.ArgumentException">Thrown if the tested condition is false.</exception>
</member>
<member name="M:Microsoft.Requires.NotNullEmptyOrNullElements``1(System.Collections.Generic.IEnumerable{``0},System.String)">
<summary>
Throws an exception if the specified parameter's value is null,
has no elements or has an element with a null value.
</summary>
<typeparam name="T">The type of the elements in the sequence.</typeparam>
<param name="values">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<exception cref="T:System.ArgumentException">Thrown if the tested condition is false.</exception>
</member>
<member name="M:Microsoft.Requires.NullOrNotNullElements``1(System.Collections.Generic.IEnumerable{``0},System.String)">
<summary>
Throws an exception if the specified parameter's value is not null
<em>and</em> has an element with a null value.
</summary>
<typeparam name="T">The type of the elements in the sequence.</typeparam>
<param name="values">The value of the argument.</param>
<param name="parameterName">The name of the parameter to include in any thrown exception.</param>
<exception cref="T:System.ArgumentException">Thrown if the tested condition is false.</exception>
</member>
<member name="M:Microsoft.Requires.Range(System.Boolean,System.String,System.String)">
<summary>
Throws an <see cref="T:System.ArgumentOutOfRangeException"/> if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Requires.FailRange(System.String,System.String)">
<summary>
Throws an <see cref="T:System.ArgumentOutOfRangeException"/> if a condition does not evaluate to true.
</summary>
<returns>Nothing. This method always throws.</returns>
</member>
<member name="M:Microsoft.Requires.Argument(System.Boolean,System.String,System.String)">
<summary>
Throws an ArgumentException if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Requires.Argument(System.Boolean,System.String,System.String,System.Object)">
<summary>
Throws an ArgumentException if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Requires.Argument(System.Boolean,System.String,System.String,System.Object,System.Object)">
<summary>
Throws an ArgumentException if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Requires.Argument(System.Boolean,System.String,System.String,System.Object[])">
<summary>
Throws an ArgumentException if a condition does not evaluate to true.
</summary>
</member>
<member name="M:Microsoft.Requires.Fail(System.String)">
<summary>
Throws an ArgumentException.
</summary>
<returns>Nothing. It always throws.</returns>
</member>
<member name="M:Microsoft.Requires.Fail(System.String,System.Object[])">
<summary>
Throws an ArgumentException.
</summary>
<returns>Nothing. It always throws.</returns>
</member>
<member name="M:Microsoft.Requires.Fail(System.Exception,System.String,System.Object[])">
<summary>
Throws an ArgumentException.
</summary>
</member>
<member name="M:Microsoft.Requires.Format(System.String,System.Object[])">
<summary>
Helper method that formats string arguments.
</summary>
</member>
<member name="T:Microsoft.ValidatedNotNullAttribute">
<summary>
Indicates to Code Analysis that a method validates a particular parameter.
</summary>
</member>
<member name="M:Microsoft.ValidatedNotNullAttribute.#ctor">
<summary>
Initializes a new instance of the <see cref="T:Microsoft.ValidatedNotNullAttribute"/> class.
</summary>
</member>
<member name="T:Microsoft.Verify">
<summary>
Common runtime checks that throw exceptions upon failure.
</summary>
</member>
<member name="M:Microsoft.Verify.Operation(System.Boolean,System.String)">
<summary>
Throws an <see cref="T:System.InvalidOperationException"/> if a condition is false.
</summary>
</member>
<member name="M:Microsoft.Verify.Operation(System.Boolean,System.String,System.Object)">
<summary>
Throws an <see cref="T:System.InvalidOperationException"/> if a condition is false.
</summary>
</member>
<member name="M:Microsoft.Verify.Operation(System.Boolean,System.String,System.Object,System.Object)">
<summary>
Throws an <see cref="T:System.InvalidOperationException"/> if a condition is false.
</summary>
</member>
<member name="M:Microsoft.Verify.Operation(System.Boolean,System.String,System.Object[])">
<summary>
Throws an <see cref="T:System.InvalidOperationException"/> if a condition is false.
</summary>
</member>
<member name="M:Microsoft.Verify.OperationWithHelp(System.Boolean,System.String,System.String)">
<summary>
Throws an <see cref="T:System.InvalidOperationException"/> if a condition is false.
</summary>
</member>
<member name="M:Microsoft.Verify.FailOperation(System.String,System.Object[])">
<summary>
Throws an <see cref="T:System.InvalidOperationException"/>.
</summary>
<returns>
Nothing. This method always throws.
The signature claims to return an exception to allow callers to throw this method
to satisfy C# execution path constraints.
</returns>
</member>
<member name="M:Microsoft.Verify.NotDisposed(Microsoft.IDisposableObservable,System.String)">
<summary>
Throws an <see cref="T:System.ObjectDisposedException"/> if an object is disposed.
</summary>
</member>
<member name="M:Microsoft.Verify.NotDisposed(System.Boolean,System.Object,System.String)">
<summary>
Throws an <see cref="T:System.ObjectDisposedException"/> if a condition is false.
</summary>
</member>
<member name="M:Microsoft.Verify.NotDisposed(System.Boolean,System.String)">
<summary>
Throws an <see cref="T:System.ObjectDisposedException"/> if a condition is false.
</summary>
</member>
</members>
</doc>
``` | /content/code_sandbox/packages/Microsoft.VisualStudio.Validation.14.1.111/lib/portable-net45+win+wpa81+wp80/Microsoft.VisualStudio.Validation.xml | xml | 2016-04-24T09:50:47 | 2024-08-16T11:45:14 | ILRuntime | Ourpalm/ILRuntime | 2,976 | 5,400 |
```xml
import { ErrorHandler, Injectable, Injector, inject } from "@angular/core";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
@Injectable()
export class LoggingErrorHandler extends ErrorHandler {
/**
* When injecting services into an `ErrorHandler`, we must use the `Injector` manually to avoid circular dependency errors.
*
* path_to_url
*/
private injector = inject(Injector);
override handleError(error: any): void {
try {
const logService = this.injector.get(LogService, null);
logService.error("Unhandled error in angular", error);
} catch {
super.handleError(error);
}
}
}
``` | /content/code_sandbox/libs/angular/src/platform/services/logging-error-handler.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 139 |
```xml
import graphqlPubsub from "@erxes/api-utils/src/graphqlPubsub";
import { CONVERSATION_STATUSES } from "./models/definitions/constants";
import { sendContactsMessage, sendCoreMessage } from "./messageBroker";
import { generateModels } from "./connectionResolver";
import { IConversationDocument } from "./models/definitions/conversations";
import { pConversationClientMessageInserted } from "./graphql/resolvers/widgetMutations";
import {
RPError,
RPResult,
RPSuccess
} from "@erxes/api-utils/src/messageBroker";
const sendError = (message): RPError => ({
status: "error",
errorMessage: message
});
const sendSuccess = (data): RPSuccess => ({
status: "success",
data
});
/*
* Handle requests from integrations api
*/
export const receiveRpcMessage = async (subdomain, data): Promise<RPResult> => {
const { action, metaInfo, payload } = data;
const { Integrations, ConversationMessages, Conversations } =
await generateModels(subdomain);
const doc = JSON.parse(payload || "{}");
if (action === "get-create-update-customer") {
const integration = await Integrations.findOne({
_id: doc.integrationId
});
if (!integration) {
return sendError(`Integration not found: ${doc.integrationId}`);
}
const { primaryEmail, primaryPhone } = doc;
let customer;
const getCustomer = async selector =>
sendContactsMessage({
subdomain,
action: "customers.findOne",
data: selector,
isRPC: true
});
if (primaryPhone) {
customer = await getCustomer({ primaryPhone });
if (customer) {
await sendContactsMessage({
subdomain,
action: "customers.updateCustomer",
data: {
_id: customer._id,
doc
},
isRPC: true
});
return sendSuccess({ _id: customer._id });
}
}
if (primaryEmail) {
customer = await getCustomer({ primaryEmail });
}
if (customer) {
return sendSuccess({ _id: customer._id });
} else {
customer = await sendContactsMessage({
subdomain,
action: "customers.createCustomer",
data: {
...doc,
scopeBrandIds: integration.brandId
},
isRPC: true
});
}
return sendSuccess({ _id: customer._id });
}
if (action === "create-or-update-conversation") {
const { conversationId, content, owner, updatedAt } = doc;
let user;
if (owner) {
user = await sendCoreMessage({
subdomain,
action: "users.findOne",
data: {
"details.operatorPhone": owner
},
isRPC: true,
defaultValue: {}
});
}
let assignedUserId = user ? user._id : null;
if (conversationId) {
if (!assignedUserId) {
const existingConversation = await Conversations.findOne({
_id: conversationId
});
assignedUserId = existingConversation?.assignedUserId || null;
}
const conversation = await Conversations.findOne({
_id: conversationId
}).lean();
if (conversation) {
await Conversations.updateConversation(conversationId, {
content,
assignedUserId,
updatedAt,
// mark this conversation as unread
readUserIds: [],
// reopen this conversation if it's closed
status: CONVERSATION_STATUSES.OPEN
});
} else {
const formattedDoc = {
_id: doc.conversationId,
customerId: doc.customerId,
integrationId: doc.integrationId,
content: doc.content,
attachments: doc.attachments,
conversationId: doc.conversationId,
updatedAt: doc.updatedAt
};
await Conversations.createConversation(formattedDoc);
}
return sendSuccess({ _id: conversationId });
}
doc.assignedUserId = assignedUserId;
const conversation = await Conversations.createConversation(doc);
return sendSuccess({ _id: conversation._id });
}
if (action === "create-conversation-message") {
const message = await ConversationMessages.createMessage(doc);
const conversationDoc: {
status: string;
readUserIds: string[];
content?: string;
updatedAt?: Date;
} = {
// Reopen its conversation if it's closed
status:
doc.unread || doc.unread === undefined
? CONVERSATION_STATUSES.OPEN
: CONVERSATION_STATUSES.CLOSED,
// Mark as unread
readUserIds: []
};
if (message.content && metaInfo === "replaceContent") {
conversationDoc.content = message.content;
}
if (doc.createdAt) {
conversationDoc.updatedAt = doc.createdAt;
}
await Conversations.updateConversation(
message.conversationId,
conversationDoc
);
// FIXME: Find userId and `conversationClientMessageInserted:${userId}`
// graphqlPubsub.publish('conversationClientMessageInserted', {
// conversationClientMessageInserted: message,
// });
graphqlPubsub.publish(
`conversationMessageInserted:${message.conversationId}`,
{
conversationMessageInserted: message
}
);
return sendSuccess({ _id: message._id });
}
if (action === "get-configs") {
const configs = await sendCoreMessage({
subdomain,
action: "getConfigs",
data: {},
isRPC: true
});
return sendSuccess({ configs });
}
if (action === "getUserIds") {
const users = await sendCoreMessage({
subdomain,
action: "users.getIds",
data: {},
isRPC: true,
defaultValue: []
});
return sendSuccess({ userIds: users.map(user => user._id) });
}
throw new Error(`Unknown action: ${action}`);
};
/*
* Integrations api notification
*/
export const receiveIntegrationsNotification = async (subdomain, msg) => {
const { action, conversationId } = msg;
const models = await generateModels(subdomain);
if (action === "external-integration-entry-added") {
graphqlPubsub.publish("conversationExternalIntegrationMessageInserted", {});
if (conversationId) {
await models.Conversations.reopen(conversationId);
// FIXME: It must have _id
// await pConversationClientMessageInserted(models, subdomain, {
// conversationId,
// });
}
return sendSuccess({ status: "ok" });
}
if (action === "sync-calendar-event") {
graphqlPubsub.publish("calendarEventUpdated", {});
return sendSuccess({ status: "ok" });
}
};
/**
* Remove engage conversations
*/
export const removeEngageConversations = async (models, _id) => {
await models.Conversations.removeEngageConversations(_id);
};
export const collectConversations = async (
subdomain: string,
{ contentId }: { contentId: string }
) => {
const models = await generateModels(subdomain);
const results: any[] = [];
const activities = await sendCoreMessage({
subdomain,
action: "activityLogs.findMany",
data: {
query: {
contentId,
action: "convert"
},
options: {
content: 1
}
},
isRPC: true,
defaultValue: []
});
const contentIds = activities.map(activity => activity.content);
let conversations: IConversationDocument[] = [];
if (!contentIds.length) {
conversations = await models.Conversations.find({
$or: [{ customerId: contentId }, { participatedUserIds: contentId }]
}).lean();
} else {
conversations = await models.Conversations.find({
_id: { $in: contentIds }
}).lean();
}
for (const c of conversations) {
results.push({
_id: c._id,
contentType: "inbox:conversation",
contentId,
createdAt: c.createdAt,
contentTypeDetail: {
integration: await models.Integrations.findOne({
_id: c.integrationId
})
}
});
}
return results;
};
``` | /content/code_sandbox/packages/plugin-inbox-api/src/receiveMessage.ts | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 1,759 |
```xml
export const data = `name,url,additional_urls,username,password,note,cardholdername,cardnumber,cvc,expirydate,zipcode,folder,full_name,phone_number,email,address1,address2,city,country,state,type,custom_fields
SomeTitle,,,,,SomeNoteToMyIdentity,,,,,123456,,#fullName,123456789,hello@bitwarden.com,Test street 123,additional addressinfo,Cologne,Germany,North-Rhine-Westphalia,identity,`;
``` | /content/code_sandbox/libs/importer/spec/test-data/nordpass-csv/nordpass.identity.csv.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 105 |
```xml
import { IPersonaProps, PersonaPresence } from '@fluentui/react/lib/Persona';
import { TestImages } from '@fluentui/example-data';
/* eslint-disable deprecation/deprecation */
/** @deprecated Use the version from `@fluentui/example-data` instead. */
export const people: (IPersonaProps & { key: string | number })[] = [
{
key: 1,
imageUrl: TestImages.personaFemale,
imageInitials: 'PV',
text: 'Annie Lindqvist',
secondaryText: 'Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 2,
imageUrl: TestImages.personaMale,
imageInitials: 'AR',
text: 'Aaron Reid',
secondaryText: 'Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 3,
imageUrl: TestImages.personaMale,
imageInitials: 'AL',
text: 'Alex Lundberg',
secondaryText: 'Software Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.dnd,
},
{
key: 4,
imageUrl: TestImages.personaMale,
imageInitials: 'RK',
text: 'Roko Kolar',
secondaryText: 'Financial Analyst',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.offline,
},
{
key: 5,
imageUrl: TestImages.personaMale,
imageInitials: 'CB',
text: 'Christian Bergqvist',
secondaryText: 'Sr. Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 6,
imageUrl: TestImages.personaFemale,
imageInitials: 'VL',
text: 'Valentina Lovric',
secondaryText: 'Design Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 7,
imageUrl: TestImages.personaMale,
imageInitials: 'MS',
text: 'Maor Sharett',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.away,
},
{
key: 8,
imageUrl: TestImages.personaFemale,
imageInitials: 'PV',
text: 'Anny Lindqvist',
secondaryText: 'Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 9,
imageUrl: TestImages.personaMale,
imageInitials: 'AR',
text: 'Aron Reid',
secondaryText: 'Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.dnd,
},
{
key: 10,
imageUrl: TestImages.personaMale,
imageInitials: 'AL',
text: 'Alix Lundberg',
secondaryText: 'Software Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.offline,
},
{
key: 11,
imageUrl: TestImages.personaMale,
imageInitials: 'RK',
text: 'Roko Kular',
secondaryText: 'Financial Analyst',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.none,
},
{
key: 12,
imageUrl: TestImages.personaMale,
imageInitials: 'CB',
text: 'Christian Bergqvest',
secondaryText: 'Sr. Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 13,
imageUrl: TestImages.personaFemale,
imageInitials: 'VL',
text: 'Valintina Lovric',
secondaryText: 'Design Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 14,
imageUrl: TestImages.personaMale,
imageInitials: 'MS',
text: 'Maor Sharet',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.blocked,
},
{
key: 15,
imageUrl: TestImages.personaFemale,
imageInitials: 'VL',
text: 'Anny Lindqvest',
secondaryText: 'SDE',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.blocked,
},
{
key: 16,
imageUrl: TestImages.personaMale,
imageInitials: 'MS',
text: 'Alix Lunberg',
secondaryText: 'SE',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.away,
},
{
key: 17,
imageUrl: TestImages.personaFemale,
imageInitials: 'VL',
text: 'Annie Lindqvest',
secondaryText: 'SDET',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 18,
imageUrl: TestImages.personaMale,
imageInitials: 'MS',
text: 'Alixander Lundberg',
secondaryText: 'Senior Manager of SDET',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.offline,
},
{
key: 19,
imageUrl: TestImages.personaFemale,
imageInitials: 'VL',
text: 'Anny Lundqvist',
secondaryText: 'Junior Manager of Software',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.away,
},
{
key: 20,
imageUrl: TestImages.personaMale,
imageInitials: 'MS',
text: 'Maor Shorett',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.blocked,
},
{
key: 21,
imageUrl: TestImages.personaFemale,
imageInitials: 'VL',
text: 'Valentina Lovrics',
secondaryText: 'Design Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 22,
imageUrl: TestImages.personaMale,
imageInitials: 'MS',
text: 'Maor Sharet',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 23,
imageUrl: TestImages.personaFemale,
imageInitials: 'VL',
text: 'Valentina Lovrecs',
secondaryText: 'Design Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.blocked,
},
{
key: 24,
imageUrl: TestImages.personaMale,
imageInitials: 'MS',
text: 'Maor Sharitt',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.offline,
},
{
key: 25,
imageUrl: './images/persona-male.png',
imageInitials: 'MS',
text: 'Maor Shariett',
secondaryText: 'Design Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 3:00pm',
presence: PersonaPresence.online,
},
{
key: 26,
imageUrl: './images/persona-female.png',
imageInitials: 'AL',
text: 'Alix Lundburg',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 3:00pm',
presence: PersonaPresence.away,
},
{
key: 27,
imageUrl: './images/persona-female.png',
imageInitials: 'VL',
text: 'Valantena Lovric',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 28,
imageUrl: './images/persona-female.png',
imageInitials: 'VL',
text: 'Velatine Lourvric',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 29,
imageUrl: './images/persona-female.png',
imageInitials: 'VL',
text: 'Valentyna Lovrique',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 30,
imageUrl: './images/persona-female.png',
imageInitials: 'AL',
text: 'Annie Lindquest',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.dnd,
},
{
key: 31,
imageUrl: './images/persona-female.png',
imageInitials: 'AL',
text: 'Anne Lindquist',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.blocked,
},
{
key: 32,
imageUrl: './images/persona-female.png',
imageInitials: 'AL',
text: 'Ann Lindqiest',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 33,
imageUrl: './images/persona-male.png',
imageInitials: 'AR',
text: 'Aron Reid',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.away,
},
{
key: 34,
imageUrl: './images/persona-male.png',
imageInitials: 'AR',
text: 'Aaron Reed',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.offline,
},
{
key: 35,
imageUrl: './images/persona-female.png',
imageInitials: 'AL',
text: 'Alix Lindberg',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 36,
imageUrl: './images/persona-male.png',
imageInitials: 'AL',
text: 'Alan Lindberg',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.busy,
},
{
key: 37,
imageUrl: './images/persona-male.png',
imageInitials: 'MS',
text: 'Maor Sharit',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.offline,
},
{
key: 38,
imageUrl: './images/persona-male.png',
imageInitials: 'MS',
text: 'Maorr Sherit',
secondaryText: 'UX Designer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
{
key: 39,
imageUrl: './images/persona-male.png',
imageInitials: 'AL',
text: 'Alex Lindbirg',
secondaryText: 'Software Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.dnd,
},
{
key: 40,
imageUrl: './images/persona-male.png',
imageInitials: 'AL',
text: 'Alex Lindbarg',
secondaryText: 'Software Developer',
tertiaryText: 'In a meeting',
optionalText: 'Available at 4:00pm',
presence: PersonaPresence.online,
},
];
/** @deprecated Use the version from `@fluentui/example-data` instead. */
export const mru: IPersonaProps[] = people.slice(0, 5);
``` | /content/code_sandbox/packages/react-examples/src/react/PeoplePicker/examples/PeoplePickerExampleData.ts | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 3,105 |
```xml
import * as React from 'react'
import { Octicon } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
interface IBannerProps {
readonly id?: string
readonly timeout?: number
readonly dismissable?: boolean
readonly onDismissed: () => void
}
export class Banner extends React.Component<IBannerProps, {}> {
private banner = React.createRef<HTMLDivElement>()
// Timeout ID for manual focus placement after mounting
private focusTimeoutId: number | null = null
// Timeout ID for auto-dismissal of the banner after focus is lost
private dismissalTimeoutId: number | null = null
public render() {
return (
<div id={this.props.id} className="banner" ref={this.banner}>
<div className="contents">{this.props.children}</div>
{this.renderCloseButton()}
</div>
)
}
private renderCloseButton() {
const { dismissable, onDismissed } = this.props
if (dismissable === false) {
return null
}
return (
<div className="close">
<button onClick={onDismissed} aria-label="Dismiss this message">
<Octicon symbol={octicons.x} />
</button>
</div>
)
}
public componentDidMount() {
this.focusTimeoutId = window.setTimeout(() => {
this.focusOnFirstSuitableElement()
}, 200)
this.addDismissalFocusListeners()
}
public componentWillUnmount() {
if (this.focusTimeoutId !== null) {
window.clearTimeout(this.focusTimeoutId)
this.focusTimeoutId = null
}
this.removeDismissalFocusListeners()
}
private focusOnFirstSuitableElement = () => {
const target =
this.banner.current?.querySelector('a') ||
this.banner.current?.querySelector('button')
target?.focus()
}
private addDismissalFocusListeners() {
this.banner.current?.addEventListener('focusin', this.onFocusIn)
this.banner.current?.addEventListener('focusout', this.onFocusOut)
}
private removeDismissalFocusListeners() {
this.banner.current?.removeEventListener('focusout', this.onFocusOut)
this.banner.current?.removeEventListener('focusin', this.onFocusIn)
}
private onFocusIn = () => {
if (this.dismissalTimeoutId !== null) {
window.clearTimeout(this.dismissalTimeoutId)
this.dismissalTimeoutId = null
}
}
private onFocusOut = async (event: FocusEvent) => {
const { dismissable, onDismissed, timeout } = this.props
if (
event.relatedTarget &&
this.banner.current?.contains(event.relatedTarget as Node)
) {
return
}
if (dismissable !== false && timeout !== undefined) {
this.dismissalTimeoutId = window.setTimeout(() => {
onDismissed()
}, timeout)
}
}
}
``` | /content/code_sandbox/app/src/ui/banners/banner.tsx | xml | 2016-05-11T15:59:00 | 2024-08-16T17:00:41 | desktop | desktop/desktop | 19,544 | 632 |
```xml
/* eslint-disable */
export default {
displayName: 'identity',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {},
coverageDirectory: '../../coverage/packages/identity',
transform: {
'^.+.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
``` | /content/code_sandbox/npm/ng-packs/packages/identity/jest.config.ts | xml | 2016-12-03T22:56:24 | 2024-08-16T16:24:05 | abp | abpframework/abp | 12,657 | 180 |
```xml
import { Permission } from 'app/model/permission.model';
import { Application } from './application.model';
import { Environment } from './environment.model';
import { GroupPermission } from './group.model';
import { ProjectIntegration } from './integration.model';
import { Key } from './keys.model';
import { Pipeline } from './pipeline.model';
import { RepositoriesManager } from './repositories.model';
import { Variable } from './variable.model';
import { Workflow } from './workflow.model';
import { VariableSet } from './variablesets.model';
export class Project {
key: string;
name: string;
description: string;
icon: string;
workflows: Array<Workflow>;
workflow_names: Array<IdName>;
pipelines: Array<Pipeline>;
pipeline_names: Array<IdName>;
applications: Array<Application>;
application_names: Array<IdName>;
groups: Array<GroupPermission>;
variables: Array<Variable>;
variablesets: Array<VariableSet>;
environments: Array<Environment>;
environment_names: Array<IdName>;
permissions: Permission;
last_modified: string;
vcs_servers: Array<RepositoriesManager>;
keys: Array<Key>;
integrations: Array<ProjectIntegration>;
features: {};
labels: Label[];
metadata: {};
favorite: boolean;
workflow_retention: number;
// true if someone has updated the project ( used for warnings )
externalChange: boolean;
loading: boolean;
mute: boolean;
organization: string;
}
export class LoadOpts {
constructor(
public queryParam: string,
public fieldName: string
) { }
}
export class IdName {
id: number;
name: string;
description?: string;
icon?: string;
labels?: Label[];
// ui params
mute: boolean;
}
export class Label {
id: number;
name: string;
color: string;
project_id: number;
workflow_id: number;
// ui params
font_color: string;
}
export class ProjectRepository {
id: string;
name: string;
clone_url: string;
created: Date;
created_by: string;
}
export class RepositoryHookEvent {
uuid: string;
created: number;
status: string;
event_name: string;
extracted_data: RepositoryHookEventExtractedData;
username: string;
last_error: string;
vcs_server_name: string;
repository_name: string;
analyses: Array<RepositoryHookEventAnalysis>;
workflows: Array<RepositoryHookWorkflow>;
sign_key: string;
// UI data
nbDone: number;
nbFailed: number;
nbScheduled: number;
nbSkipped: number;
}
export class RepositoryHookEventAnalysis {
analyze_id: string;
status: string;
project_key: string;
}
export enum HookEventWorkflowStatus {
Scheduled = "Scheduled",
Skipped = "Skipped",
Error = "Error",
Done = "Done"
}
export class RepositoryHookEventExtractedData {
ref: string;
commit: string;
cds_event_name: string;
}
export class RepositoryHookWorkflow {
project_key: string;
vcs_identifier: string;
repository_identifier: string;
workflow_name: string;
type: string;
status: string;
run_id: string;
}
``` | /content/code_sandbox/ui/src/app/model/project.model.ts | xml | 2016-10-11T08:28:23 | 2024-08-16T01:55:31 | cds | ovh/cds | 4,535 | 711 |
```xml
import { Injectable, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class DataService {
baseUrl = `${this.BASE_URL}api`;
constructor(@Inject('BASE_URL') private BASE_URL: string, private http: HttpClient) {
console.log(BASE_URL);
}
// this function returns an observable of type T in the form of JSON
// the advantage of an observable : if it changes then this will fire off the change detection as the DOM has changed
public get<T>(url: string): Observable<T> {
return this.http.get<T>(`${this.baseUrl}/${url}`);
}
public getForText(url: string): Observable<any> {
return this.http.get(`${this.baseUrl}/${url}`, { responseType: 'text' });
}
public put<T>(url: string, itemToUpdate): Observable<T> {
return this.http.put<T>(`${this.baseUrl}/${url}`, itemToUpdate);
}
public post<T>(url: string, body: any): Observable<T> {
return this.http.post<T>(`${this.baseUrl}/${url}`, body);
}
public patch<T>(url: string, body: any): Observable<T> {
return this.http.patch<T>(`${this.baseUrl}/${url}`, body);
}
public delete<T>(url: string): Observable<T> {
return this.http.delete<T>(`${this.baseUrl}/${url}`);
}
}
``` | /content/code_sandbox/src/Presentation/Web/ClientApp/src/app/shared/services/data.service.ts | xml | 2016-06-03T17:49:56 | 2024-08-14T02:53:24 | AspNetCoreSpa | fullstackproltd/AspNetCoreSpa | 1,472 | 314 |
```xml
import AttachMoneyIcon from '@mui/icons-material/AttachMoney';
import { Box, Stack, Typography } from '@mui/material';
import { ResponsiveBar } from '@nivo/bar';
import { format, startOfMonth } from 'date-fns';
import { useMemo } from 'react';
import { useGetList } from 'react-admin';
import { Deal } from '../types';
const multiplier = {
opportunity: 0.2,
'proposal-sent': 0.5,
'in-negociation': 0.8,
delayed: 0.3,
};
const threeMonthsAgo = new Date(
new Date().setMonth(new Date().getMonth() - 6)
).toISOString();
export const DealsChart = () => {
const { data, isPending } = useGetList<Deal>('deals', {
pagination: { perPage: 100, page: 1 },
sort: {
field: 'created_at',
order: 'ASC',
},
filter: {
'created_at@gte': threeMonthsAgo,
},
});
const months = useMemo(() => {
if (!data) return [];
const dealsByMonth = data.reduce((acc, deal) => {
const month = startOfMonth(
deal.created_at ?? new Date()
).toISOString();
if (!acc[month]) {
acc[month] = [];
}
acc[month].push(deal);
return acc;
}, {} as any);
const amountByMonth = Object.keys(dealsByMonth).map(month => {
return {
date: format(month, 'MMM'),
won: dealsByMonth[month]
.filter((deal: Deal) => deal.stage === 'won')
.reduce((acc: number, deal: Deal) => {
acc += deal.amount;
return acc;
}, 0),
pending: dealsByMonth[month]
.filter(
(deal: Deal) => !['won', 'lost'].includes(deal.stage)
)
.reduce((acc: number, deal: Deal) => {
// @ts-ignore
acc += deal.amount * multiplier[deal.stage];
return acc;
}, 0),
lost: dealsByMonth[month]
.filter((deal: Deal) => deal.stage === 'lost')
.reduce((acc: number, deal: Deal) => {
acc -= deal.amount;
return acc;
}, 0),
};
});
return amountByMonth;
}, [data]);
if (isPending) return null; // FIXME return skeleton instead
const range = months.reduce(
(acc, month) => {
acc.min = Math.min(acc.min, month.lost);
acc.max = Math.max(acc.max, month.won + month.pending);
return acc;
},
{ min: 0, max: 0 }
);
return (
<Stack>
<Box display="flex" alignItems="center" mb={1}>
<Box mr={1} display="flex">
<AttachMoneyIcon color="disabled" fontSize="medium" />
</Box>
<Typography variant="h5" color="textSecondary">
Upcoming Deal Revenue
</Typography>
</Box>
<Box height={400}>
<ResponsiveBar
data={months}
indexBy="date"
keys={['won', 'pending', 'lost']}
colors={['#61cdbb', '#97e3d5', '#e25c3b']}
margin={{ top: 30, right: 50, bottom: 30, left: 0 }}
padding={0.3}
valueScale={{
type: 'linear',
min: range.min * 1.2,
max: range.max * 1.2,
}}
indexScale={{ type: 'band', round: true }}
enableGridX={true}
enableGridY={false}
enableLabel={false}
axisTop={{
tickSize: 0,
tickPadding: 12,
}}
axisBottom={{
legendPosition: 'middle',
legendOffset: 50,
tickSize: 0,
tickPadding: 12,
}}
axisLeft={null}
axisRight={{
format: (v: any) => `${Math.abs(v / 1000)}k`,
tickValues: 8,
}}
markers={
[
{
axis: 'y',
value: 0,
lineStyle: { strokeOpacity: 0 },
textStyle: { fill: '#2ebca6' },
legend: 'Won',
legendPosition: 'top-left',
legendOrientation: 'vertical',
},
{
axis: 'y',
value: 0,
lineStyle: {
stroke: '#f47560',
strokeWidth: 1,
},
textStyle: { fill: '#e25c3b' },
legend: 'Lost',
legendPosition: 'bottom-left',
legendOrientation: 'vertical',
},
] as any
}
/>
</Box>
</Stack>
);
};
``` | /content/code_sandbox/examples/crm/src/dashboard/DealsChart.tsx | xml | 2016-07-13T07:58:54 | 2024-08-16T18:32:27 | react-admin | marmelab/react-admin | 24,624 | 1,102 |
```xml
import Button from "@erxes/ui/src/components/Button";
import {
ControlLabel,
FormControl,
FormGroup,
} from "@erxes/ui/src/components/form";
import Icon from "@erxes/ui/src/components/Icon";
import { FlexItem, LeftItem } from "@erxes/ui/src/components/step/styles";
import Tip from "@erxes/ui/src/components/Tip";
import { __ } from "@erxes/ui/src/utils/core";
import React from "react";
import styled from "styled-components";
import { additionalField } from "../../../types";
const WebsiteItem = styled.div`
padding: 12px 16px 0 16px;
background: #fafafa;
border-radius: 4px;
border: 1px solid #eee;
position: relative;
`;
const RemoveButton = styled.div`
position: absolute;
right: 16px;
top: 16px;
background: rgba(0, 0, 0, 0.1);
border-radius: 50%;
width: 24px;
height: 24px;
display: flex;
justify-content: center;
align-items: center;
transition: opacity ease 0.3s;
&:hover {
opacity: 0.8;
cursor: pointer;
}
`;
const RequiredField = styled.div`
padding: 12px 12px 12px 0;
border-bottom: 1px solid #eee;
position: relative;
span {
float: right;
}
`;
type Props = {
onChange: (name: "additionalFields", value: any) => void;
additionalFields?: additionalField[];
};
type State = {
additionalFields: additionalField[];
};
const emptyField = { label: "", name: "", type: "text", required: false };
class CustomFields extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
additionalFields: [emptyField],
};
}
updateFieldValues = () => {
this.props.onChange("additionalFields", this.state.additionalFields);
};
onChangeInput = (
i: number,
type: "label" | "type" | "required",
e: React.FormEvent
) => {
const element = e.target as HTMLInputElement;
const value = type === "required" ? element.checked : element.value;
const entries = [...this.state.additionalFields];
entries[i] = { ...entries[i], [type]: value };
if (type === "label") {
entries[i] = { ...entries[i], name: element.value };
}
this.setState({ additionalFields: entries }, () =>
this.updateFieldValues()
);
};
handleRemoveWebsite = (i: number) => {
this.setState(
{
additionalFields: this.state.additionalFields.filter(
(item, index) => index !== i
),
},
() => this.updateFieldValues()
);
};
renderRemoveInput = (i: number) => {
return (
<Tip text={__("Remove")} placement="top">
<RemoveButton onClick={this.handleRemoveWebsite.bind(null, i)}>
<Icon icon="times" />
</RemoveButton>
</Tip>
);
};
onAddMoreInput = () => {
this.setState({
additionalFields: [...this.state.additionalFields, emptyField],
});
};
renderRequiredField = (name: string) => {
return (
<RequiredField>
<span>
(required)
<Icon icon="lock" />
</span>
{name}
</RequiredField>
);
};
render() {
const { additionalFields } = this.state;
return (
<FlexItem>
<LeftItem>
<FormGroup>
<ControlLabel>What info should guests provide?</ControlLabel>
{this.renderRequiredField("Name")}
{this.renderRequiredField("Email")}
</FormGroup>
{additionalFields.map((field, index) => (
<FormGroup key={index}>
<WebsiteItem>
<FormGroup>
<ControlLabel required={true}>Label</ControlLabel>
<FormControl
name="label"
onChange={this.onChangeInput.bind(null, index, "label")}
required={true}
value={field.label}
/>
</FormGroup>
<FormGroup>
<ControlLabel required={true}>Type</ControlLabel>
<FormControl
value={field.type}
name="type"
onChange={this.onChangeInput.bind(null, index, "type")}
componentclass="select"
>
<option value="text">text</option>
<option value="multi-line text">multi-line text</option>
<option value="email">email</option>
<option value="phone">phone</option>
<option value="number">number</option>
<option value="dropdown">dropdown</option>
<option value="checkbox">checkbox</option>
</FormControl>
</FormGroup>
<FormGroup>
<ControlLabel>Required</ControlLabel>
<FormControl
name="required"
defaultChecked={field.required}
componentclass="checkbox"
onChange={this.onChangeInput.bind(null, index, "required")}
/>
</FormGroup>
</WebsiteItem>
{this.renderRemoveInput(index)}
</FormGroup>
))}
<Button
onClick={this.onAddMoreInput}
icon="plus-circle"
btnStyle="primary"
>
Add a field
</Button>
</LeftItem>
</FlexItem>
);
}
}
export default CustomFields;
``` | /content/code_sandbox/packages/plugin-calendar-ui/src/settings/components/scheduler/steps/CustomFields.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 1,206 |
```xml
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
parameters: {
chromatic: { disable: true },
// Skip the first story in the TOC
docs: { toc: { ignoreSelector: '#one' } },
},
};
export const One = { args: { label: 'One' } };
export const Two = { args: { label: 'Two' } };
export const Three = { args: { label: 'Three' } };
``` | /content/code_sandbox/code/addons/docs/template/stories/toc/ignore-selector.stories.ts | xml | 2016-03-18T04:23:44 | 2024-08-16T19:22:08 | storybook | storybookjs/storybook | 83,755 | 119 |
```xml
// Imports
import VueGtag, { trackRouter } from 'vue-gtag-next'
// Types
import type { App } from 'vue'
import type { Router } from 'vue-router'
export function installGtag (app: App, router: Router) {
if (!IN_BROWSER) return
// vue-gtag-next doesn't support esm properly
const install = VueGtag.install ?? (VueGtag as any).default.install
app.use(install, {
property: { id: 'UA-75262397-11' },
})
trackRouter(router)
}
``` | /content/code_sandbox/packages/docs/src/plugins/gtag.ts | xml | 2016-09-12T00:39:35 | 2024-08-16T20:06:39 | vuetify | vuetifyjs/vuetify | 39,539 | 128 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- colors for general appearance -->
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorPrimaryLight">#C5CAE9</color>
<color name="colorAccent">#303F9F</color>
<!-- colors taskEntrytask priority selection -->
<color name="materialRed">#E74C3C</color>
<color name="materialOrange">#E67E22</color>
<color name="materialYellow">#F1C40F</color>
</resources>
``` | /content/code_sandbox/Lesson09b-ToDo-List-AAC/T09b.03-Solution-RetrieveTasksFromDatabaseAtMainActivity/app/src/main/res/values/colors.xml | xml | 2016-11-02T04:41:25 | 2024-08-12T19:38:05 | ud851-Exercises | udacity/ud851-Exercises | 2,039 | 148 |
```xml
import { EXTENSION_MESSAGES } from "../../constants";
import { isExtensionEnabled } from "../../utils";
import { initExtensionMessageListener } from "../common/extensionMessageListener";
import { initSessionRecording } from "../common/sessionRecorder";
import { initMessageHandler } from "./messageHandler";
document.documentElement.setAttribute("rq-ext-version", chrome.runtime.getManifest()["version"]);
// manifest version
document.documentElement.setAttribute("rq-ext-mv", "3");
// extension id
document.documentElement.setAttribute("rq-ext-id", chrome.runtime.id);
document.documentElement.setAttribute("rq-ext-name", "SESSIONBEAR");
initMessageHandler();
initExtensionMessageListener();
isExtensionEnabled().then((isExtensionStatusEnabled) => {
if (isExtensionStatusEnabled) {
chrome.runtime.sendMessage({ action: EXTENSION_MESSAGES.HANDSHAKE_CLIENT });
initSessionRecording();
}
});
``` | /content/code_sandbox/browser-extension/sessionbear/src/content-scripts/app/index.ts | xml | 2016-12-01T04:36:06 | 2024-08-16T19:12:19 | requestly | requestly/requestly | 2,121 | 174 |
```xml
import * as React from 'react';
import createSvgIcon from '../utils/createSvgIcon';
const CircleFillIcon = createSvgIcon({
svg: ({ classes }) => (
<svg xmlns="path_to_url" viewBox="0 0 2048 2048" className={classes.svg} focusable="false">
<path d="M32 1024q0-137 35-264t100-237 155-200 201-155T760 68t264-36q137 0 264 35t237 100 200 155 155 201 100 237 36 264q0 137-35 264t-100 237-155 200-201 155-237 100-264 36q-137 0-264-35t-237-100-200-155-155-201-100-237-36-264z" />
</svg>
),
displayName: 'CircleFillIcon',
});
export default CircleFillIcon;
``` | /content/code_sandbox/packages/react-icons-mdl2/src/components/CircleFillIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 217 |
```xml
import * as React from 'react';
import { createSvgIcon } from '../utils/createSvgIcon';
export const FilesFlashIcon = createSvgIcon({
svg: ({ classes }) => (
<svg role="presentation" focusable="false" viewBox="0 0 20 20" className={classes.svg}>
<path d="M16 7H13.5C12.673 7 12 6.327 12 5.5V2H4V18H16V7Z" fill="white" />
<path d="M16 6.00003V5.70703L13 2.70703V5.50003C13 5.77503 13.225 6.00003 13.5 6.00003H16Z" fill="white" />
<path
opacity="0.64"
fillRule="evenodd"
clipRule="evenodd"
d="M16.707 5L13 1.293C12.8125 1.10545 12.5582 1.00006 12.293 1H4C3.44772 1 3 1.44772 3 2V18C3 18.5523 3.44772 19 4 19H16C16.5523 19 17 18.5523 17 18V5.707C16.9999 5.4418 16.8945 5.18749 16.707 5ZM16 5.707V6H13.5C13.2241 5.99945 13.0006 5.77591 13 5.5V2.707L16 5.707ZM4 2.2V17.8C4 17.9105 4.08954 18 4.2 18H15.8C15.9105 18 16 17.9105 16 17.8V7H13.5C12.6716 7 12 6.32843 12 5.5V2H4.2C4.09 2 4 2.09 4 2.2Z"
fill="#605E5C"
/>
</svg>
),
displayName: 'FilesFlashIcon',
});
``` | /content/code_sandbox/packages/fluentui/react-icons-northstar/src/components/FilesFlashIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 513 |
```xml
/*
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
*/
import {render} from 'modules/testing-library';
import {PROCESS_INSTANCE_ID} from 'modules/mocks/metadata';
import {flowNodeSelectionStore} from 'modules/stores/flowNodeSelection';
import {processInstanceDetailsStore} from 'modules/stores/processInstanceDetails';
import {processInstanceDetailsDiagramStore} from 'modules/stores/processInstanceDetailsDiagram';
import {createInstance} from 'modules/testUtils';
import {createRef, useEffect} from 'react';
import {MemoryRouter} from 'react-router-dom';
import {ModificationDropdown} from '..';
import {processInstanceDetailsStatisticsStore} from 'modules/stores/processInstanceDetailsStatistics';
import {modificationsStore} from 'modules/stores/modifications';
import {flowNodeMetaDataStore} from 'modules/stores/flowNodeMetaData';
import {Paths} from 'modules/Routes';
const Wrapper: React.FC<{children?: React.ReactNode}> = ({children}) => {
useEffect(() => {
initializeStores();
return resetStores;
}, []);
return (
<MemoryRouter initialEntries={[Paths.processInstance('1')]}>
{children}
</MemoryRouter>
);
};
const renderPopover = () => {
const {container} = render(<svg />);
const ref = createRef<HTMLDivElement>();
return render(
<ModificationDropdown
selectedFlowNodeRef={container.querySelector('svg') ?? undefined}
diagramCanvasRef={ref}
/>,
{
wrapper: Wrapper,
},
);
};
const initializeStores = () => {
flowNodeSelectionStore.init();
processInstanceDetailsStatisticsStore.init('processId');
processInstanceDetailsDiagramStore.init();
processInstanceDetailsStore.setProcessInstance(
createInstance({
id: PROCESS_INSTANCE_ID,
state: 'ACTIVE',
processId: 'processId',
}),
);
};
const resetStores = () => {
flowNodeSelectionStore.reset();
processInstanceDetailsStore.reset();
modificationsStore.reset();
processInstanceDetailsStatisticsStore.reset();
processInstanceDetailsDiagramStore.reset();
flowNodeMetaDataStore.reset();
};
export {renderPopover};
``` | /content/code_sandbox/operate/client/src/App/ProcessInstance/TopPanel/ModificationDropdown/tests/mocks.tsx | xml | 2016-03-20T03:38:04 | 2024-08-16T19:59:58 | camunda | camunda/camunda | 3,172 | 463 |
```xml
import * as React from 'react'
import Form from 'next/form'
export default function Home() {
return (
<Form action="/" id="search-form">
<input name="query" />
<button type="submit" formAction="/search">
Submit
</button>
</Form>
)
}
``` | /content/code_sandbox/test/e2e/app-dir/next-form/default/app/forms/button-formaction/page.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 69 |
```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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-java</artifactId>
<version>0.64.8</version>
</parent>
<artifactId>flexmark-ext-typographic</artifactId>
<name>flexmark-java extension for typographic</name>
<description>flexmark-java extension for typographic</description>
<dependencies>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-util</artifactId>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark</artifactId>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-test-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-core-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
``` | /content/code_sandbox/flexmark-ext-typographic/pom.xml | xml | 2016-01-23T15:29:29 | 2024-08-15T04:04:18 | flexmark-java | vsch/flexmark-java | 2,239 | 310 |
```xml
import { IterableX } from '../../iterable/iterablex.js';
import { maxBy } from '../../iterable/maxby.js';
import { ExtremaOptions } from '../../iterable/extremaoptions.js';
/**
* @ignore
*/
export function maxByProto<TSource, TKey>(
this: IterableX<TSource>,
options?: ExtremaOptions<TSource, TKey>
): TSource[] {
return maxBy(this, options);
}
IterableX.prototype.maxBy = maxByProto;
declare module '../../iterable/iterablex' {
interface IterableX<T> {
maxBy: typeof maxByProto;
}
}
``` | /content/code_sandbox/src/add/iterable-operators/maxby.ts | xml | 2016-02-22T20:04:19 | 2024-08-09T18:46:41 | IxJS | ReactiveX/IxJS | 1,319 | 130 |
```xml
export * from './checkbox/index.js';
``` | /content/code_sandbox/packages/mdui/src/components/checkbox.ts | xml | 2016-07-11T17:39:02 | 2024-08-16T07:12:34 | mdui | zdhxiong/mdui | 4,077 | 9 |
```xml
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { ButtonComponent } from "./button.component";
@NgModule({
imports: [CommonModule],
exports: [ButtonComponent],
declarations: [ButtonComponent],
})
export class ButtonModule {}
``` | /content/code_sandbox/libs/components/src/button/button.module.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 58 |
```xml
<refentry id="refparam">
<refmeta>
<refentrytitle>ne_strparam</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname id="ne_strparam">ne_strparam</refname>
<refpurpose>HTTP extended parameter value encoding</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <ne_string.h></funcsynopsisinfo>
<funcprototype>
<funcdef>char *<function>ne_strparam</function></funcdef>
<paramdef>const char *<parameter>charset</parameter></paramdef>
<paramdef>const char *<parameter>lang</parameter></paramdef>
<paramdef>const char *<parameter>value</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>The <function>ne_strparam</function> function can be
used to encode an extended parameter value for an HTTP header,
as defined in RFC 5987. The function takes as arguments the
<parameter>value</parameter> to encode, using a given MIME
<parameter>charset</parameter> character set, and
<parameter>lang</parameter> language tag. The extended
parameter encoding is used in HTTP protocol specifications to
allow easily embedding special characters (such as quote
marks, separators or non-ASCII) in header values.</para>
<para>In accordance with RFC 5987, the
<parameter>charset</parameter> argument must be either
<constant>"UTF-8"</constant> or
<constant>"IS0-8859-1"</constant>, but the
<parameter>lang</parameter> argument may be &null;.</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>The return value is either:
<variablelist>
<varlistentry>
<term>&null;</term>
<listitem><simpara>if the value parameter is a "regular
parameter" and does not need extended
encoding</simpara></listitem> </varlistentry>
<varlistentry>
<term>non-&null;</term>
<listitem><simpara>the encoding of the input value as an
extended parameter as a NUL-terminated, malloc-allocated
string</simpara></listitem>
</varlistentry>
</variablelist></para>
</refsect1>
<refsect1>
<title>See also</title>
<para><ulink url="path_to_url"/></para>
</refsect1>
</refentry>
``` | /content/code_sandbox/libs/neon/doc/ref/param.xml | xml | 2016-06-22T17:19:44 | 2024-08-16T02:15:29 | winscp | winscp/winscp | 2,528 | 632 |
```xml
const foo = (): () => void => (): void => null;
const bar = (): (() => void) => (): void => null;
const baz = (): ((() => void)) => (): void => null;
``` | /content/code_sandbox/tests/format/typescript/function-type/type-annotation.ts | xml | 2016-11-29T17:13:37 | 2024-08-16T17:29:57 | prettier | prettier/prettier | 48,913 | 43 |
```xml
export const humanizeNote = (text: string): string => {
if (text) {
return text.replace(/>/g, '>').replace(/'/g, "'")
}
return ''
}
``` | /content/code_sandbox/ui/src/dashboards/utils/notes.ts | xml | 2016-08-24T23:28:56 | 2024-08-13T19:50:03 | chronograf | influxdata/chronograf | 1,494 | 48 |
```xml
/*
* Squidex Headless CMS
*
* @license
*/
import { AsyncPipe } from '@angular/common';
import { Component, Input } from '@angular/core';
import { FormsModule, ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
import { FieldDto, FormHintComponent, RichTextFieldPropertiesDto, SchemaTagSource, TagEditorComponent, TranslatePipe } from '@app/shared';
@Component({
standalone: true,
selector: 'sqx-rich-text-ui',
styleUrls: ['rich-text-ui.component.scss'],
templateUrl: 'rich-text-ui.component.html',
imports: [
AsyncPipe,
FormHintComponent,
FormsModule,
ReactiveFormsModule,
TagEditorComponent,
TranslatePipe,
],
})
export class RichTextUIComponent {
@Input({ required: true })
public fieldForm!: UntypedFormGroup;
@Input({ required: true })
public field!: FieldDto;
@Input({ required: true })
public properties!: RichTextFieldPropertiesDto;
constructor(
public readonly schemasSource: SchemaTagSource,
) {
}
}
``` | /content/code_sandbox/frontend/src/app/features/schemas/pages/schema/fields/types/rich-text-ui.component.ts | xml | 2016-08-29T05:53:40 | 2024-08-16T17:39:38 | squidex | Squidex/squidex | 2,222 | 226 |
```xml
import { Operator } from '../Operator';
import { Observable } from '../Observable';
import { Subscriber } from '../Subscriber';
import { Subscription } from '../Subscription';
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
import { ObservableInput, OperatorFunction } from '../types';
import { map } from './map';
import { from } from '../observable/from';
/* tslint:disable:max-line-length */
export function switchMap<T, R>(project: (value: T, index: number) => ObservableInput<R>): OperatorFunction<T, R>;
/** @deprecated resultSelector is no longer supported, use inner map instead */
export function switchMap<T, R>(project: (value: T, index: number) => ObservableInput<R>, resultSelector: undefined): OperatorFunction<T, R>;
/** @deprecated resultSelector is no longer supported, use inner map instead */
export function switchMap<T, I, R>(project: (value: T, index: number) => ObservableInput<I>, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R): OperatorFunction<T, R>;
/* tslint:enable:max-line-length */
/**
* Projects each source value to an Observable which is merged in the output
* Observable, emitting values only from the most recently projected Observable.
*
* <span class="informal">Maps each value to an Observable, then flattens all of
* these inner Observables.</span>
*
* 
*
* Returns an Observable that emits items based on applying a function that you
* supply to each item emitted by the source Observable, where that function
* returns an (so-called "inner") Observable. Each time it observes one of these
* inner Observables, the output Observable begins emitting the items emitted by
* that inner Observable. When a new inner Observable is emitted, `switchMap`
* stops emitting items from the earlier-emitted inner Observable and begins
* emitting items from the new one. It continues to behave like this for
* subsequent inner Observables.
*
* ## Example
* Rerun an interval Observable on every click event
* ```javascript
* const clicks = fromEvent(document, 'click');
* const result = clicks.pipe(switchMap((ev) => interval(1000)));
* result.subscribe(x => console.log(x));
* ```
*
* @see {@link concatMap}
* @see {@link exhaustMap}
* @see {@link mergeMap}
* @see {@link switchAll}
* @see {@link switchMapTo}
*
* @param {function(value: T, ?index: number): ObservableInput} project A function
* that, when applied to an item emitted by the source Observable, returns an
* Observable.
* @return {Observable} An Observable that emits the result of applying the
* projection function (and the optional deprecated `resultSelector`) to each item
* emitted by the source Observable and taking only the values from the most recently
* projected inner Observable.
* @method switchMap
* @owner Observable
*/
export function switchMap<T, I, R>(
project: (value: T, index: number) => ObservableInput<I>,
resultSelector?: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R,
): OperatorFunction<T, I|R> {
if (typeof resultSelector === 'function') {
return (source: Observable<T>) => source.pipe(
switchMap((a, i) => from(project(a, i)).pipe(
map((b, ii) => resultSelector(a, b, i, ii))
))
);
}
return (source: Observable<T>) => source.lift(new SwitchMapOperator(project));
}
class SwitchMapOperator<T, R> implements Operator<T, R> {
constructor(private project: (value: T, index: number) => ObservableInput<R>) {
}
call(subscriber: Subscriber<R>, source: any): any {
return source.subscribe(new SwitchMapSubscriber(subscriber, this.project));
}
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
class SwitchMapSubscriber<T, R> extends OuterSubscriber<T, R> {
private index: number = 0;
private innerSubscription: Subscription;
constructor(destination: Subscriber<R>,
private project: (value: T, index: number) => ObservableInput<R>) {
super(destination);
}
protected _next(value: T) {
let result: ObservableInput<R>;
const index = this.index++;
try {
result = this.project(value, index);
} catch (error) {
this.destination.error(error);
return;
}
this._innerSub(result, value, index);
}
private _innerSub(result: ObservableInput<R>, value: T, index: number) {
const innerSubscription = this.innerSubscription;
if (innerSubscription) {
innerSubscription.unsubscribe();
}
const innerSubscriber = new InnerSubscriber(this, undefined, undefined);
const destination = this.destination as Subscription;
destination.add(innerSubscriber);
this.innerSubscription = subscribeToResult(this, result, value, index, innerSubscriber);
}
protected _complete(): void {
const {innerSubscription} = this;
if (!innerSubscription || innerSubscription.closed) {
super._complete();
}
this.unsubscribe();
}
protected _unsubscribe() {
this.innerSubscription = null;
}
notifyComplete(innerSub: Subscription): void {
const destination = this.destination as Subscription;
destination.remove(innerSub);
this.innerSubscription = null;
if (this.isStopped) {
super._complete();
}
}
notifyNext(outerValue: T, innerValue: R,
outerIndex: number, innerIndex: number,
innerSub: InnerSubscriber<T, R>): void {
this.destination.next(innerValue);
}
}
``` | /content/code_sandbox/deps/node-10.15.3/tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/switchMap.ts | xml | 2016-09-05T10:18:44 | 2024-08-11T13:21:40 | LiquidCore | LiquidPlayer/LiquidCore | 1,010 | 1,276 |
```xml
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ImageDocModule } from '@doc/Image/imagedoc.module';
import { ImageDemo } from './imagedemo';
import { ImageDemoRoutingModule } from './imagedemo-routing.module';
@NgModule({
imports: [CommonModule, ImageDemoRoutingModule, ImageDocModule],
declarations: [ImageDemo]
})
export class ImageDemoModule {}
``` | /content/code_sandbox/src/app/showcase/pages/image/imagedemo.module.ts | xml | 2016-01-16T09:23:28 | 2024-08-16T19:58:20 | primeng | primefaces/primeng | 9,969 | 90 |
```xml
export default function Page() {
return 'foo'
}
``` | /content/code_sandbox/test/e2e/app-dir/parallel-routes-and-interception/app/parallel-nested-catchall/foo/page.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 13 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"path_to_url">
<mapper namespace="recordMapper">
<select id="showRecords" resultType="org.lab5.entity.Record">
select *
from Records
where Records.cid = #{cid}
</select>
<insert id="insertOne" parameterType="org.lab5.entity.Record">
INSERT INTO Records (`ISBN`, cid, BorrowTime, Due, AID)
VALUES (#{ISBN},
#{cid},
#{BorrowTime},
#{Due},
#{AID})
</insert>
<delete id="deleteOne" parameterType="org.lab5.entity.Record">
delete
from Records
where ISBN = #{ISBN}
and cid = #{cid}
and BorrowTime = #{BorrowTime}
and Due = #{Due}
and AID = #{AID}
</delete>
<select id="findNearestDue" resultType="org.lab5.entity.Record">
select *
from Records
where Due = ( (select min(Due) from Records where ISBN = #{ISBN}))
</select>
</mapper>
``` | /content/code_sandbox/数据库系统原理/实验/lab/mybLab5/src/main/resources/recordMapper.xml | xml | 2016-06-28T16:17:32 | 2024-08-16T18:40:43 | zju-icicles | QSCTech/zju-icicles | 36,801 | 268 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<com.airbnb.epoxy.integrationtest.ViewWithAnnotationsForIntegrationTest xmlns:android="path_to_url"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
``` | /content/code_sandbox/epoxy-integrationtest/src/main/res/layout/view_with_annotations_for_integration_test.xml | xml | 2016-08-08T23:05:11 | 2024-08-16T16:11:07 | epoxy | airbnb/epoxy | 8,486 | 63 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~
~ 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.
-->
<sql-node-converter-test-cases>
<test-cases sql-case-id="explain_select_constant_without_table" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT 1 AS `a`" db-types="MySQL" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_select_constant_without_table" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT ? AS `a`" db-types="MySQL" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_select_constant_without_table" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT 1 AS "a"" db-types="PostgreSQL, openGauss" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_select_constant_without_table" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT ? AS "a"" db-types="PostgreSQL, openGauss" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_delete_without_sharding_value" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM `t_order` WHERE `status` = 'init'" db-types="MySQL" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_delete_without_sharding_value" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM `t_order` WHERE `status` = ?" db-types="MySQL" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_delete_without_sharding_value" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "status" = 'init'" db-types="PostgreSQL, openGauss" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_delete_without_sharding_value" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "status" = ?" db-types="PostgreSQL, openGauss" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_select_with_analyze" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > 8" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_select_with_analyze" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_delete_without_sharding_value" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "status" = 'init'" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_delete_without_sharding_value" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "status" = ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_with_analyze" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM `t_order` WHERE `order_id` > 8" db-types="MySQL" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_with_analyze" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM `t_order` WHERE `order_id` > ?" db-types="MySQL" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_table" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR (SELECT * FROM `t_order` ORDER BY `order_id` LIMIT 1 OFFSET 2)" db-types="MySQL" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_table" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR (SELECT * FROM `t_order` ORDER BY `order_id` LIMIT ? OFFSET ?)" db-types="MySQL" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_performance" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT 1" db-types="openGauss" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_performance" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT ?" db-types="openGauss" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_select_alias_as_keyword" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT "length"."item_id" "password" FROM "t_order_item" "length" WHERE "length"."item_id" = 1" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_select_alias_as_keyword" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT "length"."item_id" "password" FROM "t_order_item" "length" WHERE "length"."item_id" = ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_select_with_binding_tables" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT "i".* FROM "t_order" "o" INNER JOIN "t_order_item" "i" USING ("order_id") WHERE "o"."order_id" = 10" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_select_with_binding_tables" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT "i".* FROM "t_order" "o" INNER JOIN "t_order_item" "i" USING ("order_id") WHERE "o"."order_id" = ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_select_with_analyze" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > 8" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_select_with_analyze" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_select_with_statement" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > 8" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_select_with_statement" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_select_with_into" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > 8" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_select_with_into" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_select_with_into_dblink" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > 8" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_select_with_into_dblink" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR SELECT * FROM "t_order" WHERE "order_id" > ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_with_analyze_delete" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order"" db-types="Oracle" />
<test-cases sql-case-id="explain_for_delete_condition" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "t_order"."x" = 1" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_delete_condition" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "t_order"."x" = ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_for_delete_statement" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "t_order"."x" = 1" db-types="Oracle" sql-case-types="LITERAL" />
<test-cases sql-case-id="explain_for_delete_statement" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR DELETE FROM "t_order" WHERE "t_order"."x" = ?" db-types="Oracle" sql-case-types="PLACEHOLDER" />
<test-cases sql-case-id="explain_update_without_condition" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR UPDATE `t_order` SET `status` = 'finished'" db-types="MySQL" />
<test-cases sql-case-id="explain_update_without_condition" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR UPDATE "t_order" SET "status" = 'finished'" db-types="PostgreSQL, openGauss" />
<test-cases sql-case-id="explain_with_analyze_update" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR UPDATE `t_order` SET `id` = 1" db-types="MySQL" />
<test-cases sql-case-id="explain_for_update_without_condition" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR UPDATE "t_order" SET "status" = 'finished'" db-types="Oracle" />
<test-cases sql-case-id="explain_for_update" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR UPDATE "t_order" SET "id" = 1" db-types="Oracle" />
<test-cases sql-case-id="explain_for_update_with_statement" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR UPDATE "t_order" SET "id" = 1" db-types="Oracle" />
<test-cases sql-case-id="explain_for_update_with_into" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR UPDATE "t_order" SET "id" = 1" db-types="Oracle" />
<test-cases sql-case-id="explain_insert_without_parameters" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR INSERT INTO `t_order` (`order_id`, `user_id`, `status`) VALUES (1, 1, 'insert')" db-types="MySQL" />
<test-cases sql-case-id="explain_insert_without_parameters" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR INSERT INTO "t_order" ("order_id", "user_id", "status") VALUES (1, 1, 'insert')" db-types="PostgreSQL,openGauss,Oracle" />
<test-cases sql-case-id="explain_for_with_analyze_insert" expected-sql="EXPLAIN PLAN INCLUDING ALL ATTRIBUTES WITH TYPE FOR INSERT INTO "t_order" ("order_id") VALUES (1)" db-types="Oracle" />
</sql-node-converter-test-cases>
``` | /content/code_sandbox/test/it/optimizer/src/test/resources/converter/explain.xml | xml | 2016-01-18T12:49:26 | 2024-08-16T15:48:11 | shardingsphere | apache/shardingsphere | 19,707 | 2,887 |
```xml
<resources xmlns:tools="path_to_url">
<string name="app_name">PDF </string>
<string name="title">PDF</string>
<string name="file_name_text"></string>
<string name="select_images_text"></string>
<string name="password_protect_pdf_text"> PDF</string>
<string name="edit_images_text"></string>
<string name="open_pdf_text">PDF</string>
<string name="create_pdf_text">PDF</string>
<string name="details"><b></b></string>
<string name="search_hint"></string>
<string name="search"></string>
<string name="default_content_description"></string>
<string name="prompt_input"></string>
<!-- Items -->
<array name="items">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</array>
<array name="itemIds" translatable="false">
<item>open</item>
<item>delete</item>
<item>rename</item>
<item>print</item>
<item>e-mail</item>
<item>details</item>
</array>
<string-array name="array_page_sizes_b0_b10" translatable="false">
<item>B0 (1000 x 1414 mm)</item>
<item>B1 (707 x 1000 mm)</item>
<item>B2 (500 x 707 mm)</item>
<item>B3 (353 x 500 mm)</item>
<item>B4 (250 x 353 mm)</item>
<item>B5 (176 x 250 mm)</item>
<item>B6 (125 x 176 mm)</item>
<item>B7 (88 x 125 mm)</item>
<item>B8 (62 x 88 mm)</item>
<item>B9 (44 x 62 mm)</item>
<item>B10 (31 x 44 mm)</item>
</string-array>
<string-array name="array_page_sizes_a0_b10" translatable="false">
<item>A0 (841 x 1189 mm)</item>
<item>A1 (594 x 841 mm)</item>
<item>A2 (420 x 594 mm)</item>
<item>A3 (297 x 420 mm)</item>
<item>A4 (210 x 297 mm)</item>
<item>A5 (148 x 210 mm)</item>
<item>A6 (105 x 148 mm)</item>
<item>A7 (74 x 105 mm)</item>
<item>A8 (52 x 74 mm)</item>
<item>A9 (37 x 52 mm)</item>
<item>A10 (26 x 37 mm)</item>
</string-array>
<string-array name="fontStyles" translatable="false">
<item>NORMAL</item>
<item>BOLD</item>
<item>ITALIC</item>
<item>UNDERLINE</item>
<item>STRIKETHRU</item>
<item>BOLDITALIC</item>
</string-array>
<string name="please_wait"></string>
<string name="bundleKey">URI</string>
<string name="whatsappToast"> **** </string>
<string name="successToast"></string>
<!-- Navigation drawer strings -->
<string name="create_pdf">PDF</string>
<string name="qr_barcode_pdf"></string>
<string name="viewFiles"></string>
<string name="extras"></string>
<string name="share"></string>
<string name="help"></string>
<!-- images to PDF -->
<string name="images_to_pdf">PDF</string>
<string name="page_color"></string>
<string name="filter_images_Text"> \n</string>
<!-- Image to PDF -Preview PDF-->
<string name="preview_image_to_pdf">PDF</string>
<!-- Image to PDF-show page number-->
<string name="choose_page_number_style"></string>
<string name="show_pg_num"></string>
<string name="page_x_of_n">X N</string>
<string name="page_x">X / N</string>
<string name="x">X</string>
<!-- Image to PDF -Rearrange images-->
<string name="arrow_up"></string>
<string name="arrow_down"></string>
<string name="rearrange_images"></string>
<string name="rearrange_text"></string>
<string name="images_rearranged"></string>
<string name="snackbar_undoAction"></string>
<string name="pdf_does_not_exist_message">PDF</string>
<string name="image_rearranging_options"></string>
<!-- Image compression-->
<string name="compress_image"> %1$s %%</string>
<string name="quality_image">:</string>
<string name="invalid_entry"></string>
<string name="compress_dialog_enter_prompt"></string>
<string name="compress_dialog_percentage">%</string>
<string name="set_as_default"></string>
<!-- Image to PDf -Add margins-->
<string name="add_margins"></string>
<string name="top"></string>
<string name="bottom"></string>
<string name="right"></string>
<string name="left"></string>
<!-- Add Image Border -->
<string name="border"></string>
<string name="border_dialog_title"> %d</string>
<string name="border_width_prompt"></string>
<!-- set Image Scale type -->
<string name="image_scale_type"></string>
<string name="stretch_image"></string>
<string name="maintain_aspect_ratio"></string>
<!--QR & Barcode Scan-->
<string name="scan_qrcode"></string>
<string name="scan_barcode"></string>
<string name="qrbarcodes_to_pdf">PDF</string>
<string name="scan_cancelled"></string>
<!--Snackbar strings -->
<string name="snackbar_no_images"></string>
<string name="snackbar_no_pdfs_selected">PDF</string>
<string name="snackbar_name_not_blank"></string>
<string name="snackbar_permissions_given"></string>
<string name="snackbar_insufficient_permissions"></string>
<string name="no_permissions"></string>
<string name="prompt_give_permission"></string>
<string name="snackbar_images_added"></string>
<string name="snackbar_file_renamed"></string>
<string name="snackbar_file_not_renamed"></string>
<string name="snackbar_file_deleted"></string>
<string name="snackbar_file_not_deleted"></string>
<string name="snackbar_folder_not_created"></string>
<string name="pdf_merged">PDF</string>
<string name="error_path_not_found"></string>
<string name="creating_pdf"> PDF</string>
<string name="creating_txt"></string>
<string name="enter_file_name"></string>
<string name="example"> abc</string>
<string name="snackbar_no_pdf_app">PDF</string>
<string name="open_file"></string>
<string name="set_password"></string>
<string name="enter_password"></string>
<string name="snackbar_password_cannot_be_blank"></string>
<string name="cannot_add_password">PDFPDF</string>
<string name="snackbar_imagecropped"></string>
<string name="cropImage_activityTitle"></string>
<string name="snackbar_pdfCreated">PDF</string>
<string name="error_uri_not_found"></string>
<string name="snack_bar_empty_txt_in_pdf">PDF</string>
<string name="snackbar_txtExtracted"></string>
<string name="snackbar_pdfselected">PDF</string>
<string name="snackbar_viewAction"></string>
<string name="more_options_text"></string>
<string name="snackbar_no_duplicate_pdf">PDF</string>
<string name="snackbar_duplicate_removed">PDF</string>
<string name="snackbar_invert_unsuccessful">PDF</string>
<string name="snackbar_invert_successfull"></string>
<string name="snackbar_color_too_close"></string>
<!-- Excel to PDF -->
<string name="excel_selected"></string>
<string name="excel_to_pdf">PDF</string>
<string name="excel_tv_view_text">Excel </string>
<string name="select_excel_file">Excel</string>
<!-- Share strings -->
<string name="share_chooser"></string>
<!-- Rate us strings -->
<string name="rate_us_text">HiPlaypath_to_urlPDF:)</string>
<string name="snackbar_no_share_app"></string>
<!-- Select Images string -->
<string name="images_selected"> %1$d </string>
<!-- Feedback Strings -->
<string name="feedback_subject">PDF</string>
<string name="feedback_text"> :)</string>
<string name="snackbar_no_email_clients"></string>
<string name="feedback_chooser">""</string>
<string name="no_pdf">PDF</string>
<string name="get_started"></string>
<string name="view_files_text">!</string>
<string name="empty_image_description">Pdf</string>
<!-- Add Password -->
<string name="enter_password_custom"></string>
<string name="example_pass_123">pass@123</string>
<string name="remove_dialog"></string>
<string name="password_remove"></string>
<!-- Merge PDF -->
<string name="merge_pdf">PDF</string>
<string name="merge_file_select"></string>
<string name="File_hint_two" tools:keep="@string/File_hint_two">PDF</string>
<string name="merge_files"></string>
<string name="file_date_text"></string>
<string name="file_size_text"></string>
<string name="encrypted_file">pdf</string>
<string name="i_have_attached_pdfs_to_this_message"></string>
<string name="nextimage_contentdesc"></string>
<string name="decrypted_file">pdf</string>
<string name="decrypt_message"></string>
<string name="snackbar_txtselected"></string>
<string name="decrypt_protected_file">PDF</string>
<string name="not_encrypted">PDF</string>
<string name="save_current"></string>
<string name="save"></string>
<string name="choose_color_text"></string>
<string name="save_first"></string>
<string name="Filter_name"></string>
<string name="Filter_image_preview"></string>
<string name="warning"></string>
<string name="overwrite_message"></string>
<!-- Text To PDF -Set Page Size-->
<string name="set_page_size_text"></string>
<string name="b0_to_b10">B0 to B10</string>
<string name="a0_to_a10">A0 to A10</string>
<string name="default_page_size"> ( %s )</string>
<string name="master_password_changed"></string>
<!--View File options -->
<string name="delete_alert_selected"></string>
<string name="sort_by_title"></string>
<string name="delete"></string>
<string name="sort"></string>
<!-- Directory Strings -->
<string name="directory"></string>
<string name="moving_files"></string>
<string name="success_move"></string>
<string name="dir_does_not_exists"></string>
<string name="move_files_delete_dir"></string>
<string name="directory_deleted"></string>
<string name="success_delete_directory"></string>
<string name="moved_files"></string>
<string name="dialog_new_dir"></string>
<string name="dialog_dir"></string>
<string name="cancel"></string>
<string name="ok"></string>
<string name="yes"></string>
<string name="select_all"></string>
<string name="converting_file_message">PDF</string>
<string name="select_text_file"></string>
<string name="install_file_manager"></string>
<!-- Text to PDF -->
<string name="text_to_pdf">PDF</string>
<string name="text_file_selected"></string>
<string name="select_file">""</string>
<string name="new_directory"></string>
<string name="previous_image_content_desc"></string>
<string name="text_file_name">""</string>
<string name="extension_not_supported"></string>
<string name="font_color"></string>
<string name="edit_font_size"> ( : %d)</string>
<string name="enter_font_size"></string>
<string name="example_font">10</string>
<string name="font_size_changed"></string>
<string name="font_size"> %1$s</string>
<!-- About US & App Description & Contact US -->
<string name="about_us"></string>
<string name="rate_us"></string>
<string name="app_description">PDF</string>
<string name="version"> </string>
<string name="developer"> Swati Garg</string>
<string name="github_repo">Github </string>
<string name="view_contributors"></string>
<string name="privacy_policy"></string>
<string name="mail"></string>
<string name="join_slack">Slack</string>
<string name="website"></string>
<string name="license"></string>
<string name="playstore">Playstore</string>
<!-- Preview strings -->
<string name="swipe_to_view_next"></string>
<string name="showing_image"> %1$d %2$d </string>
<!-- Filter strings -->
<string name="filter_brush"></string>
<string name="filter_none"></string>
<string name="filter_autofix"></string>
<string name="filter_grayscale"></string>
<string name="filter_brightness"></string>
<string name="filter_contrast"></string>
<string name="filter_cross"></string>
<string name="filter_documentary"></string>
<string name="filter_duetone"></string>
<string name="filter_filllight"></string>
<string name="filter_filpver"></string>
<string name="filter_fliphor"></string>
<string name="filter_grain"></string>
<string name="filter_lomish">Lomish</string>
<string name="filter_negative"></string>
<string name="filter_poster"></string>
<string name="filter_rotate"></string>
<string name="filter_saturate"></string>
<string name="filter_sepia">Sepia</string>
<string name="filter_sharpen"></string>
<string name="filter_temp"></string>
<string name="filter_tint"></string>
<string name="filter_vig"></string>
<string name="filter_saved"></string>
<string name="created"></string>
<string name="printed"></string>
<string name="renamed"></string>
<string name="deleted"></string>
<string name="rotated"></string>
<string name="encrypted"></string>
<string name="decrypted"></string>
<string name="history"></string>
<string name="no_history_message"></string>
<string name="view_history_here_message"></string>
<string name="delete_history_message"></string>
<!-- Extract images -->
<string name="extract_images"></string>
<string name="extract_images_failed">PDF</string>
<string name="extract_images_success">PDF %1$d PDF</string>
<!-- Extract Text-->
<string name="extract_text"></string>
<string name="pdf_selected">PDF </string>
<!-- Text To PDF FontFamily-->
<string name="default_font_family_text"> ( %s)</string>
<string name="font_family_text">" "</string>
<string name="undefined"></string>
<string name="selected_image"></string>
<string name="reset"></string>
<string name="rotate"></string>
<string name="done"></string>
<string name="image_successfully_cropped"></string>
<string name="confirm_exit_message"></string>
<string name="filter_not_saved"></string>
<string name="remove_image_message"></string>
<string name="dont_show_again"></string>
<string name="remove_page_message"></string>
<!-- Watermark Strings -->
<string name="encrypted_file_text"></string>
<!-- Split PDF -->
<string name="split_pdf">PDF</string>
<string name="split_success">PDF %1$d PDF</string>
<string name="split_info">PDFPDF 1–5,6–7,8,9</string>
<string name="error_page_number"></string>
<string name="error_page_range"></string>
<string name="error_invalid_input"></string>
<string name="split_one_page_pdf_alert">PDF1</string>
<!-- Remove Pages -->
<string name="remove_pages"></string>
<string name="remove_pages_error"></string>
<string name="encrypted_pdf">PDF</string>
<string name="file_access_error">PDF</string>
<string name="file_order"></string>
<!-- Reorder Pages -->
<!-- Compress PDF -->
<string name="compress_pdf">PDF</string>
<string name="compress_pdf_prompt">PDF </string>
<string name="compress_info">! PDF \n PDF : %s \n PDF: %s</string>
<!-- PDF to Images string resources-->
<string name="pdf_to_images">PDF</string>
<string name="create_images"></string>
<string name="select_pdf_file">PDF</string>
<string name="share_images"></string>
<string name="view_images"></string>
<string name="view_in_gallery"></string>
<!-- Remove Duplicate Pages -->
<string name="remove_duplicate_pages"></string>
<string name="remove_duplicate_info">PDF</string>
<string name="remove_duplicate"></string>
<!-- Invert Pdf -->
<string name="invert_pdf">Pdf</string>
<string name="invert_pdf_info">PDF</string>
<string name="invert_pdf_title">PDF</string>
<!-- Rate us strings -->
<string name="rate_positive"></string>
<string name="rate_negative"></string>
<string name="rate_title"></string>
<string name="rate_dialog_text"> :)</string>
<string name="rate_us_never"></string>
<string name="error_occurred"></string>
<!--Rotate Pages -->
<string name="rotate_pages"></string>
<string name="enter_rotation_angle"></string>
<string name="share_files"></string>
<string name="pdf_removed_from_list">PDF</string>
<string name="pdf_added_to_list">PDF</string>
<string name="select_files"></string>
<!-- Settings page -->
<string name="settings"></string>
<string name="compression_image_edit"></string>
<string name="font_family_edit"></string>
<string name="font_size_edit"></string>
<string name="theme_edit"></string>
<string name="image_compression_value_default"> %d %%</string>
<string name="theme_value_def"> %s </string>
<string name="page_size_value_def"> %s </string>
<string name="font_size_value_def"> %d </string>
<string name="font_family_value_def"> %s </string>
<string name="settings_info"></string>
<string name="storage_location_modified"></string>
<string name="storage_location_info"></string>
<string name="theme_white"></string>
<string name="theme_dark"></string>
<string name="theme_black"></string>
<string name="theme_system">System</string>
<string name="change_master_pwd"></string>
<string name="current_master_pwd">PDF \"%1$s\" </string>
<!-- Home page -->
<string name="home_page"></string>
<string name="create_new_pdfs">PDF</string>
<string name="view_pdfs">PDF</string>
<string name="view_pdf">PDF</string>
<string name="modify_existing_pdfs">PDF</string>
<string name="more_options"></string>
<string name="add_password"></string>
<string name="add_text"></string>
<string name="reorder_pages"></string>
<string name="remove_password"></string>
<string name="enhance_created_pdfs">PDF</string>
<string name="viewfiles_rotatepages">1. PDF \n2. \n3. OK \n4. PDF</string>
<string name="viewfiles_addpassword">1. PDF \n2. \n3. OK \n4. PDF</string>
<string name="viewfiles_removepassword">1. PDF \n2. \n3. PDFOK \n4. PDF</string>
<string name="grayscale_images">PDF</string>
<!-- Welcome screens-->
<string name="welcome_create_pdf_message">PDF</string>
<string name="welcome_create_pdf_info">PDF</string>
<string name="welcome_themes_title"></string>
<string name="welcome_themes_message"></string>
<string name="welcome_merge_title">PDF</string>
<string name="welcome_text_to_pdf">PDF</string>
<string name="welcome_text_to_pdf_message">PDF</string>
<string name="welcome_qrcode_to_pdf">PDF</string>
<string name="welcome_qrcode_to_pdf_message">PDF</string>
<string name="welcome_remove_pages"></string>
<string name="welcome_remove_pages_message"></string>
<string name="welcome_reorder_pages"></string>
<string name="welcome_reorder_pages_message"></string>
<string name="welcome_extract_images">PDF</string>
<string name="welcome_extract_images_message">PDF</string>
<string name="welcome_merge_message">PDF</string>
<string name="welcome_viewfiles_title">PDF</string>
<string name="welcome_viewfiles_message">PDF</string>
<string name="skip_text"></string>
<string name="get_started_title">!</string>
<!-- Whats New Dialog -->
<string name="whatsnew_continue"></string>
<string name="whatsnew_title"></string>
<!--watermark strings -->
<string name="watermark_added"></string>
<string name="watermarked"></string>
<string name="watermarked_file">.pdf</string>
<string name="watermark_remove"></string>
<string name="snackbar_watermark_cannot_be_blank"></string>
<string name="cannot_add_watermark">PDFPDF</string>
<string name="add_watermark"></string>
<string name="enter_watermark_text"></string>
<string name="enter_watermark_angle"></string>
<string name="watermark_angle"></string>
<string name="choose_watermark_color"></string>
<string name="enter_watermark_font_size"></string>
<string name="choose_watermark_font_family"></string>
<string name="watermark_font_size"></string>
<string name="choose_watermark_style"></string>
<string name="viewfiles_addwatermark">1. PDF \n2. \n3. OK \n4. PDF</string>
<!--<nav add images>-->
<string name="add_images"></string>
<string name="selected_images_text">PDF</string>
<string name="no_images_selected"></string>
<string name="title_filter_history_dialog"></string>
<!--zip to pdf-->
<string name="zip_to_pdf">ZIPPDF</string>
<string name="convert_to_pdf">PDF</string>
<string name="error_no_image_in_zip">ZIP</string>
<string name="error_open_file"></string>
<!--text to pdf-->
<string name="error_pdf_not_created">PDF</string>
<!--favourite fragment-->
<string name="favourites"></string>
<string name="add_to_favourite"></string>
<string name="favourites_text">"+"</string>
<string name="no_excel_file">Excel</string>
<string name="split_range_alert">PDF</string>
<!--file name suffix-->
<string name="reordering_pages_dialog"></string>
<string name="delete_alert_singular"></string>
<string name="snackbar_files_deleted"></string>
<string name="lbl_recently_used"></string>
<!-- FAQs -->
<string name="faqSearch"></string>
<string-array name="faq_question_answers">
<item>#####jpegjpgtiffgifpsdbmpepspng</item>
<item>#####PDF \n1) <strong></strong> . \n2) <strong>PDF</strong>PDF \n3) <strong></strong>. \n4) PDF</item>
<item>PDF#####</item>
<item>#####<strong>10MB</strong>10</item>
<item>#####</item>
<item>PDF#####PDF</item>
<item>PDF#####PDF PDFfiles \n<strong></strong></item>
<item>##### \n1) <strong></strong> \n2) <strong></strong> \n3) <strong></strong> . \n4) <strong></strong> \n</item>
<item>/PDF#####/PDFPDF \n1) <strong></strong> \n2) \n3) <strong></strong> () <strong></strong>. \n4) </item>
<item>PDF#####</item>
<item>PDF##### <strong></strong> </item>
<item>PDF##### \n1) <strong>PDF</strong> \n2) <strong></strong> \n3) <strong></strong> </item>
<item>PDF#####PDF <strong>.png</strong> </item>
<item>/#####</item>
<item>/##### <strong></strong> </item>
<item>PDF#####PDF, \n1) <strong>PDF</strong> \n2) <strong></strong> PDF \n3) <strong></strong> </item>
<item>PDF##### \n1) <strong>PDF</strong> \n2) <strong></strong> \n3) <strong></strong> <strong></strong> \n4) \n5) <strong></strong> <strong>PDF</strong>PDF</item>
<item>PDF##### <strong>PDF</strong> <strong></strong></item>
<item>PDF##### \n1) <strong></strong> \n2) <strong></strong> PDF \n3) <strong>PDF</strong>. \n4) \n5) <strong></strong> PDF</item>
<item>PDF##### \n1) \n2) PDF \n3) </item>
<item>PDFPPTPPTXODTDOCDOCX#####PDF</item>
<item>PDF CONVERTER: Files to PDF#####Google PlayStoreF-Droid</item>
<item>#####GitHub <strong>Swati4star/Images-to-PDF</strong> \nPull request \n <strong>Contributor\'s guide</strong> </item>
<item>##### <strong>swati4star@gmail.com</strong></item>
</string-array>
</resources>
``` | /content/code_sandbox/app/src/main/res/values-zh-rHK/strings.xml | xml | 2016-02-22T10:00:46 | 2024-08-16T15:37:50 | Images-to-PDF | Swati4star/Images-to-PDF | 1,174 | 6,212 |
```xml
/// <reference types="mocha"/>
/// <reference types="node" />
import xs, {Stream} from '../../src/index';
import * as assert from 'assert';
describe('xs.merge', () => {
it('should merge OR-style two streams together', (done: any) => {
const stream = xs.merge(
xs.periodic(100).take(2),
xs.periodic(120).take(2)
);
let expected = [0, 0, 1, 1];
stream.addListener({
next: (x) => {
assert.equal(x, expected.shift());
},
error: done,
complete: () => {
assert.equal(expected.length, 0);
done();
},
});
});
it('should complete only when all member streams have completed', (done: any) => {
const stream1 = xs.periodic(30).take(1);
const stream2 = xs.periodic(50).take(4);
const stream = xs.merge(stream1, stream2);
let expected = [0, 0, 1, 2, 3];
stream.addListener({
next: (x) => {
assert.equal(x, expected.shift());
},
error: done,
complete: () => {
assert.equal(expected.length, 0);
done();
},
});
});
it('should complete properly when stopped asynchronously and restarted synchronously', (done: any) => {
const initial = xs.of('foo');
const stream = xs.merge(initial);
const noop = () => {};
stream.addListener({next: noop, error: noop, complete: noop});
let expected = ['foo'];
stream.addListener({
next: (x) => {
assert.equal(x, expected.shift());
},
error: done,
complete: () => {
assert.equal(expected.length, 0);
done();
}
});
});
it('should return a Stream when merging a MemoryStream with a Stream', (done: any) => {
const input1 = xs.periodic(50).take(4).remember();
const input2 = xs.periodic(80).take(3);
const stream: Stream<number> = xs.merge(input1, input2);
assert.strictEqual(stream instanceof Stream, true);
done();
});
it('should return a Stream when merging a MemoryStream with a MemoryStream', (done: any) => {
const input1 = xs.periodic(50).take(4).remember();
const input2 = xs.periodic(80).take(3).remember();
const stream: Stream<number> = xs.merge(input1, input2);
assert.strictEqual(stream instanceof Stream, true);
done();
});
it('should have a correct TypeScript signature', () => {
const bools = xs.create<boolean>({
start: listener => {},
stop: () => {}
});
const numbers = xs.create<number>({
start: listener => {},
stop: () => {}
});
const strings = xs.create<string>({
start: listener => {},
stop: () => {}
});
const emptyIsh: Stream<boolean> = xs.merge<boolean>();
const doubled: Stream<boolean | string> = xs.merge(bools, strings);
const tripled: Stream<boolean | number | string> = xs.merge(bools, strings, numbers);
});
});
``` | /content/code_sandbox/tests/factory/merge.ts | xml | 2016-04-22T19:25:41 | 2024-08-12T22:43:18 | xstream | staltz/xstream | 2,374 | 717 |
```xml
// Public utilities API
export { SUPPORTED_PACKAGES } from './defaultSupportedPackages';
export { isEditorSupported } from './isEditorSupported';
// Re-export for convenience
export { configureEnvironment } from '@fluentui/monaco-editor/lib/configureEnvironment';
// Intentionally not exporting the query param utilities, since those really ought to live in
// react-docsite-components and are exported from there
export type { IMonacoConfig } from '@fluentui/monaco-editor/lib/configureEnvironment';
``` | /content/code_sandbox/packages/react-monaco-editor/src/utilities/index.ts | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 108 |
```xml
import { EncryptedPayloadInterface, HistoryEntry } from '@standardnotes/models'
import { EncryptionProviderInterface, RevisionClientInterface } from '@standardnotes/services'
jest.mock('@standardnotes/models', () => {
const original = jest.requireActual('@standardnotes/models')
return {
...original,
checkRemotePayloadAllowed: jest.fn(),
}
})
const checkRemotePayloadAllowed = require('@standardnotes/models').checkRemotePayloadAllowed
import { Revision } from '../../Revision/Revision'
import { GetRevision } from './GetRevision'
describe('GetRevision', () => {
let revisionManager: RevisionClientInterface
let encryptionService: EncryptionProviderInterface
const createUseCase = () => new GetRevision(revisionManager, encryptionService)
beforeEach(() => {
revisionManager = {} as jest.Mocked<RevisionClientInterface>
revisionManager.getRevision = jest.fn().mockReturnValue({
uuid: '00000000-0000-0000-0000-000000000000',
item_uuid: '00000000-0000-0000-0000-000000000000',
content: '004:foobar',
content_type: 'Note',
items_key_id: 'foobar',
enc_item_key: 'foobar',
auth_hash: 'foobar',
created_at: '2021-01-01T00:00:00.000Z',
updated_at: '2021-01-01T00:00:00.000Z',
} as jest.Mocked<Revision>)
encryptionService = {} as jest.Mocked<EncryptionProviderInterface>
encryptionService.getEmbeddedPayloadAuthenticatedData = jest
.fn()
.mockReturnValue({ u: '00000000-0000-0000-0000-000000000000' })
const encryptedPayload = {
content: 'foobar',
} as jest.Mocked<EncryptedPayloadInterface>
encryptedPayload.copy = jest.fn().mockReturnValue(encryptedPayload)
encryptionService.decryptSplitSingle = jest.fn().mockReturnValue(encryptedPayload)
checkRemotePayloadAllowed.mockImplementation(() => ({ allowed: {} }))
})
it('should get revision', async () => {
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(false)
expect(result.getValue()).toBeInstanceOf(HistoryEntry)
})
it('it should get a revision without uuid from embedded params', async () => {
encryptionService.getEmbeddedPayloadAuthenticatedData = jest.fn().mockReturnValue({ u: undefined })
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(false)
expect(result.getValue()).toBeInstanceOf(HistoryEntry)
})
it('it should get a revision without embedded params', async () => {
encryptionService.getEmbeddedPayloadAuthenticatedData = jest.fn().mockReturnValue(undefined)
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(false)
expect(result.getValue()).toBeInstanceOf(HistoryEntry)
})
it('should fail if item uuid is invalid', async () => {
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: 'invalid',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(true)
expect(result.getError()).toEqual('Could not get revision: Given value is not a valid uuid: invalid')
})
it('should fail if revision uuid is invalid', async () => {
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: 'invalid',
})
expect(result.isFailed()).toBe(true)
expect(result.getError()).toEqual('Could not get revision: Given value is not a valid uuid: invalid')
})
it('should fail if revision is not found', async () => {
revisionManager.getRevision = jest.fn().mockReturnValue(null)
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(true)
expect(result.getError()).toEqual('Could not get revision: Revision not found')
})
it('should fail if there is an error in decrypting the revision', async () => {
const encryptedPayload = {
content: 'foobar',
errorDecrypting: true,
} as jest.Mocked<EncryptedPayloadInterface>
encryptedPayload.copy = jest.fn().mockReturnValue(encryptedPayload)
encryptionService.decryptSplitSingle = jest.fn().mockReturnValue(encryptedPayload)
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(true)
expect(result.getError()).toEqual('Could not decrypt revision.')
})
it('should fail if remote payload is not allowed', async () => {
checkRemotePayloadAllowed.mockImplementation(() => ({ disallowed: {} }))
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(true)
})
it('should fail if revision manager throws', async () => {
revisionManager.getRevision = jest.fn().mockRejectedValue(new Error('error'))
const useCase = createUseCase()
const result = await useCase.execute({
itemUuid: '00000000-0000-0000-0000-000000000000',
revisionUuid: '00000000-0000-0000-0000-000000000000',
})
expect(result.isFailed()).toBe(true)
expect(result.getError()).toEqual('Could not get revision: error')
})
})
``` | /content/code_sandbox/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.spec.ts | xml | 2016-12-05T23:31:33 | 2024-08-16T06:51:19 | app | standardnotes/app | 5,180 | 1,510 |
```xml
import { toFullOption, toFullOptionList } from './toFullOption';
describe('toFullOption', () => {
it('adds value', () => {
expect(toFullOption({ name: 'n1', label: 'l1' })).toEqual({
name: 'n1',
value: 'n1',
label: 'l1',
});
});
it('adds name', () => {
expect(toFullOption({ value: 'n1', label: 'l1' })).toEqual({
name: 'n1',
value: 'n1',
label: 'l1',
});
});
it('retains value', () => {
expect(toFullOption({ name: 'n1', value: 'v1', label: 'l1' })).toEqual({
name: 'n1',
value: 'v1',
label: 'l1',
});
});
it('retains reference', () => {
const o = { name: 'n1', value: 'v1', label: 'l1' };
expect(toFullOption(o)).toBe(o);
});
it('adds base properties', () => {
const o = { value: 'v1', label: 'l1' };
const base = { someDefault: 'property' };
expect(toFullOption(o, base)).toEqual({
name: 'v1',
value: 'v1',
label: 'l1',
someDefault: 'property',
});
});
});
describe('toFullOptionList', () => {
it('converts an option array', () => {
expect(
toFullOptionList([
{ name: 'n1', label: 'l1' },
{ name: 'n2', label: 'l2' },
])
).toEqual([
{
name: 'n1',
value: 'n1',
label: 'l1',
},
{
name: 'n2',
value: 'n2',
label: 'l2',
},
]);
});
it('converts an option group array', () => {
expect(
toFullOptionList([
{
label: 'lg',
options: [
{ name: 'n1', label: 'l1' },
{ name: 'n2', label: 'l2' },
],
},
])
).toEqual([
{
label: 'lg',
options: [
{
name: 'n1',
value: 'n1',
label: 'l1',
},
{
name: 'n2',
value: 'n2',
label: 'l2',
},
],
},
]);
});
});
``` | /content/code_sandbox/packages/react-querybuilder/src/utils/toFullOption.test.ts | xml | 2016-06-17T22:03:19 | 2024-08-16T10:28:42 | react-querybuilder | react-querybuilder/react-querybuilder | 1,131 | 595 |
```xml
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { DockDocModule } from '@doc/dock/dockdoc.module';
import { DockDemo } from './dockdemo';
import { DockDemoRoutingModule } from './dockdemo-routing.module';
@NgModule({
imports: [CommonModule, DockDemoRoutingModule, DockDocModule],
declarations: [DockDemo]
})
export class DockDemoModule {}
``` | /content/code_sandbox/src/app/showcase/pages/dock/dockdemo.module.ts | xml | 2016-01-16T09:23:28 | 2024-08-16T19:58:20 | primeng | primefaces/primeng | 9,969 | 89 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="path_to_url"
xmlns:tools="path_to_url"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.eveningoutpost.dexdrip.utils.DisplayQRCode">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<TextView
android:id="@+id/textLibreHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/libre_chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</lecho.lib.hellocharts.view.LineChartView>
</LinearLayout>
<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:onClick="closeNow"
android:src="@android:drawable/ic_delete" />
</RelativeLayout>
``` | /content/code_sandbox/app/src/main/res/layout/activity_libre_trend.xml | xml | 2016-09-23T13:33:17 | 2024-08-15T09:51:19 | xDrip | NightscoutFoundation/xDrip | 1,365 | 354 |
```xml
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { Tag, TagModule } from './tag';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { By } from '@angular/platform-browser';
describe('Tag', () => {
let tag: Tag;
let fixture: ComponentFixture<Tag>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopAnimationsModule, TagModule]
});
fixture = TestBed.createComponent(Tag);
tag = fixture.componentInstance;
});
it('should display by default', () => {
fixture.detectChanges();
const tagEl = fixture.debugElement.query(By.css('.p-tag'));
expect(tagEl.nativeElement).toBeTruthy();
});
});
``` | /content/code_sandbox/src/app/components/tag/tag.spec.ts | xml | 2016-01-16T09:23:28 | 2024-08-16T19:58:20 | primeng | primefaces/primeng | 9,969 | 145 |
```xml
import { verifySignedMessage } from './signing';
describe('lib/signing', () => {
const msgToSign = 'Testing your code is great!';
const msgToVerify = {
address: '0x6980ba0ab378c2ed0efccd7ea6ab84d54615a2de',
msg: msgToSign,
sig:
your_sha256_hashyour_sha256_hash771c',
version: '2'
};
it('verifySignedMessage properly verifies a signed message', () => {
expect(verifySignedMessage(msgToVerify)).toBeTruthy();
});
});
``` | /content/code_sandbox/src/utils/signing.spec.ts | xml | 2016-12-04T01:35:27 | 2024-08-14T21:41:58 | MyCrypto | MyCryptoHQ/MyCrypto | 1,347 | 131 |
```xml
import { z } from '@botpress/sdk'
import { omit } from 'lodash'
export const ticketSchema = z.object({
id: z.number(),
subject: z.string(),
description: z.string(),
status: z.enum(['new', 'open', 'pending', 'hold', 'solved', 'closed']),
priority: z.enum(['low', 'normal', 'high', 'urgent']).nullable(),
requesterId: z.number(),
assigneeId: z.number().nullable(),
createdAt: z.string(),
updatedAt: z.string(),
tags: z.array(z.string()),
})
const zdTicketSchema = ticketSchema.transform((data) => ({
...omit(data, ['requesterId', 'assigneeId', 'createdAt', 'updatedAt']),
created_at: data.createdAt,
updated_at: data.updatedAt,
requester_id: data.requesterId,
assignee_id: data.assigneeId,
}))
export type ZendeskTicket = z.output<typeof zdTicketSchema>
export type Ticket = z.input<typeof ticketSchema>
export const transformTicket = (ticket: ZendeskTicket): Ticket => {
return {
...omit(ticket, ['requester_id', 'assignee_id', 'created_at', 'updated_at']),
requesterId: ticket.requester_id,
assigneeId: ticket.assignee_id,
createdAt: ticket.created_at,
updatedAt: ticket.updated_at,
}
}
export const userSchema = z.object({
id: z.number(),
name: z.string(),
email: z.string(),
phone: z.string().nullable().optional(),
photo: z.string().nullable().optional(),
role: z.enum(['end-user', 'agent', 'admin']),
tags: z.array(z.string()),
createdAt: z.string(),
updatedAt: z.string(),
externalId: z.string().nullable(),
userFields: z.record(z.string()).optional(),
})
const zdUserSchema = userSchema.transform((data) => ({
...omit(data, ['createdAt', 'updatedAt', 'externalId', 'userFields']),
created_at: data.createdAt,
updated_at: data.updatedAt,
external_id: data.externalId,
user_fields: data.userFields,
}))
export type ZendeskUser = z.output<typeof zdUserSchema>
export type User = z.input<typeof userSchema>
export const transformUser = (ticket: ZendeskUser): User => {
return {
...omit(ticket, ['external_id', 'user_fields', 'created_at', 'updated_at']),
externalId: ticket.external_id,
userFields: ticket.user_fields,
createdAt: ticket.created_at,
updatedAt: ticket.updated_at,
}
}
export type ZendeskArticle = {
id: number
url: string
html_url: string
author_id: number
comments_disabled: boolean
draft: boolean
promoted: boolean
position: number
vote_sum: number
vote_count: number
section_id: number
created_at: string
updated_at: string
name: string
title: string
source_locale: string
locale: string
outdated: boolean
outdated_locales: string[]
edited_at: string
user_segment_id: number | null
permission_group_id: number
content_tag_ids: number[]
label_names: string[]
body: string
}
export type ZendeskWebhook = {
id: string
name: string
status: string
subscriptions: string[]
created_at: string
created_by: string
endpoint: string
http_method: string
request_format: string
}
``` | /content/code_sandbox/integrations/zendesk/src/definitions/schemas.ts | xml | 2016-11-16T21:57:59 | 2024-08-16T18:45:35 | botpress | botpress/botpress | 12,401 | 768 |
```xml
/* eslint-disable verdaccio/jsx-spread */
import Box from '@mui/material/Box';
import React from 'react';
import { MemoryRouter } from 'react-router';
import Search from './Search';
export default {
title: 'Components/Header/Search',
};
export const SearchByQuery = {
render: (args) => (
<MemoryRouter initialEntries={[`/-/web/detail/storybook`]}>
<Box
sx={{
height: 100,
padding: 10,
backgroundColor: 'primary.dark',
'&:hover': {
backgroundColor: 'primary.main',
opacity: [0.9, 0.8, 0.7],
},
}}
>
<Search {...args} />
</Box>
</MemoryRouter>
),
};
``` | /content/code_sandbox/packages/ui-components/src/components/Search/Search.stories.tsx | xml | 2016-04-15T16:21:12 | 2024-08-16T09:38:01 | verdaccio | verdaccio/verdaccio | 16,189 | 168 |
```xml
import React from 'react';
import { getRouter } from '@storybook/nextjs/navigation.mock';
import type { Meta, StoryObj } from '@storybook/react';
import { expect, userEvent, within } from '@storybook/test';
import {
useParams,
usePathname,
useRouter,
useSearchParams,
useSelectedLayoutSegment,
useSelectedLayoutSegments,
} from 'next/navigation';
function Component() {
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const params = useParams();
const segment = useSelectedLayoutSegment();
const segments = useSelectedLayoutSegments();
const searchParamsList = searchParams ? Array.from(searchParams.entries()) : [];
const routerActions = [
{
cb: () => router.back(),
name: 'Go back',
},
{
cb: () => router.forward(),
name: 'Go forward',
},
{
cb: () => router.prefetch('/prefetched-html'),
name: 'Prefetch',
},
{
// @ts-expect-error (old API)
cb: () => router.push('/push-html', { forceOptimisticNavigation: true }),
name: 'Push HTML',
},
{
cb: () => router.refresh(),
name: 'Refresh',
},
{
// @ts-expect-error (old API)
cb: () => router.replace('/replaced-html', { forceOptimisticNavigation: true }),
name: 'Replace',
},
];
return (
<div>
<div>pathname: {pathname}</div>
<div>segment: {segment}</div>
<div>segments: {segments.join(',')}</div>
<div>
searchparams:{' '}
<ul>
{searchParamsList.map(([key, value]) => (
<li key={key}>
{key}: {value}
</li>
))}
</ul>
</div>
<div>
params:{' '}
<ul>
{Object.entries(params).map(([key, value]) => (
<li key={key}>
{key}: {value}
</li>
))}
</ul>
</div>
{routerActions.map(({ cb, name }) => (
<div key={name} style={{ marginBottom: '1em' }}>
<button type="button" onClick={cb}>
{name}
</button>
</div>
))}
</div>
);
}
type Story = StoryObj<typeof Component>;
export default {
component: Component,
parameters: {
nextjs: {
appDirectory: true,
navigation: {
pathname: '/hello',
query: {
foo: 'bar',
},
prefetch: () => {
console.log('custom prefetch');
},
},
},
},
} as Meta<typeof Component>;
export const Default: StoryObj<typeof Component> = {
play: async ({ canvasElement, step }) => {
const canvas = within(canvasElement);
const routerMock = getRouter();
await step('Asserts whether forward hook is called', async () => {
const forwardBtn = await canvas.findByText('Go forward');
await userEvent.click(forwardBtn);
await expect(routerMock.forward).toHaveBeenCalled();
});
await step('Asserts whether custom prefetch hook is called', async () => {
const prefetchBtn = await canvas.findByText('Prefetch');
await userEvent.click(prefetchBtn);
await expect(routerMock.prefetch).toHaveBeenCalledWith('/prefetched-html');
});
},
};
export const WithSegmentDefined: Story = {
parameters: {
nextjs: {
appDirectory: true,
navigation: {
segments: ['dashboard', 'settings'],
},
},
},
};
export const WithSegmentDefinedForParams: Story = {
parameters: {
nextjs: {
appDirectory: true,
navigation: {
segments: [
['slug', 'hello'],
['framework', 'nextjs'],
],
},
},
},
};
``` | /content/code_sandbox/code/frameworks/nextjs/template/stories_nextjs-default-ts/Navigation.stories.tsx | xml | 2016-03-18T04:23:44 | 2024-08-16T19:22:08 | storybook | storybookjs/storybook | 83,755 | 862 |
```xml
import 'rxjs/add/observable/of';
import { EventEmitter } from 'events';
import { Observable } from 'rxjs/Observable';
import { ChildProcess } from 'child_process';
import {
ExecutionResult,
IProcessService,
ObservableExecutionResult,
Output,
ShellOptions,
SpawnOptions,
} from '../../client/common/process/types';
import { noop } from '../core';
type ExecObservableCallback = (result: Observable<Output<string>> | Output<string>) => void;
type ExecCallback = (result: ExecutionResult<string>) => void;
export const IOriginalProcessService = Symbol('IProcessService');
export class MockProcessService extends EventEmitter implements IProcessService {
constructor(private procService: IProcessService) {
super();
}
public onExecObservable(
handler: (file: string, args: string[], options: SpawnOptions, callback: ExecObservableCallback) => void,
): void {
this.on('execObservable', handler);
}
public execObservable(file: string, args: string[], options: SpawnOptions = {}): ObservableExecutionResult<string> {
let value: Observable<Output<string>> | Output<string> | undefined;
let valueReturned = false;
this.emit('execObservable', file, args, options, (result: Observable<Output<string>> | Output<string>) => {
value = result;
valueReturned = true;
});
if (valueReturned) {
const output = value as Output<string>;
if (['stderr', 'stdout'].some((source) => source === output.source)) {
return {
proc: {} as ChildProcess,
out: Observable.of(output),
dispose: () => {
noop();
},
};
}
return {
proc: {} as ChildProcess,
out: value as Observable<Output<string>>,
dispose: () => {
noop();
},
};
}
return this.procService.execObservable(file, args, options);
}
public onExec(
handler: (file: string, args: string[], options: SpawnOptions, callback: ExecCallback) => void,
): void {
this.on('exec', handler);
}
public async exec(file: string, args: string[], options: SpawnOptions = {}): Promise<ExecutionResult<string>> {
let value: ExecutionResult<string> | undefined;
let valueReturned = false;
this.emit('exec', file, args, options, (result: ExecutionResult<string>) => {
value = result;
valueReturned = true;
});
return valueReturned ? value! : this.procService.exec(file, args, options);
}
public async shellExec(command: string, options?: ShellOptions): Promise<ExecutionResult<string>> {
let value: ExecutionResult<string> | undefined;
let valueReturned = false;
this.emit('shellExec', command, options, (result: ExecutionResult<string>) => {
value = result;
valueReturned = true;
});
return valueReturned ? value! : this.procService.shellExec(command, options);
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
public dispose(): void {}
}
``` | /content/code_sandbox/src/test/mocks/proc.ts | xml | 2016-01-19T10:50:01 | 2024-08-12T21:05:24 | pythonVSCode | DonJayamanne/pythonVSCode | 2,078 | 662 |
```xml
import { parallelTest as test } from '../parallelTest';
import { expect } from '@playwright/test';
import WpAdminPage from '../pages/wp-admin-page';
async function validateGettingStartedPage( wpAdmin: WpAdminPage ) {
await wpAdmin.page.goto( '/wp-admin/admin.php?page=elementor-getting-started' );
expect( await wpAdmin.page.locator( '.e-getting-started' ).count() ).toEqual( 1 );
}
async function validateGettingStartedLinkCount( wpAdmin: WpAdminPage, expectedCount ) {
await wpAdmin.page.locator( 'li .toplevel_page_elementor' ).click();
expect( await wpAdmin.page.getByText( 'Getting Started' ).count() ).toEqual( expectedCount );
}
test.describe( 'General Settings', () => {
test( 'Is hidden if home is active (default for plugin users)', async ( { page, apiRequests }, testInfo ) => {
// Arrange.
const wpAdmin = new WpAdminPage( page, testInfo, apiRequests );
await wpAdmin.gotoDashboard();
await validateGettingStartedLinkCount( wpAdmin, 0 );
await validateGettingStartedPage( wpAdmin );
} );
test( 'Is visible if home is not active (default for hosting users)', async ( { page, apiRequests }, testInfo ) => {
// Arrange.
const wpAdmin = new WpAdminPage( page, testInfo, apiRequests );
await wpAdmin.setExperiments( { home_screen: false } );
// We need to navigate away
await validateGettingStartedPage( wpAdmin );
await validateGettingStartedLinkCount( wpAdmin, 1 );
await wpAdmin.setExperiments( { home_screen: true }, true );
} );
} );
``` | /content/code_sandbox/tests/playwright/sanity/elementor-menu.test.ts | xml | 2016-05-30T13:05:46 | 2024-08-16T13:13:10 | elementor | elementor/elementor | 6,507 | 378 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="path_to_url"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/news_content_fragment"
android:name="com.example.fragmentbestpractice.NewsContentFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
``` | /content/code_sandbox/chapter4/FragmentBestPractice/app/src/main/res/layout/news_content.xml | xml | 2016-10-04T02:55:57 | 2024-08-16T11:00:26 | booksource | guolindev/booksource | 3,105 | 100 |
```xml
import { Location } from "@angular/common";
import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { first } from "rxjs/operators";
import { SendComponent as BaseSendComponent } from "@bitwarden/angular/tools/send/send.component";
import { SearchService } from "@bitwarden/common/abstractions/search.service";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
import { DialogService, ToastService } from "@bitwarden/components";
import { BrowserComponentState } from "../../../models/browserComponentState";
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
import { BrowserSendStateService } from "../services/browser-send-state.service";
const ComponentId = "SendTypeComponent";
@Component({
selector: "app-send-type",
templateUrl: "send-type.component.html",
})
export class SendTypeComponent extends BaseSendComponent implements OnInit, OnDestroy {
groupingTitle: string;
// State Handling
state: BrowserComponentState;
private refreshTimeout: number;
private applySavedState = true;
constructor(
sendService: SendService,
i18nService: I18nService,
platformUtilsService: PlatformUtilsService,
environmentService: EnvironmentService,
ngZone: NgZone,
policyService: PolicyService,
searchService: SearchService,
private stateService: BrowserSendStateService,
private route: ActivatedRoute,
private location: Location,
private changeDetectorRef: ChangeDetectorRef,
private broadcasterService: BroadcasterService,
private router: Router,
logService: LogService,
sendApiService: SendApiService,
dialogService: DialogService,
toastService: ToastService,
) {
super(
sendService,
i18nService,
platformUtilsService,
environmentService,
ngZone,
searchService,
policyService,
logService,
sendApiService,
dialogService,
toastService,
);
super.onSuccessfulLoad = async () => {
this.selectType(this.type);
};
this.applySavedState =
(window as any).previousPopupUrl != null &&
!(window as any).previousPopupUrl.startsWith("/send-type");
}
async ngOnInit() {
// Let super class finish
await super.ngOnInit();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (this.applySavedState) {
this.state = await this.stateService.getBrowserSendTypeComponentState();
if (this.state?.searchText != null) {
this.searchText = this.state.searchText;
}
}
if (params.type != null) {
this.type = parseInt(params.type, null);
switch (this.type) {
case SendType.Text:
this.groupingTitle = this.i18nService.t("sendTypeText");
break;
case SendType.File:
this.groupingTitle = this.i18nService.t("sendTypeFile");
break;
default:
break;
}
await this.load((s) => s.type === this.type);
}
// Restore state and remove reference
if (this.applySavedState && this.state != null) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
BrowserPopupUtils.setContentScrollY(window, this.state?.scrollY);
}
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.stateService.setBrowserSendTypeComponentState(null);
});
// Refresh Send list if sync completed in background
this.broadcasterService.subscribe(ComponentId, (message: any) => {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.ngZone.run(async () => {
switch (message.command) {
case "syncCompleted":
if (message.successfully) {
this.refreshTimeout = window.setTimeout(() => {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.refresh();
}, 500);
}
break;
default:
break;
}
this.changeDetectorRef.detectChanges();
});
});
}
ngOnDestroy() {
// Remove timeout
if (this.refreshTimeout != null) {
window.clearTimeout(this.refreshTimeout);
}
// Save state
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.saveState();
// Unsubscribe
this.broadcasterService.unsubscribe(ComponentId);
}
async selectSend(s: SendView) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.router.navigate(["/edit-send"], { queryParams: { sendId: s.id } });
}
async addSend() {
if (this.disableSend) {
return;
}
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.router.navigate(["/add-send"], { queryParams: { type: this.type } });
}
async removePassword(s: SendView): Promise<boolean> {
if (this.disableSend) {
return;
}
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
super.removePassword(s);
}
back() {
(window as any).routeDirection = "b";
this.location.back();
}
private async saveState() {
this.state = {
scrollY: BrowserPopupUtils.getContentScrollY(window),
searchText: this.searchText,
};
await this.stateService.setBrowserSendTypeComponentState(this.state);
}
}
``` | /content/code_sandbox/apps/browser/src/tools/popup/send/send-type.component.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 1,597 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="path_to_url">
<androidx.preference.CheckBoxPreference
android:defaultValue="false"
android:key="@string/play_sounds_key"
android:summary="@string/play_sound_on_check_in_out"
android:title="@string/play_sounds" />
<androidx.preference.CheckBoxPreference
android:defaultValue="false"
android:key="local_date"
android:summaryOff="Dates are shown in Event Timezone now"
android:summaryOn="Dates are shown in Local Timezone now"
android:title="Show dates in local timezone" />
<androidx.preference.EditTextPreference
android:key="device_name"
android:summary="@string/device_name_summary"
android:title="Device Name" />
<Preference
android:key="@string/sales_data_display_key"
android:title="@string/sales_data_display" />
<Preference
android:key="@string/developer_mode_key"
android:selectable="true"
android:title="@string/developer_mode" />
</androidx.preference.PreferenceScreen>
``` | /content/code_sandbox/app/src/main/res/xml/preferences.xml | xml | 2016-08-13T08:08:39 | 2024-08-06T13:58:48 | open-event-organizer-android | fossasia/open-event-organizer-android | 1,783 | 238 |
```xml
"use client"
/* eslint-disable react-hooks/exhaustive-deps */
import { useEffect, useState } from "react"
import { configAtom, configsAtom, currentUserAtom } from "@/store/config.store"
import { useAtomValue } from "jotai"
import { Loader2, ServerOffIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import ConfigsFetch from "./configsFetch"
import Login from "./LoginPage"
const checkValidAuth = (currentUser: any, config: any) => {
const { _id } = currentUser || {}
const { _id: configId, cashierIds, adminIds } = config || {}
if (!_id) {
return false
}
if (!configId) {
return false
}
if (
![...(cashierIds || []).concat(adminIds || [])].includes(currentUser._id)
) {
return false
}
return true
}
const CheckAuth = ({ children }: any) => {
const configs = useAtomValue(configsAtom)
const currentUser = useAtomValue(currentUserAtom)
const config = useAtomValue(configAtom)
const [show, setShow] = useState<"login" | "init" | "private" | null>(null)
const isConfigsFetched = Array.isArray(configs) && !!configs.length
useEffect(() => {
if (!isConfigsFetched) return setShow("init")
const checkValid = checkValidAuth(currentUser, config)
if (!checkValid) return setShow("login")
if (checkValid) return setShow("private")
}, [currentUser, isConfigsFetched, config])
if (!Array.isArray(configs))
return (
<div className="flex h-screen flex-col items-center justify-center">
<ServerOffIcon className={cn("m-4 h-12 w-12")} strokeWidth={0.8} />
<h5>Network Error</h5>
<br />
<p> </p>
</div>
)
if (show === "init") return <ConfigsFetch />
if (show === "login") return <Login />
if (show === "private") return children
return (
<div className="flex h-screen items-center justify-center">
<Loader2 className="mr-2 animate-spin" /> ...
</div>
)
}
export default CheckAuth
``` | /content/code_sandbox/pos/modules/auth/checkAuth.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 509 |
```xml
<vector xmlns:android="path_to_url"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M7.24,8.75c-0.26,-0.48 -0.39,-1.03 -0.39,-1.67 0,-0.61 0.13,-1.16 0.4,-1.67 0.26,-0.5 0.63,-0.93 1.11,-1.29 0.48,-0.35 1.05,-0.63 1.7,-0.83 0.66,-0.19 1.39,-0.29 2.18,-0.29 0.81,0 1.54,0.11 2.21,0.34 0.66,0.22 1.23,0.54 1.69,0.94 0.47,0.4 0.83,0.88 1.08,1.43 0.25,0.55 0.38,1.15 0.38,1.81h-3.01c0,-0.31 -0.05,-0.59 -0.15,-0.85 -0.09,-0.27 -0.24,-0.49 -0.44,-0.68 -0.2,-0.19 -0.45,-0.33 -0.75,-0.44 -0.3,-0.1 -0.66,-0.16 -1.06,-0.16 -0.39,0 -0.74,0.04 -1.03,0.13 -0.29,0.09 -0.53,0.21 -0.72,0.36 -0.19,0.16 -0.34,0.34 -0.44,0.55 -0.1,0.21 -0.15,0.43 -0.15,0.66 0,0.48 0.25,0.88 0.74,1.21 0.38,0.25 0.77,0.48 1.41,0.7H7.39c-0.05,-0.08 -0.11,-0.17 -0.15,-0.25zM21,12v-2H3v2h9.62c0.18,0.07 0.4,0.14 0.55,0.2 0.37,0.17 0.66,0.34 0.87,0.51 0.21,0.17 0.35,0.36 0.43,0.57 0.07,0.2 0.11,0.43 0.11,0.69 0,0.23 -0.05,0.45 -0.14,0.66 -0.09,0.2 -0.23,0.38 -0.42,0.53 -0.19,0.15 -0.42,0.26 -0.71,0.35 -0.29,0.08 -0.63,0.13 -1.01,0.13 -0.43,0 -0.83,-0.04 -1.18,-0.13s-0.66,-0.23 -0.91,-0.42c-0.25,-0.19 -0.45,-0.44 -0.59,-0.75 -0.14,-0.31 -0.25,-0.76 -0.25,-1.21H6.4c0,0.55 0.08,1.13 0.24,1.58 0.16,0.45 0.37,0.85 0.65,1.21 0.28,0.35 0.6,0.66 0.98,0.92 0.37,0.26 0.78,0.48 1.22,0.65 0.44,0.17 0.9,0.3 1.38,0.39 0.48,0.08 0.96,0.13 1.44,0.13 0.8,0 1.53,-0.09 2.18,-0.28s1.21,-0.45 1.67,-0.79c0.46,-0.34 0.82,-0.77 1.07,-1.27s0.38,-1.07 0.38,-1.71c0,-0.6 -0.1,-1.14 -0.31,-1.61 -0.05,-0.11 -0.11,-0.23 -0.17,-0.33H21z"
android:fillColor="#FFFFFF"/>
</vector>
``` | /content/code_sandbox/app/src/main/res/drawable/ic_strikethrough.xml | xml | 2016-08-13T08:08:39 | 2024-08-06T13:58:48 | open-event-organizer-android | fossasia/open-event-organizer-android | 1,783 | 1,122 |
```xml
import {
Document,
Schema,
Model,
Connection,
Types,
HydratedDocument,
} from 'mongoose';
import { IModels } from '../index';
import * as _ from 'lodash';
import { TimeDurationUnit, TIME_DURATION_UNITS } from '../../../consts';
// null, undefined, '' means it's for every user types
export const SUBSCRIPTION_PRODUCT_USER_TYPES = [
null,
undefined,
'',
'company',
'customer',
] as const;
export type SubscriptionProductUserTypes =
(typeof SUBSCRIPTION_PRODUCT_USER_TYPES)[number];
export interface ISubscriptionProduct {
_id: Types.ObjectId;
name?: string | null;
description?: string | null;
unit: TimeDurationUnit;
multiplier: number;
price: number;
listOrder: number;
userType: SubscriptionProductUserTypes;
}
export type SubscriptionProductInsert = Omit<ISubscriptionProduct, '_id'>;
export type SubscriptionProductPatch = Partial<SubscriptionProductInsert>;
export type SubscriptionProductDocument =
HydratedDocument<ISubscriptionProduct>;
export interface ISubscriptionProductModel extends Model<ISubscriptionProduct> {
findByIdOrThrow(_id: string): Promise<SubscriptionProductDocument>;
createSubscriptionProduct(
input: SubscriptionProductInsert,
): Promise<SubscriptionProductDocument>;
patchSubscriptionProduct(
_id: string,
input: SubscriptionProductPatch,
): Promise<SubscriptionProductDocument>;
deleteSubscriptionProduct(_id: string): Promise<SubscriptionProductDocument>;
}
export const subscriptionProductSchema = new Schema<ISubscriptionProduct>({
name: String,
description: String,
unit: {
type: String,
required: true,
enum: TIME_DURATION_UNITS,
},
multiplier: {
type: Number,
required: true,
min: 0,
},
price: {
type: Number,
required: true,
min: 0,
},
listOrder: {
type: Number,
required: true,
default: 0,
},
userType: {
type: String,
enum: SUBSCRIPTION_PRODUCT_USER_TYPES,
},
});
export const generateSubscriptionProductModel = (
subdomain: string,
con: Connection,
models: IModels,
): void => {
class SubscriptionProductModel {
public static async findByIdOrThrow(
_id: string,
): Promise<SubscriptionProductDocument> {
const product = await models.SubscriptionProduct.findById(_id);
if (!product) {
throw new Error('Subscription product not found');
}
return product;
}
public static async createSubscriptionProduct(
input: SubscriptionProductInsert,
): Promise<SubscriptionProductDocument | void> {
const product = await models.SubscriptionProduct.create(input);
return product;
}
public static async patchSubscriptionProduct(
_id: string,
input: SubscriptionProductPatch,
): Promise<SubscriptionProductDocument> {
const product = await models.SubscriptionProduct.findByIdAndUpdate(
_id,
{ $set: input },
{ new: true },
);
if (!product) {
throw new Error('Subscription product not found');
}
return product;
}
public static async deleteSubscriptionProduct(
_id: string,
): Promise<SubscriptionProductDocument> {
const product = await models.SubscriptionProduct.findByIdOrThrow(_id);
await product.deleteOne();
return product;
}
}
subscriptionProductSchema.loadClass(SubscriptionProductModel);
models.SubscriptionProduct = con.model<
ISubscriptionProduct,
ISubscriptionProductModel
>('forum_subscription_products', subscriptionProductSchema);
};
``` | /content/code_sandbox/packages/plugin-forum-api/src/db/models/subscription/subscriptionProduct.ts | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 772 |
```xml
import {
observable,
computed,
action,
extendObservable,
runInAction,
} from 'mobx';
import { find, get } from 'lodash';
import BigNumber from 'bignumber.js';
import Store from './lib/Store';
import Request from './lib/LocalizedRequest';
import { WalletTransaction } from '../domains/WalletTransaction';
import type {
GetTransactionFeeRequest,
DeleteTransactionRequest,
GetTransactionsResponse,
CreateExternalTransactionRequest,
GetWithdrawalsResponse,
} from '../api/transactions/types';
import {
isValidAmountInLovelaces,
isValidAssetAmountInNaturalUnits,
} from '../utils/validations';
import transactionsCsvGenerator from '../utils/transactionsCsvGenerator';
import { i18nContext } from '../utils/i18nContext';
import {
generateFilterOptions,
isTransactionInFilterRange,
} from '../utils/transaction';
import type { ApiTokens } from '../api/assets/types';
import { EventCategories } from '../analytics';
const INITIAL_SEARCH_LIMIT = null; // 'null' value stands for 'load all'
const SEARCH_LIMIT_INCREASE = 500; // eslint-disable-line
const SEARCH_SKIP = 0;
const RECENT_TRANSACTIONS_LIMIT = 50; // eslint-disable-line
export type DateRangeType =
| ''
| 'last7Days'
| 'last30Days'
| 'last90Days'
| 'thisYear'
| 'custom';
export const DateRangeTypes = {
LAST_7_DAYS: 'last7Days',
LAST_30_DAYS: 'last30Days',
LAST_90_DAYS: 'last90Days',
THIS_YEAR: 'thisYear',
CUSTOM: 'custom',
};
export type TransactionFilterOptionsType = {
searchTerm?: string;
searchLimit?: number | null | undefined;
searchSkip?: number | null | undefined;
dateRange?: DateRangeType;
fromDate?: string;
toDate?: string;
fromAmount?: string;
toAmount?: string;
incomingChecked?: boolean;
outgoingChecked?: boolean;
};
export const emptyTransactionFilterOptions = {
searchTerm: '',
searchLimit: INITIAL_SEARCH_LIMIT,
searchSkip: SEARCH_SKIP,
dateRange: '',
fromDate: '',
toDate: '',
fromAmount: '',
toAmount: '',
incomingChecked: true,
outgoingChecked: true,
};
type TransactionFeeRequest = {
walletId: string;
address: string;
amount: number;
assets?: ApiTokens;
};
export default class TransactionsStore extends Store {
@observable
transactionsRequests: Array<{
walletId: string;
isLegacy: boolean;
recentRequest: Request<GetTransactionsResponse>;
allRequest: Request<GetTransactionsResponse>;
withdrawalsRequest: Request<GetWithdrawalsResponse>;
}> = [];
@observable
deleteTransactionRequest: Request<DeleteTransactionRequest> = new Request(
this.api.ada.deleteTransaction
);
@observable
createExternalTransactionRequest: Request<
CreateExternalTransactionRequest
> = new Request(this.api.ada.createExternalTransaction);
@observable
_filterOptionsForWallets = {};
@observable
calculateTransactionFeeRequest: Request<
GetTransactionFeeRequest
> = new Request(this.api.ada.calculateTransactionFee);
setup() {
const {
transactions: transactionActions,
networkStatus: networkStatusActions,
} = this.actions;
transactionActions.filterTransactions.listen(this._updateFilterOptions);
// transactionActions.loadMoreTransactions.listen(this._increaseSearchLimit);
transactionActions.requestCSVFile.listen(this._requestCSVFile);
networkStatusActions.restartNode.listen(this._clearFilterOptions);
this.registerReactions([this._ensureFilterOptionsForActiveWallet]);
}
@computed
get recentTransactionsRequest(): Request<GetTransactionsResponse> {
const wallet = this.stores.wallets.active;
// TODO: Do not return new request here
if (!wallet) return new Request(this.api.ada.getTransactions);
return this._getTransactionsRecentRequest(wallet.id);
}
@computed
get searchRequest(): Request<GetTransactionsResponse> {
const wallet = this.stores.wallets.active;
// TODO: Do not return new request here
if (!wallet) return new Request(this.api.ada.getTransactions);
return this._getTransactionsAllRequest(wallet.id);
}
@computed
get filterOptions(): TransactionFilterOptionsType | null | undefined {
const wallet = this.stores.wallets.active;
if (!wallet) return null;
return this._filterOptionsForWallets[wallet.id];
}
@computed
get withdrawals(): Record<string, BigNumber> {
const withdrawals = {};
const { allWallets: wallets } = this.stores.wallets;
for (const wallet of wallets) {
const { id: walletId } = wallet;
const request = this._getWithdrawalsRequest(walletId);
withdrawals[walletId] =
get(request, 'result.withdrawals') || new BigNumber(0);
}
return withdrawals;
}
@computed
get all(): Array<WalletTransaction> {
const wallet = this.stores.wallets.active;
if (!wallet) return [];
const request = this._getTransactionsAllRequest(wallet.id);
if (!request.result) {
return [];
}
return request.result.transactions || [];
}
@computed
get allFiltered(): Array<WalletTransaction> {
const { recentFiltered } = this;
const allFiltered = this.all.filter((transaction) =>
isTransactionInFilterRange(this.filterOptions, transaction)
);
// Straight away show recent filtered transactions if all filtered ones are not loaded yet
return !allFiltered.length && recentFiltered.length
? recentFiltered
: allFiltered;
}
@computed
get defaultFilterOptions(): TransactionFilterOptionsType {
// @ts-ignore ts-migrate(2322) FIXME: Type '{ dateRange: string; fromDate: string; toDat... Remove this comment to see the full error message
return generateFilterOptions(this.all);
}
@computed
get populatedFilterOptions(): TransactionFilterOptionsType {
// @ts-ignore ts-migrate(2322) FIXME: Type 'TransactionFilterOptionsType | { searchTerm:... Remove this comment to see the full error message
return this.filterOptions || emptyTransactionFilterOptions;
}
@computed
get recent(): Array<WalletTransaction> {
const wallet = this.stores.wallets.active;
if (!wallet) return [];
const results = this._getTransactionsRecentRequest(wallet.id).result;
return results ? results.transactions : [];
}
@computed
get recentFiltered(): Array<WalletTransaction> {
return this.recent.filter((transaction) =>
isTransactionInFilterRange(this.filterOptions, transaction)
);
}
@computed
get hasAnyFiltered(): boolean {
const wallet = this.stores.wallets.active;
if (!wallet) return false;
const results = this._getTransactionsAllRequest(wallet.id).result;
return results ? results.transactions.length > 0 : false;
}
@computed
get hasAny(): boolean {
const wallet = this.stores.wallets.active;
if (!wallet) return false;
const results = this._getTransactionsRecentRequest(wallet.id).result;
return results ? results.total > 0 : false;
}
@computed
get totalAvailable(): number {
const wallet = this.stores.wallets.active;
if (!wallet) return 0;
const results = this._getTransactionsAllRequest(wallet.id).result;
return results ? results.total : 0;
}
@computed
get totalFilteredAvailable(): number {
const wallet = this.stores.wallets.active;
if (!wallet) return 0;
const results = this._getTransactionsAllRequest(wallet.id).result;
return results ? results.transactions.length : 0;
}
@computed
get pendingTransactionsCount(): number {
return this.recent.filter(({ state }) => state === 'pending').length;
}
@action
_refreshTransactionData = async () => {
if (this.stores.networkStatus.isConnected) {
const { all: wallets } = this.stores.wallets;
for (const wallet of wallets) {
const recentRequest = this._getTransactionsRecentRequest(wallet.id);
recentRequest.execute({
walletId: wallet.id,
order: 'descending',
fromDate: null,
toDate: null,
isLegacy: wallet.isLegacy, // @API TODO - Params "pending" for V2
// limit: this.RECENT_TRANSACTIONS_LIMIT,
// skip: 0,
// searchTerm: '',
// isFirstLoad: !recentRequest.wasExecuted,
// isRestoreActive,
// isRestoreCompleted,
// cachedTransactions: get(recentRequest, 'result.transactions', []),
});
const allRequest = this._getTransactionsAllRequest(wallet.id);
allRequest.execute({
walletId: wallet.id,
order: 'descending',
fromDate: null,
toDate: null,
isLegacy: wallet.isLegacy, // @API TODO - Params "pending" for V2
// limit: this.INITIAL_SEARCH_LIMIT,
// skip: 0,
// searchTerm: '',
// isFirstLoad: !allRequest.wasExecuted,
// isRestoreActive,
// isRestoreCompleted,
// cachedTransactions: get(allRequest, 'result.transactions', []),
});
if (!wallet.isLegacy) {
const withdrawalsRequest = this._getWithdrawalsRequest(wallet.id);
withdrawalsRequest.execute({
walletId: wallet.id,
});
}
}
}
};
// @ts-ignore ts-migrate(1058) FIXME: The return type of an async function must either b... Remove this comment to see the full error message
calculateTransactionFee = async (
transactionFeeRequest: TransactionFeeRequest
) => {
const { walletId } = transactionFeeRequest;
const wallet = this.stores.wallets.getWalletById(walletId);
if (!wallet) {
throw new Error(
'Active wallet required before calculating transaction fees.'
);
}
const { amount, availableAmount, reward, isLegacy } = wallet;
this.calculateTransactionFeeRequest.reset();
return this.calculateTransactionFeeRequest.execute({
...transactionFeeRequest,
walletBalance: amount,
availableBalance: availableAmount.plus(reward),
rewardsBalance: reward,
isLegacy,
});
};
deletePendingTransaction = async ({
walletId,
transactionId,
}: {
walletId: string;
transactionId: string;
}) => {
const wallet = this.stores.wallets.getWalletById(walletId);
if (!wallet) {
throw new Error(
'Active wallet required before deleting a pending transaction.'
);
}
const { isLegacy } = wallet;
// @ts-ignore ts-migrate(1320) FIXME: Type of 'await' operand must either be a valid pro... Remove this comment to see the full error message
await this.deleteTransactionRequest.execute({
walletId,
transactionId,
isLegacy,
});
this.stores.wallets.refreshWalletsData();
};
validateAmount = (amountInLovelaces: string): Promise<boolean> =>
Promise.resolve(isValidAmountInLovelaces(amountInLovelaces));
validateAssetAmount = (amountInNaturalUnits: string): Promise<boolean> =>
Promise.resolve(isValidAssetAmountInNaturalUnits(amountInNaturalUnits));
// ======================= PRIVATE ========================== //
@action
_updateFilterOptions = (filterOptions: TransactionFilterOptionsType) => {
const wallet = this.stores.wallets.active;
if (!wallet) return false;
const currentFilterOptions = this._filterOptionsForWallets[wallet.id];
this._filterOptionsForWallets[wallet.id] = {
...currentFilterOptions,
...filterOptions,
};
this.analytics.sendEvent(
EventCategories.WALLETS,
'Set transaction filters'
);
return true;
};
@action
_clearFilterOptions = () => {
const wallet = this.stores.wallets.active;
if (!wallet) return false;
this._filterOptionsForWallets[wallet.id] = {
...emptyTransactionFilterOptions,
};
return true;
};
@action
_requestCSVFile = async () => {
const {
stores: { profile },
allFiltered,
actions,
stores,
} = this;
const { isInternalAddress } = stores.addresses;
const { active } = this.stores.wallets;
const { desktopDirectoryPath } = profile;
const locale = profile.currentLocale;
const intl = i18nContext(locale);
const transactions = allFiltered;
const walletName = active ? active.name : '';
const { getAsset } = this.stores.assets;
const success = await transactionsCsvGenerator({
desktopDirectoryPath,
intl,
transactions,
walletName,
getAsset,
isInternalAddress,
});
if (success) {
actions.transactions.requestCSVFileSuccess.trigger();
this.analytics.sendEvent(
EventCategories.WALLETS,
'Exported transactions as CSV'
);
}
};
@action
_createExternalTransaction = async (signedTransactionBlob: Buffer) => {
// @ts-ignore ts-migrate(1320) FIXME: Type of 'await' operand must either be a valid pro... Remove this comment to see the full error message
await this.createExternalTransactionRequest.execute({
signedTransactionBlob,
});
this.stores.wallets.refreshWalletsData();
};
_getTransactionsRecentRequest = (
walletId: string
): Request<GetTransactionsResponse> => {
const foundRequest = find(this.transactionsRequests, {
walletId,
});
if (foundRequest && foundRequest.recentRequest)
return foundRequest.recentRequest;
return new Request(this.api.ada.getTransactions);
};
_getTransactionsAllRequest = (
walletId: string
): Request<GetTransactionsResponse> => {
const foundRequest = find(this.transactionsRequests, {
walletId,
});
if (foundRequest && foundRequest.allRequest) return foundRequest.allRequest;
return new Request(this.api.ada.getTransactions);
};
_getWithdrawalsRequest = (
walletId: string
): Request<GetWithdrawalsResponse> => {
const foundRequest = find(this.transactionsRequests, {
walletId,
});
if (foundRequest && foundRequest.withdrawalsRequest)
return foundRequest.withdrawalsRequest;
return new Request(this.api.ada.getWithdrawals);
};
// ======================= REACTIONS ========================== //
/**
* Reaction that makes sure that we have some default (empty)
* search options for the active wallet.
* @private
*/
_ensureFilterOptionsForActiveWallet = () => {
const wallet = this.stores.wallets.active;
if (!wallet) return false;
const options = this._filterOptionsForWallets[wallet.id];
if (!options) {
// Setup options for active wallet
runInAction('setFilterOptionsForActiveWallet', () => {
extendObservable(this._filterOptionsForWallets, {
[wallet.id]: emptyTransactionFilterOptions,
});
});
}
return true;
};
}
``` | /content/code_sandbox/source/renderer/app/stores/TransactionsStore.ts | xml | 2016-10-05T13:48:54 | 2024-08-13T22:03:19 | daedalus | input-output-hk/daedalus | 1,230 | 3,307 |
```xml
// luma.gl
import type {BufferProps} from '@luma.gl/core';
import {Buffer} from '@luma.gl/core';
import type {NullDevice} from '../null-device';
export class NullBuffer extends Buffer {
device: NullDevice;
byteLength: number;
constructor(device: NullDevice, props: BufferProps = {}) {
super(device, props);
this.device = device;
const byteOffset = props.byteOffset || 0;
const byteLength = props.byteLength ?? (props.data ? props.data.byteLength + byteOffset : 0);
// assert(byteLength >= 0);
this.byteLength = byteLength;
this.trackAllocatedMemory(byteLength);
}
override destroy(): void {
if (!this.destroyed) {
super.destroy();
this.trackDeallocatedMemory();
}
}
async readAsync(byteOffset = 0, byteLength?: number): Promise<Uint8Array> {
byteLength = byteLength ?? this.byteLength - byteOffset;
return new Uint8Array(byteLength);
}
write(data: ArrayBufferView, byteOffset: number = 0): void {
// assert(data.byteLength + byteOffset <= this.byteLength);
}
}
``` | /content/code_sandbox/modules/test-utils/src/null-device/resources/null-buffer.ts | xml | 2016-01-25T09:41:59 | 2024-08-16T10:03:05 | luma.gl | visgl/luma.gl | 2,280 | 260 |
```xml
import { DefaultEnvironment, expect } from '@test/util';
import * as vscode from 'vscode';
suite('Debug/Launch interface using Presets', () => {
let testEnv: DefaultEnvironment;
setup(async function (this: Mocha.Context) {
this.timeout(100000);
const build_loc = 'build';
const exe_res = 'output.txt';
testEnv = new DefaultEnvironment('test/extension-tests/single-root-UI/project-folder', build_loc, exe_res);
testEnv.projectFolder.buildDirectory.clear();
await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('useCMakePresets', 'always');
await vscode.commands.executeCommand('cmake.getSettingsChangePromise');
await vscode.commands.executeCommand('cmake.setConfigurePreset', process.platform === 'win32' ? 'WindowsUser1' : 'LinuxUser1');
await vscode.commands.executeCommand('cmake.setBuildPreset', '__defaultBuildPreset__');
await vscode.commands.executeCommand('cmake.setTestPreset', '__defaultTestPreset__');
expect(await vscode.commands.executeCommand('cmake.build')).to.be.eq(0);
});
teardown(async function (this: Mocha.Context) {
this.timeout(30000);
testEnv.teardown();
});
test('Test call of debugger', async () => {
const executablesTargets = await vscode.commands.executeCommand('cmake.executableTargets') as string[];
expect(executablesTargets.length).to.be.not.eq(0);
await vscode.commands.executeCommand('cmake.selectLaunchTarget', undefined, executablesTargets[0]);
await vscode.commands.executeCommand('cmake.debugTarget');
}).timeout(60000);
});
``` | /content/code_sandbox/test/extension-tests/single-root-UI/test/debugger-presets.test.ts | xml | 2016-04-16T21:00:29 | 2024-08-16T16:41:57 | vscode-cmake-tools | microsoft/vscode-cmake-tools | 1,450 | 368 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"path_to_url">
<header name="boost/signals/trackable.hpp">
<namespace name="boost">
<namespace name="signals">
<class name="trackable">
<purpose>Enables safe use of multicast callbacks.</purpose>
<description>
<para>The <code>trackable</code> class provides automatic
disconnection of signals and slots when objects bound in
slots (via pointer or reference) are destroyed. The
<code>trackable</code> class may only be used as a public
base class for some other class; when used as such, that
class may be bound to function objects used as part of
slots. The manner in which a <code>trackable</code> object
tracks the set of signal-slot connections it is a part of is
unspecified.</para>
<para>The actual use of <code>trackable</code> is contingent
on the presence of appropriate
<functionname>visit_each</functionname> overloads for any
type that may contain pointers or references to trackable
objects.</para>
</description>
<constructor>
<effects><para>Sets the list of connected slots to empty.</para></effects>
<throws><para>Will not throw.</para></throws>
</constructor>
<constructor>
<parameter name="other">
<paramtype>const <classname>trackable</classname>&</paramtype>
</parameter>
<effects><para>Sets the list of connected slots to empty.</para></effects>
<throws><para>Will not throw.</para></throws>
<rationale><para>Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied.</para></rationale>
</constructor>
<destructor>
<effects><para>Disconnects all signal/slot connections that
contain a pointer or reference to this trackable object that
can be found by
<functionname>visit_each</functionname>.</para></effects>
</destructor>
<copy-assignment>
<parameter name="other">
<paramtype>const <classname>trackable</classname>&</paramtype>
</parameter>
<effects><para>Sets the list of connected slots to empty.</para></effects>
<returns><para><code>*this</code></para></returns>
<throws><para>Will not throw.</para></throws>
<rationale><para>Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied.</para></rationale>
</copy-assignment>
</class>
</namespace>
</namespace>
</header>
``` | /content/code_sandbox/deps/boost_1_66_0/libs/signals/doc/reference/trackable.xml | xml | 2016-09-05T10:18:44 | 2024-08-11T13:21:40 | LiquidCore | LiquidPlayer/LiquidCore | 1,010 | 637 |
```xml
import * as React from 'react';
import { IContextualMenuProps, Stack } from '@fluentui/react'; // IStackTokens
import { DefaultButton } from '@fluentui/react/lib/Button';
export default {
title: 'Components/SplitButton',
};
export interface IButtonExampleProps {
// These are set based on the toggles shown above the examples (not needed in real code)
disabled?: boolean;
checked?: boolean;
}
const menuProps: IContextualMenuProps = {
items: [
{
key: 'emailMessage',
text: 'Email message',
iconProps: { iconName: 'Mail' },
},
{
key: 'calendarEvent',
text: 'Calendar event',
iconProps: { iconName: 'Calendar' },
},
],
};
// Example formatting
// const stackTokens: IStackTokens = { childrenGap: 40 };
export const ButtonSplitExample: React.FunctionComponent<IButtonExampleProps> = props => {
const { disabled, checked } = props;
return (
<Stack tokens={{ childrenGap: 8 }} horizontalAlign="center">
<DefaultButton
text="Standard split"
split
splitButtonAriaLabel="See 2 options"
aria-roledescription="split button"
menuProps={menuProps}
onClick={_alertClicked}
disabled={disabled}
checked={false}
/>
<DefaultButton
text="Standard checked split"
split
splitButtonAriaLabel="See 2 options"
aria-roledescription="split button"
menuProps={menuProps}
onClick={_alertClicked}
disabled={disabled}
checked={true}
/>
<DefaultButton
text="Primary checked split"
primary
split
splitButtonAriaLabel="See 2 options"
aria-roledescription="split button"
menuProps={menuProps}
onClick={_alertClicked}
disabled={disabled}
checked={true}
/>
<DefaultButton
text="Primary split"
primary
split
splitButtonAriaLabel="See 2 options"
aria-roledescription="split button"
menuProps={menuProps}
onClick={_alertClicked}
disabled={disabled}
checked={false}
/>
<DefaultButton
text="(default) Main action disabled split"
primaryDisabled
split
splitButtonAriaLabel="See 2 options"
aria-roledescription="split button"
menuProps={menuProps}
onClick={_alertClicked}
disabled={disabled}
checked={checked}
/>
<DefaultButton
text="(primary) Main action disabled split"
primaryDisabled
split
primary
splitButtonAriaLabel="See 2 options"
aria-roledescription="split button"
menuProps={menuProps}
onClick={_alertClicked}
disabled={disabled}
checked={checked}
/>
<DefaultButton
text="Disabled split"
disabled
allowDisabledFocus
split
splitButtonAriaLabel="See 2 options"
aria-roledescription="split button"
menuProps={menuProps}
onClick={_alertClicked}
checked={checked}
/>
</Stack>
);
};
function _alertClicked() {
alert('Clicked');
}
``` | /content/code_sandbox/packages/react-examples/src/azure-themes/stories/components/splitButton.stories.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 716 |
```xml
{
"!" = "Generated by ProjectCenter, do not edit";
ApplicationDescription = "Simple image viewer";
ApplicationIcon = "Review.tiff";
ApplicationName = Review;
ApplicationRelease = "0.1";
Authors = (
"Serg Stoyan <stoyan255@ukr.net>"
);
FullVersionID = "0.1";
NOTE = "Automatically generated, do not edit!";
NSExecutable = Review;
NSIcon = "Review.tiff";
NSMainNibFile = "Review.gorm";
NSPrincipalClass = NSApplication;
NSRole = Application;
NSTypes = (
{
NSIcon = "JPEGImage.tiff";
NSUnixExtensions = (jpg,jpeg);
},
{
NSIcon = "TIFFImage.tiff";
NSUnixExtensions = (tif,tiff);
},
{
NSIcon = "PNGImage.tiff";
NSUnixExtensions = (png);
},
{
NSIcon = "GIFImage.tiff";
NSUnixExtensions = (gif);
},
{
NSIcon = "XPMImage.tiff";
NSUnixExtensions = (xpm);
}
);
}
``` | /content/code_sandbox/Applications/Review/ReviewInfo.plist | xml | 2016-10-28T07:02:49 | 2024-08-16T14:14:55 | nextspace | trunkmaster/nextspace | 1,872 | 259 |
```xml
import { useQuery } from '@tanstack/react-query';
import axios, { parseAxiosError } from '@/portainer/services/axios';
import { withError } from '@/react-tools/react-query';
import { ExperimentalFeatures } from '../types';
import { buildUrl } from '../settings.service';
import { queryKeys } from './queryKeys';
type ExperimentalFeaturesSettings = {
experimentalFeatures: ExperimentalFeatures;
};
export function useExperimentalSettings<T = ExperimentalFeaturesSettings>(
select?: (settings: ExperimentalFeaturesSettings) => T,
enabled = true
) {
return useQuery(queryKeys.experimental(), getExperimentalSettings, {
select,
enabled,
staleTime: 50,
...withError('Unable to retrieve experimental settings'),
});
}
async function getExperimentalSettings() {
try {
const { data } = await axios.get<ExperimentalFeaturesSettings>(
buildUrl('experimental')
);
return data;
} catch (e) {
throw parseAxiosError(
e as Error,
'Unable to retrieve experimental settings'
);
}
}
``` | /content/code_sandbox/app/react/portainer/settings/queries/useExperimentalSettings.ts | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 224 |
```xml
type Props = {
className?: string
}
const Spinner = ({ className }: Props) => (
<div className={`animate-spin rounded-full border border-solid border-info border-r-transparent ${className}`} />
)
export default Spinner
``` | /content/code_sandbox/packages/web/src/javascripts/Components/Spinner/Spinner.tsx | xml | 2016-12-05T23:31:33 | 2024-08-16T06:51:19 | app | standardnotes/app | 5,180 | 47 |
```xml
/// <reference path="../../node_modules/electron/electron.d.ts" />
interface Window {
devhub?: boolean
eval: never
ipc: Electron.IpcRenderer
process?: {
type?: string
}
require: NodeRequireFunction
}
declare namespace NodeJS {
interface ProcessVersions {
electron?: boolean
}
}
``` | /content/code_sandbox/@types/electron/index.d.ts | xml | 2016-11-30T23:24:21 | 2024-08-16T00:24:59 | devhub | devhubapp/devhub | 9,652 | 75 |
```xml
/**
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type {
ApplyUncommittedChangesPreviewsFuncType,
UncommittedChangesPreviewContext,
} from '../previews';
import type {
CommandArg,
ExactRevset,
OptimisticRevset,
RepoRelativePath,
SucceedableRevset,
UncommittedChanges,
} from '../types';
import {Operation} from './Operation';
export class RevertOperation extends Operation {
static opName = 'Revert';
constructor(
private files: Array<RepoRelativePath>,
private revset?: SucceedableRevset | ExactRevset | OptimisticRevset,
) {
super('RevertOperation');
}
getArgs() {
const args: Array<CommandArg> = ['revert'];
if (this.revset != null) {
args.push('--rev', this.revset);
}
if (this.files.length > 0) {
// Tag file arguments specialy so the remote repo can convert them to the proper cwd-relative format.
args.push({
type: 'repo-relative-file-list' as const,
paths: this.files,
});
}
return args;
}
makeOptimisticUncommittedChangesApplier?(
context: UncommittedChangesPreviewContext,
): ApplyUncommittedChangesPreviewsFuncType | undefined {
if (this.revset == null) {
const filesToHide = new Set(this.files);
if (context.uncommittedChanges.every(change => !filesToHide.has(change.path))) {
return undefined;
}
const func: ApplyUncommittedChangesPreviewsFuncType = (changes: UncommittedChanges) => {
return changes.filter(change => !filesToHide.has(change.path));
};
return func;
} else {
// If reverting back to a specific commit, the file will probably become 'M', not disappear.
// Note: this is just a guess, in reality the file could do any number of things.
const filesToMarkChanged = new Set(this.files);
if (context.uncommittedChanges.find(change => filesToMarkChanged.has(change.path)) != null) {
return undefined;
}
const func: ApplyUncommittedChangesPreviewsFuncType = (changes: UncommittedChanges) => {
const existingChanges = new Set(changes.map(change => change.path));
const revertedChangesToInsert = this.files.filter(file => !existingChanges.has(file));
return [
...changes.map(change =>
filesToMarkChanged.has(change.path) ? {...change, status: 'M' as const} : change,
),
...revertedChangesToInsert.map(path => ({path, status: 'M' as const})),
];
};
return func;
}
}
}
``` | /content/code_sandbox/addons/isl/src/operations/RevertOperation.ts | xml | 2016-05-05T16:53:47 | 2024-08-16T19:12:02 | sapling | facebook/sapling | 5,987 | 604 |
```xml
// @ts-ignore
try{self['workbox:range-requests:7.1.0']&&_()}catch(e){}
``` | /content/code_sandbox/packages/workbox-range-requests/src/_version.ts | xml | 2016-04-04T15:55:19 | 2024-08-16T08:33:26 | workbox | GoogleChrome/workbox | 12,245 | 30 |
```xml
import React, { useState, useEffect } from 'react';
import type {
ColorMode,
StorageManager,
IColorModeContextProps,
} from './types';
import { HybridContext } from './../hybrid-overlay/Context';
import type { IHybridContextProps } from './../hybrid-overlay/types';
import { AppState, useColorScheme as _useColorScheme } from 'react-native';
import { useSyncExternalStore } from 'use-sync-external-store/shim';
import { useNativeBaseConfig } from '../NativeBaseContext';
export const useColorMode = (): IColorModeContextProps => {
const {
colorMode: colorModeContext,
}: {
colorMode: IColorModeContextProps;
} = React.useContext<IHybridContextProps>(HybridContext);
if (colorModeContext === undefined) {
throw new Error('useColorMode must be used within a NativeBaseProvider');
}
return colorModeContext;
};
export function useColorModeValue(light: any, dark: any) {
const { colorMode } = useColorMode();
return colorMode === 'dark' ? dark : light;
}
export const useAppState = () => {
const subscription = React.useMemo(
() => ({
getCurrentValue: () => AppState.currentState,
subscribe: (callback: () => void) => {
const subsription = AppState.addEventListener('change', callback);
return () => {
if (AppState.removeEventListener) {
// React Native < 0.65
AppState.removeEventListener('change', callback);
} else {
// React Native >= 0.65
// @ts-ignore:next-line ignoring ts error as devDependency contains "@types/react-native" < 0.65
subsription.remove();
}
};
},
}),
[]
);
const isSSR = useNativeBaseConfig('useBreakpointResolvedProps').isSSR;
if (isSSR) {
return 'unknown';
} else {
// This if statement technically breaks the rules of hooks, but is safe
// because the condition never changes after mounting.
// eslint-disable-next-line react-hooks/rules-of-hooks
return useSyncExternalStore(
subscription.subscribe,
subscription.getCurrentValue,
subscription.getCurrentValue
);
}
};
export const useColorScheme = () => {
const colorScheme = _useColorScheme();
const [currentScheme, setCurrentScheme] = useState(colorScheme);
const appState = useAppState();
useEffect(() => {
if (appState === 'active') {
setCurrentScheme(colorScheme);
}
}, [appState, colorScheme]);
return currentScheme;
};
export function useModeManager(
initialColorMode: ColorMode,
useSystemColorMode: boolean | undefined,
colorModeManager?: StorageManager
) {
const systemColorMode = useColorScheme();
if (useSystemColorMode) {
initialColorMode = systemColorMode;
}
const [colorMode, setRawMode] = useState<ColorMode>(initialColorMode);
const setColorMode = React.useCallback(
async (val: ColorMode) => {
if (colorModeManager) {
await colorModeManager.set(val);
}
setRawMode(val);
},
[colorModeManager]
);
// For initial setting initial color mode from storage
useEffect(() => {
if (colorModeManager) {
(async function getMode() {
const value = await colorModeManager.get(initialColorMode);
if (value && value !== colorMode) {
setRawMode(value);
}
})();
}
}, [colorMode, initialColorMode, colorModeManager]);
// Set system color mode only when user has not passed a colorModeManager
useEffect(() => {
if (!colorModeManager && useSystemColorMode) {
setRawMode(systemColorMode);
}
}, [systemColorMode, colorModeManager, useSystemColorMode, setRawMode]);
return { colorMode, setColorMode };
}
export function useAccessibleColors(): [
boolean,
(val: boolean) => void,
() => void
] {
const {
colorMode: colorModeContext,
}: {
colorMode: IColorModeContextProps;
} = React.useContext<IHybridContextProps>(HybridContext);
const toggleAccessibleColors = () =>
colorModeContext.setAccessibleColors(!colorModeContext.accessibleColors);
return [
colorModeContext.accessibleColors,
colorModeContext.setAccessibleColors,
toggleAccessibleColors,
];
}
``` | /content/code_sandbox/src/core/color-mode/hooks.tsx | xml | 2016-04-15T11:37:23 | 2024-08-14T16:16:44 | NativeBase | GeekyAnts/NativeBase | 20,132 | 974 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="path_to_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#DDCCCC"
android:orientation="vertical"
android:paddingBottom="0dp"
android:paddingTop="32dp">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:padding="16dp"
android:text="Medium Text"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/colorAccent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider" />
</LinearLayout>
``` | /content/code_sandbox/app/src/main/res/layout/list_item_multi_header_0.xml | xml | 2016-04-16T22:20:07 | 2024-07-18T10:04:59 | StickyHeaders | ShamylZakariya/StickyHeaders | 1,404 | 199 |
```xml
import { IUser } from "./IUser";
import { WebPartContext } from "@microsoft/sp-webpart-base";
export interface IAppContext {
currentUser: IUser;
context: WebPartContext;
}
``` | /content/code_sandbox/samples/react-modern-organization-chart/src/Entities/IAppContext.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 44 |
```xml
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatSelectModule } from '@angular/material/select';
import { MatIconModule } from '@angular/material/icon';
import { MatDividerModule } from '@angular/material/divider';
import { BreadcrumbsDemoBasicComponent } from './breadcrumbs-demo-basic/breadcrumbs-demo-basic.component';
import { BreadcrumbsDemoCustomSeparatorComponent } from './breadcrumbs-demo-custom-separator/breadcrumbs-demo-custom-separator.component';
import { BreadcrumbsResizeBasicComponent } from './breadcrumbs-demo-resize/breadcrumbs-demo-resize.component';
import { BreadcrumbsDemoComponent } from './breadcrumbs-demo.component';
import { CovalentBreadcrumbsModule } from '@covalent/core/breadcrumbs';
import { BreadcrumbsDemoRoutingModule } from './breadcrumbs-demo-routing.module';
import { DemoModule } from '../../../../../components/shared/demo-tools/demo.module';
@NgModule({
declarations: [
BreadcrumbsDemoComponent,
BreadcrumbsDemoBasicComponent,
BreadcrumbsDemoCustomSeparatorComponent,
BreadcrumbsResizeBasicComponent,
],
imports: [
DemoModule,
// Material
MatSelectModule,
MatDividerModule,
MatIconModule,
BreadcrumbsDemoRoutingModule,
/** Covalent Modules */
CovalentBreadcrumbsModule,
/** Angular Modules */
CommonModule,
],
})
export class BreadcrumbsDemoModule {}
``` | /content/code_sandbox/apps/docs-app/src/app/content/components/component-demos/breadcrumbs/demos/breadcrumbs-demo.module.ts | xml | 2016-07-11T23:30:52 | 2024-08-15T15:20:45 | covalent | Teradata/covalent | 2,228 | 279 |
```xml
import { Component, ChangeDetectionStrategy } from '@angular/core';
import {
CalendarEvent,
CalendarEventTitleFormatter,
CalendarView,
} from 'angular-calendar';
import { CustomEventTitleFormatter } from './custom-event-title-formatter.provider';
import { colors } from '../demo-utils/colors';
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'template.html',
providers: [
{
provide: CalendarEventTitleFormatter,
useClass: CustomEventTitleFormatter,
},
],
})
export class DemoComponent {
view: CalendarView = CalendarView.Month;
viewDate: Date = new Date();
events: CalendarEvent[] = [
{
title: 'An event',
start: new Date(),
color: colors.red,
},
];
}
``` | /content/code_sandbox/projects/demos/app/demo-modules/disable-tooltips/component.ts | xml | 2016-04-26T15:19:33 | 2024-08-08T14:23:40 | angular-calendar | mattlewis92/angular-calendar | 2,717 | 175 |
```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 skewness = require( './index' );
// TESTS //
// The function returns a number...
{
skewness( 0, 4 ); // $ExpectType number
}
// The compiler throws an error if the function is provided values other than two numbers...
{
skewness( true, 3 ); // $ExpectError
skewness( false, 2 ); // $ExpectError
skewness( '5', 1 ); // $ExpectError
skewness( [], 1 ); // $ExpectError
skewness( {}, 2 ); // $ExpectError
skewness( ( x: number ): number => x, 2 ); // $ExpectError
skewness( 9, true ); // $ExpectError
skewness( 9, false ); // $ExpectError
skewness( 5, '5' ); // $ExpectError
skewness( 8, [] ); // $ExpectError
skewness( 9, {} ); // $ExpectError
skewness( 8, ( x: number ): number => x ); // $ExpectError
skewness( [], true ); // $ExpectError
skewness( {}, false ); // $ExpectError
skewness( false, '5' ); // $ExpectError
skewness( {}, [] ); // $ExpectError
skewness( '5', ( x: number ): number => x ); // $ExpectError
}
// The compiler throws an error if the function is provided insufficient arguments...
{
skewness(); // $ExpectError
skewness( 3 ); // $ExpectError
}
``` | /content/code_sandbox/lib/node_modules/@stdlib/stats/base/dists/arcsine/skewness/docs/types/test.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 420 |
```xml
import orderBy from './orderBy';
describe('orderBy()', () => {
it('orders an array of objects by the numeric value of a given property of the objects in the array', () => {
const arrayOfObjects = [{ id: 7 }, { id: 3 }, { id: 3 }, { id: 6 }, { id: 18 }, { id: 2 }];
const output = orderBy(arrayOfObjects, 'id');
const expected = [{ id: 2 }, { id: 3 }, { id: 3 }, { id: 6 }, { id: 7 }, { id: 18 }];
expect(output).toEqual(expected);
});
});
``` | /content/code_sandbox/packages/utils/orderBy.test.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 143 |
```xml
import path from 'path';
import { exportAppAsync } from './exportApp';
import { Options } from './resolveOptions';
import * as Log from '../log';
import { waitUntilAtlasExportIsReadyAsync } from '../start/server/metro/debugging/attachAtlas';
import { FileNotifier } from '../utils/FileNotifier';
import { ensureDirectoryAsync, removeAsync } from '../utils/dir';
import { ensureProcessExitsAfterDelay } from '../utils/exit';
export async function exportAsync(projectRoot: string, options: Options) {
// Ensure the output directory is created
const outputPath = path.resolve(projectRoot, options.outputDir);
// Delete the output directory if it exists
await removeAsync(outputPath);
// Create the output directory
await ensureDirectoryAsync(outputPath);
// Export the app
await exportAppAsync(projectRoot, options);
// Stop any file watchers to prevent the CLI from hanging.
FileNotifier.stopAll();
// Wait until Atlas is ready, when enabled
// NOTE(cedric): this is a workaround, remove when `process.exit` is removed
await waitUntilAtlasExportIsReadyAsync(projectRoot);
// Final notes
Log.log(`App exported to: ${options.outputDir}`);
// Exit the process to stop any hanging processes from reading the app.config.js or server rendering.
ensureProcessExitsAfterDelay();
}
``` | /content/code_sandbox/packages/@expo/cli/src/export/exportAsync.ts | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 292 |
```xml
import { hasNext } from '../iterablehelpers.js';
import { catchError, concat, range, sequenceEqual, throwError } from 'ix/iterable/index.js';
test('Iterable.catchError with no errors', () => {
const res = catchError(range(0, 5), range(5, 5));
expect(sequenceEqual(res, range(0, 5))).toBeTruthy();
});
test('Iterable.catchError with concat error', () => {
const res = catchError(concat(range(0, 5), throwError(new Error())), range(5, 5));
expect(sequenceEqual(res, range(0, 10))).toBeTruthy();
});
test('Iterable.catchError still throws', () => {
const e1 = new Error();
const er1 = throwError(e1);
const e2 = new Error();
const er2 = throwError(e2);
const e3 = new Error();
const er3 = throwError(e3);
const res = catchError(concat(range(0, 2), er1), concat(range(2, 2), er2), er3);
const it = res[Symbol.iterator]();
hasNext(it, 0);
hasNext(it, 1);
hasNext(it, 2);
hasNext(it, 3);
expect(() => it.next()).toThrow();
});
``` | /content/code_sandbox/spec/iterable/catcherror-spec.ts | xml | 2016-02-22T20:04:19 | 2024-08-09T18:46:41 | IxJS | ReactiveX/IxJS | 1,319 | 273 |
```xml
// THESE EXPORTS WILL BE REMOVED IN THE NEXT MAJOR RELEASE
export { DebugSymbolicator } from './debugsymbolicator';
export { DeviceContext } from './devicecontext';
export { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';
export { NativeLinkedErrors } from './nativelinkederrors';
export { Release } from './release';
export { EventOrigin } from './eventorigin';
export { SdkInfo } from './sdkinfo';
export { ReactNativeInfo } from './reactnativeinfo';
export { ModulesLoader } from './modulesloader';
export { HermesProfiling } from '../profiling/integration';
export { Screenshot } from './screenshot';
export { ViewHierarchy } from './viewhierarchy';
export { ExpoContext } from './expocontext';
export { Spotlight } from './spotlight';
export { mobileReplayIntegration } from '../replay/mobilereplay';
``` | /content/code_sandbox/src/js/integrations/index.ts | xml | 2016-11-30T14:45:57 | 2024-08-16T13:21:38 | sentry-react-native | getsentry/sentry-react-native | 1,558 | 188 |
```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
*/
import {CollectionViewer, DataSource} from '@angular/cdk/collections';
import {BehaviorSubject, merge, Observable} from 'rxjs';
import {map} from 'rxjs/operators';
/**
* Data source for nested tree.
*
* The data source for nested tree doesn't have to consider node flattener, or the way to expand
* or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
*/
export class MatTreeNestedDataSource<T> extends DataSource<T> {
/**
* Data for the nested tree
*/
get data() {
return this._data.value;
}
set data(value: T[]) {
this._data.next(value);
}
private readonly _data = new BehaviorSubject<T[]>([]);
connect(collectionViewer: CollectionViewer): Observable<T[]> {
return merge(...([collectionViewer.viewChange, this._data] as Observable<unknown>[])).pipe(
map(() => this.data),
);
}
disconnect() {
// no op
}
}
``` | /content/code_sandbox/src/material/tree/data-source/nested-data-source.ts | xml | 2016-01-04T18:50:02 | 2024-08-16T11:21:13 | components | angular/components | 24,263 | 253 |
```xml
import { sentry as sentryHelpers } from '@botpress/sdk-addons'
import actions from './actions'
import channels from './channels'
import { handler } from './handler'
import { register, unregister } from './setup'
import * as bp from '.botpress'
const integration = new bp.Integration({
register,
unregister,
actions,
channels,
handler,
})
export default sentryHelpers.wrapIntegration(integration, {
dsn: bp.secrets.SENTRY_DSN,
environment: bp.secrets.SENTRY_ENVIRONMENT,
release: bp.secrets.SENTRY_RELEASE,
})
``` | /content/code_sandbox/integrations/zendesk/src/index.ts | xml | 2016-11-16T21:57:59 | 2024-08-16T18:45:35 | botpress | botpress/botpress | 12,401 | 125 |
```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 lucas = require( './index' );
// TESTS //
// The function returns a number...
{
lucas( 8 ); // $ExpectType number
}
// The compiler throws an error if the function is provided a value other than a number...
{
lucas( true ); // $ExpectError
lucas( false ); // $ExpectError
lucas( null ); // $ExpectError
lucas( undefined ); // $ExpectError
lucas( '5' ); // $ExpectError
lucas( [] ); // $ExpectError
lucas( {} ); // $ExpectError
lucas( ( x: number ): number => x ); // $ExpectError
}
// The compiler throws an error if the function is provided insufficient arguments...
{
lucas(); // $ExpectError
}
``` | /content/code_sandbox/lib/node_modules/@stdlib/math/base/special/lucas/docs/types/test.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 218 |
```xml
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
import { useIsSwarm } from '@/react/docker/proxy/queries/useInfo';
import { StackType } from '@/react/common/stacks/types';
import { PageHeader } from '@@/PageHeader';
import { Widget } from '@@/Widget';
import { TemplateViewType, useViewType } from '../useViewType';
import { CreateForm } from './CreateForm';
export function CreateView() {
const viewType = useViewType();
const environmentId = useEnvironmentId(false);
const isSwarm = useIsSwarm(environmentId, { enabled: viewType === 'docker' });
const defaultType = getDefaultType(viewType, isSwarm);
return (
<div>
<PageHeader
title="Create Custom template"
breadcrumbs={[
{ label: 'Custom Templates', link: '^' },
'Create Custom template',
]}
/>
<div className="row">
<div className="col-sm-12">
<Widget>
<Widget.Body>
<CreateForm
viewType={viewType}
environmentId={environmentId}
defaultType={defaultType}
/>
</Widget.Body>
</Widget>
</div>
</div>
</div>
);
}
function getDefaultType(
viewType: TemplateViewType,
isSwarm: boolean
): StackType {
switch (viewType) {
case 'docker':
return isSwarm ? StackType.DockerSwarm : StackType.DockerCompose;
case 'kube':
return StackType.Kubernetes;
default:
return StackType.DockerCompose;
}
}
``` | /content/code_sandbox/app/react/portainer/templates/custom-templates/CreateView/CreateView.tsx | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 356 |
```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.
-->
<TextView xmlns:android="path_to_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="13sp"
android:gravity="left"
android:textColor="@android:color/black"
android:paddingTop="@dimen/margin_small"
android:paddingBottom="@dimen/margin_small"
android:paddingStart="@dimen/margin_tiny"
android:paddingLeft="@dimen/margin_tiny"
android:paddingEnd="@dimen/margin_tiny"
android:paddingRight="@dimen/margin_tiny" />
``` | /content/code_sandbox/demo-playground/src/main/res/layout/spinner_item.xml | xml | 2016-05-04T08:11:22 | 2024-08-15T12:27:34 | flexbox-layout | google/flexbox-layout | 18,226 | 178 |
```xml
/* your_sha256_hash----------------------------
* See 'LICENSE' in the project root for license information.
* your_sha256_hash-------------------------- */
import { ok, strictEqual } from 'assert';
import { describe, it } from 'mocha';
import { parse } from '../../src/Utility/Eventing/eventParser';
const tests = [
'someEvent[a == 100]',
'someEvent[a == 100 && b == 200]',
'someEvent[a == 100 && b == 200 && c == 300]',
'someEvent[/text-here/g]',
'someEvent[/over.here/g && a == 100]',
'someEvent[a === 100 && /text-here/g]',
'someEvent/something[name !== "bob"]',
'someEvent/something[name !== "bob"]/somethingElse[happy]',
'someEvent/somethingElse[!sad && /hello.world/g]',
'someEvent/somethingElse[!sad && /(hello).world/g]'
];
describe('Event Handler/Parser', () => {
it('parses events, successful filter matches.', async () => {
const parsed = tests.map(each => parse(each, undefined)[2]);
console.log(`Generated filter ${tests.length} functions :`);
const eventData = { a: 100, b: 200, c: 300 };
const someEventText = ['there is text-here', 'and some over here too'];
const somethingData = { name: 'contoso' };
const somethingText = [] as string[];
const somethingElseData = { happy: true, sad: false, color: 'red', value: 123 };
const somethingElseText = ['hello world'];
for (const filters of parsed) {
const captures = [] as string[];
for (const [name, filter] of filters) {
if (filter === true) {
continue;
}
switch (name) {
case 'someEvent':
ok(filter(eventData, someEventText, captures), `filter '${filter.toString()}' should return true`);
continue;
case 'something':
ok(filter(somethingData, somethingText, captures), `filter '${filter.toString()}' should return true`);
continue;
case 'somethingElse':
ok(filter(somethingElseData, somethingElseText, captures), `filter '${filter.toString()}' should return true`);
// on the one with 'sad', check to see we get back some filter capture data
if (filter.toString().includes('sad')) {
strictEqual(captures[0], 'hello world', `capture[0] from filter '${filter.toString()}' should be \'hello world\'`);
}
continue;
}
}
}
});
it('parses events, fails filter matches.', async () => {
const parsed = tests.map(each => parse(each, undefined)[2]);
console.log(`Generated filter ${tests.length} functions :`);
const eventData = { a: 101, b: 200, c: 300 };
const someEvent = ['there is not text', 'and some not here too'];
const something = [] as string[];
const somethingData = { name: 'bob' };
const somethingElse = ['helloworld'];
const somethingElseData = { happy: false, sad: false, color: 'red', value: 123 };
for (const filters of parsed) {
const captures = [] as string[];
for (const [name, filter] of filters) {
if (filter === true) {
continue;
}
switch (name) {
case 'someEvent':
ok(!filter(eventData, someEvent, captures), `filter '${filter.toString()}' should return false`);
continue;
case 'something':
ok(!filter(somethingData, something, captures), `filter '${filter.toString()}' should return false`);
continue;
case 'somethingElse':
ok(!filter(somethingElseData, somethingElse, captures), `filter '${filter.toString()}' should return false`);
strictEqual(captures.length, 0, `capture[0] from filter '${filter.toString()}' should be empty`);
continue;
}
}
}
});
});
``` | /content/code_sandbox/Extension/test/unit/parser.test.ts | xml | 2016-03-26T21:26:30 | 2024-08-16T15:16:40 | vscode-cpptools | microsoft/vscode-cpptools | 5,438 | 900 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.