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 * as React from 'react';
import { KnobContext, KnobContextValue } from './KnobContexts';
import { KnobComponent, KnobComponentProps, KnobDefinition } from './types';
import { useKnobValues } from './useKnobValues';
const getKnobControls = (knobsContext: KnobContextValue): Record<'Control' | 'Field' | 'Label', KnobComponent> => {
const { KnobControl, KnobField, KnobLabel } = knobsContext.components;
const controls = {
Control: KnobControl,
Field: KnobField,
Label: KnobLabel,
};
if (process.env.NODE_ENV !== 'production') {
Object.keys(controls).forEach(name => {
if (typeof controls[name] === 'undefined') {
throw new Error(`"${name}" is not defined, please check you mapping`);
}
});
}
return controls;
};
const getKnobComponents = (knobsContext: KnobContextValue): Record<KnobDefinition['type'], KnobComponent> => {
const { KnobBoolean, KnobNumber, KnobRange, KnobSelect, KnobString } = knobsContext.components;
const components = {
boolean: KnobBoolean,
number: KnobNumber,
range: KnobRange,
select: KnobSelect,
string: KnobString,
};
if (process.env.NODE_ENV !== 'production') {
Object.keys(components).forEach(name => {
if (typeof components[name] === 'undefined') {
throw new Error(`A component for "${name}" is not defined, please check you mapping`);
}
});
}
return components;
};
type KnobInspectorProps = {
children?: (children: React.ReactElement) => React.ReactElement;
};
export const KnobInspector: React.FunctionComponent<KnobInspectorProps> = props => {
const knobContext = React.useContext(KnobContext);
const { Control, Field, Label } = getKnobControls(knobContext);
const knobComponents = getKnobComponents(knobContext);
const knobValues = useKnobValues();
const children =
knobValues.length > 0 ? (
<>
{knobValues.map((knob: KnobDefinition) => {
const setValue = (value: any) => knobContext.setKnobValue(knob.name, value);
const knobProps: KnobComponentProps = { ...knob, setValue };
return (
<Field {...knobProps} key={knob.name}>
<Label {...knobProps} />
<Control {...knobProps}>{React.createElement(knobComponents[knob.type], knobProps)}</Control>
</Field>
);
})}
</>
) : null;
return props.children ? props.children(children) : children;
};
``` | /content/code_sandbox/packages/fluentui/docs-components/src/knobs/KnobInspector.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 607 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" target-language="zh-CN" datatype="plaintext" original="teams.en.xlf">
<body>
<trans-unit id="A_4Fc7c" resname="teams.project_access">
<source>teams.project_access</source>
<target></target>
</trans-unit>
<trans-unit id="QchGnbx" resname="teams.customer_access">
<source>teams.customer_access</source>
<target></target>
</trans-unit>
<trans-unit id=".yIcFDx" resname="team.visibility_global">
<source>team.visibility_global</source>
<target></target>
</trans-unit>
<trans-unit id="hlIIRjb" resname="team.visibility_restricted">
<source>team.visibility_restricted</source>
<target state="translated"></target>
</trans-unit>
<trans-unit id="sx7AVYH" resname="team.project_visibility_inherited">
<source>team.project_visibility_inherited</source>
<target state="translated"></target>
</trans-unit>
<trans-unit id="FC4DW27" resname="team.activity_visibility_inherited">
<source>team.activity_visibility_inherited</source>
<target state="translated">/</target>
</trans-unit>
<trans-unit id="cZEIdcu" resname="team.create_default">
<source>team.create_default</source>
<target state="translated"></target>
</trans-unit>
<trans-unit id="6g81kYY" approved="no" resname="team.member">
<source>team.member</source>
<target state="translated"></target>
</trans-unit>
</body>
</file>
</xliff>
``` | /content/code_sandbox/translations/teams.zh_CN.xlf | xml | 2016-10-20T17:06:34 | 2024-08-16T18:27:30 | kimai | kimai/kimai | 3,084 | 431 |
```xml
import * as assert from 'assert';
import * as path from 'path';
import * as sinon from 'sinon';
import * as fsWatcher from '../../../../../client/common/platform/fileSystemWatcher';
import * as platformUtils from '../../../../../client/common/utils/platform';
import { PythonEnvKind } from '../../../../../client/pythonEnvironments/base/info';
import { getEnvs } from '../../../../../client/pythonEnvironments/base/locatorUtils';
import { PythonEnvsChangedEvent } from '../../../../../client/pythonEnvironments/base/watcher';
import * as externalDependencies from '../../../../../client/pythonEnvironments/common/externalDependencies';
import {
CustomVirtualEnvironmentLocator,
VENVFOLDERS_SETTING_KEY,
VENVPATH_SETTING_KEY,
} from '../../../../../client/pythonEnvironments/base/locators/lowLevel/customVirtualEnvLocator';
import { createBasicEnv } from '../../common';
import { TEST_LAYOUT_ROOT } from '../../../common/commonTestConstants';
import { assertBasicEnvsEqual } from '../envTestUtils';
suite('CustomVirtualEnvironment Locator', () => {
const testVirtualHomeDir = path.join(TEST_LAYOUT_ROOT, 'virtualhome');
const testVenvPathWithTilda = path.join('~', 'customfolder');
let getUserHomeDirStub: sinon.SinonStub;
let getOSTypeStub: sinon.SinonStub;
let readFileStub: sinon.SinonStub;
let locator: CustomVirtualEnvironmentLocator;
let watchLocationForPatternStub: sinon.SinonStub;
let getPythonSettingStub: sinon.SinonStub;
let onDidChangePythonSettingStub: sinon.SinonStub;
let untildify: sinon.SinonStub;
setup(async () => {
untildify = sinon.stub(externalDependencies, 'untildify');
untildify.callsFake((value: string) => value.replace('~', testVirtualHomeDir));
getUserHomeDirStub = sinon.stub(platformUtils, 'getUserHomeDir');
getUserHomeDirStub.returns(testVirtualHomeDir);
getPythonSettingStub = sinon.stub(externalDependencies, 'getPythonSetting');
getOSTypeStub = sinon.stub(platformUtils, 'getOSType');
getOSTypeStub.returns(platformUtils.OSType.Linux);
watchLocationForPatternStub = sinon.stub(fsWatcher, 'watchLocationForPattern');
watchLocationForPatternStub.returns({
dispose: () => {
/* do nothing */
},
});
onDidChangePythonSettingStub = sinon.stub(externalDependencies, 'onDidChangePythonSetting');
onDidChangePythonSettingStub.returns({
dispose: () => {
/* do nothing */
},
});
const expectedDotProjectFile = path.join(
testVirtualHomeDir,
'.local',
'share',
'virtualenvs',
'project2-vnNIWe9P',
'.project',
);
readFileStub = sinon.stub(externalDependencies, 'readFile');
readFileStub.withArgs(expectedDotProjectFile).returns(path.join(TEST_LAYOUT_ROOT, 'pipenv', 'project2'));
readFileStub.callThrough();
locator = new CustomVirtualEnvironmentLocator();
});
teardown(async () => {
await locator.dispose();
sinon.restore();
});
test('iterEnvs(): Windows with both settings set', async () => {
getPythonSettingStub.withArgs('venvPath').returns(testVenvPathWithTilda);
getPythonSettingStub.withArgs('venvFolders').returns(['.venvs', '.virtualenvs', 'Envs']);
getOSTypeStub.returns(platformUtils.OSType.Windows);
const expectedEnvs = [
createBasicEnv(PythonEnvKind.Venv, path.join(testVirtualHomeDir, '.venvs', 'win1', 'python.exe')),
createBasicEnv(PythonEnvKind.Venv, path.join(testVirtualHomeDir, '.venvs', 'win2', 'bin', 'python.exe')),
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, '.virtualenvs', 'win1', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, '.virtualenvs', 'win2', 'bin', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnvWrapper,
path.join(testVirtualHomeDir, 'Envs', 'wrapper_win1', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnvWrapper,
path.join(testVirtualHomeDir, 'Envs', 'wrapper_win2', 'bin', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, 'customfolder', 'win1', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, 'customfolder', 'win2', 'bin', 'python.exe'),
),
];
const iterator = locator.iterEnvs();
const actualEnvs = await getEnvs(iterator);
assertBasicEnvsEqual(actualEnvs, expectedEnvs);
});
test('iterEnvs(): Non-Windows with both settings set', async () => {
const testWorkspaceFolder = path.join(TEST_LAYOUT_ROOT, 'workspace', 'folder1');
getPythonSettingStub.withArgs('venvPath').returns(path.join(testWorkspaceFolder, 'posix2conda'));
getPythonSettingStub
.withArgs('venvFolders')
.returns(['.venvs', '.virtualenvs', 'envs', path.join('.local', 'share', 'virtualenvs')]);
const expectedEnvs = [
createBasicEnv(PythonEnvKind.Unknown, path.join(testWorkspaceFolder, 'posix2conda', 'python')),
createBasicEnv(PythonEnvKind.Venv, path.join(testVirtualHomeDir, '.venvs', 'posix1', 'python')),
createBasicEnv(PythonEnvKind.Venv, path.join(testVirtualHomeDir, '.venvs', 'posix2', 'bin', 'python')),
createBasicEnv(
PythonEnvKind.VirtualEnvWrapper,
path.join(testVirtualHomeDir, '.virtualenvs', 'posix1', 'python'),
),
createBasicEnv(
PythonEnvKind.VirtualEnvWrapper,
path.join(testVirtualHomeDir, '.virtualenvs', 'posix2', 'bin', 'python'),
),
createBasicEnv(
PythonEnvKind.Pipenv,
path.join(testVirtualHomeDir, '.local', 'share', 'virtualenvs', 'project2-vnNIWe9P', 'bin', 'python'),
),
];
const iterator = locator.iterEnvs();
const actualEnvs = await getEnvs(iterator);
assertBasicEnvsEqual(actualEnvs, expectedEnvs);
});
test('iterEnvs(): No User home dir set', async () => {
getUserHomeDirStub.returns(undefined);
getPythonSettingStub.withArgs('venvPath').returns(testVenvPathWithTilda);
getPythonSettingStub.withArgs('venvFolders').returns(['.venvs', '.virtualenvs', 'Envs']);
getOSTypeStub.returns(platformUtils.OSType.Windows);
const expectedEnvs = [
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, 'customfolder', 'win1', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, 'customfolder', 'win2', 'bin', 'python.exe'),
),
];
const iterator = locator.iterEnvs();
const actualEnvs = await getEnvs(iterator);
assertBasicEnvsEqual(actualEnvs, expectedEnvs);
});
test('iterEnvs(): with only venvFolders set', async () => {
getPythonSettingStub.withArgs('venvFolders').returns(['.venvs', '.virtualenvs', 'Envs']);
getOSTypeStub.returns(platformUtils.OSType.Windows);
const expectedEnvs = [
createBasicEnv(PythonEnvKind.Venv, path.join(testVirtualHomeDir, '.venvs', 'win1', 'python.exe')),
createBasicEnv(PythonEnvKind.Venv, path.join(testVirtualHomeDir, '.venvs', 'win2', 'bin', 'python.exe')),
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, '.virtualenvs', 'win1', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnv,
path.join(testVirtualHomeDir, '.virtualenvs', 'win2', 'bin', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnvWrapper,
path.join(testVirtualHomeDir, 'Envs', 'wrapper_win1', 'python.exe'),
),
createBasicEnv(
PythonEnvKind.VirtualEnvWrapper,
path.join(testVirtualHomeDir, 'Envs', 'wrapper_win2', 'bin', 'python.exe'),
),
];
const iterator = locator.iterEnvs();
const actualEnvs = await getEnvs(iterator);
assertBasicEnvsEqual(actualEnvs, expectedEnvs);
});
test('iterEnvs(): with only venvPath set', async () => {
const testWorkspaceFolder = path.join(TEST_LAYOUT_ROOT, 'workspace', 'folder1');
getPythonSettingStub.withArgs('venvPath').returns(path.join(testWorkspaceFolder, 'posix2conda'));
const expectedEnvs = [
createBasicEnv(PythonEnvKind.Unknown, path.join(testWorkspaceFolder, 'posix2conda', 'python')),
];
const iterator = locator.iterEnvs();
const actualEnvs = await getEnvs(iterator);
assertBasicEnvsEqual(actualEnvs, expectedEnvs);
});
test('onChanged fires if venvPath setting changes', async () => {
const events: PythonEnvsChangedEvent[] = [];
const expected: PythonEnvsChangedEvent[] = [{ providerId: locator.providerId }];
locator.onChanged((e) => events.push(e));
await getEnvs(locator.iterEnvs());
const venvPathCall = onDidChangePythonSettingStub
.getCalls()
.filter((c) => c.args[0] === VENVPATH_SETTING_KEY)[0];
const callback = venvPathCall.args[1];
callback(); // Callback is called when venvPath setting changes
assert.deepEqual(events, expected, 'Unexpected events');
});
test('onChanged fires if venvFolders setting changes', async () => {
const events: PythonEnvsChangedEvent[] = [];
const expected: PythonEnvsChangedEvent[] = [{ providerId: locator.providerId }];
locator.onChanged((e) => events.push(e));
await getEnvs(locator.iterEnvs());
const venvFoldersCall = onDidChangePythonSettingStub
.getCalls()
.filter((c) => c.args[0] === VENVFOLDERS_SETTING_KEY)[0];
const callback = venvFoldersCall.args[1];
callback(); // Callback is called when venvFolders setting changes
assert.deepEqual(events, expected, 'Unexpected events');
});
});
``` | /content/code_sandbox/src/test/pythonEnvironments/base/locators/lowLevel/customVirtualEnvLocator.unit.test.ts | xml | 2016-01-19T10:50:01 | 2024-08-12T21:05:24 | pythonVSCode | DonJayamanne/pythonVSCode | 2,078 | 2,384 |
```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 kumaraswamy = require( './index' );
// TESTS //
// The function returns a number...
{
kumaraswamy( 2, 3 ); // $ExpectType number
kumaraswamy( 1, 2 ); // $ExpectType number
}
// The compiler throws an error if the function is provided values other than two numbers...
{
kumaraswamy( true, 3 ); // $ExpectError
kumaraswamy( false, 2 ); // $ExpectError
kumaraswamy( '5', 1 ); // $ExpectError
kumaraswamy( [], 1 ); // $ExpectError
kumaraswamy( {}, 2 ); // $ExpectError
kumaraswamy( ( x: number ): number => x, 2 ); // $ExpectError
kumaraswamy( 9, true ); // $ExpectError
kumaraswamy( 9, false ); // $ExpectError
kumaraswamy( 5, '5' ); // $ExpectError
kumaraswamy( 8, [] ); // $ExpectError
kumaraswamy( 9, {} ); // $ExpectError
kumaraswamy( 8, ( x: number ): number => x ); // $ExpectError
}
// The compiler throws an error if the function is provided an unsupported number of arguments...
{
kumaraswamy(); // $ExpectError
kumaraswamy( 2 ); // $ExpectError
kumaraswamy( 2, 2, 4 ); // $ExpectError
}
// Attached to main export is a `factory` method which returns a function...
{
kumaraswamy.factory( 2, 2 ); // $ExpectType NullaryFunction
kumaraswamy.factory(); // $ExpectType BinaryFunction
kumaraswamy.factory( { 'copy': false } ); // $ExpectType BinaryFunction
}
// The `factory` method returns a function which returns a number...
{
const fcn1 = kumaraswamy.factory( 2, 2 );
fcn1(); // $ExpectType number
const fcn2 = kumaraswamy.factory();
fcn2( 2, 2 ); // $ExpectType number
}
// The compiler throws an error if the function returned by the `factory` method is provided invalid arguments...
{
const fcn1 = kumaraswamy.factory( 2, 4 );
fcn1( 12 ); // $ExpectError
fcn1( true ); // $ExpectError
fcn1( false ); // $ExpectError
fcn1( '5' ); // $ExpectError
fcn1( [] ); // $ExpectError
fcn1( {} ); // $ExpectError
fcn1( ( x: number ): number => x ); // $ExpectError
const fcn2 = kumaraswamy.factory();
fcn2( true, 2 ); // $ExpectError
fcn2( false, 2 ); // $ExpectError
fcn2( '5', 2 ); // $ExpectError
fcn2( [], 2 ); // $ExpectError
fcn2( {}, 2 ); // $ExpectError
fcn2( ( x: number ): number => x, 2 ); // $ExpectError
fcn2( 1, true ); // $ExpectError
fcn2( 1, false ); // $ExpectError
fcn2( 1, '5' ); // $ExpectError
fcn2( 1, [] ); // $ExpectError
fcn2( 1, {} ); // $ExpectError
fcn2( 1, ( x: number ): number => x ); // $ExpectError
}
// The compiler throws an error if the function returned by the `factory` method is provided an unsupported number of arguments...
{
const fcn1 = kumaraswamy.factory( 2, 2 );
fcn1( 1 ); // $ExpectError
fcn1( 2, 1 ); // $ExpectError
fcn1( 2, 1, 1 ); // $ExpectError
const fcn2 = kumaraswamy.factory();
fcn2(); // $ExpectError
fcn2( 1 ); // $ExpectError
fcn2( 2, 1, 1 ); // $ExpectError
}
// The compiler throws an error if the `factory` method is provided values other than two numbers aside from an options object...
{
kumaraswamy.factory( true, 3 ); // $ExpectError
kumaraswamy.factory( false, 2 ); // $ExpectError
kumaraswamy.factory( '5', 1 ); // $ExpectError
kumaraswamy.factory( [], 1 ); // $ExpectError
kumaraswamy.factory( {}, 2 ); // $ExpectError
kumaraswamy.factory( ( x: number ): number => x, 2 ); // $ExpectError
kumaraswamy.factory( 9, true ); // $ExpectError
kumaraswamy.factory( 9, false ); // $ExpectError
kumaraswamy.factory( 5, '5' ); // $ExpectError
kumaraswamy.factory( 8, [] ); // $ExpectError
kumaraswamy.factory( 9, {} ); // $ExpectError
kumaraswamy.factory( 8, ( x: number ): number => x ); // $ExpectError
kumaraswamy.factory( true, 3, {} ); // $ExpectError
kumaraswamy.factory( false, 2, {} ); // $ExpectError
kumaraswamy.factory( '5', 1, {} ); // $ExpectError
kumaraswamy.factory( [], 1, {} ); // $ExpectError
kumaraswamy.factory( {}, 2, {} ); // $ExpectError
kumaraswamy.factory( ( x: number ): number => x, 2, {} ); // $ExpectError
kumaraswamy.factory( 9, true, {} ); // $ExpectError
kumaraswamy.factory( 9, false, {} ); // $ExpectError
kumaraswamy.factory( 5, '5', {} ); // $ExpectError
kumaraswamy.factory( 8, [], {} ); // $ExpectError
kumaraswamy.factory( 9, {}, {} ); // $ExpectError
kumaraswamy.factory( 8, ( x: number ): number => x, {} ); // $ExpectError
}
// The compiler throws an error if the `factory` method is provided an options argument which is not an object...
{
kumaraswamy.factory( null ); // $ExpectError
kumaraswamy.factory( 2, 2, null ); // $ExpectError
}
// The compiler throws an error if the `factory` method is provided a `prng` option which is not a pseudorandom number generator...
{
kumaraswamy.factory( 2, 2, { 'prng': 123 } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'prng': 'abc' } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'prng': null } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'prng': [] } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'prng': {} } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'prng': true ); // $ExpectError
kumaraswamy.factory( { 'prng': 123 } ); // $ExpectError
kumaraswamy.factory( { 'prng': 'abc' } ); // $ExpectError
kumaraswamy.factory( { 'prng': null } ); // $ExpectError
kumaraswamy.factory( { 'prng': [] } ); // $ExpectError
kumaraswamy.factory( { 'prng': {} } ); // $ExpectError
kumaraswamy.factory( { 'prng': true ); // $ExpectError
}
// The compiler throws an error if the `factory` method is provided a `seed` option which is not a valid seed...
{
kumaraswamy.factory( 2, 2, { 'seed': true } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'seed': 'abc' } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'seed': null } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'seed': [ 'a' ] } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'seed': {} } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'seed': ( x: number ): number => x } ); // $ExpectError
kumaraswamy.factory( { 'seed': true } ); // $ExpectError
kumaraswamy.factory( { 'seed': 'abc' } ); // $ExpectError
kumaraswamy.factory( { 'seed': null } ); // $ExpectError
kumaraswamy.factory( { 'seed': [ 'a' ] } ); // $ExpectError
kumaraswamy.factory( { 'seed': {} } ); // $ExpectError
kumaraswamy.factory( { 'seed': ( x: number ): number => x } ); // $ExpectError
}
// The compiler throws an error if the `factory` method is provided a `state` option which is not a valid state...
{
kumaraswamy.factory( 2, 2, { 'state': 123 } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'state': 'abc' } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'state': null } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'state': [] } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'state': {} } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'state': true ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'state': ( x: number ): number => x } ); // $ExpectError
kumaraswamy.factory( { 'state': 123 } ); // $ExpectError
kumaraswamy.factory( { 'state': 'abc' } ); // $ExpectError
kumaraswamy.factory( { 'state': null } ); // $ExpectError
kumaraswamy.factory( { 'state': [] } ); // $ExpectError
kumaraswamy.factory( { 'state': {} } ); // $ExpectError
kumaraswamy.factory( { 'state': true ); // $ExpectError
kumaraswamy.factory( { 'state': ( x: number ): number => x } ); // $ExpectError
}
// The compiler throws an error if the `factory` method is provided a `copy` option which is not a boolean...
{
kumaraswamy.factory( 2, 2, { 'copy': 123 } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'copy': 'abc' } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'copy': null } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'copy': [] } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'copy': {} } ); // $ExpectError
kumaraswamy.factory( 2, 2, { 'copy': ( x: number ): number => x } ); // $ExpectError
kumaraswamy.factory( { 'copy': 123 } ); // $ExpectError
kumaraswamy.factory( { 'copy': 'abc' } ); // $ExpectError
kumaraswamy.factory( { 'copy': null } ); // $ExpectError
kumaraswamy.factory( { 'copy': [] } ); // $ExpectError
kumaraswamy.factory( { 'copy': {} } ); // $ExpectError
kumaraswamy.factory( { 'copy': ( x: number ): number => x } ); // $ExpectError
}
// The compiler throws an error if the `factory` method is provided more than three arguments...
{
kumaraswamy.factory( 2, 4, {}, 2 ); // $ExpectError
}
``` | /content/code_sandbox/lib/node_modules/@stdlib/random/base/kumaraswamy/docs/types/test.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 2,894 |
```xml
import React, {PureComponent} from 'react'
import _ from 'lodash'
import {ErrorHandling} from 'src/shared/decorators/errors'
import {LogItem} from 'src/types/kapacitor'
interface Props {
logItem: LogItem
}
class LogItemKapacitorPoint extends PureComponent<Props> {
public render() {
const {logItem} = this.props
return (
<div className="logs-table--row">
<div className="logs-table--divider">
<div className={`logs-table--level ${logItem.lvl}`} />
<div className="logs-table--timestamp">{logItem.ts}</div>
</div>
<div className="logs-table--details">
<div className="logs-table--service">Kapacitor Point</div>
<div className="logs-table--columns">
{this.renderKeysAndValues(logItem.tag, 'Tags')}
{this.renderKeysAndValues(logItem.field, 'Fields')}
</div>
</div>
</div>
)
}
private renderKeysAndValues = (object: any, name: string) => {
if (_.isEmpty(object)) {
return <span className="logs-table--empty-cell">--</span>
}
const sortedObjKeys = Object.keys(object).sort()
return (
<div className="logs-table--column">
<h1>{`${sortedObjKeys.length} ${name}`}</h1>
<div className="logs-table--scrollbox">
{sortedObjKeys.map(objKey => (
<div key={objKey} className="logs-table--key-value">
{objKey}: <span>{String(object[objKey])}</span>
</div>
))}
</div>
</div>
)
}
}
export default ErrorHandling(LogItemKapacitorPoint)
``` | /content/code_sandbox/ui/src/kapacitor/components/LogItemKapacitorPoint.tsx | xml | 2016-08-24T23:28:56 | 2024-08-13T19:50:03 | chronograf | influxdata/chronograf | 1,494 | 396 |
```xml
/*
* Squidex Headless CMS
*
* @license
*/
import { booleanAttribute, Component, forwardRef, Input } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppSettingsDto, ConfirmClickDirective, createProperties, DialogModel, DropdownMenuComponent, EditFieldForm, FieldDto, LanguageDto, ModalDirective, ModalModel, ModalPlacementDirective, NestedFieldDto, RootFieldDto, SchemaDto, SchemasState, TooltipDirective, TourStepDirective, TranslatePipe, TypedSimpleChanges } from '@app/shared';
import { FieldWizardComponent } from './field-wizard.component';
import { FieldFormComponent } from './forms/field-form.component';
import { SortableFieldListComponent } from './sortable-field-list.component';
@Component({
standalone: true,
selector: 'sqx-field',
styleUrls: ['./field.component.scss'],
templateUrl: './field.component.html',
imports: [
ConfirmClickDirective,
DropdownMenuComponent,
FieldFormComponent,
FieldWizardComponent,
FormsModule,
ModalDirective,
ModalPlacementDirective,
ReactiveFormsModule,
TooltipDirective,
TourStepDirective,
TranslatePipe,
forwardRef(() => SortableFieldListComponent),
],
})
export class FieldComponent {
@Input({ required: true })
public field!: NestedFieldDto | RootFieldDto;
@Input({ required: true })
public schema!: SchemaDto;
@Input({ transform: booleanAttribute })
public plain = false;
@Input()
public parent?: RootFieldDto;
@Input({ required: true })
public languages!: ReadonlyArray<LanguageDto>;
@Input({ required: true })
public settings!: AppSettingsDto;
public dropdown = new ModalModel();
public isEditing = false;
public isEditable?: boolean | null;
public editForm!: EditFieldForm;
public fieldWizard = new DialogModel();
public get isLocalizable() {
return (this.parent && this.parent.isLocalizable) || (this.field as any)['isLocalizable'];
}
constructor(
private readonly schemasState: SchemasState,
) {
}
public ngOnChanges(changes: TypedSimpleChanges<this>) {
if (changes.field) {
this.isEditable = this.field.canUpdate;
this.editForm = new EditFieldForm(this.field.properties);
}
}
public toggleEditing() {
this.isEditing = !this.isEditing;
this.editForm.load(this.field.properties);
}
public deleteField() {
this.schemasState.deleteField(this.schema, this.field);
}
public enableField() {
this.schemasState.enableField(this.schema, this.field);
}
public disableField() {
this.schemasState.disableField(this.schema, this.field);
}
public showField() {
this.schemasState.showField(this.schema, this.field);
}
public hideField() {
this.schemasState.hideField(this.schema, this.field);
}
public sortFields(fields: ReadonlyArray<FieldDto>) {
this.schemasState.orderFields(this.schema, fields, this.field as any);
}
public lockField() {
this.schemasState.lockField(this.schema, this.field);
}
public save() {
if (!this.isEditable) {
return;
}
const value = this.editForm.submit();
if (value) {
const properties = createProperties(this.field.properties.fieldType, value);
this.schemasState.updateField(this.schema, this.field, { properties })
.subscribe({
next: () => {
this.editForm.submitCompleted({ noReset: true });
},
error: error => {
this.editForm.submitFailed(error);
},
});
}
}
}
``` | /content/code_sandbox/frontend/src/app/features/schemas/pages/schema/fields/field.component.ts | xml | 2016-08-29T05:53:40 | 2024-08-16T17:39:38 | squidex | Squidex/squidex | 2,222 | 789 |
```xml
/*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
import { AST_NODE_TYPES, type TSESLint, type TSESTree } from "@typescript-eslint/utils";
import { addImportToFile } from "./utils/addImportToFile";
import { createRule } from "./utils/createRule";
import { FixList } from "./utils/fixList";
import { getProgram } from "./utils/getProgram";
const PATTERN = /^(h[1-6]|code|pre|blockquote|table)$/;
type MessageIds = "useBlueprintComponents";
// tslint:disable object-literal-sort-keys
export const htmlComponentsRule = createRule<[], MessageIds>({
name: "html-components",
meta: {
docs: {
description: "Enforce usage of Blueprint components over JSX intrinsic elements.",
recommended: "recommended",
requiresTypeChecking: false,
},
fixable: "code",
messages: {
useBlueprintComponents: "use Blueprint {{ componentName }} component instead of JSX intrinsic element.",
},
schema: [],
type: "suggestion",
},
defaultOptions: [],
create: context => ({
JSXOpeningElement: node => create(context, node),
}),
});
function create(context: TSESLint.RuleContext<MessageIds, []>, node: TSESTree.JSXOpeningElement): void {
const tagNameNode = node.name;
if (tagNameNode.type === AST_NODE_TYPES.JSXIdentifier) {
const match = PATTERN.exec(tagNameNode.name);
if (match != null) {
const newTagName = getNewTagName(match[1]);
context.report({
messageId: "useBlueprintComponents",
data: {
componentName: newTagName,
},
node,
fix: fixer => {
const fixes = new FixList();
fixes.addFixes(fixer.replaceText(tagNameNode, newTagName));
// Find closing tag after this opening tag to replace both in one failure
if (!node.selfClosing) {
const closingNode = (node.parent as TSESTree.JSXElement).closingElement;
if (closingNode != null) {
fixes.addFixes(fixer.replaceText(closingNode.name, newTagName));
}
}
// Add import for the new tag
const program = getProgram(node);
if (program !== undefined) {
fixes.addFixes(addImportToFile(program, [newTagName], "@blueprintjs/core")(fixer));
}
return fixes.getFixes();
},
});
}
}
}
function getNewTagName(tagName: string) {
switch (tagName) {
case "table":
return "HTMLTable";
default:
return tagName.charAt(0).toUpperCase() + tagName.slice(1);
}
}
``` | /content/code_sandbox/packages/eslint-plugin/src/rules/html-components.ts | xml | 2016-10-25T21:17:50 | 2024-08-16T15:14:48 | blueprint | palantir/blueprint | 20,593 | 606 |
```xml
import { BoardItem } from "@erxes/ui-sales/src/settings/boards/styles";
import { Header } from "@erxes/ui-settings/src/styles";
import { ICalendar } from "../../types";
import { Link } from "react-router-dom";
import { SidebarList as List } from "@erxes/ui/src/layout/styles";
import React from "react";
import Sidebar from "@erxes/ui/src/layout/components/Sidebar";
type Props = {
accountId?: string;
calendars: ICalendar[];
};
class Calendars extends React.Component<Props, {}> {
renderItems = () => {
const { calendars, accountId } = this.props;
return calendars.map(calendar => (
<BoardItem key={calendar._id} isActive={calendar.accountId === accountId}>
<Link to={`?accountId=${calendar.accountId}`}>{calendar.name}</Link>
</BoardItem>
));
};
render() {
return (
<Sidebar wide={true} header={<Header>Calendars</Header>} full={true}>
<List>{this.renderItems()}</List>
</Sidebar>
);
}
}
export default Calendars;
``` | /content/code_sandbox/packages/plugin-calendar-ui/src/settings/components/scheduler/Sidebar.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 233 |
```xml
import { Component, OnInit } from '@angular/core';
import { ChartsService } from '../shared/services/charts.service';
import { Chart } from '../shared/models/chart';
import { SeoService } from '../shared/services/seo.service';
@Component({
selector: 'app-chart-index',
templateUrl: './chart-index.component.html',
styleUrls: ['./chart-index.component.scss']
})
export class ChartIndexComponent implements OnInit {
charts: Chart[]
loading: boolean = true;
totalChartsNumber: number
constructor(
private chartsService: ChartsService,
private seo: SeoService
) {}
ngOnInit() {
this.loadCharts();
this.seo.setMetaTags('index');
}
loadCharts(): void {
this.chartsService.getCharts().subscribe(charts => {
this.loading = false;
this.charts = charts;
this.totalChartsNumber = charts.length;
});
}
}
``` | /content/code_sandbox/frontend/src/app/chart-index/chart-index.component.ts | xml | 2016-08-24T19:35:09 | 2024-07-01T06:23:47 | monocular | helm/monocular | 1,423 | 194 |
```xml
import { TypedStartListening } from '@reduxjs/toolkit';
import {
type AddressKeysState,
type OrganizationKeyState,
type SecurityCheckupReduxState,
type UserInvitationsState,
type UserKeysState,
type UserSettingsState,
addressKeysListener,
authenticationListener,
organizationKeysListener,
organizationThemeListener,
securityCheckupListener,
userInvitationsListener,
userKeysListener,
} from '@proton/account';
import type { ProtonDispatch, ProtonThunkArguments } from '@proton/redux-shared-store-types';
interface RequiredState
extends AddressKeysState,
UserKeysState,
UserSettingsState,
OrganizationKeyState,
UserInvitationsState,
SecurityCheckupReduxState {}
type AppStartListening = TypedStartListening<RequiredState, ProtonDispatch<any>, ProtonThunkArguments>;
export const startSharedListening = (startListening: AppStartListening) => {
userKeysListener(startListening);
addressKeysListener(startListening);
organizationThemeListener(startListening);
organizationKeysListener(startListening);
userInvitationsListener(startListening);
authenticationListener(startListening);
securityCheckupListener(startListening);
};
``` | /content/code_sandbox/packages/redux-shared-store/sharedListeners.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 247 |
```xml
import { readFileSync } from 'fs';
import { join } from 'path';
import { IResolvers } from '@graphql-tools/utils';
export const typeDefs = readFileSync(join(__dirname, './discount.graphql'), 'utf8');
export const resolvers: IResolvers = {
Product: {
__resolveReference(object) {
return {
...object,
discounts,
};
},
},
Category: {
__resolveReference(object) {
return {
...object,
discounts,
};
},
},
Discount: {
__resolveReference(object) {
return {
...object,
...discounts.find(discount => discount.id === object.id),
};
},
},
Query: {
discounts(_, args) {
return discounts.slice(0, args.first);
},
},
};
const discounts = [
{ id: '1', discount: 10 },
{ id: '2', discount: 20 },
{ id: '3', discount: 30 },
];
``` | /content/code_sandbox/packages/federation/test/fixtures/gateway/discount/index.ts | xml | 2016-03-22T00:14:38 | 2024-08-16T02:02:06 | graphql-tools | ardatan/graphql-tools | 5,331 | 218 |
```xml
import * as React from 'react';
import { Animated } from 'react-native';
export default function useAnimatedValueArray(initialValues: number[]) {
const refs = React.useRef<Animated.Value[]>([]);
refs.current.length = initialValues.length;
initialValues.forEach((initialValue, i) => {
refs.current[i] = refs.current[i] ?? new Animated.Value(initialValue);
});
return refs.current;
}
``` | /content/code_sandbox/src/utils/useAnimatedValueArray.tsx | xml | 2016-10-19T05:56:53 | 2024-08-16T08:48:04 | react-native-paper | callstack/react-native-paper | 12,646 | 88 |
```xml
/* eslint-disable @typescript-eslint/indent */
import type { Element, Text } from '@ice/miniapp-runtime';
import { document } from '@ice/miniapp-runtime';
import { EMPTY_ARR, isBoolean, isUndefined, noop } from '@ice/shared';
import type { HostConfig } from 'react-reconciler';
import Reconciler from 'react-reconciler';
import * as scheduler from 'scheduler';
import type { Props } from './props.js';
import { updateProps } from './props.js';
const {
unstable_now: now,
} = scheduler;
function returnFalse() {
return false;
}
const hostConfig: HostConfig<
string, // Type
Props, // Props
Element, // Container
Element, // Instance
Text, // TextInstance
Element, // SuspenseInstance
Element, // HydratableInstance
Element, // PublicInstance
Record<string, any>, // HostContext
string[], // UpdatePayload
unknown, // ChildSet
unknown, // TimeoutHandle
unknown // NoTimeout
> & {
hideInstance: (instance: Element) => void;
unhideInstance: (instance: Element, props) => void;
getCurrentEventPriority: () => number;
detachDeletedInstance: () => void;
} = {
createInstance(type) {
return document.createElement(type);
},
createTextInstance(text) {
return document.createTextNode(text);
},
getPublicInstance(inst: Element) {
return inst;
},
getRootHostContext() {
return {};
},
getChildHostContext() {
return {};
},
getCurrentEventPriority() {
// @types/react-reconciler ts16
return 16; // import { DefaultEventPriority } from 'react-reconciler/constants'
},
detachDeletedInstance() {
// noop
},
appendChild(parent, child) {
parent.appendChild(child);
},
appendInitialChild(parent, child) {
parent.appendChild(child);
},
appendChildToContainer(parent, child) {
parent.appendChild(child);
},
removeChild(parent, child) {
parent.removeChild(child);
},
removeChildFromContainer(parent, child) {
parent.removeChild(child);
},
insertBefore(parent, child, refChild) {
parent.insertBefore(child, refChild);
},
insertInContainerBefore(parent, child, refChild) {
parent.insertBefore(child, refChild);
},
commitTextUpdate(textInst, _, newText) {
textInst.nodeValue = newText;
},
finalizeInitialChildren(dom, _, props) {
updateProps(dom, {}, props);
return false;
},
prepareUpdate() {
return EMPTY_ARR;
},
commitUpdate(dom, _payload, _type, oldProps, newProps) {
updateProps(dom, oldProps, newProps);
},
hideInstance(instance) {
const { style } = instance;
style.setProperty('display', 'none');
},
unhideInstance(instance, props) {
const styleProp = props.style;
let display = (styleProp && Object.prototype.hasOwnProperty.call(styleProp, 'display')) ? styleProp.display : null;
display = display == null || isBoolean(display) || display === '' ? '' : (`${display}`).trim();
// eslint-disable-next-line dot-notation
instance.style['display'] = display;
},
clearContainer(element) {
if (element.childNodes.length > 0) {
element.textContent = '';
}
},
queueMicrotask: isUndefined(Promise)
? setTimeout
: callback =>
Promise.resolve(null)
.then(callback)
.catch((error) => {
setTimeout(() => {
throw error;
});
}),
shouldSetTextContent: returnFalse,
prepareForCommit() { return null; },
resetAfterCommit: noop,
commitMount: noop,
now,
cancelTimeout: clearTimeout,
scheduleTimeout: setTimeout,
preparePortalMount: noop,
noTimeout: -1,
supportsMutation: true,
supportsPersistence: false,
isPrimaryRenderer: true,
supportsHydration: false,
};
const IceMiniappReconciler = Reconciler(hostConfig);
if (process.env.NODE_ENV !== 'production') {
const foundDevTools = IceMiniappReconciler.injectIntoDevTools({
bundleType: 1,
version: '18.0.0',
rendererPackageName: '@ice/miniapp-react-dom',
});
if (!foundDevTools) {
// eslint-disable-next-line no-console
console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'path_to_url 'font-weight:bold');
}
}
export {
IceMiniappReconciler,
};
``` | /content/code_sandbox/packages/miniapp-react-dom/src/reconciler.ts | xml | 2016-11-03T06:59:15 | 2024-08-16T10:11:29 | ice | alibaba/ice | 17,815 | 1,018 |
```xml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="path_to_url"
xmlns:x="path_to_url"
xmlns:d="path_to_url"
xmlns:mc="path_to_url"
xmlns:dualScreen="clr-namespace:Xamarin.Forms.DualScreen;assembly=Xamarin.Forms.DualScreen"
xmlns:local="clr-namespace:DualScreen"
mc:Ignorable="d"
x:Class="DualScreen.MasterDetail">
<dualScreen:TwoPaneView MinWideModeWidth="4000" MinTallModeHeight="4000">
<dualScreen:TwoPaneView.Pane1>
<local:Master x:Name="masterPage"></local:Master>
</dualScreen:TwoPaneView.Pane1>
<dualScreen:TwoPaneView.Pane2>
<local:Details x:Name="detailsPage"></local:Details>
</dualScreen:TwoPaneView.Pane2>
</dualScreen:TwoPaneView>
</ContentPage>
``` | /content/code_sandbox/DualScreen/DualScreen/MasterDetail/MasterDetail.xaml | xml | 2016-03-18T15:52:03 | 2024-08-16T16:25:43 | Xamarin.Forms | xamarin/Xamarin.Forms | 5,637 | 230 |
```xml
import "reflect-metadata"
import { DataSource } from "../../../src/data-source/DataSource"
import {
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases,
} from "../../utils/test-utils"
describe("query runner > drop foreign key", () => {
let connections: DataSource[]
before(async () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
})
})
beforeEach(() => reloadTestingDatabases(connections))
after(() => closeTestingConnections(connections))
it("should correctly drop foreign key and revert drop", () =>
Promise.all(
connections.map(async (connection) => {
const queryRunner = connection.createQueryRunner()
let table = await queryRunner.getTable("student")
table!.foreignKeys.length.should.be.equal(2)
await queryRunner.dropForeignKey(table!, table!.foreignKeys[0])
table = await queryRunner.getTable("student")
table!.foreignKeys.length.should.be.equal(1)
await queryRunner.executeMemoryDownSql()
table = await queryRunner.getTable("student")
table!.foreignKeys.length.should.be.equal(2)
await queryRunner.release()
}),
))
})
``` | /content/code_sandbox/test/functional/query-runner/drop-foreign-key.ts | xml | 2016-02-29T07:41:14 | 2024-08-16T18:28:52 | typeorm | typeorm/typeorm | 33,875 | 267 |
```xml
<resources>
<!-- Base application theme. -->
</resources>
``` | /content/code_sandbox/contentprovider-management/src/main/res/values/styles.xml | xml | 2016-01-28T02:51:45 | 2024-08-16T11:36:48 | understand-plugin-framework | tiann/understand-plugin-framework | 2,633 | 14 |
```xml
export * from './alert';
export * from './tooltip';
export * from './banner';
``` | /content/code_sandbox/packages/feedback/src/index.tsx | xml | 2016-05-14T02:18:49 | 2024-08-16T02:46:28 | ElectroCRUD | garrylachman/ElectroCRUD | 1,538 | 19 |
```xml
import * as React from 'react';
import { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
import {
useTooltipVisibility_unstable as useTooltipVisibility,
useFluent_unstable as useFluent,
} from '@fluentui/react-shared-contexts';
import type { KeyborgFocusInEvent } from '@fluentui/react-tabster';
import { KEYBORG_FOCUSIN } from '@fluentui/react-tabster';
import {
applyTriggerPropsToChildren,
useControllableState,
useId,
useIsomorphicLayoutEffect,
useIsSSR,
useMergedRefs,
useTimeout,
getTriggerChild,
mergeCallbacks,
useEventCallback,
slot,
} from '@fluentui/react-utilities';
import type { TooltipProps, TooltipState, TooltipChildProps, OnVisibleChangeData } from './Tooltip.types';
import { arrowHeight, tooltipBorderRadius } from './private/constants';
import { Escape } from '@fluentui/keyboard-keys';
/**
* Create the state required to render Tooltip.
*
* The returned state can be modified with hooks such as useTooltipStyles_unstable,
* before being passed to renderTooltip_unstable.
*
* @param props - props from this instance of Tooltip
*/
export const useTooltip_unstable = (props: TooltipProps): TooltipState => {
'use no memo';
const context = useTooltipVisibility();
const isServerSideRender = useIsSSR();
const { targetDocument } = useFluent();
const [setDelayTimeout, clearDelayTimeout] = useTimeout();
const {
appearance = 'normal',
children,
content,
withArrow = false,
positioning = 'above',
onVisibleChange,
relationship,
showDelay = 250,
hideDelay = 250,
mountNode,
} = props;
const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });
const setVisible = React.useCallback(
(ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => {
clearDelayTimeout();
setVisibleInternal(oldVisible => {
if (data.visible !== oldVisible) {
onVisibleChange?.(ev, data);
}
return data.visible;
});
},
[clearDelayTimeout, setVisibleInternal, onVisibleChange],
);
const state: TooltipState = {
withArrow,
positioning,
showDelay,
hideDelay,
relationship,
visible,
shouldRenderTooltip: visible,
appearance,
mountNode,
// Slots
components: {
content: 'div',
},
content: slot.always(content, {
defaultProps: {
role: 'tooltip',
},
elementType: 'div',
}),
};
state.content.id = useId('tooltip-', state.content.id);
const positioningOptions = {
enabled: state.visible,
arrowPadding: 2 * tooltipBorderRadius,
position: 'above' as const,
align: 'center' as const,
offset: 4,
...resolvePositioningShorthand(state.positioning),
};
if (state.withArrow) {
positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);
}
const {
targetRef,
containerRef,
arrowRef,
}: {
targetRef: React.MutableRefObject<unknown>;
containerRef: React.MutableRefObject<HTMLDivElement>;
arrowRef: React.MutableRefObject<HTMLDivElement>;
} = usePositioning(positioningOptions);
state.content.ref = useMergedRefs(state.content.ref, containerRef);
state.arrowRef = arrowRef;
// When this tooltip is visible, hide any other tooltips, and register it
// as the visibleTooltip with the TooltipContext.
// Also add a listener on document to hide the tooltip if Escape is pressed
useIsomorphicLayoutEffect(() => {
if (visible) {
const thisTooltip = {
hide: (ev?: KeyboardEvent) => setVisible(undefined, { visible: false, documentKeyboardEvent: ev }),
};
context.visibleTooltip?.hide();
context.visibleTooltip = thisTooltip;
const onDocumentKeyDown = (ev: KeyboardEvent) => {
if (ev.key === Escape && !ev.defaultPrevented) {
thisTooltip.hide(ev);
// stop propagation to avoid conflicting with other elements that listen for `Escape`
// e,g: Dialog, Popover, Menu and Tooltip
ev.preventDefault();
}
};
targetDocument?.addEventListener('keydown', onDocumentKeyDown, {
// As this event is added at targeted document,
// we need to capture the event to be sure keydown handling from tooltip happens first
capture: true,
});
return () => {
if (context.visibleTooltip === thisTooltip) {
context.visibleTooltip = undefined;
}
targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });
};
}
}, [context, targetDocument, visible, setVisible]);
// Used to skip showing the tooltip in certain situations when the trigger is focused.
// See comments where this is set for more info.
const ignoreNextFocusEventRef = React.useRef(false);
// Listener for onPointerEnter and onFocus on the trigger element
const onEnterTrigger = React.useCallback(
(ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {
if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {
ignoreNextFocusEventRef.current = false;
return;
}
// Show immediately if another tooltip is already visible
const delay = context.visibleTooltip ? 0 : state.showDelay;
setDelayTimeout(() => {
setVisible(ev, { visible: true });
}, delay);
ev.persist(); // Persist the event since the setVisible call will happen asynchronously
},
[setDelayTimeout, setVisible, state.showDelay, context],
);
// Callback ref that attaches a keyborg:focusin event listener.
const [keyborgListenerCallbackRef] = React.useState(() => {
const onKeyborgFocusIn = ((ev: KeyborgFocusInEvent) => {
// Skip showing the tooltip if focus moved programmatically.
// For example, we don't want to show the tooltip when a dialog is closed
// and Tabster programmatically restores focus to the trigger button.
// See path_to_url
if (ev.detail?.isFocusedProgrammatically) {
ignoreNextFocusEventRef.current = true;
}
}) as EventListener;
// Save the current element to remove the listener when the ref changes
let current: Element | null = null;
// Callback ref that attaches the listener to the element
return (element: Element | null) => {
current?.removeEventListener(KEYBORG_FOCUSIN, onKeyborgFocusIn);
element?.addEventListener(KEYBORG_FOCUSIN, onKeyborgFocusIn);
current = element;
};
});
// Listener for onPointerLeave and onBlur on the trigger element
const onLeaveTrigger = React.useCallback(
(ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {
let delay = state.hideDelay;
if (ev.type === 'blur') {
// Hide immediately when losing focus
delay = 0;
// The focused element gets a blur event when the document loses focus
// (e.g. switching tabs in the browser), but we don't want to show the
// tooltip again when the document gets focus back. Handle this case by
// checking if the blurred element is still the document's activeElement.
// See path_to_url
ignoreNextFocusEventRef.current = targetDocument?.activeElement === ev.target;
}
setDelayTimeout(() => {
setVisible(ev, { visible: false });
}, delay);
ev.persist(); // Persist the event since the setVisible call will happen asynchronously
},
[setDelayTimeout, setVisible, state.hideDelay, targetDocument],
);
// Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.
// This keeps the tooltip visible when the mouse is moved over it, or it has focus within.
state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);
state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);
state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);
state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);
const child = getTriggerChild(children);
const triggerAriaProps: Pick<TooltipChildProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> = {};
if (relationship === 'label') {
// aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
if (typeof state.content.children === 'string') {
triggerAriaProps['aria-label'] = state.content.children;
} else {
triggerAriaProps['aria-labelledby'] = state.content.id;
// Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
state.shouldRenderTooltip = true;
}
} else if (relationship === 'description') {
triggerAriaProps['aria-describedby'] = state.content.id;
// Always render the tooltip even if hidden, so that aria-describedby refers to a valid element
state.shouldRenderTooltip = true;
}
// Don't render the Tooltip in SSR to avoid hydration errors
if (isServerSideRender) {
state.shouldRenderTooltip = false;
}
// Apply the trigger props to the child, either by calling the render function, or cloning with the new props
state.children = applyTriggerPropsToChildren(children, {
...triggerAriaProps,
...child?.props,
ref: useMergedRefs(
child?.ref,
keyborgListenerCallbackRef,
// If the target prop is not provided, attach targetRef to the trigger element's ref prop
positioningOptions.target === undefined ? targetRef : undefined,
),
onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),
onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),
onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),
onBlur: useEventCallback(mergeCallbacks(child?.props?.onBlur, onLeaveTrigger)),
});
return state;
};
``` | /content/code_sandbox/packages/react-components/react-tooltip/library/src/components/Tooltip/useTooltip.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 2,272 |
```xml
import React from 'react';
import DragAndDrop, { DraggableItemData } from './DragAndDrop';
import Tile, { ColorTile } from './Tile';
const COLORS = [
'#F94144',
'#F3722C',
'#F8961E',
'#F9844A',
'#F9C74F',
'#90BE6D',
'pink',
'#43AA8B',
'#4D908E',
'#577590',
'#277DA1',
];
const COLORS_ITEMS = COLORS.map((c) => ({
id: c,
color: c,
}));
const Example = () => {
const handleOrderChange = (_items: ColorTile[]) => {
// do stuff with newly ordered items
};
const renderItem = ({
data,
isActive,
draggingActive,
tileSize,
}: DraggableItemData<ColorTile>) => {
return (
<Tile
isActive={isActive}
draggingActive={draggingActive}
data={data}
tileSize={tileSize}
/>
);
};
return (
<DragAndDrop
items={COLORS_ITEMS}
itemsInRowCount={4}
columnGap={20}
rowGap={20}
renderItem={renderItem}
onOrderUpdate={handleOrderChange}
/>
);
};
export default Example;
``` | /content/code_sandbox/example/src/new_api/drag_n_drop/index.tsx | xml | 2016-10-27T08:31:38 | 2024-08-16T12:03:40 | react-native-gesture-handler | software-mansion/react-native-gesture-handler | 5,989 | 289 |
```xml
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:cd>
<domain:name avail="1">example1.tld</domain:name>
</domain:cd>
</domain:chkData>
</resData>
<extension>
<fee:chkData xmlns:fee="urn:ietf:params:xml:ns:fee-0.12"
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<fee:cd>
<fee:object>
<domain:name>example1.tld</domain:name>
</fee:object>
<fee:command name="create">
<fee:period unit="y">1</fee:period>
<fee:fee description="create">6.50</fee:fee>
</fee:command>
</fee:cd>
<fee:cd>
<fee:object>
<domain:name>example1.tld</domain:name>
</fee:object>
<fee:command name="renew">
<fee:period unit="y">1</fee:period>
<fee:fee description="renew">11.00</fee:fee>
</fee:command>
</fee:cd>
<fee:cd>
<fee:object>
<domain:name>example1.tld</domain:name>
</fee:object>
<fee:command name="transfer">
<fee:period unit="y">1</fee:period>
<fee:fee description="renew">11.00</fee:fee>
</fee:command>
</fee:cd>
<fee:cd>
<fee:object>
<domain:name>example1.tld</domain:name>
</fee:object>
<fee:command name="restore">
<fee:period unit="y">1</fee:period>
<fee:fee description="restore">17.00</fee:fee>
</fee:command>
</fee:cd>
<fee:cd>
<fee:object>
<domain:name>example1.tld</domain:name>
</fee:object>
<fee:command name="update">
<fee:period unit="y">1</fee:period>
<fee:fee description="update">0.00</fee:fee>
</fee:command>
</fee:cd>
</fee:chkData>
</extension>
<trID>
<clTRID>ABC-12345</clTRID>
<svTRID>server-trid</svTRID>
</trID>
</response>
</epp>
``` | /content/code_sandbox/core/src/test/resources/google/registry/flows/domain/domain_check_fee_multiple_commands_default_token_response_v12.xml | xml | 2016-02-29T20:16:48 | 2024-08-15T19:49:29 | nomulus | google/nomulus | 1,685 | 647 |
```xml
import { svgIcon } from "@bitwarden/components";
export const ReportReusedPasswords = svgIcon`
<svg width="102" height="102" fill="none" xmlns="path_to_url">
<path d="M57.983 15.06a35.664 35.664 0 0 1 14.531 6.27c16.164 11.78 19.585 34.613 7.643 51a37.227 37.227 0 0 1-6.81 7.138m-32.842 6.697a35.708 35.708 0 0 1-11.239-5.495c-16.163-11.78-19.585-34.613-7.642-51a37.55 37.55 0 0 1 3.295-3.929" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M93.909 64.598H7.72c-.708 0-1.275-.662-1.275-1.49V40.273c0-.828.567-1.49 1.275-1.49H93.91c.708 0 1.275.663 1.275 1.49v22.837c.047.827-.567 1.49-1.275 1.49Z" fill="currentColor" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M21.532 52.186v-5.965M21.532 52.187l5.748-1.844M21.532 52.186l3.524 4.881M21.531 52.186l-3.47 4.881M21.532 52.187l-5.694-1.844M40.944 52.186v-5.965M40.944 52.187l5.694-1.844M40.944 52.187l3.525 4.88M40.944 52.187l-3.525 4.88M40.944 52.187l-5.694-1.844M54.849 57.337h11.294M74.21 57.337h11.295M41.75 83l.71 4.75-4.75.71M58.664 18.66 56 14.665 59.996 12" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
`;
``` | /content/code_sandbox/apps/web/src/app/tools/reports/icons/report-reused-passwords.icon.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 608 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="path_to_url"
xmlns:activiti="path_to_url"
targetNamespace="Examples">
<process id="compensateProcess">
<startEvent id="start" />
<sequenceFlow sourceRef="start" targetRef="fork" />
<parallelGateway id="fork" />
<sequenceFlow sourceRef="fork" targetRef="bookHotel" />
<sequenceFlow sourceRef="fork" targetRef="bookFlight" />
<serviceTask id="bookHotel" activiti:expression="${true}">
<multiInstanceLoopCharacteristics isSequential="true">
<loopCardinality>5</loopCardinality>
</multiInstanceLoopCharacteristics>
</serviceTask>
<boundaryEvent id="compensateBookHotelEvt" name="Boundary event" attachedToRef="bookHotel">
<compensateEventDefinition />
</boundaryEvent>
<!-- not supported -->
<boundaryEvent id="compensateBookHotelEvt2" name="Boundary event" attachedToRef="bookHotel">
<compensateEventDefinition />
</boundaryEvent>
<serviceTask id="undoBookHotel" activiti:expression="${true}" />
<serviceTask id="undoBookHotel2" activiti:expression="${true}" />
<serviceTask id="bookFlight" activiti:expression="${true}">
<multiInstanceLoopCharacteristics isSequential="true">
<loopCardinality>5</loopCardinality>
</multiInstanceLoopCharacteristics>
</serviceTask>
<boundaryEvent id="compensateBookFlightEvt" name="Boundary event" attachedToRef="bookFlight">
<compensateEventDefinition />
</boundaryEvent>
<serviceTask id="undoBookFlight" activiti:expression="${true}" />
<parallelGateway id="join" />
<sequenceFlow sourceRef="bookHotel" targetRef="join" />
<sequenceFlow sourceRef="bookFlight" targetRef="join" />
<sequenceFlow sourceRef="join" targetRef="throwCompensate" />
<intermediateThrowEvent id="throwCompensate">
<compensateEventDefinition />
</intermediateThrowEvent>
<sequenceFlow sourceRef="throwCompensate" targetRef="end" />
<endEvent id="end" />
<association associationDirection="One" sourceRef="compensateBookHotelEvt" targetRef="undoBookHotel" />
<association associationDirection="One" sourceRef="compensateBookHotelEvt2" targetRef="undoBookHotel2" />
<association associationDirection="One" sourceRef="compensateBookFlightEvt" targetRef="undoBookFlight" />
</process>
</definitions>
``` | /content/code_sandbox/modules/flowable-engine/src/test/resources/org/flowable/engine/test/bpmn/event/compensate/CompensateEventTest.testMultipleCompensationCatchEventsCompensationAttributeMissingFails.bpmn20.xml | xml | 2016-10-13T07:21:43 | 2024-08-16T15:23:14 | flowable-engine | flowable/flowable-engine | 7,715 | 658 |
```xml
import { Image, Button, ButtonProps } from '@fluentui/react-northstar';
import * as React from 'react';
export interface GridPickerItemProps {
title?: string;
imageSrc: string;
onClick?: (e: React.SyntheticEvent, props: ButtonProps) => void;
}
const imageButtonStyles = {
minWidth: '56px',
height: '56px',
padding: '0',
background: '#fff',
};
class GridImagePickerItem extends React.Component<GridPickerItemProps> {
render() {
const { title, imageSrc, onClick } = this.props;
return (
<li role="presentation">
<Button styles={imageButtonStyles} onClick={onClick} title={title} aria-label={title} role="listitem">
{imageSrc && <Image alt={title} src={imageSrc} fluid />}
</Button>
</li>
);
}
}
export default GridImagePickerItem;
``` | /content/code_sandbox/packages/fluentui/react-northstar-prototypes/src/prototypes/popups/GridImagePicker/GridImagePickerItem.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 208 |
```xml
/**
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import * as ExtensionApi from '@extraterm/extraterm-extension-api';
import * as _ from 'lodash-es';
import { Logger, getLogger } from "extraterm-logging";
import { ExtensionMetadata, ExtensionSessionSettingsContribution } from "./ExtensionMetadata.js";
import { InternalSessionSettingsEditor, SessionSettingsChange } from "../InternalTypes.js";
import { QWidget } from "@nodegui/nodegui";
import { Window } from "../Window.js";
import { StyleImpl } from "./api/StyleImpl.js";
import { ConfigDatabase } from "../config/ConfigDatabase.js";
import { ErrorTolerantEventEmitter } from './ErrorTolerantEventEmitter.js';
export class WorkspaceSessionSettingsEditorRegistry {
private _log: Logger = null;
#registeredSessionSettingsEditors: Map<string, ExtensionApi.SessionSettingsEditorFactory> = null;
#configDatabase: ConfigDatabase;
#extensionMetadata: ExtensionMetadata;
constructor(configDatabase: ConfigDatabase, extensionMetadata: ExtensionMetadata) {
this._log = getLogger("WorkspaceSessionSettingsEditorRegistry", this);
this.#configDatabase = configDatabase;
this.#extensionMetadata = extensionMetadata;
this.#registeredSessionSettingsEditors = new Map();
}
registerSessionSettingsEditor(id: string, factory: ExtensionApi.SessionSettingsEditorFactory): void {
let sessionSettingsEditorMetadata: ExtensionSessionSettingsContribution = null;
for (const semd of this.#extensionMetadata.contributes.sessionSettings) {
if (semd.id === id) {
sessionSettingsEditorMetadata = semd;
break;
}
}
if (sessionSettingsEditorMetadata == null) {
this._log.warn(`Unable to register session settings editor '${id}' for extension ` +
`'${this.#extensionMetadata.name}' because the session editor contribution data ` +
`couldn't be found in the extension's package.json file.`);
return;
}
this.#registeredSessionSettingsEditors.set(sessionSettingsEditorMetadata.id, factory);
}
#getExtensionSessionSettingsContributionById(id: string): ExtensionSessionSettingsContribution {
for (const ssm of this.#extensionMetadata.contributes.sessionSettings) {
if (ssm.id === id) {
return ssm;
}
}
return null;
}
createSessionSettingsEditors(sessionType: string,
sessionConfiguration: ExtensionApi.SessionConfiguration, window: Window): InternalSessionSettingsEditor[] {
const result: InternalSessionSettingsEditor[] = [];
for (const id of this.#registeredSessionSettingsEditors.keys()) {
const factory = this.#registeredSessionSettingsEditors.get(id);
const sessionSettingsMetadata = this.#getExtensionSessionSettingsContributionById(id);
const settingsConfigKey = `${this.#extensionMetadata.name}:${id}`;
let settings = sessionConfiguration.extensions?.[settingsConfigKey];
if (settings == null) {
settings = {};
}
const editorBase = new SessionSettingsEditorBaseImpl(sessionSettingsMetadata.name, settingsConfigKey, settings,
this.#configDatabase, window, factory, this._log);
result.push(editorBase);
}
return result;
}
}
export class SessionSettingsEditorBaseImpl implements InternalSessionSettingsEditor {
#name: string;
#key: string;
#settings: object;
onSettingsChanged: ExtensionApi.Event<SessionSettingsChange>;
#onSettingsChangedEventEmitter: ErrorTolerantEventEmitter<SessionSettingsChange> = null;
#configDatabase: ConfigDatabase;
#widget: QWidget = null;
#window: Window;
#style: StyleImpl = null;
constructor(name: string, key: string, settings: Object, configDatabase: ConfigDatabase, window: Window,
factory: ExtensionApi.SessionSettingsEditorFactory, log: Logger) {
this.#name = name;
this.#key = key;
this.#settings = settings;
this.#onSettingsChangedEventEmitter = new ErrorTolerantEventEmitter<SessionSettingsChange>(
"onSettingsChanged", log);
this.onSettingsChanged = this.#onSettingsChangedEventEmitter.event;
this.#configDatabase = configDatabase;
this.#window = window;
this.#widget = factory.call(null, this);
}
get name(): string {
return this.#name;
}
_getWidget(): QWidget {
return this.#widget;
}
get settings(): Object {
return this.#settings;
}
setSettings(settings: Object): void {
this.#settings = settings;
this.#onSettingsChangedEventEmitter.fire({
settingsConfigKey: this.#key,
settings: _.cloneDeep(settings)
});
}
get style(): ExtensionApi.Style {
if (this.#style == null) {
this.#style = new StyleImpl(this.#configDatabase, this.#window);
}
return this.#style;
}
}
``` | /content/code_sandbox/main/src/extension/WorkspaceSessionSettingsEditorRegistry.ts | xml | 2016-03-04T12:39:59 | 2024-08-16T18:44:37 | extraterm | sedwards2009/extraterm | 2,501 | 1,041 |
```xml
export const roundedRect = (
ctx: CanvasRenderingContext2D,
x: number,
y: number,
width: number,
height: number,
radius: number
) => {
if (radius > 0) {
ctx.moveTo(x + radius, y)
ctx.lineTo(x + width - radius, y)
ctx.quadraticCurveTo(x + width, y, x + width, y + radius)
ctx.lineTo(x + width, y + height - radius)
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height)
ctx.lineTo(x + radius, y + height)
ctx.quadraticCurveTo(x, y + height, x, y + height - radius)
ctx.lineTo(x, y + radius)
ctx.quadraticCurveTo(x, y, x + radius, y)
ctx.closePath()
} else {
ctx.rect(x, y, width, height)
}
}
``` | /content/code_sandbox/packages/canvas/src/roundedRect.ts | xml | 2016-04-16T03:27:56 | 2024-08-16T03:38:37 | nivo | plouc/nivo | 13,010 | 207 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IconDownloaderDialog</class>
<widget class="QDialog" name="IconDownloaderDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>453</width>
<height>339</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Download Favicons</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="progressLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Downloading favicon 0/0</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="fallbackLabel">
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Having trouble downloading icons?
You can enable the DuckDuckGo website icon service in the security section of the application settings.</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="tableView">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>20</number>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>20</number>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>cancelButton</tabstop>
<tabstop>tableView</tabstop>
<tabstop>closeButton</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
``` | /content/code_sandbox/src/gui/IconDownloaderDialog.ui | xml | 2016-02-28T15:52:40 | 2024-08-16T19:26:56 | keepassxc | keepassxreboot/keepassxc | 20,477 | 1,173 |
```xml
import * as React from 'react';
import createSvgIcon from '../utils/createSvgIcon';
const CommandPromptIcon = createSvgIcon({
svg: ({ classes }) => (
<svg xmlns="path_to_url" viewBox="0 0 2048 2048" className={classes.svg} focusable="false">
<path d="M2048 128v1664H0V128h2048zM128 256v128h1792V256H128zm1792 1408V512H128v1152h1792zm-528-896l257 640h-91l-257-640h91zm-656 76q-53 0-96 16t-74 48-48 78-17 106q0 55 15 100t45 76 73 49 98 17q35 0 69-7t58-18l16 62q-22 11-63 19t-96 9q-63 0-117-20t-95-58-62-95-23-131q0-70 23-128t64-100 99-65 128-23q57 0 92 9t51 18l-19 63q-22-11-52-18t-69-7zm288 52h128v128h-128V896zm0 256h128v128h-128v-128z" />
</svg>
),
displayName: 'CommandPromptIcon',
});
export default CommandPromptIcon;
``` | /content/code_sandbox/packages/react-icons-mdl2/src/components/CommandPromptIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 337 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="path_to_url"
package="com.journaldev.androidexpressobasics">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
``` | /content/code_sandbox/Android/AndroidEspressoBasics/app/src/main/AndroidManifest.xml | xml | 2016-05-02T05:43:21 | 2024-08-16T06:51:39 | journaldev | WebJournal/journaldev | 1,314 | 154 |
```xml
import { ColumnDef, Row } from '@tanstack/react-table';
import { Checkbox } from '@@/form-components/Checkbox';
export function createSelectColumn<T>(dataCy: string): ColumnDef<T> {
let lastSelectedId = '';
return {
id: 'select',
header: ({ table }) => (
<Checkbox
id="select-all"
data-cy={`select-all-checkbox-${dataCy}`}
checked={table.getIsAllRowsSelected()}
indeterminate={table.getIsSomeRowsSelected()}
onChange={table.getToggleAllRowsSelectedHandler()}
disabled={table.getRowModel().rows.every((row) => !row.getCanSelect())}
onClick={(e) => {
e.stopPropagation();
}}
aria-label="Select all rows"
title="Select all rows"
/>
),
cell: ({ row, table }) => (
<Checkbox
id={`select-row-${row.id}`}
data-cy={`select-row-checkbox_${row.id}`}
checked={row.getIsSelected()}
indeterminate={row.getIsSomeSelected()}
onChange={row.getToggleSelectedHandler()}
disabled={!row.getCanSelect()}
onClick={(e) => {
e.stopPropagation();
if (e.shiftKey) {
const { rows, rowsById } = table.getRowModel();
const rowsToToggle = getRowRange(rows, row.id, lastSelectedId);
const isLastSelected = rowsById[lastSelectedId].getIsSelected();
rowsToToggle.forEach((row) => row.toggleSelected(isLastSelected));
}
lastSelectedId = row.id;
}}
aria-label="Select row"
/>
),
enableHiding: false,
meta: {
width: 50,
},
};
}
function getRowRange<T>(rows: Array<Row<T>>, idA: string, idB: string) {
const range: Array<Row<T>> = [];
let foundStart = false;
let foundEnd = false;
for (let index = 0; index < rows.length; index += 1) {
const row = rows[index];
if (row.id === idA || row.id === idB) {
if (foundStart) {
foundEnd = true;
}
if (!foundStart) {
foundStart = true;
}
}
if (foundStart) {
range.push(row);
}
if (foundEnd) {
break;
}
}
return range;
}
``` | /content/code_sandbox/app/react/components/datatables/select-column.tsx | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 529 |
```xml
import HeaderDescription from '@erxes/ui/src/components/HeaderDescription';
import { __ } from '@erxes/ui/src/utils';
import React from 'react';
function Header({
title,
description
}: {
title?: string;
description?: string;
}) {
return (
<HeaderDescription
icon="/images/actions/25.svg"
title={title || ''}
description={description || ''}
/>
);
}
export default Header;
``` | /content/code_sandbox/packages/ui-settings/src/general/components/Header.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 93 |
```xml
import React from 'react';
import { storiesOf } from '@storybook/react-native';
import { withKnobs } from '@storybook/addon-knobs';
import Wrapper from './../../Wrapper';
import Examples from './AppBarExamples';
storiesOf('AppBar', module)
.addDecorator(withKnobs)
.addDecorator((getStory: any) => <Wrapper>{getStory()}</Wrapper>)
.add('Examples', () => <Examples />);
``` | /content/code_sandbox/example/storybook/stories/components/composites/AppBar/index.tsx | xml | 2016-04-15T11:37:23 | 2024-08-14T16:16:44 | NativeBase | GeekyAnts/NativeBase | 20,132 | 91 |
```xml
<vector xmlns:android="path_to_url"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="@color/gray20"
android:pathData="m16.614,10.1801c0.0155,3.1165 -1.1329,6.4181 -3.6417,8.3195 -0.7118,0.4002 -1.0296,-1.1937 -0.2831,-1.3774 1.6236,-1.8414 2.0655,-4.4306 2.0997,-6.8333 0.0249,-2.4959 -0.4452,-5.1675 -2.0694,-7.1137 -0.4547,-0.2685 -0.5838,-0.7136 -0.3174,-1.1536 0.0661,-0.8558 0.7305,-0.1301 1.1203,0.172 2.1748,1.9746 3.1179,5.0755 3.0915,7.9866zM11.2592,10.6311c-1.4007,0 -2.8015,0 -4.2022,0 0,-0.5357 0,-1.0715 0,-1.6072 1.4007,0 2.8015,0 4.2022,0 0,0.5357 0,1.0715 0,1.6072zM4.3036,12.8041C5.2775,12.6653 5.8523,14.1022 5.1035,14.7279 4.4431,15.3258 3.1038,14.9005 3.1695,13.9029 3.1464,13.2907 3.7055,12.7411 4.3036,12.8041ZM4.3036,5.8422c0.9739,-0.1388 1.5488,1.2981 0.7999,1.9237 -0.6604,0.5979 -1.9997,0.1727 -1.934,-0.8249 -0.0231,-0.6123 0.536,-1.1618 1.1341,-1.0988z" />
</vector>
``` | /content/code_sandbox/src/main/res/drawable/ic_emoji_emoticon_dark_20.xml | xml | 2016-07-03T07:32:36 | 2024-08-16T16:51:15 | deltachat-android | deltachat/deltachat-android | 1,082 | 580 |
```xml
import React from 'react';
import Triangle from '../components/Triangle';
import { renderWithWrapper } from '../../../.ci/testHelper';
describe('Tooltip component', () => {
it('should match snapshot ', () => {
const { toJSON } = renderWithWrapper(<Triangle />, 'RNE__Tooltip_Triangle');
expect(toJSON()).toMatchSnapshot();
});
it('should render ', () => {
const { wrapper } = renderWithWrapper(
<Triangle pointerColor="red" />,
'RNE__Tooltip_Triangle'
);
expect(wrapper.props.style.borderBottomColor).toBe('red');
});
it('should render without downward', () => {
const { wrapper } = renderWithWrapper(
<Triangle isDown />,
'RNE__Tooltip_Triangle'
);
expect(wrapper.props.style.transform).toMatchObject([{ rotate: '180deg' }]);
});
});
``` | /content/code_sandbox/packages/base/src/Tooltip/__tests__/Triangle.test.tsx | xml | 2016-09-08T14:21:41 | 2024-08-16T10:11:29 | react-native-elements | react-native-elements/react-native-elements | 24,875 | 187 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="path_to_url">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)lib\3rdParty\OpenBLAS\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)lib\3rdParty\OpenBLAS\lib\$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libopenblas.dll.a;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent />
<PreLinkEvent>
<Command>xcopy /I /E /Y /D /C "$(SolutionDir)lib\3rdParty\OpenBlas\bin\$(PlatformShortName)" "$(OutDir)"</Command>
</PreLinkEvent>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
``` | /content/code_sandbox/lib/3rdParty/OpenBLAS/OpenBLAS_x86.props | xml | 2016-03-05T20:08:49 | 2024-08-16T11:30:08 | OpenFace | TadasBaltrusaitis/OpenFace | 6,799 | 241 |
```xml
export type JSONValue = boolean | number | string | null | JSONArray | JSONObject;
export interface JSONArray extends Array<JSONValue> {}
export interface JSONObject {
[key: string]: JSONValue | undefined;
}
export type BridgeMessage<TData extends JSONValue> = {
type: string;
data: TData;
};
``` | /content/code_sandbox/packages/expo/src/dom/www-types.ts | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 68 |
```xml
/*
*
* See the LICENSE file at the top-level directory of this distribution
* for licensing information.
*
* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
* no part of this software, including this file, may be copied, modified,
* propagated, or distributed except according to the terms contained in the
* LICENSE file.
*
* Removal or modification of this copyright notice is prohibited.
*/
import { BaseStore } from '../../base_store';
import { MAX_LENGTH_MODULE_NAME, MIN_LENGTH_MODULE_NAME } from '../constants';
export interface UserStoreData {
lockingModule: string;
}
export const userStoreSchema = {
$id: '/nft/store/user',
type: 'object',
required: ['lockingModule'],
properties: {
lockingModule: {
dataType: 'string',
minLength: MIN_LENGTH_MODULE_NAME,
maxLength: MAX_LENGTH_MODULE_NAME,
pattern: '^[a-zA-Z0-9]*$',
fieldNumber: 1,
},
},
};
export class UserStore extends BaseStore<UserStoreData> {
public schema = userStoreSchema;
public getKey(address: Buffer, nftID: Buffer): Buffer {
return Buffer.concat([address, nftID]);
}
}
``` | /content/code_sandbox/framework/src/modules/nft/stores/user.ts | xml | 2016-02-01T21:45:35 | 2024-08-15T19:16:48 | lisk-sdk | LiskArchive/lisk-sdk | 2,721 | 260 |
```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-logging</artifactId>
<version>5.5.1-SNAPSHOT</version>
</parent>
<artifactId>shardingsphere-logging-api</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-infra-common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
``` | /content/code_sandbox/kernel/logging/api/pom.xml | xml | 2016-01-18T12:49:26 | 2024-08-16T15:48:11 | shardingsphere | apache/shardingsphere | 19,707 | 264 |
```xml
import { EntitySchemaOptions } from "../../../../src/entity-schema/EntitySchemaOptions"
export class Post {
id: number
name: string
title: string
}
export const PostSchema: EntitySchemaOptions<Post> = {
name: "Post",
target: Post,
columns: {
id: {
primary: true,
type: Number,
},
name: {
type: String,
unique: true,
},
title: {
type: String,
},
},
}
``` | /content/code_sandbox/test/github-issues/3803/entity/Post.ts | xml | 2016-02-29T07:41:14 | 2024-08-16T18:28:52 | typeorm | typeorm/typeorm | 33,875 | 110 |
```xml
import React, { FunctionComponent } from "react";
import { graphql } from "react-relay";
import { withFragmentContainer } from "coral-framework/lib/relay";
import { StoryRatingContainer_story } from "coral-stream/__generated__/StoryRatingContainer_story.graphql";
import StoryRating from "./StoryRating";
interface Props {
story: StoryRatingContainer_story;
}
const StoryRatingContainer: FunctionComponent<Props> = ({ story }) => {
if (!story.ratings) {
return null;
}
return (
<StoryRating
title={story.metadata?.title}
average={story.ratings.average}
count={story.ratings.count}
/>
);
};
const enhanced = withFragmentContainer<Props>({
story: graphql`
fragment StoryRatingContainer_story on Story {
id
metadata {
title
}
ratings {
average
count
}
}
`,
})(StoryRatingContainer);
export default enhanced;
``` | /content/code_sandbox/client/src/core/client/stream/tabs/Comments/Stream/StoryRating/StoryRatingContainer.tsx | xml | 2016-10-31T16:14:05 | 2024-08-06T16:15:57 | talk | coralproject/talk | 1,881 | 202 |
```xml
<dict>
<key>CommonPeripheralDSP</key>
<array>
<dict>
<key>DeviceID</key>
<integer>0</integer>
<key>DeviceType</key>
<string>Headphone</string>
</dict>
<dict>
<key>DeviceID</key>
<integer>0</integer>
<key>DeviceType</key>
<string>Microphone</string>
</dict>
</array>
<key>PathMaps</key>
<array>
<dict>
<key>PathMap</key>
<array>
<array>
<array>
<array>
<dict>
<key>NodeID</key>
<integer>22</integer>
</dict>
<dict>
<key>NodeID</key>
<integer>24</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<true/>
</dict>
<key>Boost</key>
<integer>1</integer>
<key>NodeID</key>
<integer>10</integer>
</dict>
</array>
</array>
</array>
<array>
<array>
<array>
<dict>
<key>NodeID</key>
<integer>21</integer>
</dict>
<dict>
<key>NodeID</key>
<integer>23</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<true/>
</dict>
<key>Boost</key>
<integer>1</integer>
<key>NodeID</key>
<integer>17</integer>
</dict>
</array>
</array>
</array>
<array>
<array>
<array>
<dict>
<key>NodeID</key>
<integer>11</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<false/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>20</integer>
</dict>
</array>
</array>
<array>
<array>
<dict>
<key>NodeID</key>
<integer>13</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<false/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>28</integer>
</dict>
<dict>
<key>NodeID</key>
<integer>27</integer>
</dict>
<dict>
<key>NodeID</key>
<integer>19</integer>
</dict>
</array>
</array>
</array>
</array>
<key>PathMapID</key>
<integer>11</integer>
</dict>
</array>
</dict>
``` | /content/code_sandbox/Resources/IDT92HD81B1C5/Platforms11.xml | xml | 2016-03-07T20:45:58 | 2024-08-14T08:57:03 | AppleALC | acidanthera/AppleALC | 3,420 | 1,462 |
```xml
/*
* Wire
*
* This program is free software: you can redistribute it and/or modify
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* along with this program. If not, see path_to_url
*
*/
export * from './Availability';
``` | /content/code_sandbox/src/script/components/AvailabilityIcon/index.ts | xml | 2016-07-21T15:34:05 | 2024-08-16T11:40:13 | wire-webapp | wireapp/wire-webapp | 1,125 | 94 |
```xml
<WixLocalization Culture="en-us" Language="1033" xmlns="path_to_url">
<String Id="Caption">Instalador do [WixBundleName]</String>
<String Id="Title">[BUNDLEMONIKER]</String>
<String Id="ConfirmCancelMessage">Tem certeza de que deseja cancelar?</String>
<String Id="ExecuteUpgradeRelatedBundleMessage">Verso anterior</String>
<String Id="HelpHeader">Ajuda da Instalao</String>
<String Id="HelpText">/install | /repair | /uninstall | /layout [\[]"directory"[\]] - instala, repara, desinstala
ou cria uma cpia local completa do pacote no diretrio. '/install' o padro.
/passive | /quiet - exibe a interface do usurio mnima sem prompts ou no exibe a interface do usurio e
nenhum prompt. Por padro, a interface do usurio e todos os prompts so exibidos.
/norestart - suprimi qualquer tentativa de reiniciar. Por padro, a interface do usurio ser solicitada antes de reiniciar.
/log [\[]"log.txt"[\]] - logs para um arquivo especfico. Por padro, um arquivo de log criado em %TEMP%.</String>
<String Id="HelpCloseButton">&Fechar</String>
<String Id="InstallAcceptCheckbox">Eu &concordo com os termos e condies da licena</String>
<String Id="InstallOptionsButton">&Opes</String>
<String Id="InstallInstallButton">&Instalar</String>
<String Id="InstallCloseButton">&Fechar</String>
<String Id="ProgressHeader">Progresso da Instalao</String>
<String Id="ProgressLabel">Processando:</String>
<String Id="OverallProgressPackageText">Inicializando...</String>
<String Id="ProgressCancelButton">&Cancelar</String>
<String Id="ModifyHeader">Modificar Instalao</String>
<String Id="ModifyRepairButton">&Reparar</String>
<String Id="ModifyUninstallButton">&Desinstalar</String>
<String Id="ModifyCloseButton">&Fechar</String>
<String Id="SuccessRepairHeader">Reparao Concluda com xito</String>
<String Id="SuccessUninstallHeader">Desinstalao Concluda com xito</String>
<String Id="SuccessHeader">Instalao com xito</String>
<String Id="SuccessLaunchButton">&Iniciar</String>
<String Id="SuccessRestartText"> necessrio reiniciar o computador para concluir a instalao do software.</String>
<String Id="SuccessRestartButton">&Reiniciar</String>
<String Id="SuccessCloseButton">&Fechar</String>
<String Id="FailureHeader">Falha na Instalao</String>
<String Id="FailureInstallHeader">Falha na Instalao</String>
<String Id="FailureUninstallHeader">Falha na Desinstalao</String>
<String Id="FailureRepairHeader">Falha ao Reparar</String>
<String Id="FailureHyperlinkLogText">Um ou mais problemas fizeram com que a configurao falhasse. Corrija os problemas e tente novamente a configurao. Para obter mais informaes, consulte o <a href="#">arquivo de log</a>.</String>
<String Id="FailureRestartText">Reinicie o computador para concluir a reverso do software.</String>
<String Id="FailureRestartButton">&Reiniciar</String>
<String Id="FailureCloseButton">&Fechar</String>
<String Id="FilesInUseHeader">Arquivos em Uso</String>
<String Id="FilesInUseLabel">Os aplicativos a seguir esto usando arquivos que precisam ser atualizados:</String>
<String Id="FilesInUseCloseRadioButton">Feche os &aplicativos e tente reinici-los.</String>
<String Id="FilesInUseDontCloseRadioButton">&No feche os aplicativos. Uma reinicializao ser necessria.</String>
<String Id="FilesInUseOkButton">&OK</String>
<String Id="FilesInUseCancelButton">&Cancelar</String>
<String Id="FirstTimeWelcomeMessage">A instalao foi bem sucedida.
Os seguintes produtos foram instalados:
.NET SDK [DOTNETSDKVERSION]
.NET Runtime [DOTNETRUNTIMEVERSION]
ASP.NET Core Runtime [ASPNETCOREVERSION]
.NET Windows Desktop Runtime [WINFORMSANDWPFVERSION]
Esse produto coleta dados de uso
Mais informaes e recusa path_to_url
Recursos
Documentao do .NET path_to_url
Documentao do SDK path_to_url
Notas de Verso path_to_url
Tutoriais path_to_url
<String Id="WelcomeHeaderMessage">SDK do .NET</String>
<String Id="WelcomeDescription">
O SDK do .NET usado para criar, executar e testar aplicativos .NET. Voc pode escolher entre vrios idiomas, editores e ferramentas de desenvolvedor e aproveitar um grande ecossistema de bibliotecas para criar aplicativos para Web, dispositivos mveis, desktop, jogos e IoT. Esperamos que voc goste!</String>
<String Id="LearnMoreTitle">Saiba mais sobre o .NET</String>
<String Id="ResourcesHeader">Recursos</String>
<String Id="CoreDocumentationLink"><A HREF="path_to_url">Documentao do .NET</A></String>
<String Id="SDKDocumentation"><A HREF="path_to_url">Documentao do SDK</A></String>
<String Id="PrivacyStatementLink"><A HREF="path_to_url">Poltica de Privacidade</A></String>
<String Id="DotNetEulaLink"><A HREF="path_to_url">Informaes de licenciamento para .NET</A></String>
<String Id="DotNetCLITelemetryLink"><A HREF="path_to_url">Coleo e recusa de telemetria</A></String>
<String Id="InstallationNoteTitle">Nota de instalao</String>
<String Id="InstallationNote">Um comando ser executado durante o processo de instalao que melhorar a velocidade de restaurao do projeto e habilitar o acesso offline. Isso levar at um minuto para ser concludo.
</String>
<String Id="VisualStudioWarning">Se voc planeja usar .NET [VERSIONMAJOR].[VERSIONMINOR] com o Visual Studio, necessrio o Visual Studio 2022 [MINIMUMVSVERSION] ou mais recente. <A HREF="path_to_url">Saiba mais</A>.
</String>
<String Id="InstallPathx64x86">O caminho da instalao para instalaes do SDK x64: "[DOTNETHOME_X64]" no pode ser o mesmo que para instalaes do SDK x86: "[DOTNETHOME_X86]"</String>
<String Id="InstallPathARM64x86">O caminho da instalao para instalaes do SDK ARM64: "[DOTNETHOME_ARM64]" no pode ser o mesmo que para instalaes do SDK x86: "[DOTNETHOME_X86]"</String>
<String Id="InstallPathARM64x64">O caminho da instalao para instalaes do SDK ARM64: "[DOTNETHOME_ARM64]" no pode ser o mesmo que para instalaes do SDK x64: "[DOTNETHOME_X64]"</String>
</WixLocalization>
``` | /content/code_sandbox/src/Installer/redist-installer/packaging/windows/LCID/1046/bundle.wxl | xml | 2016-07-22T21:26:02 | 2024-08-16T17:23:58 | sdk | dotnet/sdk | 2,627 | 1,773 |
```xml
import { isNotUndefined } from './Utils'
export const classNames = (...values: (string | null | undefined | boolean)[]): string => {
return values
.map((value) => (typeof value === 'string' ? value : null))
.filter(isNotUndefined)
.join(' ')
}
``` | /content/code_sandbox/packages/utils/src/Domain/Utils/ClassNames.ts | xml | 2016-12-05T23:31:33 | 2024-08-16T06:51:19 | app | standardnotes/app | 5,180 | 67 |
```xml
import { Quantile as QuantileScale } from '@antv/scale';
import { ScaleComponent as SC } from '../runtime';
import { QuantileScale as QuantileScaleSpec } from '../spec';
export type QuantileOptions = Omit<QuantileScaleSpec, 'type'>;
export const Quantile: SC<QuantileOptions> = (options) => {
return new QuantileScale(options);
};
Quantile.props = {};
``` | /content/code_sandbox/src/scale/quantile.ts | xml | 2016-05-26T09:21:04 | 2024-08-15T16:11:17 | G2 | antvis/G2 | 12,060 | 92 |
```xml
/**
* This plugin contains all the logic for setting up the singletons
*/
import { definePlugin, type DocumentDefinition } from "sanity";
import { type StructureResolver } from "sanity/structure";
export const singletonPlugin = definePlugin((types: string[]) => {
return {
name: "singletonPlugin",
document: {
// Hide 'Singletons (such as Settings)' from new document options
// path_to_url
newDocumentOptions: (prev, { creationContext, ...rest }) => {
if (creationContext.type === "global") {
return prev.filter(
(templateItem) => !types.includes(templateItem.templateId),
);
}
return prev;
},
// Removes the "duplicate" action on the Singletons (such as Home)
actions: (prev, { schemaType }) => {
if (types.includes(schemaType)) {
return prev.filter(({ action }) => action !== "duplicate");
}
return prev;
},
},
};
});
// The StructureResolver is how we're changing the DeskTool structure to linking to document (named Singleton)
// like how "Home" is handled.
export const pageStructure = (
typeDefArray: DocumentDefinition[],
): StructureResolver => {
return (S) => {
// Goes through all of the singletons that were provided and translates them into something the
// Structure tool can understand
const singletonItems = typeDefArray.map((typeDef) => {
return S.listItem()
.title(typeDef.title!)
.icon(typeDef.icon)
.child(
S.editor()
.id(typeDef.name)
.schemaType(typeDef.name)
.documentId(typeDef.name),
);
});
// The default root list items (except custom ones)
const defaultListItems = S.documentTypeListItems().filter(
(listItem) =>
!typeDefArray.find((singleton) => singleton.name === listItem.getId()),
);
return S.list()
.title("Content")
.items([...singletonItems, S.divider(), ...defaultListItems]);
};
};
``` | /content/code_sandbox/examples/cms-sanity/sanity/plugins/settings.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 447 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="path_to_url"
android:width="18dp"
android:height="18dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="1"
android:viewportWidth="1">
<group
android:translateX="@dimen/digit_translateX"
android:translateY="@dimen/digit_translateY">
<path
android:name="iconPath"
android:pathData="@string/path_eight"
android:strokeColor="@android:color/white"
android:strokeWidth="@dimen/digit_strokewidth"/>
</group>
</vector>
``` | /content/code_sandbox/app/src/main/res/drawable/vd_pathmorph_digits_eight.xml | xml | 2016-11-04T14:23:35 | 2024-08-12T07:50:44 | adp-delightful-details | alexjlockwood/adp-delightful-details | 1,070 | 152 |
```xml
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
<domain:add>
<domain:ns>
<domain:hostObj>ns2.example.foo</domain:hostObj>
</domain:ns>
<domain:status s="serverHold"
lang="en">Payment overdue.</domain:status>
</domain:add>
<domain:rem>
<domain:ns>
<domain:hostObj>ns1.example.foo</domain:hostObj>
</domain:ns>
<domain:status s="clientUpdateProhibited"/>
</domain:rem>
<domain:chg>
<domain:registrant>sh8013</domain:registrant>
<domain:authInfo>
<domain:pw>2BARfoo</domain:pw>
</domain:authInfo>
</domain:chg>
</domain:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
``` | /content/code_sandbox/core/src/test/resources/google/registry/flows/domain/domain_update_prohibited_status.xml | xml | 2016-02-29T20:16:48 | 2024-08-15T19:49:29 | nomulus | google/nomulus | 1,685 | 264 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="path_to_url"
android:id="@+id/no_network_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/no_network_retry_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"
android:padding="15dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/ic_no_network"
/>
<TextView
android:id="@+id/no_network_view_tv"
style="@style/MultipleStatusView.Content"
android:layout_gravity="center_horizontal"
android:text="@string/no_network_view_hint"
android:textSize="@dimen/small_size"/>
</LinearLayout>
</RelativeLayout>
``` | /content/code_sandbox/app/src/main/res/layout/custom_no_network_view.xml | xml | 2016-02-02T05:18:46 | 2024-08-15T02:04:44 | GanK | dongjunkun/GanK | 1,163 | 218 |
```xml
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Counter of document updates failed to be sent to the server and saved.
*/
export interface HttpsProtonMeDocsDocumentUpdatesSaveErrorTotalV1SchemaJson {
Labels: {
type: "server_error" | "network_error" | "update_too_big" | "document_too_big" | "unknown";
};
Value: number;
}
``` | /content/code_sandbox/packages/metrics/types/docs_document_updates_save_error_total_v1.schema.d.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 127 |
```xml
import { fromUnixTime, isBefore } from 'date-fns';
import { getAppFromPathnameSafe } from '@proton/shared/lib/apps/slugHelper';
import { APPS } from '@proton/shared/lib/constants';
import { isManagedExternally, isTrial } from '@proton/shared/lib/helpers/subscription';
import type { ProtonConfig, Subscription, UserModel } from '@proton/shared/lib/interfaces';
import { FREE_DOWNGRADER_LIMIT } from '../../helpers/offerPeriods';
interface Props {
subscription?: Subscription;
protonConfig: ProtonConfig;
user: UserModel;
lastSubscriptionEnd?: number;
}
const isEligible = ({ subscription, protonConfig, user, lastSubscriptionEnd = 0 }: Props) => {
const parentApp = getAppFromPathnameSafe(window.location.pathname);
const hasValidApp =
(protonConfig.APP_NAME === APPS.PROTONACCOUNT && parentApp === APPS.PROTONMAIL) ||
(protonConfig.APP_NAME === APPS.PROTONACCOUNT && parentApp === APPS.PROTONCALENDAR) ||
protonConfig.APP_NAME === APPS.PROTONCALENDAR ||
protonConfig.APP_NAME === APPS.PROTONMAIL;
const { canPay, isDelinquent, isFree } = user;
const notDelinquent = !isDelinquent;
const isNotExternal = !isManagedExternally(subscription);
const hasTrial = isTrial(subscription);
return (
hasValidApp &&
isNotExternal &&
canPay &&
notDelinquent &&
(hasTrial || (isFree && isBefore(fromUnixTime(lastSubscriptionEnd), FREE_DOWNGRADER_LIMIT)))
);
};
export default isEligible;
``` | /content/code_sandbox/packages/components/containers/offers/operations/blackFridayInbox2023Free/eligibility.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 366 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="path_to_url"
android:orientation="vertical" android:layout_width="match_parent"
android:padding="20dp"
android:layout_height="wrap_content">
<androidx.core.widget.ContentLoadingProgressBar
android:layout_width="match_parent"
android:id="@+id/pb"
style="?android:attr/progressBarStyleHorizontal"
android:progressDrawable="@drawable/progressbar_horizontal"
android:max="100"
android:progress="0"
android:layout_height="15dp" />
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textSize="15sp"
android:textColor="@color/versionchecklib_theme_color"
android:text="@string/versionchecklib_downloading"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/tv_progress"
android:text="@string/versionchecklib_progress"
android:textColor="@color/versionchecklib_theme_color"
android:textSize="15sp"
android:layout_alignParentRight="true"
android:layout_height="wrap_content" />
</RelativeLayout>
</LinearLayout>
``` | /content/code_sandbox/sample/src/main/res/layout/custom_download_layout.xml | xml | 2016-09-23T04:47:25 | 2024-08-09T06:58:52 | CheckVersionLib | AlexLiuSheng/CheckVersionLib | 2,661 | 294 |
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/janino/src/test/java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="2"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=janino/src\/test\/java=/test=/true=/=/optional=/true=/=/maven.pomderived=/true=/"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="5" projectName="janino" type="1"/> "/>
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" path="5" type="4"/> "/>
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="5" projectName="jdisasm" type="1"/> "/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<listAttribute key="org.eclipse.jdt.launching.MODULEPATH">
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11" path="4" type="4"/> "/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="janino"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xverify:all -DxxSimpleCompiler.disassembleClassFilesToStdout=true -DxxAbstractCompiler.disassembleClassFilesToStdout=true -Dxxorg.codehaus.commons.compiler.util.Disassembler.printStackMap=true -Dxxorg.codehaus.commons.compiler.util.Disassembler.printAllOffsets=true -Dxxorg.codehaus.commons.compiler.util.Disassembler.printAllAttributes=true -Dxxorg.codehaus.commons.compiler.util.Disassembler.dumpConstantPool=true -Dxxorg.codehaus.commons.compiler.util.Disassembler.showClassPoolIndexes=true"/>
</launchConfiguration>
``` | /content/code_sandbox/janino/launch/janino-tests (JavaSE-11).launch | xml | 2016-06-12T16:42:49 | 2024-08-16T02:16:53 | janino | janino-compiler/janino | 1,225 | 973 |
```xml
import type { AppProps } from 'next/app'
import { ThemeProvider } from 'next-themes'
import { Analytics } from '@vercel/analytics/react'
import Layout from 'src/components/Layout'
import 'src/utils/theme/theme.css'
const App = (props: AppProps) => (
<ThemeProvider>
<Layout>
<props.Component {...props.pageProps} />
<Analytics />
</Layout>
</ThemeProvider>
)
export default App
``` | /content/code_sandbox/packages/website/src/pages/_app.tsx | xml | 2016-10-21T09:36:02 | 2024-08-16T14:16:08 | gitmoji | carloscuesta/gitmoji | 15,539 | 97 |
```xml
/**
* A general error class that should be used for all errors in Expo modules.
* Guarantees a `code` field that can be used to differentiate between different
* types of errors without further subclassing Error.
*/
export declare class CodedError extends Error {
code: string;
info?: any;
constructor(code: string, message: string);
}
//# sourceMappingURL=CodedError.d.ts.map
``` | /content/code_sandbox/packages/expo-modules-core/build/errors/CodedError.d.ts | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 85 |
```xml
<layer-list xmlns:android="path_to_url">
<item>
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="?attr/colorSecondary" />
<solid android:color="@color/white_white_005" />
<corners android:radius="5dp" />
</shape>
</item>
</layer-list>
``` | /content/code_sandbox/app/src/main/res/drawable/background_item_grid_selected.xml | xml | 2016-05-04T11:46:20 | 2024-08-15T16:29:10 | android | meganz/android | 1,537 | 86 |
```xml
export { bundle } from './vite'
export type { ViteBuildContext } from './vite'
``` | /content/code_sandbox/packages/vite/src/index.ts | xml | 2016-10-26T11:18:47 | 2024-08-16T19:32:46 | nuxt | nuxt/nuxt | 53,705 | 22 |
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\common\Execution.cs" Link="Execution.cs" />
<Compile Include="..\common\StringUtils.cs" Link="StringUtils.cs" />
</ItemGroup>
</Project>
``` | /content/code_sandbox/tools/governance/governance.csproj | xml | 2016-04-20T18:24:26 | 2024-08-16T13:29:19 | xamarin-macios | xamarin/xamarin-macios | 2,436 | 92 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="path_to_url"
xmlns:activiti="path_to_url"
targetNamespace="test">
<process id="testProcess2" name="test">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="end" />
<endEvent id="end" />
</process>
</definitions>
``` | /content/code_sandbox/modules/flowable5-test/src/test/resources/org/activiti/engine/test/repository/latest/version_testProcess2_one.bpmn20.xml | xml | 2016-10-13T07:21:43 | 2024-08-16T15:23:14 | flowable-engine | flowable/flowable-engine | 7,715 | 100 |
```xml
/*
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
*/
import {shallow} from 'enzyme';
import {ComposedModal, ModalBody} from '@carbon/react';
import Modal from './Modal';
it('should render without throwing an error', () => {
const node = shallow(<Modal />);
expect(node.exists()).toBe(true);
});
it('should render children', () => {
const node = shallow(
<Modal open>
<div>Child content</div>
</Modal>
);
expect(node.find('div').text()).toEqual('Child content');
});
it('should call onClose when close button is clicked', () => {
const spy = jest.fn();
const node = shallow(<Modal open onClose={spy} />);
node.find(ComposedModal).simulate('close');
expect(spy).toHaveBeenCalled();
});
it('should call onClick callback when clicked', () => {
const spy = jest.fn();
const node = shallow(<Modal.Content onClick={spy}>Some Content</Modal.Content>);
node.find(ModalBody).simulate('click', {stopPropagation: jest.fn()});
expect(spy).toHaveBeenCalled();
});
it('should call onMouseDown callback when mouse down', () => {
const spy = jest.fn();
const node = shallow(<Modal.Content onMouseDown={spy}>Some Content</Modal.Content>);
node.find(ModalBody).simulate('mousedown', {stopPropagation: jest.fn()});
expect(spy).toHaveBeenCalled();
});
it('should stop propagation of events', () => {
const spy = jest.fn();
const node = shallow(<Modal.Content>Some Content</Modal.Content>);
node.find(ModalBody).simulate('click', {
stopPropagation: spy,
});
expect(spy).toHaveBeenCalled();
});
it('should set aria label from modal header title when no label', () => {
const node = shallow(
<Modal open>
<Modal.Header title="Title" />
</Modal>
);
expect(node.find(ComposedModal).prop('aria-label')).toEqual('Title');
});
it('should set aria label from modal header label', () => {
const node = shallow(
<Modal open>
<Modal.Header title="Title" label="Label" />
</Modal>
);
expect(node.find(ComposedModal).prop('aria-label')).toEqual('Label');
});
``` | /content/code_sandbox/optimize/client/src/modules/components/Modal/Modal.test.tsx | xml | 2016-03-20T03:38:04 | 2024-08-16T19:59:58 | camunda | camunda/camunda | 3,172 | 506 |
```xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url">
<plist version="1.0">
<array>
<array>
<string>public.default</string>
<string>glyphs</string>
</array>
</array>
</plist>
``` | /content/code_sandbox/sources/ufo/PublicSans-ThinItalic.ufo/layercontents.plist | xml | 2016-11-04T13:51:35 | 2024-08-16T16:28:40 | public-sans | uswds/public-sans | 4,449 | 83 |
```xml
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
export namespace documentdb {
export interface CompositePathResponse {
/**
* Sort order for composite paths.
*/
order?: string;
/**
* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)
*/
path?: string;
}
/**
* Cosmos DB indexing policy
*/
export interface IndexingPolicyResponse {
/**
* List of composite path list
*/
compositeIndexes?: outputs.documentdb.CompositePathResponse[][];
}
export interface SqlContainerGetPropertiesResponseResource {
/**
* The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container
*/
indexingPolicy?: outputs.documentdb.IndexingPolicyResponse;
}
}
``` | /content/code_sandbox/tests/testdata/codegen/azure-native-nested-types/nodejs/types/output.ts | xml | 2016-10-31T21:02:47 | 2024-08-16T19:47:04 | pulumi | pulumi/pulumi | 20,743 | 227 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="path_to_url">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{58A7E7A9-1DAB-403B-A5FA-882987254EF0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Atomix.Kernel_H</RootNamespace>
<AssemblyName>Atomix.Kernel_H</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Build\Bin\</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Build\Bin\</OutputPath>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\..\Build\Bin\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Arch\x86\GDT.cs" />
<Compile Include="Arch\x86\IDT.cs" />
<Compile Include="Arch\x86\Multiboot.cs" />
<Compile Include="Arch\x86\Paging.cs" />
<Compile Include="Arch\x86\PIC.cs" />
<Compile Include="Arch\x86\PortIO.cs" />
<Compile Include="Arch\x86\SHM.cs" />
<Compile Include="Core\GC.cs" />
<Compile Include="Core\Syscall.cs" />
<Compile Include="Exec\ELF.cs" />
<Compile Include="Core\Monitor.cs" />
<Compile Include="Devices\MBR.cs" />
<Compile Include="Devices\Partition.cs" />
<Compile Include="Devices\Storage.cs" />
<Compile Include="Drivers\Buses\ATA\IDE.cs" />
<Compile Include="Drivers\Buses\ATA\misc.cs" />
<Compile Include="Drivers\Input\Keyboard.cs" />
<Compile Include="Drivers\Input\Mouse.cs" />
<Compile Include="Gui\Compositor.cs" />
<Compile Include="Core\Debug.cs" />
<Compile Include="Core\Fault.cs" />
<Compile Include="Core\Heap.cs" />
<Compile Include="Core\Process.cs" />
<Compile Include="Core\Scheduler.cs" />
<Compile Include="Core\Task.cs" />
<Compile Include="Core\Thread.cs" />
<Compile Include="Devices\Timer.cs" />
<Compile Include="Boot.cs" />
<Compile Include="Gui\GuiRequest.cs" />
<Compile Include="Gui\Programs\Explorer.cs" />
<Compile Include="Gui\Window.cs" />
<Compile Include="IO\FileSystem\FatFileSystem.cs" />
<Compile Include="IO\FileSystem\FAT\FatStream.cs" />
<Compile Include="IO\FileSystem\FAT\FileLocation.cs" />
<Compile Include="IO\FileSystem\FAT\Find\Any.cs" />
<Compile Include="IO\FileSystem\FAT\Find\ByCluster.cs" />
<Compile Include="IO\FileSystem\FAT\Find\Empty.cs" />
<Compile Include="IO\FileSystem\FAT\Find\WithName.cs" />
<Compile Include="IO\FileSystem\FAT\misc.cs" />
<Compile Include="IO\FileSystem\GenericFileSystem.cs" />
<Compile Include="IO\FileSystem\RamFileSystem.cs" />
<Compile Include="IO\FileSystem\RFS\FileStream.cs" />
<Compile Include="IO\FileSystem\RFS\RamFile.cs" />
<Compile Include="IO\FileSystem\VirtualFileSystem.cs" />
<Compile Include="Drivers\Video\VBE.cs" />
<Compile Include="IO\Pipe.cs" />
<Compile Include="IO\Stream.cs" />
<Compile Include="Lib\Cairo\ColorFormat.cs" />
<Compile Include="Lib\Cairo\Font.cs" />
<Compile Include="Lib\Cairo\Cairo.cs" />
<Compile Include="Lib\Cairo\Operator.cs" />
<Compile Include="Lib\Cairo\Status.cs" />
<Compile Include="Lib\ds\IDictionary.cs" />
<Compile Include="Lib\ds\IList.cs" />
<Compile Include="Lib\ds\IQueue.cs" />
<Compile Include="Lib\ds\ISet.cs" />
<Compile Include="Lib\ds\misc.cs" />
<Compile Include="Lib\ds\Pair.cs" />
<Compile Include="Lib\Marshal.cs" />
<Compile Include="Lib\Numerics.cs" />
<Compile Include="plugs\Convert.cs" />
<Compile Include="plugs\Helper.cs" />
<Compile Include="plugs\Math.cs" />
<Compile Include="plugs\Numerics.cs" />
<Compile Include="plugs\String.cs" />
<Compile Include="Start-x86.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="linker.ld" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Compiler\Atomixilc\Atomixilc.csproj">
<Project>{37d928f2-4035-431f-8027-f8ed1b6edd80}</Project>
<Name>Atomixilc</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
``` | /content/code_sandbox/src/Kernel/Atomix.Kernel_H/Atomix.Kernel_H.csproj | xml | 2016-04-11T15:56:39 | 2024-08-12T19:22:17 | AtomOS | amaneureka/AtomOS | 1,260 | 1,809 |
```xml
import type { APP_NAMES } from '@proton/shared/lib/constants';
import type { Parameters } from '../../pages/interface';
const loginJsonContext = require.context('../../pages', true, /login.ts$/, 'sync');
const loginJsonKeys = loginJsonContext.keys();
const getContext = (key: string): { default: () => Parameters } => {
if (loginJsonKeys.some((otherKey) => otherKey === key)) {
return loginJsonContext(key);
}
return loginJsonContext('./login.ts');
};
export const getLoginMeta = (toApp: APP_NAMES | undefined): Parameters => {
const productName = (toApp || '').replace('proton-', '').replace('-settings', '');
return getContext(`./${productName}.login.ts`).default();
};
``` | /content/code_sandbox/applications/account/src/app/login/loginPagesJson.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 160 |
```xml
import { normalizeStyleOptions, StyleOptions } from 'botframework-webchat-api';
import createActivitiesStyle from './StyleSet/Activities';
import createActivityButtonStyle from './StyleSet/ActivityButton';
import createActivityCopyButtonStyle from './StyleSet/ActivityCopyButton';
import createAudioAttachmentStyle from './StyleSet/AudioAttachment';
import createAudioContentStyle from './StyleSet/AudioContent';
import createAutoResizeTextAreaStyle from './StyleSet/AutoResizeTextArea';
import createAvatarStyle from './StyleSet/Avatar';
import createBasicTranscriptStyle from './StyleSet/BasicTranscript';
import createBubbleStyle from './StyleSet/Bubble';
import createCarouselFilmStrip from './StyleSet/CarouselFilmStrip';
import createCarouselFilmStripAttachment from './StyleSet/CarouselFilmStripAttachment';
import createCarouselFlipper from './StyleSet/CarouselFlipper';
import createCitationModalDialogStyle from './StyleSet/CitationModalDialog';
import createConnectivityNotification from './StyleSet/ConnectivityNotification';
import createCSSCustomPropertiesStyle from './StyleSet/CSSCustomProperties';
import createDictationInterimsStyle from './StyleSet/DictationInterims';
import createErrorBoxStyle from './StyleSet/ErrorBox';
import createErrorNotificationStyle from './StyleSet/ErrorNotification';
import createFileContentStyle from './StyleSet/FileContent';
import createImageAvatarStyle from './StyleSet/ImageAvatar';
import createInitialsAvatarStyle from './StyleSet/InitialsAvatar';
import createLinkDefinitionsStyle from './StyleSet/LinkDefinitions';
import createMicrophoneButtonStyle from './StyleSet/MicrophoneButton';
import createModalDialogStyle from './StyleSet/ModalDialog';
import createMonochromeImageMaskerStyleSet from './StyleSet/MonochromeImageMasker';
import createRenderMarkdownStyle from './StyleSet/RenderMarkdown';
import createRootStyle from './StyleSet/Root';
import createScrollToEndButtonStyle from './StyleSet/ScrollToEndButton';
import createSendBoxButtonStyle from './StyleSet/SendBoxButton';
import createSendBoxStyle from './StyleSet/SendBox';
import createSendBoxTextBoxStyle from './StyleSet/SendBoxTextBox';
import createSendStatusStyle from './StyleSet/SendStatus';
import createSingleAttachmentActivityStyle from './StyleSet/SingleAttachmentActivity';
import createSlottedActivityStatusStyle from './StyleSet/SlottedActivityStatus';
import createSpinnerAnimationStyle from './StyleSet/SpinnerAnimation';
import createStackedLayoutStyle from './StyleSet/StackedLayout';
import createSuggestedActionsStyle from './StyleSet/SuggestedActions';
import createSuggestedActionStyle from './StyleSet/SuggestedAction';
import createTextContentStyle from './StyleSet/TextContent';
import createThumbButtonStyle from './StyleSet/ThumbButton';
import createToasterStyle from './StyleSet/Toaster';
import createToastStyle from './StyleSet/Toast';
import createTypingAnimationStyle from './StyleSet/TypingAnimation';
import createTypingIndicatorStyle from './StyleSet/TypingIndicator';
import createUploadButtonStyle from './StyleSet/UploadButton';
import createVideoAttachmentStyle from './StyleSet/VideoAttachment';
import createVideoContentStyle from './StyleSet/VideoContent';
import createVimeoContentStyle from './StyleSet/VimeoContent';
import createWarningNotificationStyle from './StyleSet/WarningNotification';
import createYouTubeContentStyle from './StyleSet/YouTubeContent';
// TODO: [P4] We should add a notice for people who want to use "styleSet" instead of "styleOptions".
// "styleSet" is actually CSS stylesheet and it is based on the DOM tree.
// DOM tree may change from time to time, thus, maintaining "styleSet" becomes a constant effort.
export default function createStyleSet(styleOptions: StyleOptions) {
const strictStyleOptions = normalizeStyleOptions(styleOptions);
return Object.freeze({
activities: createActivitiesStyle(),
activityButton: createActivityButtonStyle(),
activityCopyButton: createActivityCopyButtonStyle(),
audioAttachment: createAudioAttachmentStyle(strictStyleOptions),
audioContent: createAudioContentStyle(),
autoResizeTextArea: createAutoResizeTextAreaStyle(strictStyleOptions),
avatar: createAvatarStyle(strictStyleOptions),
basicTranscript: createBasicTranscriptStyle(strictStyleOptions),
bubble: createBubbleStyle(strictStyleOptions),
carouselFilmStrip: createCarouselFilmStrip(strictStyleOptions),
carouselFilmStripAttachment: createCarouselFilmStripAttachment(strictStyleOptions),
carouselFlipper: createCarouselFlipper(strictStyleOptions),
connectivityNotification: createConnectivityNotification(strictStyleOptions),
dictationInterims: createDictationInterimsStyle(strictStyleOptions),
errorBox: createErrorBoxStyle(strictStyleOptions),
errorNotification: createErrorNotificationStyle(strictStyleOptions),
fileContent: createFileContentStyle(strictStyleOptions),
imageAvatar: createImageAvatarStyle(strictStyleOptions),
initialsAvatar: createInitialsAvatarStyle(strictStyleOptions),
microphoneButton: createMicrophoneButtonStyle(strictStyleOptions),
monochromeImageMasker: createMonochromeImageMaskerStyleSet(),
options: { ...strictStyleOptions }, // Cloned to make sure no additional modifications will propagate up.
root: createRootStyle(strictStyleOptions),
scrollToEndButton: createScrollToEndButtonStyle(strictStyleOptions),
sendBox: createSendBoxStyle(strictStyleOptions),
sendBoxButton: createSendBoxButtonStyle(strictStyleOptions),
sendBoxTextBox: createSendBoxTextBoxStyle(strictStyleOptions),
singleAttachmentActivity: createSingleAttachmentActivityStyle(strictStyleOptions),
spinnerAnimation: createSpinnerAnimationStyle(strictStyleOptions),
stackedLayout: createStackedLayoutStyle(strictStyleOptions),
suggestedAction: createSuggestedActionStyle(strictStyleOptions),
suggestedActions: createSuggestedActionsStyle(strictStyleOptions),
toast: createToastStyle(strictStyleOptions),
toaster: createToasterStyle(strictStyleOptions),
typingAnimation: createTypingAnimationStyle(strictStyleOptions),
typingIndicator: createTypingIndicatorStyle(strictStyleOptions),
uploadButton: createUploadButtonStyle(strictStyleOptions),
videoAttachment: createVideoAttachmentStyle(),
videoContent: createVideoContentStyle(strictStyleOptions),
vimeoContent: createVimeoContentStyle(strictStyleOptions),
warningNotification: createWarningNotificationStyle(strictStyleOptions),
youTubeContent: createYouTubeContentStyle(strictStyleOptions),
// Following styles follows new house rules:
// - Use CSS var instead of strictStyleOptions
citationModalDialog: createCitationModalDialogStyle(),
cssCustomProperties: createCSSCustomPropertiesStyle(strictStyleOptions),
linkDefinitions: createLinkDefinitionsStyle(),
modalDialog: createModalDialogStyle(),
renderMarkdown: createRenderMarkdownStyle(),
sendStatus: createSendStatusStyle(),
slottedActivityStatus: createSlottedActivityStatusStyle(),
textContent: createTextContentStyle(),
thumbButton: createThumbButtonStyle()
} as const);
}
``` | /content/code_sandbox/packages/component/src/Styles/createStyleSet.ts | xml | 2016-07-07T23:16:57 | 2024-08-16T00:12:37 | BotFramework-WebChat | microsoft/BotFramework-WebChat | 1,567 | 1,452 |
```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.
-->
<PreferenceScreen
xmlns:android="path_to_url">
<ListPreference
android:key="browser_selection"
android:title="@string/browser_selection"
android:defaultValue="article"
android:entries="@array/browser_selection"
android:entryValues="@array/browser_selection_inserted" />
<ListPreference
android:key="quote_style"
android:title="@string/quote_style"
android:defaultValue="0"
android:entries="@array/quote_style"
android:entryValues="@array/quote_style_inserted" />
<SwitchPreference
android:key="followers_only_auto_complete"
android:title="@string/followers_only_auto_complete"
android:summary="@string/followers_only_auto_complete_summary"
android:defaultValue="false" />
<SwitchPreference
android:key="hashtag_auto_complete"
android:title="@string/auto_complete_hashtags"
android:summary="@string/auto_complete_hashtags_summary"
android:defaultValue="true" />
<SwitchPreference
android:key="fav_rt_multiple_accounts"
android:title="@string/fav_rt_multiple_accounts"
android:summary="@string/fav_rt_multiple_accounts_summary"
android:defaultValue="true" />
<SwitchPreference
android:key="top_down_mode"
android:title="@string/top_down"
android:summary="@string/top_down_summary"
android:defaultValue="false" />
<SwitchPreference
android:key="auto_insert_hashtags"
android:title="@string/auto_insert_hashtags"
android:summary="@string/to_replies"
android:defaultValue="false" />
<SwitchPreference
android:key="use_peek"
android:title="@string/use_peek"
android:summary="@string/use_peek_description"
android:defaultValue="true" />
</PreferenceScreen>
``` | /content/code_sandbox/app/src/main/res/xml/settings_other_options.xml | xml | 2016-07-08T03:18:40 | 2024-08-14T02:54:51 | talon-for-twitter-android | klinker24/talon-for-twitter-android | 1,189 | 431 |
```xml
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedTestingModule } from 'src/app/shared/shared.module';
import { JobServiceDashboardComponent } from './job-service-dashboard.component';
import { NO_ERRORS_SCHEMA } from '@angular/core';
describe('JobServiceDashboardComponent', () => {
let component: JobServiceDashboardComponent;
let fixture: ComponentFixture<JobServiceDashboardComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [NO_ERRORS_SCHEMA],
imports: [SharedTestingModule],
declarations: [JobServiceDashboardComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(JobServiceDashboardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
``` | /content/code_sandbox/src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.component.spec.ts | xml | 2016-01-28T21:10:28 | 2024-08-16T15:28:34 | harbor | goharbor/harbor | 23,335 | 167 |
```xml
import * as useUserModule from '@proton/account/user/hooks';
import type { UserModel } from '@proton/shared/lib/interfaces';
import { buildUser } from '../builders';
export const mockUseUser = (value: [Partial<UserModel>?, boolean?] = []) => {
const [user, cached = false] = value;
const mockedUseUser = jest.spyOn(useUserModule, 'useUser');
mockedUseUser.mockReturnValue([buildUser(user), Boolean(cached)]);
return mockedUseUser;
};
``` | /content/code_sandbox/packages/testing/lib/mockUseUser.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 109 |
```xml
<controls:ContentPopup x:Class="Telegram.Views.Popups.ChatMutePopup"
xmlns="path_to_url"
xmlns:d="path_to_url"
xmlns:x="path_to_url"
xmlns:mc="path_to_url"
xmlns:controls="using:Telegram.Controls"
mc:Ignorable="d"
Title="Mute for..."
PrimaryButtonText="OK"
SecondaryButtonText="Cancel"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick">
<Grid Padding="4,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="8" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Background="{ThemeResource TextControlBackgroundFocused}"
BorderBrush="{ThemeResource TextControlBorderBrushFocused}"
BorderThickness="{ThemeResource TextControlBorderThemeThicknessFocused}"
CornerRadius="{ThemeResource ControlCornerRadius}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Margin="-4,0,0,0"
Height="80" />
<Border Grid.Column="2"
Background="{ThemeResource TextControlBackgroundFocused}"
BorderBrush="{ThemeResource TextControlBorderBrushFocused}"
BorderThickness="{ThemeResource TextControlBorderThemeThicknessFocused}"
CornerRadius="{ThemeResource ControlCornerRadius}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Margin="0,0,-4,0"
Height="80" />
<!--<TextBlock Text=""
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Padding="0,4,0,18"
FontFamily="Segoe UI"
FontSize="40"
FontWeight="Bold"
TextLineBounds="Tight"
TextAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="1" />-->
<controls:LoopingPicker x:Name="DaysPicker"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ValueChanged="DaysPicker_ValueChanged"
Maximum="365" />
<controls:LoopingPicker x:Name="HoursPicker"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ValueChanged="HoursPicker_ValueChanged"
Maximum="23"
Grid.Column="2" />
</Grid>
</controls:ContentPopup>
``` | /content/code_sandbox/Telegram/Views/Popups/ChatMutePopup.xaml | xml | 2016-05-23T09:03:33 | 2024-08-16T16:17:48 | Unigram | UnigramDev/Unigram | 3,744 | 489 |
```xml
///
///
///
/// path_to_url
///
/// Unless required by applicable law or agreed to in writing, software
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
///
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { select, Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { UserSettingsService } from '@core/http/user-settings.service';
import { mergeMap, withLatestFrom } from 'rxjs/operators';
import { AuthActions, AuthActionTypes } from '@core/auth/auth.actions';
import { selectAuthState } from '@core/auth/auth.selectors';
@Injectable()
export class AuthEffects {
constructor(
private actions$: Actions<AuthActions>,
private store: Store<AppState>,
private userSettingsService: UserSettingsService
) {
}
persistOpenedMenuSections = createEffect(() => this.actions$.pipe(
ofType(
AuthActionTypes.UPDATE_OPENED_MENU_SECTION,
),
withLatestFrom(this.store.pipe(select(selectAuthState))),
mergeMap(([action, state]) => this.userSettingsService.putUserSettings({ openedMenuSections: state.userSettings.openedMenuSections }))
), {dispatch: false});
putUserSettings = createEffect(() => this.actions$.pipe(
ofType(
AuthActionTypes.PUT_USER_SETTINGS,
),
mergeMap((state) => this.userSettingsService.putUserSettings(state.payload))
), {dispatch: false});
deleteUserSettings = createEffect(() => this.actions$.pipe(
ofType(
AuthActionTypes.DELETE_USER_SETTINGS,
),
mergeMap((state) => this.userSettingsService.deleteUserSettings(state.payload))
), {dispatch: false});
}
``` | /content/code_sandbox/ui-ngx/src/app/core/auth/auth.effects.ts | xml | 2016-12-01T09:33:30 | 2024-08-16T19:58:25 | thingsboard | thingsboard/thingsboard | 16,820 | 360 |
```xml
import EmptyState from "@erxes/ui/src/components/EmptyState";
import HeaderDescription from "@erxes/ui/src/components/HeaderDescription";
import { __ } from "@erxes/ui/src/utils/core";
import Wrapper from "@erxes/ui/src/layout/components/Wrapper";
import React from "react";
import Boards from "../containers/Boards";
import Groups from "../containers/Groups";
import { useLocation, useNavigate } from "react-router-dom";
type Props = {
boardId: string;
queryParams: any;
};
const Home =(props:Props)=> {
const { boardId, queryParams } = props;
const navigate = useNavigate();
const location = useLocation();
const breadcrumb = [
{ title: __("Settings"), link: "/settings" },
{ title: __("Calendar"), link: `/settings/calendars` },
];
return (
<Wrapper
header={
<Wrapper.Header title={__("Calendar")} breadcrumb={breadcrumb} />
}
mainHead={
<HeaderDescription
icon="/images/actions/34.svg"
title={__(`Group & Calendar`)}
description={`${__(
`Manage your boards and calendars so that its easy to manage incoming pop ups or requests that is adaptable to your team's needs`
)}.${__(
`Add in or delete boards and calendars to keep business development on track and in check`
)}`}
/>
}
leftSidebar={<Boards currentBoardId={boardId} navigate={navigate} location={location} />}
content={
boardId ? (
<Groups
boardId={boardId}
queryParams={queryParams}
navigate={navigate}
location={location}
/>
) : (
<EmptyState
text={`Get started on your board`}
image="/images/actions/16.svg"
/>
)
}
hasBorder={true}
transparent={true}
/>
);
}
export default Home;
``` | /content/code_sandbox/packages/plugin-calendar-ui/src/settings/components/Home.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 402 |
```xml
export default function Page({ params }) {
return (
<div>
Hello from [this-is-my-route]/some-page. Param:{' '}
{params['this-is-my-route']}
</div>
)
}
``` | /content/code_sandbox/test/e2e/app-dir/parallel-routes-and-interception/app/interception-route-special-params/[this-is-my-route]/some-page/page.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 48 |
```xml
export * from './menu-list';
export * from './menu-item';
export * from './menu-label';
export * from './menu-divider';
``` | /content/code_sandbox/src/webviews/apps/shared/components/menu/index.ts | xml | 2016-08-08T14:50:30 | 2024-08-15T21:25:09 | vscode-gitlens | gitkraken/vscode-gitlens | 8,889 | 29 |
```xml
import type { ButtonProps } from '@proton/atoms';
import { Button } from '@proton/atoms';
import type { IconProps } from '@proton/components';
import { Icon } from '@proton/components';
import clsx from '@proton/utils/clsx';
interface Props {
title: string;
className?: string;
expanded: boolean;
onClick: () => void;
style?: React.CSSProperties;
size?: IconProps['size'];
pill?: ButtonProps['pill'];
iconCollapsed?: IconProps['name'];
iconExpanded?: IconProps['name'];
}
export default function SidebarExpandButton({
className,
title,
expanded,
onClick,
style,
size,
pill,
iconCollapsed = 'chevron-right-filled',
iconExpanded = 'chevron-down-filled',
}: Props) {
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
e.preventDefault();
onClick();
};
return (
<Button
shape="ghost"
size="small"
icon
className={clsx(['shrink-0 flex items-center drive-sidebar--button-expand', className])}
onClick={handleClick}
aria-expanded={expanded}
title={title}
style={style}
data-testid={expanded ? 'sidebar-expanded-folder' : 'sidebar-expand-folder'}
pill={pill}
>
<Icon size={size} name={expanded ? iconExpanded : iconCollapsed} alt={title} />
</Button>
);
}
``` | /content/code_sandbox/packages/components/components/button/SidebarExpandButton.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 323 |
```xml
export function formatVariant(
scenario: string,
props: Record<string, string | number | boolean | null>
): string {
const keys = Object.keys(props)
.filter((key) => props[key] !== false && props[key] !== null)
.map((key) => (props[key] === true ? key : `${key}=${props[key]}`));
if (keys.length === 0) {
return scenario;
}
return `${scenario} ${keys.join(" ")}`;
}
``` | /content/code_sandbox/turbopack/packages/devlow-bench/src/utils.ts | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 108 |
```xml
import { expect, test, describe, afterAll } from 'vitest';
import { startFixture, setupStartBrowser } from '../utils/start';
import type { Page } from '../utils/browser';
import type Browser from '../utils/browser';
const example = 'with-suspense-ssr';
describe(`start ${example}`, () => {
let page: Page;
let browser: Browser;
let serverPort;
test('open /', async () => {
const { devServer, port } = await startFixture(example, {
mock: true,
force: true,
https: false,
analyzer: false,
open: false,
mode: 'start',
});
serverPort = port;
const res = await setupStartBrowser({ server: devServer, port });
page = res.page;
browser = res.browser;
expect(await page.$$text('h2')).toStrictEqual(['Home Page', 'Thanks for reading!']);
});
test('open /with-data-error', async () => {
const page = await browser.page(`path_to_url{serverPort}`, '/with-data-error', false);
expect((await page.$$text('.comment')).length).toEqual(3);
});
test('open /with-data-error without hydrate', async () => {
const page = await browser.page(`path_to_url{serverPort}`, '/with-data-error', true);
expect((await page.$$text('.comment')).length).toEqual(0);
});
test('open /with-render-error', async () => {
const page = await browser.page(`path_to_url{serverPort}`, '/with-render-error', false);
expect((await page.$$text('.comment')).length).toEqual(3);
});
test('open /with-render-error without hydrate', async () => {
const page = await browser.page(`path_to_url{serverPort}`, '/with-render-error', true);
expect((await page.$$text('.comment')).length).toEqual(0);
});
test('open /with-fallback', async () => {
const page = await browser.page(`path_to_url{serverPort}`, '/with-fallback', false);
expect(await page.$$text('#fallback')).toStrictEqual(['Something went wrong.']);
});
afterAll(async () => {
await browser.close();
});
});
``` | /content/code_sandbox/tests/integration/with-suspense-ssr.test.ts | xml | 2016-11-03T06:59:15 | 2024-08-16T10:11:29 | ice | alibaba/ice | 17,815 | 490 |
```xml
import {useCallback, useContext, useEffect, useState} from 'react';
import {StreamsContext} from "./streamsContext";
import {ApplicationContext} from "cad/context";
import {Emitter, Stream} from "lstream";
import produce from "immer";
export function useStream<T>(getStream: Stream<T> | ((ctx: ApplicationContext) => Stream<T>)) : T {
const basicStreams = useContext(StreamsContext);
const [state, setState] = useState<{data: T}>();
const stream: Emitter<T> = resolveStream(getStream, basicStreams);
if (!stream) {
console.log(getStream);
throw "no stream ^";
}
useEffect(() => stream.attach(data => setState({data})), [stream]);
// @ts-ignore
return state ? state.data : (stream.value !== undefined ? stream.value : null);
}
export function useStreamWithUpdater<T>(getStream: (ctx: ApplicationContext) => Emitter<T>) : [T, (val: T|((T) => T)) => void] {
const data = useStream(getStream);
const basicStreams = useContext(StreamsContext);
const stream = resolveStream(getStream, basicStreams);
const updater = useCallback((val) => {
if (typeof val === 'function') {
val = val(data)
}
stream.next(val)
}, [data, stream]);
return [data, updater];
}
export type Patcher<T> = (draft: T) => void;
export function useStreamWithPatcher<T>(getStream: (ctx: ApplicationContext) => Emitter<T>) : [T, (patcher: Patcher<T>) => void] {
const data = useStream(getStream);
const basicStreams = useContext(StreamsContext);
const stream: Emitter<T> = resolveStream(getStream, basicStreams);
const patch = (patcher: Patcher<T>) => {
const newData: T = produce(data, (draft:T) => {
patcher(draft)
})
stream.next(newData);
}
return [data, patch];
}
function resolveStream<T>(getStream, basicStreams): Emitter<T> {
return typeof getStream === 'function' ? getStream(basicStreams) : getStream
}
``` | /content/code_sandbox/modules/ui/effects.ts | xml | 2016-08-26T21:55:19 | 2024-08-15T01:02:53 | jsketcher | xibyte/jsketcher | 1,461 | 481 |
```xml
import 'reflect-metadata';
import { assert } from 'chai';
import { IObfuscationResult } from '../../../../../../src/interfaces/source-code/IObfuscationResult';
import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
import { getStringArrayRegExp } from '../../../../../helpers/get-string-array-regexp';
import { readFileAsString } from '../../../../../helpers/readFileAsString';
describe('StringArrayTemplate', () => {
describe('Prevailing kind of variables', () => {
describe('`var` kind', () => {
let obfuscatedCode: string,
stringArrayRegExp: RegExp = getStringArrayRegExp(['foo'], {kind: 'var'});
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/prevailing-kind-of-variables-var.js');
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
stringArray: true,
stringArrayThreshold: 1
}
);
obfuscatedCode = obfuscationResult.getObfuscatedCode();
});
it('Should return correct kind of variables for string array', () => {
assert.match(obfuscatedCode, stringArrayRegExp);
});
it('Should does not break on obfuscating', () => {
assert.doesNotThrow(() => obfuscatedCode);
});
});
describe('`const` kind', () => {
let obfuscatedCode: string,
stringArrayRegExp: RegExp = getStringArrayRegExp(['foo'], {kind: 'const'});
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/prevailing-kind-of-variables-const.js');
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
stringArray: true,
stringArrayThreshold: 1
}
);
obfuscatedCode = obfuscationResult.getObfuscatedCode();
});
it('Should return correct kind of variables for string array', () => {
assert.match(obfuscatedCode, stringArrayRegExp);
});
it('Should does not break on obfuscating', () => {
assert.doesNotThrow(() => obfuscatedCode);
});
});
describe('`let` kind', () => {
let obfuscatedCode: string,
stringArrayRegExp: RegExp = getStringArrayRegExp(['foo'], {kind: 'const'});
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/prevailing-kind-of-variables-let.js');
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
stringArray: true,
stringArrayThreshold: 1
}
);
obfuscatedCode = obfuscationResult.getObfuscatedCode();
});
it('Should return correct kind of variables for string array', () => {
assert.match(obfuscatedCode, stringArrayRegExp);
});
it('Should does not break on obfuscating', () => {
assert.doesNotThrow(() => obfuscatedCode);
});
});
});
});
``` | /content/code_sandbox/test/functional-tests/custom-code-helpers/string-array/templates/string-array-template/StringArrayTemplate.spec.ts | xml | 2016-05-09T08:16:53 | 2024-08-16T19:43:07 | javascript-obfuscator | javascript-obfuscator/javascript-obfuscator | 13,358 | 716 |
```xml
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/gfx/platform_font_ios.h"
#import <UIKit/UIKit.h>
#include <cmath>
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/gfx/font.h"
#include "ui/gfx/font_render_params.h"
#include "ui/gfx/ios/NSString+CrStringDrawing.h"
namespace gfx {
////////////////////////////////////////////////////////////////////////////////
// PlatformFontIOS, public:
PlatformFontIOS::PlatformFontIOS() {
font_size_ = [UIFont systemFontSize];
style_ = gfx::Font::NORMAL;
UIFont* system_font = [UIFont systemFontOfSize:font_size_];
font_name_ = base::SysNSStringToUTF8([system_font fontName]);
CalculateMetrics();
}
PlatformFontIOS::PlatformFontIOS(NativeFont native_font) {
std::string font_name = base::SysNSStringToUTF8([native_font fontName]);
InitWithNameSizeAndStyle(font_name,
[native_font pointSize],
gfx::Font::NORMAL);
}
PlatformFontIOS::PlatformFontIOS(const std::string& font_name,
int font_size) {
InitWithNameSizeAndStyle(font_name, font_size, gfx::Font::NORMAL);
}
////////////////////////////////////////////////////////////////////////////////
// PlatformFontIOS, PlatformFont implementation:
Font PlatformFontIOS::DeriveFont(int size_delta, int style) const {
return Font(new PlatformFontIOS(font_name_, font_size_ + size_delta, style));
}
int PlatformFontIOS::GetHeight() {
return height_;
}
int PlatformFontIOS::GetBaseline() {
return ascent_;
}
int PlatformFontIOS::GetCapHeight() {
return cap_height_;
}
int PlatformFontIOS::GetExpectedTextWidth(int length) {
return length * average_width_;
}
int PlatformFontIOS::GetStyle() const {
return style_;
}
const std::string& PlatformFontIOS::GetFontName() const {
return font_name_;
}
std::string PlatformFontIOS::GetActualFontNameForTesting() const {
return base::SysNSStringToUTF8([GetNativeFont() familyName]);
}
int PlatformFontIOS::GetFontSize() const {
return font_size_;
}
const FontRenderParams& PlatformFontIOS::GetFontRenderParams() {
NOTIMPLEMENTED();
static FontRenderParams params;
return params;
}
NativeFont PlatformFontIOS::GetNativeFont() const {
return [UIFont fontWithName:base::SysUTF8ToNSString(font_name_)
size:font_size_];
}
////////////////////////////////////////////////////////////////////////////////
// PlatformFontIOS, private:
PlatformFontIOS::PlatformFontIOS(const std::string& font_name,
int font_size,
int style) {
InitWithNameSizeAndStyle(font_name, font_size, style);
}
void PlatformFontIOS::InitWithNameSizeAndStyle(const std::string& font_name,
int font_size,
int style) {
font_name_ = font_name;
font_size_ = font_size;
style_ = style;
CalculateMetrics();
}
void PlatformFontIOS::CalculateMetrics() {
UIFont* font = GetNativeFont();
height_ = font.lineHeight;
ascent_ = font.ascender;
cap_height_ = font.capHeight;
average_width_ = [@"x" cr_sizeWithFont:font].width;
}
////////////////////////////////////////////////////////////////////////////////
// PlatformFont, public:
// static
PlatformFont* PlatformFont::CreateDefault() {
return new PlatformFontIOS;
}
// static
PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) {
return new PlatformFontIOS(native_font);
}
// static
PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
int font_size) {
return new PlatformFontIOS(font_name, font_size);
}
} // namespace gfx
``` | /content/code_sandbox/orig_chrome/ui/gfx/platform_font_ios.mm | xml | 2016-09-27T03:41:10 | 2024-08-16T10:42:57 | miniblink49 | weolar/miniblink49 | 7,069 | 813 |
```xml
import {
Column,
Entity,
JoinColumn,
ManyToOne,
PrimaryColumn,
} from "../../../../src/index"
import { MainModel } from "./MainModel"
import { ValidationModel } from "./ValidationModel"
@Entity()
export class DataModel {
@PrimaryColumn()
validation: number
@PrimaryColumn()
mainId: number
@ManyToOne(
(type) => ValidationModel,
(validation) => validation.dataModel,
{ eager: true },
)
@JoinColumn({
name: "validation",
referencedColumnName: "validation",
})
validations: ValidationModel
@ManyToOne((type) => MainModel, (main) => main.dataModel)
@JoinColumn({
name: "mainId",
referencedColumnName: "id",
})
main: MainModel
@Column({
type: "boolean",
default: false,
})
active: boolean
}
``` | /content/code_sandbox/test/github-issues/1545/entity/DataModel.ts | xml | 2016-02-29T07:41:14 | 2024-08-16T18:28:52 | typeorm | typeorm/typeorm | 33,875 | 194 |
```xml
/**
* @license
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
import type { DataType } from "#src/util/data_type.js";
export const SKELETON_LAYER_RPC_ID = "skeleton/SkeletonLayer";
export interface VertexAttributeInfo {
dataType: DataType;
numComponents: number;
}
``` | /content/code_sandbox/src/skeleton/base.ts | xml | 2016-05-27T02:37:25 | 2024-08-16T07:24:25 | neuroglancer | google/neuroglancer | 1,045 | 91 |
```xml
import asyncComponent from "@erxes/ui/src/components/AsyncComponent";
import queryString from "query-string";
import React from "react";
import { Route, Routes, useLocation } from "react-router-dom";
import GeneralSettings from "./settings/components/GeneralSettings";
const SyncHistoryList = asyncComponent(
() =>
import(
/* webpackChunkName: "CheckSyncedDeals" */ "./syncPolarisHistories/containers/SyncHistoryList"
)
);
const Settings = asyncComponent(
() =>
import(/* webpackChunkName: "Settings" */ "./settings/containers/Settings")
);
const List = asyncComponent(
() =>
import(/* webpackChunkName: "customer" */ "./syncPolaris/containers/List")
);
const SyncHistoryListComponent = () => {
const location = useLocation();
return <SyncHistoryList queryParams={queryString.parse(location.search)} />;
};
const CustomerList = () => {
const location = useLocation();
return (
<List
queryParams={queryString.parse(location.search)}
contentType="core:customer"
/>
);
};
const TransactionSavingList = () => {
const location = useLocation();
return (
<List
queryParams={queryString.parse(location.search)}
contentType="savings:transaction"
/>
);
};
const TransactionLoanList = () => {
const location = useLocation();
return (
<List
queryParams={queryString.parse(location.search)}
contentType="loans:transaction"
/>
);
};
const SavingAcntList = () => {
const location = useLocation();
return (
<List
queryParams={queryString.parse(location.search)}
contentType="savings:contract"
/>
);
};
const LoanAcntList = () => {
const location = useLocation();
return (
<List
queryParams={queryString.parse(location.search)}
contentType="loans:contract"
/>
);
};
const GeneralSetting = () => {
return <Settings component={GeneralSettings} configCode="POLARIS" />;
};
const routes = () => {
return (
<Routes>
<Route
key="/erxes-plugin-polaris-polaris/settings/general"
path="/erxes-plugin-sync-polaris/settings/general"
element={<GeneralSetting />}
/>
<Route
key="/sync-polaris-history"
path="/sync-polaris-history"
element={<SyncHistoryListComponent />}
/>
<Route key="/customer" path="/customer" element={<CustomerList />} />
<Route
key="/transaction-loan"
path="/transaction-loan"
element={<TransactionLoanList />}
/>
<Route
key="/transaction-saving"
path="/transaction-saving"
element={<TransactionSavingList />}
/>
<Route
key="/saving-account"
path="/saving-acnt"
element={<SavingAcntList />}
/>
<Route key="/loan-account" path="/loan-acnt" element={<LoanAcntList />} />
</Routes>
);
};
export default routes;
``` | /content/code_sandbox/packages/plugin-syncpolaris-ui/src/routes.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 640 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="path_to_url"
xmlns:app="path_to_url"
xmlns:tools="path_to_url"
tools:context="org.horaapps.leafpic.activities.MainActivity">
<group android:id="@+id/timeline_view_items">
<item
android:id="@+id/timeline_menu_filter"
android:icon="@drawable/ic_filter"
android:title="@string/filter_menu_title"
app:showAsAction="ifRoom">
<menu>
<group android:checkableBehavior="single">
<item
android:id="@+id/all_media_filter"
android:checked="true"
android:title="@string/all"
app:showAsAction="never" />
<item
android:id="@+id/video_media_filter"
android:title="@string/videos"
app:showAsAction="never" />
<item
android:id="@+id/image_media_filter"
android:title="@string/images"
app:showAsAction="never" />
<item
android:id="@+id/gifs_media_filter"
android:title="@string/gifs"
app:showAsAction="never" />
</group>
</menu>
</item>
<item
android:id="@+id/timeline_menu_grouping"
android:icon="@drawable/ic_group"
android:title="@string/timeline_grouping_menu_label"
app:showAsAction="ifRoom">
<menu>
<group android:checkableBehavior="single">
<item
android:id="@+id/timeline_grouping_day"
android:checked="true"
android:title="@string/timeline_grouping_menu_day"
app:showAsAction="never" />
<item
android:id="@+id/timeline_grouping_week"
android:title="@string/timeline_grouping_menu_week"
app:showAsAction="never" />
<item
android:id="@+id/timeline_grouping_month"
android:title="@string/timeline_grouping_menu_month"
app:showAsAction="never" />
<item
android:id="@+id/timeline_grouping_year"
android:title="@string/timeline_grouping_menu_year"
app:showAsAction="never" />
</group>
</menu>
</item>
</group>
<group android:id="@+id/timeline_edit_items">
<item
android:id="@+id/timeline_share"
android:icon="@drawable/ic_share"
android:title="@string/share"
app:showAsAction="ifRoom" />
<item
android:id="@+id/timeline_menu_delete"
android:icon="@drawable/ic_delete"
android:title="@string/delete"
app:showAsAction="ifRoom" />
<item
android:id="@+id/timeline_menu_exclude"
android:title="@string/exclude"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/timeline_menu_shortcut"
android:title="@string/install_shortcut"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/timeline_menu_hide"
android:title="@string/hide"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/timeline_menu_select_all"
android:icon="@drawable/ic_select_all"
android:title="@string/select_all"
app:showAsAction="ifRoom" />
</group>
</menu>
``` | /content/code_sandbox/app/src/main/res/menu/menu_timeline.xml | xml | 2016-01-07T17:24:12 | 2024-08-16T06:55:33 | LeafPic | UnevenSoftware/LeafPic | 3,258 | 779 |
```xml
/**
* This file needs to be improved in terms of typing. They were rushed due to time constraints.
*/
import ICAL from 'ical.js';
import { parseWithRecovery } from '@proton/shared/lib/calendar/icsSurgery/ics';
import { DAY, HOUR, MINUTE, SECOND, WEEK } from '../constants';
import type {
VcalCalendarComponent,
VcalCalendarComponentWithMaybeErrors,
VcalDateOrDateTimeValue,
VcalDateTimeValue,
VcalDateValue,
VcalDurationValue,
VcalErrorComponent,
VcalRrulePropertyValue,
VcalValarmComponent,
VcalVcalendar,
VcalVcalendarWithMaybeErrors,
VcalVeventComponent,
VcalVeventComponentWithMaybeErrors,
} from '../interfaces/calendar';
import { UNIQUE_PROPERTIES } from './vcalDefinition';
import { getIsVcalErrorComponent } from './vcalHelper';
const getIcalDateValue = (value: any, tzid: string | undefined, isDate: boolean) => {
const icalTimezone = value.isUTC ? ICAL.Timezone.utcTimezone : ICAL.Timezone.localTimezone;
const icalData = {
year: value.year,
month: value.month,
day: value.day,
hour: value.hours || 0,
minute: value.minutes || 0,
second: value.seconds || 0,
isDate,
};
return ICAL.Time.fromData(icalData, icalTimezone);
};
const getIcalPeriodValue = (value: any, tzid: string | undefined) => {
return ICAL.Period.fromData({
// periods must be of date-time
start: value.start ? getIcalDateValue(value.start, tzid, false) : undefined,
end: value.end ? getIcalDateValue(value.end, tzid, false) : undefined,
duration: value.duration ? ICAL.Duration.fromData(value.duration) : undefined,
});
};
const getIcalDurationValue = (value?: any) => {
return ICAL.Duration.fromData(value);
};
const getIcalUntilValue = (value?: any) => {
if (!value) {
return;
}
return getIcalDateValue(value, '', typeof value.hours === 'undefined');
};
export const internalValueToIcalValue = (type: string, value: any, { tzid }: { tzid?: string } = {}) => {
if (Array.isArray(value)) {
return value;
}
if (typeof value === 'string') {
return value;
}
if (type === 'date' || type === 'date-time') {
return getIcalDateValue(value, tzid, type === 'date');
}
if (type === 'duration') {
return getIcalDurationValue(value);
}
if (type === 'period') {
return getIcalPeriodValue(value, tzid);
}
if (type === 'recur') {
if (!value.until) {
return ICAL.Recur.fromData(value);
}
const until = getIcalUntilValue(value.until);
return ICAL.Recur.fromData({ ...value, until });
}
return value.toString();
};
const getInternalDateValue = (value: any): VcalDateValue => {
return {
year: value.year,
month: value.month,
day: value.day,
};
};
export const getInternalDateTimeValue = (value: any): VcalDateTimeValue => {
return {
...getInternalDateValue(value),
hours: value.hour,
minutes: value.minute,
seconds: value.second,
isUTC: value.zone.tzid === 'UTC',
};
};
const getInternalDurationValue = (value: any): VcalDurationValue => {
return {
weeks: value.weeks,
days: value.days,
hours: value.hours,
minutes: value.minutes,
seconds: value.seconds,
isNegative: value.isNegative,
};
};
const getInternalUntil = (value?: any): VcalDateOrDateTimeValue | undefined => {
if (!value) {
return;
}
return value.icaltype === 'date' ? getInternalDateValue(value) : getInternalDateTimeValue(value);
};
const getInternalRecur = (value?: any): VcalRrulePropertyValue | undefined => {
if (!value) {
return;
}
const result = {
...value.toJSON(),
};
// COUNT = 0 gets ignored in the above step
if (value.count === 0) {
result.count = 0;
}
const until = getInternalUntil(value.until);
if (until) {
result.until = until;
}
return result;
};
/**
* Convert from ical.js format to an internal format
*/
export const icalValueToInternalValue = (type: string, value: any) => {
if (Array.isArray(value)) {
return value;
}
if (typeof value === 'string' || type === 'integer') {
return value;
}
if (type === 'date') {
return getInternalDateValue(value);
}
if (type === 'date-time') {
return getInternalDateTimeValue(value);
}
if (type === 'duration') {
return getInternalDurationValue(value);
}
if (type === 'period') {
const result: any = {};
if (value.start) {
result.start = getInternalDateTimeValue(value.start);
}
if (value.end) {
result.end = getInternalDateTimeValue(value.end);
}
if (value.duration) {
result.duration = getInternalDurationValue(value.duration);
}
return result;
}
if (type === 'recur') {
return getInternalRecur(value);
}
return value.toString();
};
/**
* Get an ical property.
*/
const getProperty = (name: string, { value, parameters }: any) => {
const property = new ICAL.Property(name);
const { type: specificType, ...restParameters } = parameters || {};
if (specificType) {
property.resetType(specificType);
}
const type = specificType || property.type;
if (property.isMultiValue && Array.isArray(value)) {
property.setValues(value.map((val) => internalValueToIcalValue(type, val, restParameters)));
} else {
property.setValue(internalValueToIcalValue(type, value, restParameters));
}
Object.keys(restParameters).forEach((key) => {
property.setParameter(key, restParameters[key]);
});
return property;
};
const addInternalProperties = (component: any, properties: any) => {
Object.keys(properties).forEach((name) => {
const jsonProperty = properties[name];
if (Array.isArray(jsonProperty)) {
jsonProperty.forEach((property) => {
component.addProperty(getProperty(name, property));
});
return;
}
component.addProperty(getProperty(name, jsonProperty));
});
return component;
};
const fromInternalComponent = (properties: any) => {
const { component: name, components, ...restProperties } = properties;
const component = addInternalProperties(new ICAL.Component(name), restProperties);
if (Array.isArray(components)) {
components.forEach((otherComponent) => {
component.addSubcomponent(fromInternalComponent(otherComponent));
});
}
return component;
};
export const serialize = (component: any) => {
return fromInternalComponent(component).toString();
};
const getParameters = (type: string, property: any) => {
const allParameters = property.toJSON() || [];
const parameters = allParameters[1];
const isDefaultType = type === property.getDefaultType();
const result = {
...parameters,
};
if (!isDefaultType) {
result.type = type;
}
return result;
};
const checkIfDateOrDateTimeValid = (dateOrDateTimeString: string, isDateType = false) => {
if (/--/.test(dateOrDateTimeString)) {
// just to be consistent with error messages from ical.js
const message = isDateType ? 'could not extract integer from' : 'invalid date-time value';
throw new Error(message);
}
};
const fromIcalProperties = (properties = []) => {
if (properties.length === 0) {
return;
}
return properties.reduce<{ [key: string]: any }>((acc, property: any) => {
const { name } = property;
if (!name) {
return acc;
}
const { type } = property;
if (['date-time', 'date'].includes(type)) {
checkIfDateOrDateTimeValid(property.toJSON()[3], type === 'date');
}
const values = property.getValues().map((value: any) => icalValueToInternalValue(type, value));
const parameters = getParameters(type, property);
const propertyAsObject = {
value: property.isMultiValue ? values : values[0],
...(Object.keys(parameters).length && { parameters }),
};
if (UNIQUE_PROPERTIES.has(name)) {
acc[name] = propertyAsObject;
return acc;
}
if (!acc[name]) {
acc[name] = [];
}
// Exdate can be both an array and multivalue, force it to only be an array
if (name === 'exdate') {
const normalizedValues = values.map((value: any) => ({ ...propertyAsObject, value }));
acc[name] = acc[name].concat(normalizedValues);
} else {
acc[name].push(propertyAsObject);
}
return acc;
}, {});
};
export const fromIcalComponent = (component: any) => {
const components = component.getAllSubcomponents().map(fromIcalComponent);
return {
component: component.name,
...(components.length && { components }),
...fromIcalProperties(component ? component.getAllProperties() : undefined),
} as VcalCalendarComponent;
};
export const fromIcalComponentWithMaybeErrors = (
component: any
): VcalCalendarComponentWithMaybeErrors | VcalErrorComponent => {
const components = component.getAllSubcomponents().map((subcomponent: any) => {
try {
return fromIcalComponentWithMaybeErrors(subcomponent);
} catch (error: any) {
return { error, icalComponent: subcomponent };
}
});
return {
component: component.name,
...(components.length && { components }),
...fromIcalProperties(component ? component.getAllProperties() : undefined),
} as VcalCalendarComponentWithMaybeErrors;
};
/**
* Parse vCalendar String and return a component
*/
export const parse = (vcal = ''): VcalCalendarComponent => {
if (!vcal) {
return {} as VcalCalendarComponent;
}
return fromIcalComponent(new ICAL.Component(ICAL.parse(vcal))) as VcalCalendarComponent;
};
/**
* Same as the parseWithRecovery function, but catching errors in individual components.
* This is useful in case we can parse some events but not all in a given ics
*/
export const parseVcalendarWithRecoveryAndMaybeErrors = (
vcal: string,
retry?: {
retryLineBreaks?: boolean;
retryEnclosing?: boolean;
retryDateTimes?: boolean;
retryOrganizer?: boolean;
}
): VcalVcalendarWithMaybeErrors | VcalCalendarComponentWithMaybeErrors => {
try {
const result = parseWithRecovery(vcal, retry) as VcalVcalendar;
// add mandatory but maybe missing properties
if (!result.prodid) {
result.prodid = { value: '' };
}
if (!result.version) {
result.version = { value: '2.0' };
}
return result;
} catch (e) {
return fromIcalComponentWithMaybeErrors(new ICAL.Component(ICAL.parse(vcal))) as
| VcalVcalendarWithMaybeErrors
| VcalCalendarComponentWithMaybeErrors;
}
};
export const getVeventWithoutErrors = (
veventWithMaybeErrors: VcalVeventComponentWithMaybeErrors
): VcalVeventComponent => {
const filteredComponents: VcalValarmComponent[] | undefined = veventWithMaybeErrors.components?.filter(
(component): component is VcalValarmComponent => !getIsVcalErrorComponent(component)
);
return {
...veventWithMaybeErrors,
components: filteredComponents,
};
};
export const fromRruleString = (rrule = '') => {
return getInternalRecur(ICAL.Recur.fromString(rrule));
};
/**
* Parse a trigger string (e.g. '-PT15M') and return an object indicating its duration
*/
export const fromTriggerString = (trigger = '') => {
return getInternalDurationValue(ICAL.Duration.fromString(trigger));
};
export const toTriggerString = (value: VcalDurationValue): string => {
return getIcalDurationValue(value).toString();
};
/**
* Transform a duration object into milliseconds
*/
export const durationToMilliseconds = ({
isNegative = false,
weeks = 0,
days = 0,
hours = 0,
minutes = 0,
seconds = 0,
milliseconds = 0,
}) => {
const lapse = weeks * WEEK + days * DAY + hours * HOUR + minutes * MINUTE + seconds * SECOND + milliseconds;
return isNegative ? -lapse : lapse;
};
/**
* Parse a trigger string (e.g. '-PT15M') and return its duration in milliseconds
*/
export const getMillisecondsFromTriggerString = (trigger = '') => {
return durationToMilliseconds(fromTriggerString(trigger));
};
``` | /content/code_sandbox/packages/shared/lib/calendar/vcal.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 2,943 |
```xml
// Type definitions for iview 3.3.1
// Project: path_to_url
// Definitions by: yangdan
// Definitions: path_to_url
import Vue from 'vue';
export declare class Avatar extends Vue {
/**
* circlesquare
* @default circle
*/
shape?: 'circle' | 'square';
/**
* largesmalldefault
* @default default
*/
size?: 'large'|'small'|'default';
/**
*
*/
src?: string;
/**
* Icon
*/
icon?: string;
/**
*
*/
'custom-icon'?: string;
/**
* src
*/
$emit(eventName: 'on-error', event: Event): this;
}
``` | /content/code_sandbox/types/avatar.d.ts | xml | 2016-07-28T01:52:59 | 2024-08-16T10:15:08 | iview | iview/iview | 23,980 | 170 |
```xml
import { GENERATE_VOTING_PDF_CHANNEL } from '../../../common/ipc/api';
import type {
GenerateVotingPDFMainResponse,
GenerateVotingPDFRendererRequest,
} from '../../../common/ipc/api';
import { RendererIpcChannel } from './lib/RendererIpcChannel';
export const generateVotingPDFChannel: // IpcChannel<Incoming, Outgoing>
RendererIpcChannel<
GenerateVotingPDFMainResponse,
GenerateVotingPDFRendererRequest
> = new RendererIpcChannel(GENERATE_VOTING_PDF_CHANNEL);
``` | /content/code_sandbox/source/renderer/app/ipc/generateVotingPDFChannel.ts | xml | 2016-10-05T13:48:54 | 2024-08-13T22:03:19 | daedalus | input-output-hk/daedalus | 1,230 | 118 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>16G29</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>WhateverGreen</string>
<key>CFBundleIdentifier</key>
<string>as.vit9696.WhateverGreen</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>WhateverGreen</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>1.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.1.2</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>9A1004</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>17A360</string>
<key>DTSDKName</key>
<string>macosx10.13</string>
<key>DTXcode</key>
<string>0901</string>
<key>DTXcodeBuild</key>
<string>9A1004</string>
<key>IOKitPersonalities</key>
<dict>
<key>as.vit9696.WhateverAudio</key>
<dict>
<key>CFBundleIdentifier</key>
<string>as.vit9696.WhateverGreen</string>
<key>IOClass</key>
<string>WhateverAudio</string>
<key>IOMatchCategory</key>
<string>IOService</string>
<key>IOPCIClassMatch</key>
<string>0x04030000&0xffff0000</string>
<key>IOPCIMatch</key>
<string>0x00001002&0x0000ffff</string>
<key>IOProbeScore</key>
<integer>60000</integer>
<key>IOProviderClass</key>
<string>IOPCIDevice</string>
</dict>
<key>as.vit9696.WhateverGreen</key>
<dict>
<key>CFBundleIdentifier</key>
<string>as.vit9696.WhateverGreen</string>
<key>IOClass</key>
<string>WhateverGreen</string>
<key>IOMatchCategory</key>
<string>WhateverGreen</string>
<key>IOProviderClass</key>
<string>IOResources</string>
<key>IOResourceMatch</key>
<string>IOKit</string>
</dict>
</dict>
<key>OSBundleCompatibleVersion</key>
<string>1.0</string>
<key>OSBundleLibraries</key>
<dict>
<key>as.vit9696.Lilu</key>
<string>1.2.0</string>
<key>com.apple.iokit.IOPCIFamily</key>
<string>1.0.0b1</string>
<key>com.apple.kpi.bsd</key>
<string>12.0.0</string>
<key>com.apple.kpi.dsep</key>
<string>12.0.0</string>
<key>com.apple.kpi.iokit</key>
<string>12.0.0</string>
<key>com.apple.kpi.libkern</key>
<string>12.0.0</string>
<key>com.apple.kpi.mach</key>
<string>12.0.0</string>
<key>com.apple.kpi.unsupported</key>
<string>12.0.0</string>
</dict>
<key>OSBundleRequired</key>
<string>Root</string>
</dict>
</plist>
``` | /content/code_sandbox/Clover-Configs/XiaoMi/15.6-inch/CLOVER/kexts/Other/WhateverGreen.kext/Contents/Info.plist | xml | 2016-11-05T04:22:54 | 2024-08-12T19:25:53 | Hackintosh-Installer-University | huangyz0918/Hackintosh-Installer-University | 3,937 | 1,044 |
```xml
/*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
import * as Classes from "./classes";
export { Classes };
export * from "./constants";
export * from "./documentalistUtils";
export * from "./eventHandlerUtils";
export * from "./stringUtils";
``` | /content/code_sandbox/packages/docs-theme/src/common/index.ts | xml | 2016-10-25T21:17:50 | 2024-08-16T15:14:48 | blueprint | palantir/blueprint | 20,593 | 81 |
```xml
import { CronJob, Job } from 'kubernetes-types/batch/v1';
import { Secret, Pod } from 'kubernetes-types/core/v1';
import { getIsSecretInUse } from './utils';
describe('getIsSecretInUse', () => {
it('should return false when no resources reference the secret', () => {
const secret: Secret = {
metadata: { name: 'my-secret', namespace: 'default' },
};
const pods: Pod[] = [];
const jobs: Job[] = [];
const cronJobs: CronJob[] = [];
expect(getIsSecretInUse(secret, pods, jobs, cronJobs)).toBe(false);
});
it('should return true when a pod references the secret', () => {
const secret: Secret = {
metadata: { name: 'my-secret', namespace: 'default' },
};
const pods: Pod[] = [
{
metadata: { namespace: 'default' },
spec: {
containers: [
{
name: 'container1',
envFrom: [{ secretRef: { name: 'my-secret' } }],
},
],
},
},
];
const jobs: Job[] = [];
const cronJobs: CronJob[] = [];
expect(getIsSecretInUse(secret, pods, jobs, cronJobs)).toBe(true);
});
it('should return true when a job references the secret', () => {
const secret: Secret = {
metadata: { name: 'my-secret', namespace: 'default' },
};
const pods: Pod[] = [];
const jobs: Job[] = [
{
metadata: { namespace: 'default' },
spec: {
template: {
spec: {
containers: [
{
name: 'container1',
envFrom: [{ secretRef: { name: 'my-secret' } }],
},
],
},
},
},
},
];
const cronJobs: CronJob[] = [];
expect(getIsSecretInUse(secret, pods, jobs, cronJobs)).toBe(true);
});
it('should return true when a cronJob references the secret', () => {
const secret: Secret = {
metadata: { name: 'my-secret', namespace: 'default' },
};
const pods: Pod[] = [];
const jobs: Job[] = [];
const cronJobs: CronJob[] = [
{
metadata: { namespace: 'default' },
spec: {
schedule: '0 0 * * *',
jobTemplate: {
spec: {
template: {
spec: {
containers: [
{
name: 'container1',
envFrom: [{ secretRef: { name: 'my-secret' } }],
},
],
},
},
},
},
},
},
];
expect(getIsSecretInUse(secret, pods, jobs, cronJobs)).toBe(true);
});
});
``` | /content/code_sandbox/app/react/kubernetes/configs/ListView/SecretsDatatable/utils.test.ts | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 626 |
```xml
<manifest xmlns:android="path_to_url"
package="com.albums"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
``` | /content/code_sandbox/albums/android/app/src/main/AndroidManifest.xml | xml | 2016-09-19T16:57:30 | 2024-08-06T14:29:02 | ReactNativeReduxCasts | StephenGrider/ReactNativeReduxCasts | 2,568 | 234 |
```xml
import { ChangeDetectorRef } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { Observable, Subject } from 'rxjs';
type Constructor<T> = new (...args: any[]) => T;
const noop: any = () => {
// empty method
};
export interface IControlValueAccessor extends ControlValueAccessor {
value: any;
valueChanges: Observable<any>;
onChange: (_: any) => any;
onTouched: () => any;
}
export interface IHasChangeDetectorRef {
_changeDetectorRef: ChangeDetectorRef;
}
/** Mixin to augment a component with ngModel support. */
export function mixinControlValueAccessor<
T extends Constructor<IHasChangeDetectorRef>
>(base: T, initialValue?: any): Constructor<IControlValueAccessor> & T {
return class extends base {
private _value: any =
initialValue instanceof Array
? Object.assign([], initialValue)
: initialValue;
private _subjectValueChanges: Subject<any>;
valueChanges: Observable<any>;
constructor(...args: any[]) {
super(...args);
this._subjectValueChanges = new Subject<any>();
this.valueChanges = this._subjectValueChanges.asObservable();
}
set value(v: any) {
if (v !== this._value) {
this._value = v;
this.onChange(v);
this._changeDetectorRef.markForCheck();
this._subjectValueChanges.next(v);
}
}
get value(): any {
return this._value;
}
writeValue(value: any): void {
this.value = value;
this._changeDetectorRef.markForCheck();
}
registerOnChange(fn: any): void {
this.onChange = fn;
}
registerOnTouched(fn: any): void {
this.onTouched = fn;
}
onChange = (_: any) => noop;
onTouched = () => noop;
};
}
``` | /content/code_sandbox/libs/angular/common/src/behaviors/control-value-accesor.mixin.ts | xml | 2016-07-11T23:30:52 | 2024-08-15T15:20:45 | covalent | Teradata/covalent | 2,228 | 410 |
```xml
import BigNumber from "bignumber.js";
import { IConfig } from "../../interfaces/config";
import { IContractDocument } from "../definitions/contracts";
import { calcInterest, getDatesDiffMonth, getDiffDay } from "./utils";
export async function getInterest(contract:IContractDocument,fromDate:Date,toDate:Date,balance:number,config:IConfig) {
const diffDay = getDiffDay(fromDate,toDate)
const { diffEve } = getDatesDiffMonth(
fromDate,
toDate
);
const interest = calcInterest({balance,interestRate:contract.interestRate,dayOfMonth:diffDay,fixed:config.calculationFixed})
const interestEve = calcInterest({
balance,
interestRate: contract.interestRate,
dayOfMonth: diffEve,
fixed:config.calculationFixed
});
const interestNonce = new BigNumber(interest).minus(interestEve).dp(config.calculationFixed,BigNumber.ROUND_HALF_UP).toNumber()
return {interest,interestEve,interestNonce,diffDay}
}
``` | /content/code_sandbox/packages/plugin-loans-api/src/models/utils/interestUtils.ts | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 228 |
```xml
import { Authorized } from '@/react/hooks/useUser';
import { AddButton } from '@@/buttons';
import { DeleteButton } from '@@/buttons/DeleteButton';
import { DecoratedVolume } from '../types';
export function TableActions({
selectedItems,
onRemove,
}: {
selectedItems: Array<DecoratedVolume>;
onRemove(items: Array<DecoratedVolume>): void;
}) {
return (
<div className="flex items-center gap-2">
<Authorized authorizations="DockerVolumeDelete">
<DeleteButton
disabled={selectedItems.length === 0}
onConfirmed={() => onRemove(selectedItems)}
confirmMessage="Do you want to remove the selected volume(s)?"
data-cy="volume-removeVolumeButton"
/>
</Authorized>
<Authorized authorizations="DockerVolumeCreate">
<AddButton data-cy="volume-addVolumeButton">Add volume</AddButton>
</Authorized>
</div>
);
}
``` | /content/code_sandbox/app/react/docker/volumes/ListView/VolumesDatatable/TableActions.tsx | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 209 |
```xml
import { assert } from 'chai';
import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
import { readFileAsString } from '../../../../../helpers/readFileAsString';
describe('ConditionalCommentObfuscatingGuard', () => {
describe('check', () => {
describe('Variant #1: `disable` conditional comment', () => {
const disableConditionalCommentRegExp: RegExp = /\/\/ *javascript-obfuscator:disable/;
const obfuscatedVariableDeclarationRegExp: RegExp = /var _0x([a-f0-9]){4,6} *= *0x1;/;
const ignoredVariableDeclarationRegExp: RegExp = /var bar *= *2;/;
const consoleLogRegExp: RegExp = /console.log\(_0x([a-f0-9]){4,6}\);/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/simple.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET
}
).getObfuscatedCode();
});
it('match #1: should remove `disable` conditional comment from the code', () => {
assert.notMatch(obfuscatedCode, disableConditionalCommentRegExp);
});
it('match #2: should obfuscate variable declaration before `disable` conditional comment', () => {
assert.match(obfuscatedCode, obfuscatedVariableDeclarationRegExp);
});
it('match #3: should ignore variable declaration after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredVariableDeclarationRegExp);
});
it('match #4: should obfuscate variable name in `console.log`', () => {
assert.match(obfuscatedCode, consoleLogRegExp);
});
});
describe('Variant #2: `disable` and `enable` conditional comments #1', () => {
const disableConditionalCommentRegExp: RegExp = /\/\/ *javascript-obfuscator:disable/;
const enableConditionalCommentRegExp: RegExp = /\/\/ *javascript-obfuscator:enable/;
const obfuscatedVariableDeclaration1RegExp: RegExp = /var _0x([a-f0-9]){4,6} *= *0x1;/;
const obfuscatedVariableDeclaration2RegExp: RegExp = /var _0x([a-f0-9]){4,6} *= *0x3;/;
const ignoredVariableDeclarationRegExp: RegExp = /var bar *= *2;/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/disable-and-enable-comments-1.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET
}
).getObfuscatedCode();
});
it('match #1: should remove `disable` conditional comment from the code', () => {
assert.notMatch(obfuscatedCode, disableConditionalCommentRegExp);
});
it('match #2: should remove `enable` conditional comment from the code', () => {
assert.notMatch(obfuscatedCode, enableConditionalCommentRegExp);
});
it('match #3: should obfuscate variable declaration before `disable` conditional comment', () => {
assert.match(obfuscatedCode, obfuscatedVariableDeclaration1RegExp);
});
it('match #4: should ignore variable declaration after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredVariableDeclarationRegExp);
});
it('match #5: should obfuscate variable declaration after `enable` conditional comment', () => {
assert.match(obfuscatedCode, obfuscatedVariableDeclaration2RegExp);
});
});
describe('Variant #3: `disable` and `enable` conditional comments #2', () => {
const ignoredVariableDeclarationRegExp: RegExp = /var foo *= *1;/;
const obfuscatedVariableDeclarationRegExp: RegExp = /var _0x([a-f0-9]){4,6} *= *0x2;/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/disable-and-enable-comments-2.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
renameGlobals: true
}
).getObfuscatedCode();
});
it('match #1: should ignore variable declaration after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredVariableDeclarationRegExp);
});
it('match #2: should obfuscate variable declaration before `disable` conditional comment', () => {
assert.match(obfuscatedCode, obfuscatedVariableDeclarationRegExp);
});
});
describe('Variant #4: `disable` conditional comment from beginning of the code', () => {
const ignoredVariableDeclaration1RegExp: RegExp = /var foo *= *1;/;
const ignoredVariableDeclaration2RegExp: RegExp = /var bar *= *2;/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/disable-from-beginning.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET
}
).getObfuscatedCode();
});
it('match #1: should ignore variable declaration after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredVariableDeclaration1RegExp);
});
it('match #2: should ignore variable declaration after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredVariableDeclaration2RegExp);
});
});
describe('Variant #5: `disable` and `enable` conditional comments with dead code injection', () => {
const obfuscatedFunctionExpressionRegExp: RegExp = /var _0x([a-f0-9]){4,6} *= *function *\(_0x([a-f0-9]){4,6}, *_0x([a-f0-9]){4,6}, *_0x([a-f0-9]){4,6}\) *{/g;
const expectedObfuscatedFunctionExpressionLength: number = 3;
const ignoredFunctionExpression1RegExp: RegExp = /var bar *= *function *\(a, *b, *c\) *{/;
const ignoredFunctionExpression2RegExp: RegExp = /var baz *= *function *\(a, *b, *c\) *{/;
const obfuscatedFunctionCallRegExp: RegExp = /_0x([a-f0-9]){5,6}\( *\);/g;
const expectedObfuscatedFunctionCallsLength: number = 3;
const ignoredFunctionCall1RegExp: RegExp = /bar\( *\);/;
const ignoredFunctionCall2RegExp: RegExp = /baz\( *\);/;
let obfuscatedCode: string,
obfuscatedFunctionExpressionMatchesLength: number,
obfuscatedFunctionCallMatchesLength: number;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/dead-code-injection.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
deadCodeInjection: true,
deadCodeInjectionThreshold: 1
}
).getObfuscatedCode();
const obfuscatedFunctionExpressionMatches: RegExpMatchArray | null = obfuscatedCode.match(
obfuscatedFunctionExpressionRegExp
);
const obfuscatedFunctionCallMatches: RegExpMatchArray | null = obfuscatedCode.match(
obfuscatedFunctionCallRegExp
);
obfuscatedFunctionExpressionMatchesLength = obfuscatedFunctionExpressionMatches
? obfuscatedFunctionExpressionMatches.length
: 0;
obfuscatedFunctionCallMatchesLength = obfuscatedFunctionCallMatches
? obfuscatedFunctionCallMatches.length
: 0;
});
it('match #1: should ignore function expression after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredFunctionExpression1RegExp);
});
it('match #2: should ignore function expression after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredFunctionExpression2RegExp);
});
it('match #3: should ignore function expression call', () => {
assert.match(obfuscatedCode, ignoredFunctionCall1RegExp);
});
it('match #4: should ignore function expression call', () => {
assert.match(obfuscatedCode, ignoredFunctionCall2RegExp);
});
it('should obfuscate 3 function expressions', () => {
assert.equal(obfuscatedFunctionExpressionMatchesLength, expectedObfuscatedFunctionExpressionLength);
});
it('should obfuscate 3 function expression calls', () => {
assert.equal(obfuscatedFunctionCallMatchesLength, expectedObfuscatedFunctionCallsLength);
});
});
describe('Variant #6: `disable` and `enable` conditional comments with control flow flattening', () => {
const obfuscatedVariableDeclarationRegExp: RegExp = /var _0x([a-f0-9]){4,6} *= *_0x([a-f0-9]){4,6}\['\w{5}'];/;
const ignoredVariableDeclarationRegExp: RegExp = /var bar *= *'bar';/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/control-flow-flattening.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1
}
).getObfuscatedCode();
});
it('match #1: should obfuscate variable declaration before `disable` conditional comment', () => {
assert.match(obfuscatedCode, obfuscatedVariableDeclarationRegExp);
});
it('match #2: should ignore variable declaration after `disable` conditional comment', () => {
assert.match(obfuscatedCode, ignoredVariableDeclarationRegExp);
});
});
});
});
``` | /content/code_sandbox/test/functional-tests/node-transformers/preparing-transformers/obfuscating-guards/conditional-comment-obfuscating-guard/ConditionalCommentObfuscatingGuard.spec.ts | xml | 2016-05-09T08:16:53 | 2024-08-16T19:43:07 | javascript-obfuscator | javascript-obfuscator/javascript-obfuscator | 13,358 | 2,173 |
```xml
import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
describe('app dir - search params keys', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should keep the React router instance the same when changing the search params', async () => {
const browser = await next.browser('/')
const searchParams = await browser
.waitForElementByCss('#search-params')
.text()
await browser.elementByCss('#increment').click()
await browser.elementByCss('#increment').click()
await browser.elementByCss('#push').click()
await check(async () => {
const newSearchParams = await browser
.waitForElementByCss('#search-params')
.text()
const count = await browser.waitForElementByCss('#count').text()
return newSearchParams !== searchParams && count === '2'
? 'success'
: 'retry'
}, 'success')
await browser.elementByCss('#increment').click()
await browser.elementByCss('#increment').click()
await browser.elementByCss('#replace').click()
await check(async () => {
const newSearchParams = await browser
.waitForElementByCss('#search-params')
.text()
const count = await browser.waitForElementByCss('#count').text()
return newSearchParams !== searchParams && count === '4'
? 'success'
: 'retry'
}, 'success')
})
})
``` | /content/code_sandbox/test/e2e/app-dir/search-params-react-key/layout-params.test.ts | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 322 |
```xml
import Link from 'next/link'
import { Button } from '../button'
export default function Page() {
return (
<>
<div>
<Link href="/delayed-action/node/other">Navigate to Other Page</Link>
</div>
<div>
<Button />
</div>
</>
)
}
``` | /content/code_sandbox/test/e2e/app-dir/actions/app/delayed-action/node/page.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 71 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="path_to_url"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.5">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<ImageButton
android:layout_width="@dimen/d50_size"
android:layout_height="@dimen/d50_size"
android:id="@+id/playbar_model"
android:src="@drawable/play_btn_loop"
android:background="@color/transparent"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<ImageButton
android:id="@+id/playbar_prev"
android:layout_width="@dimen/d60_size"
android:layout_height="@dimen/d60_size"
android:src="@drawable/play_btn_pre"
android:background="@color/transparent"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<FrameLayout
android:id="@+id/playbar_play_container"
android:layout_width="@dimen/d56_size"
android:layout_height="@dimen/d56_size">
<remix.myplayer.ui.widget.playpause.PlayPauseView
android:id="@+id/playbar_play_pause"
android:layout_width="@dimen/player_button_size"
android:layout_height="@dimen/player_button_size"
android:layout_gravity="center"
android:visibility="visible"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<ImageButton
android:id="@+id/playbar_next"
android:layout_width="@dimen/d60_size"
android:layout_height="@dimen/d60_size"
android:src="@drawable/play_btn_next"
android:background="@color/transparent"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<ImageButton
android:layout_width="@dimen/d50_size"
android:layout_height="@dimen/d50_size"
android:id="@+id/playbar_playinglist"
android:src="@drawable/play_btn_normal_list"
android:background="@color/transparent"/>
</LinearLayout>
</LinearLayout>
``` | /content/code_sandbox/app/src/main/res/layout/layout_player_control.xml | xml | 2016-01-14T13:38:47 | 2024-08-16T13:03:46 | APlayer | rRemix/APlayer | 1,308 | 603 |
```xml
import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import MnemonicsDialog from '../../../../components/wallet/wallet-create/MnemonicsDialog';
import type { InjectedDialogContainerStepProps } from '../../../../types/injectedPropsType';
import { InjectedDialogContainerStepDefaultProps } from '../../../../types/injectedPropsType';
type Props = InjectedDialogContainerStepProps;
const DefaultProps = InjectedDialogContainerStepDefaultProps;
@inject('stores', 'actions')
@observer
class MnemonicsDialogContainer extends Component<Props> {
static defaultProps = DefaultProps;
render() {
const { onClose, onContinue, onBack } = this.props;
return (
<MnemonicsDialog
onClose={onClose}
onContinue={onContinue}
// @ts-ignore ts-migrate(2769) FIXME: No overload matches this call.
onBack={onBack}
/>
);
}
}
export default MnemonicsDialogContainer;
``` | /content/code_sandbox/source/renderer/app/containers/wallet/dialogs/wallet-create/MnemonicsDialogContainer.tsx | xml | 2016-10-05T13:48:54 | 2024-08-13T22:03:19 | daedalus | input-output-hk/daedalus | 1,230 | 213 |
```xml
/*
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
// TypeScript Version: 4.1
/// <reference types="@stdlib/types"/>
import { typedndarray, genericndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray';
import { MultiSlice } from '@stdlib/types/slice';
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6.0, 5.0 ], [ 2.0, 1.0 ] ]
*/
declare function slice( x: float64ndarray, s: MultiSlice, strict: boolean, writable: boolean ): float64ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float32' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'float32', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6.0, 5.0 ], [ 2.0, 1.0 ] ]
*/
declare function slice( x: float32ndarray, s: MultiSlice, strict: boolean, writable: boolean ): float32ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'int32' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'int32', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice( x: int32ndarray, s: MultiSlice, strict: boolean, writable: boolean ): int32ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'int16' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'int16', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice( x: int16ndarray, s: MultiSlice, strict: boolean, writable: boolean ): int16ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'int8' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'int8', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice( x: int8ndarray, s: MultiSlice, strict: boolean, writable: boolean ): int8ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint32' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'uint32', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice( x: uint32ndarray, s: MultiSlice, strict: boolean, writable: boolean ): uint32ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint16' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'uint16', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice( x: uint16ndarray, s: MultiSlice, strict: boolean, writable: boolean ): uint16ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint8' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'uint8', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice( x: uint8ndarray, s: MultiSlice, strict: boolean, writable: boolean ): uint8ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint8c' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'uint8c', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice( x: uint8cndarray, s: MultiSlice, strict: boolean, writable: boolean ): uint8cndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ], 'complex128' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'complex128', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*/
declare function slice( x: complex128ndarray, s: MultiSlice, strict: boolean, writable: boolean ): complex128ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var typedarray = require( '@stdlib/array/typed' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ], 'complex64' );
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'complex64', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*/
declare function slice( x: complex64ndarray, s: MultiSlice, strict: boolean, writable: boolean ): complex64ndarray;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = [ 1, 2, 3, 4, 5, 6 ];
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice<T = unknown>( x: genericndarray<T>, s: MultiSlice, strict: boolean, writable: boolean ): genericndarray<T>;
/**
* Returns a view of an input ndarray.
*
* @param x - input array
* @param s - multi-slice object
* @param strict - boolean indicating whether to enforce strict bounds checking
* @param writable - boolean indicating whether a returned array should be writable
* @returns output array
*
* @example
* var Slice = require( '@stdlib/slice/ctor' );
* var MultiSlice = require( '@stdlib/slice/multi' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var buffer = [ 1, 2, 3, 4, 5, 6 ];
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
* // returns <ndarray>
*
* var sh = x.shape;
* // returns [ 3, 2 ]
*
* var arr = ndarray2array( x );
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
*
* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) );
* // returns <MultiSlice>
*
* var y = slice( x, s, false, false );
* // returns <ndarray>
*
* sh = y.shape;
* // returns [ 2, 2 ]
*
* arr = ndarray2array( y );
* // returns [ [ 6, 5 ], [ 2, 1 ] ]
*/
declare function slice<T = unknown>( x: typedndarray<T>, s: MultiSlice, strict: boolean, writable: boolean ): typedndarray<T>;
// EXPORTS //
export = slice;
``` | /content/code_sandbox/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/index.d.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 5,680 |
```xml
/*
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
// TypeScript Version: 4.1
/// <reference types="@stdlib/types"/>
import { Iterator } from '@stdlib/types/iter';
/**
* Returns an iterator which iteratively computes a cumulative sum of squared absolute values.
*
* ## Notes
*
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
*
* @param iterator - input iterator
* @returns iterator
*
* @example
* var runif = require( '@stdlib/random/iter/uniform' );
*
* var rand = runif( -10.0, 10.0, {
* 'iter': 100
* });
*
* var it = itercusumabs2( rand );
*
* var v = it.next().value;
* // returns <number>
*
* v = it.next().value;
* // returns <number>
*
* v = it.next().value;
* // returns <number>
*
* // ...
*/
declare function itercusumabs2( iterator: Iterator ): Iterator;
// EXPORTS //
export = itercusumabs2;
``` | /content/code_sandbox/lib/node_modules/@stdlib/stats/iter/cusumabs2/docs/types/index.d.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 275 |
```xml
// @needsAudit
/**
* The type of notification feedback generated by a UINotificationFeedbackGenerator object.
* [`UINotificationFeedbackType`](path_to_url
*/
export enum NotificationFeedbackType {
/**
* A notification feedback type indicating that a task has completed successfully.
*/
Success = 'success',
/**
* A notification feedback type indicating that a task has produced a warning.
*/
Warning = 'warning',
/**
* A notification feedback type indicating that a task has failed.
*/
Error = 'error',
}
// @needsAudit
/**
* The mass of the objects in the collision simulated by a UIImpactFeedbackGenerator object
* [`UINotificationFeedbackStyle`](path_to_url
*/
export enum ImpactFeedbackStyle {
/**
* A collision between small, light user interface elements.
*/
Light = 'light',
/**
* A collision between moderately sized user interface elements.
*/
Medium = 'medium',
/**
* A collision between large, heavy user interface elements.
*/
Heavy = 'heavy',
/**
* A collision between user interface elements that are soft, exhibiting a large amount of compression or elasticity.
*/
Soft = 'soft',
/**
* A collision between user interface elements that are rigid, exhibiting a small amount of compression or elasticity.
*/
Rigid = 'rigid',
}
``` | /content/code_sandbox/packages/expo-haptics/src/Haptics.types.ts | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.