type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
TypeAliasDeclaration
|
type VideoPropertiesProps = {
isSubmitting?: boolean
}
|
Etherna/etherna-dapp
|
src/components/media/VideoEditor/VideoProperties/VideoProperties.tsx
|
TypeScript
|
MethodDeclaration
|
updateTitle(e
|
Etherna/etherna-dapp
|
src/components/media/VideoEditor/VideoProperties/VideoProperties.tsx
|
TypeScript
|
MethodDeclaration
|
updateDescription(value)
|
Etherna/etherna-dapp
|
src/components/media/VideoEditor/VideoProperties/VideoProperties.tsx
|
TypeScript
|
FunctionDeclaration
|
export function Load() {
const theme = useTheme();
return (
<ActivityIndicator
color={theme.colors.main}
size="large"
style={{ flex: 1 }}
|
AndreBento/ignite-mobile-rentx
|
src/components/Load/index.tsx
|
TypeScript
|
FunctionDeclaration
|
export default function TransferList(props: {
left: string[];
setLeft: (data: string[]) => void;
right: string[];
setRight: (data: string[]) => void;
itemComp?: React.ComponentType<{ value: string }>;
}) {
const [checked, setChecked] = React.useState<string[]>([]);
const { left, setLeft, right, setRight } = props;
const leftChecked = intersection(checked, left);
const rightChecked = intersection(checked, right);
const handleCheckedRight = () => {
setRight(right.concat(leftChecked));
setLeft(not(left, leftChecked));
setChecked(not(checked, leftChecked));
};
const handleCheckedLeft = () => {
setLeft(left.concat(rightChecked));
setRight(not(right, rightChecked));
setChecked(not(checked, rightChecked));
};
return (
<Grid container spacing={2} justify="center" alignItems="center" className={styles.root}>
<Grid item>
<CheckList title='Choices'
items={left}
checked={checked}
setChecked={setChecked}
itemComp={props.itemComp}
/>
</Grid>
<Grid item>
<Grid container direction="column" alignItems="center">
<Button
variant="outlined"
size="small"
className={styles.button}
onClick={handleCheckedRight}
disabled={leftChecked.length === 0}
aria-label="move selected right"
>
>
</Button>
<Button
variant="outlined"
size="small"
className={styles.button}
onClick={handleCheckedLeft}
disabled={rightChecked.length === 0}
aria-label="move selected left"
>
<
</Button>
</Grid>
</Grid>
<Grid item>
<CheckList title='Chosen'
items={right}
checked={checked}
setChecked={setChecked}
itemComp={props.itemComp}
/>
</Grid>
</Grid>
);
}
|
Cricfies/Cromwell
|
system/admin-panel/src/components/transferList/TransferList.tsx
|
TypeScript
|
ArrowFunction
|
() => {
setRight(right.concat(leftChecked));
setLeft(not(left, leftChecked));
setChecked(not(checked, leftChecked));
}
|
Cricfies/Cromwell
|
system/admin-panel/src/components/transferList/TransferList.tsx
|
TypeScript
|
ArrowFunction
|
() => {
setLeft(left.concat(rightChecked));
setRight(not(right, rightChecked));
setChecked(not(checked, rightChecked));
}
|
Cricfies/Cromwell
|
system/admin-panel/src/components/transferList/TransferList.tsx
|
TypeScript
|
ClassDeclaration
|
export default class NpcSay extends GameClientPacket {
// @Override
readImpl(): boolean {
const _id = this.readC();
const _charObjId = this.readD();
const _textType = this.readD();
const _npcId = this.readD() - 1000000;
const _npcString = this.readD();
const _messages = [];
while (this._offset + 1 < this._buffer.byteLength) {
_messages.push(this.readS());
}
this.logger.info("NpcSay", _messages);
return true;
}
}
|
SpellsingerX/l2js-client
|
src/network/incoming/game/NpcSay.ts
|
TypeScript
|
MethodDeclaration
|
// @Override
readImpl(): boolean {
const _id = this.readC();
const _charObjId = this.readD();
const _textType = this.readD();
const _npcId = this.readD() - 1000000;
const _npcString = this.readD();
const _messages = [];
while (this._offset + 1 < this._buffer.byteLength) {
_messages.push(this.readS());
}
this.logger.info("NpcSay", _messages);
return true;
}
|
SpellsingerX/l2js-client
|
src/network/incoming/game/NpcSay.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const configProvider = await ConfigProvider.create();
// Initialize UI
const initialConfig = configProvider.getConfig();
gitpodUrlInput.value = initialConfig.gitpodURL;
gitpodPopupInput.checked = initialConfig.openAsPopup;
let timeout: number | undefined = undefined;
// Save config before close
const save = () => {
// Update config (propagated internally)
configProvider.setConfig({
gitpodURL: gitpodUrlInput.value || undefined,
openAsPopup: gitpodPopupInput.checked
});
if (timeout) {
window.clearTimeout(timeout);
timeout = undefined;
}
messageElement.innerText = "Saved.";
timeout = window.setTimeout(() => { messageElement.innerText = ""; timeout = undefined }, 3000);
};
gitpodUrlInput.addEventListener("keyup", (event: KeyboardEvent) => {
if (event.isComposing || event.keyCode === 229) {
return;
}
save()
});
gitpodPopupInput.addEventListener('change', save);
}
|
drud/ddev-browser-extension
|
src/options/options.ts
|
TypeScript
|
ArrowFunction
|
() => {
// Update config (propagated internally)
configProvider.setConfig({
gitpodURL: gitpodUrlInput.value || undefined,
openAsPopup: gitpodPopupInput.checked
});
if (timeout) {
window.clearTimeout(timeout);
timeout = undefined;
}
messageElement.innerText = "Saved.";
timeout = window.setTimeout(() => { messageElement.innerText = ""; timeout = undefined }, 3000);
}
|
drud/ddev-browser-extension
|
src/options/options.ts
|
TypeScript
|
ArrowFunction
|
() => { messageElement.innerText = ""; timeout = undefined }
|
drud/ddev-browser-extension
|
src/options/options.ts
|
TypeScript
|
ArrowFunction
|
(event: KeyboardEvent) => {
if (event.isComposing || event.keyCode === 229) {
return;
}
save()
}
|
drud/ddev-browser-extension
|
src/options/options.ts
|
TypeScript
|
ArrowFunction
|
err => console.error(err)
|
drud/ddev-browser-extension
|
src/options/options.ts
|
TypeScript
|
FunctionDeclaration
|
function Pagination({
totalElements,
size,
page,
setPage,
}: PaginationProps): ReactElement {
return (
<PaginationWrapper>
<PaginationComponent
activePage={page} // 현재 페이지
itemsCountPerPage={size} // 한 페이지당 보여줄 리스트 아이템의 개수
totalItemsCount={totalElements} // 총 북마크의 개수
pageRangeDisplayed={5} // Paginator 내에서 보여줄 페이지의 범위
prevPageText={<ArrowLeft16Icon />}
|
YAPP-19th/Web-Team-2-Frontend
|
web/src/components/bookmark/Pagination.tsx
|
TypeScript
|
ArrowFunction
|
(props) => props.theme.color.gray
|
YAPP-19th/Web-Team-2-Frontend
|
web/src/components/bookmark/Pagination.tsx
|
TypeScript
|
ArrowFunction
|
(props) => props.theme.color.black
|
YAPP-19th/Web-Team-2-Frontend
|
web/src/components/bookmark/Pagination.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface PaginationProps {
totalElements: number;
size: number;
page: number;
setPage: (page: number) => void;
}
|
YAPP-19th/Web-Team-2-Frontend
|
web/src/components/bookmark/Pagination.tsx
|
TypeScript
|
FunctionDeclaration
|
export function configure<T extends Test>(test: T, options?: SetupOptions & ResetOptions): T {
test.before(() => {
setup(options)
})
test.before.each(() => reset(options))
test.after(destroy)
return test
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
FunctionDeclaration
|
export function setup({
html = '<!DOCTYPE html>',
url = 'http://localhost',
console = global.console,
}: SetupOptions = {}): JSDOM {
const dom = new JSDOM(html, {
pretendToBeVisual: true,
runScripts: 'dangerously',
url,
virtualConsole: new VirtualConsole().sendTo(console),
})
const { defaultView } = dom.window.document
if (!defaultView) {
throw new TypeError('JSDOM did not return a Window object')
}
Object.defineProperty(global, kDefaultView, {
configurable: true,
get: () => defaultView,
})
defaultView.addEventListener('error', (event) => {
process.emit('uncaughtException', event.error)
})
GLOBAL_PROPERTIES.forEach((property) =>
Object.defineProperty(global, property, {
enumerable: true,
configurable: true,
get: () => defaultView[property],
}),
)
return dom
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
FunctionDeclaration
|
export function reset({ title = '', head = '', body = '' }: ResetOptions = {}): void {
document.title = title
document.head.innerHTML = head
document.body.innerHTML = body
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
FunctionDeclaration
|
export function destroy(): void {
GLOBAL_PROPERTIES.forEach((property) => Reflect.deleteProperty(global, property))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const defaultView = (global as any)[kDefaultView] as WindowProxy & typeof globalThis
if (defaultView) {
// Dispose "document" to prevent "load" event from triggering.
Object.defineProperty(defaultView, 'document', { value: null })
defaultView.close()
}
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
ArrowFunction
|
() => {
setup(options)
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
ArrowFunction
|
() => reset(options)
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
ArrowFunction
|
() => defaultView
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
process.emit('uncaughtException', event.error)
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
ArrowFunction
|
(property) =>
Object.defineProperty(global, property, {
enumerable: true,
configurable: true,
get: () => defaultView[property],
})
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
ArrowFunction
|
() => defaultView[property]
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
ArrowFunction
|
(property) => Reflect.deleteProperty(global, property)
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface SetupOptions {
html?: string
url?: string
console?: Console
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface ResetOptions {
title?: string
head?: string
body?: string
}
|
RaphaelGimenez/twind
|
src/__fixtures__/dom-env.ts
|
TypeScript
|
FunctionDeclaration
|
export function newGUITransform(name: string, object: Transform, parent = gui) {
const c = parent.addFolder(name)
const pos = c.addFolder('position')
pos.add(object.position, 'x').step(0.1)
pos.add(object.position, 'y').step(0.1)
pos.add(object.position, 'z').step(0.1)
const rot = c.addFolder('rotation')
rot.add(object.rotation, 'x').step(0.1)
rot.add(object.rotation, 'y').step(0.1)
rot.add(object.rotation, 'z').step(0.1)
const sca = c.addFolder('scale')
sca.add(object.scale, 'x').step(0.1)
sca.add(object.scale, 'y').step(0.1)
sca.add(object.scale, 'z').step(0.1)
return c
}
|
bastienrobert/coup-doeil
|
src/Experience/gui.ts
|
TypeScript
|
FunctionDeclaration
|
export function newGUIScreenTransform(
name: string,
object: Transform,
camera: Camera,
resolution: Vec2,
parent = gui,
) {
const c = parent.addFolder(name)
const size = new Vec3()
getWorldMatrix(object, size)
getScaleFromCameraDistance(camera, size, size)
const tmp: any = {
reset: () => {
tmp.position.right = 0
tmp.position.bottom = 0
onChange()
},
position: {
top: 0,
left: 0,
right: 0,
bottom: 0,
},
size: 1 / size.x,
}
const onChange = () => {
if (tmp.position.bottom) tmp.position.top = null
if (tmp.position.right) tmp.position.left = null
getWorldPositionFromViewportRectPerc(
camera,
tmp.position,
resolution,
tmp_vec_3,
)
tmp_vec_3.z = object.position.z
object.position.copy(tmp_vec_3)
object.updateMatrixWorld()
// compute object size to fit in viewport
getWorldMatrix(object, tmp_vec_3)
getScaleFromCameraDistance(camera, tmp_vec_3, tmp_vec_3)
object.scale.set(
tmp.size * tmp_vec_3.x,
tmp.size * tmp_vec_3.x,
tmp.size * tmp_vec_3.x,
)
}
c.add(tmp, 'reset')
c.add(tmp.position, 'top').step(0.1).onChange(onChange)
c.add(tmp.position, 'left').step(0.1).onChange(onChange)
c.add(object.position, 'z', -2, 2, 0.01).listen()
c.add(tmp.position, 'right').step(0.1).onChange(onChange)
c.add(tmp.position, 'bottom').step(0.1).onChange(onChange)
c.add(tmp, 'size', 0, 1, 0.01).onChange(onChange)
const rot = c.addFolder('rotation')
rot.add(object.rotation, 'x', 0, Math.PI * 2, 0.01)
rot.add(object.rotation, 'y', 0, Math.PI * 2, 0.01)
rot.add(object.rotation, 'z', 0, Math.PI * 2, 0.01)
return c
}
|
bastienrobert/coup-doeil
|
src/Experience/gui.ts
|
TypeScript
|
ArrowFunction
|
() => {
tmp.position.right = 0
tmp.position.bottom = 0
onChange()
}
|
bastienrobert/coup-doeil
|
src/Experience/gui.ts
|
TypeScript
|
ArrowFunction
|
() => {
if (tmp.position.bottom) tmp.position.top = null
if (tmp.position.right) tmp.position.left = null
getWorldPositionFromViewportRectPerc(
camera,
tmp.position,
resolution,
tmp_vec_3,
)
tmp_vec_3.z = object.position.z
object.position.copy(tmp_vec_3)
object.updateMatrixWorld()
// compute object size to fit in viewport
getWorldMatrix(object, tmp_vec_3)
getScaleFromCameraDistance(camera, tmp_vec_3, tmp_vec_3)
object.scale.set(
tmp.size * tmp_vec_3.x,
tmp.size * tmp_vec_3.x,
tmp.size * tmp_vec_3.x,
)
}
|
bastienrobert/coup-doeil
|
src/Experience/gui.ts
|
TypeScript
|
ArrowFunction
|
props => {
const { size, withHoverEffect, color, margin, ...restProps } = props;
return (
<SvgIcon {...{ size, withHoverEffect, color, margin, ...restProps }}>
<CutIconSvg {...restProps} width="1em" height="1em" />
</SvgIcon>
|
IshanKute/medly-components
|
packages/icons/src/icons/Content/CutIcon.tsx
|
TypeScript
|
ArrowFunction
|
(): JSX.Element => {
return <div className="grid place-content-center h-screen text-2xl">Página no encontrada</div>
}
|
andresguanov/curso-react-practico
|
src/pages/NotFound.tsx
|
TypeScript
|
ClassDeclaration
|
@NgModule({
declarations: [
AppComponent,
RootsearchComponent,
ConjugationGroupComponent,
TrilateralConjugationPanelComponent,
QuadilateralConjugationPanelComponent,
StartComponent,
NotFoundComponent,
InitialSarfComponent,
ActiveVerbsComponent,
SarfVerbPronounsComponent,
PassiveVerbsComponent,
DerivedNounsComponent,
NounsListingComponent,
GerundsComponent,
AboutComponent
],
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
AppRoutingModule,
BrowserAnimationsModule,
AppMaterialModule,
FlexLayoutModule,
HttpClientModule,
RouterModule.forRoot(appRoutes, {onSameUrlNavigation: 'reload'})
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
|
alsaydi/sarf
|
sarf-ui/src/app/app.module.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* Returns `account` asset holding of `assetID`. Returns undefined if the account is not
* opt-in to the given asset id.
* @param deployer algob deployer
* @param accountAddress account to return assetholding info
* @param assetID asset index
*/
export async function balanceOf (
deployer: Deployer,
accountAddress: AccountAddress,
assetID: number
): Promise<AssetHolding | undefined> {
const accountInfo = await deployer.algodClient.accountInformation(accountAddress).do();
for (const asset of accountInfo.assets) {
if (asset['asset-id'] === assetID) {
console.log("Asset Holding Info:", asset);
return asset;
}
}
return undefined;
}
|
endlessor/algo-builder
|
packages/algob/src/lib/status.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* fetches and returns the global state of application.
* @param deployer Deployer
* @param creator Account from which call needs to be made
* @param appId ID of the application being configured or empty if creating
*/
export async function readGlobalStateSSC (
deployer: Deployer,
creator: AccountAddress,
appId: number): Promise<SSCStateSchema[] | undefined> {
const accountInfoResponse = await deployer.algodClient.accountInformation(creator).do();
for (const app of accountInfoResponse['created-apps']) {
if (app.id === appId) { return app.params['global-state']; }
}
return undefined;
}
|
endlessor/algo-builder
|
packages/algob/src/lib/status.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* Read and return the local state of application from an account.
* @param deployer Deployer
* @param account account from the which the local state has to be read
* @param appId ID of the application being configured or empty if creating
*/
export async function readLocalStateSSC (
deployer: Deployer,
account: AccountAddress,
appId: number): Promise<SSCStateSchema[] | undefined> {
const accountInfoResponse = await deployer.algodClient.accountInformation(account).do();
for (const app of accountInfoResponse['apps-local-state']) {
if (app.id === appId) { return app[`key-value`]; }
}
return undefined;
}
|
endlessor/algo-builder
|
packages/algob/src/lib/status.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* Prints account asset holdings and ALGO balance (in microalgos)
* @param deployer algob deployer object
* @param account account whose asset holding to print
*/
export async function printAssets (deployer: Deployer, account: string): Promise<void> {
const accountInfo = await deployer.algodClient.accountInformation(account).do();
console.log("Asset Holding Info:", accountInfo.assets);
console.log("Account's ALGO (microalgos):", accountInfo["amount-without-pending-rewards"]);
}
|
endlessor/algo-builder
|
packages/algob/src/lib/status.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* print account's local state of a stateful smart contract
* @param deployer algob deployer
* @param accountAddr account address to print local state
* @param appId application index of smart contract
*/
export async function printLocalStateSSC (
deployer: Deployer,
accountAddr: AccountAddress,
appId: number): Promise<void> {
const localState = await readLocalStateSSC(deployer, accountAddr, appId);
if (localState === undefined) { return; }
console.log("User's local state:");
for (let n = 0; n < localState.length; n++) {
console.log(localState[n]);
}
}
|
endlessor/algo-builder
|
packages/algob/src/lib/status.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* print global state of a stateful smart contract
* @param deployer algob deployer
* @param creatorAddr creator address of stateful smart contract
* @param appId application index of smart contract
*/
export async function printGlobalStateSSC (
deployer: Deployer,
creatorAddr: AccountAddress,
appId: number): Promise<void> {
const globalState = await readGlobalStateSSC(deployer, creatorAddr, appId);
if (globalState === undefined) { return; }
console.log("Application's global state:");
for (let n = 0; n < globalState.length; n++) {
console.log(globalState[n]);
}
}
|
endlessor/algo-builder
|
packages/algob/src/lib/status.ts
|
TypeScript
|
ArrowFunction
|
(v: number): string => this.convertWithUnit(v)
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
ArrowFunction
|
() => {
const maxTickValue = getMaxTickValue(data, 1);
return maxTickValue === 0 ? this.defaultYMax : maxTickValue;
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
ClassDeclaration
|
export class ApplicationTotalThreadCountChartContainer implements IInspectorChartContainer {
private apiUrl = 'getApplicationStat/totalThreadCount/chart.pinpoint';
private minAgentIdList: string[];
private maxAgentIdList: string[];
defaultYMax = 100;
title = 'Total Thread';
constructor(
private inspectorChartDataService: InspectorChartDataService,
private inspectorChartThemeService: InspectorChartThemeService,
) {}
getData(range: number[]): Observable<IInspectorChartData> {
return this.inspectorChartDataService.getData(this.apiUrl, range);
}
makeChartData({charts}: IInspectorChartData): PrimitiveArray[] {
this.minAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 1) as string[];
this.maxAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 3) as string[];
return [
['x', ...makeXData(charts.x)],
['max', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 2)],
['avg', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 4)],
['min', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 0)],
];
}
makeDataOption(): Data {
return {
type: spline(),
names: {
min: 'Min',
avg: 'Avg',
max: 'Max',
},
colors: {
...this.inspectorChartThemeService.getMinAvgMaxColors()
}
};
}
makeElseOption(): {[key: string]: any} {
return {
line: {
classes: ['min', 'avg', 'max']
}
};
}
makeYAxisOptions(data: PrimitiveArray[]): {[key: string]: any} {
return {
y: {
label: {
text: 'Total Thread (count)',
position: 'outer-middle'
},
tick: {
count: 5,
format: (v: number): string => this.convertWithUnit(v)
},
padding: {
top: 0,
bottom: 0
},
min: 0,
max: (() => {
const maxTickValue = getMaxTickValue(data, 1);
return maxTickValue === 0 ? this.defaultYMax : maxTickValue;
})(),
default: [0, this.defaultYMax]
}
};
}
makeTooltipOptions(): {[key: string]: any} {
return {};
}
convertWithUnit(value: number): string {
return value.toString();
}
getTooltipFormat(v: number, columnId: string, i: number): string {
return `${this.convertWithUnit(v)} ${getAgentId(columnId, i, this.minAgentIdList, this.maxAgentIdList)}`;
}
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
getData(range: number[]): Observable<IInspectorChartData> {
return this.inspectorChartDataService.getData(this.apiUrl, range);
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
makeChartData({charts}: IInspectorChartData): PrimitiveArray[] {
this.minAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 1) as string[];
this.maxAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 3) as string[];
return [
['x', ...makeXData(charts.x)],
['max', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 2)],
['avg', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 4)],
['min', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 0)],
];
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
makeDataOption(): Data {
return {
type: spline(),
names: {
min: 'Min',
avg: 'Avg',
max: 'Max',
},
colors: {
...this.inspectorChartThemeService.getMinAvgMaxColors()
}
};
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
makeElseOption(): {[key: string]: any} {
return {
line: {
classes: ['min', 'avg', 'max']
}
};
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
makeYAxisOptions(data: PrimitiveArray[]): {[key: string]: any} {
return {
y: {
label: {
text: 'Total Thread (count)',
position: 'outer-middle'
},
tick: {
count: 5,
format: (v: number): string => this.convertWithUnit(v)
},
padding: {
top: 0,
bottom: 0
},
min: 0,
max: (() => {
const maxTickValue = getMaxTickValue(data, 1);
return maxTickValue === 0 ? this.defaultYMax : maxTickValue;
})(),
default: [0, this.defaultYMax]
}
};
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
makeTooltipOptions(): {[key: string]: any} {
return {};
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
convertWithUnit(value: number): string {
return value.toString();
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
MethodDeclaration
|
getTooltipFormat(v: number, columnId: string, i: number): string {
return `${this.convertWithUnit(v)} ${getAgentId(columnId, i, this.minAgentIdList, this.maxAgentIdList)}`;
}
|
donghun-cho/pinpoint
|
web/src/main/angular/src/app/core/components/inspector-chart/application-total-thread-count-chart-container.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should create an instance', () => {
expect(new Forecast()).toBeTruthy();
});
}
|
iamalperen/weather-app
|
src/app/models/forecast/forecast.model.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(new Forecast()).toBeTruthy();
}
|
iamalperen/weather-app
|
src/app/models/forecast/forecast.model.spec.ts
|
TypeScript
|
ArrowFunction
|
props => {
const { contest, onSwitchContest } = props;
const [contestPickerVisible, setContestPickerVisible] = useState(false);
const ContestPickerButton = () => (
<HeaderButton
title={contest.name}
onPress={()
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
ArrowFunction
|
() => (
<HeaderButton
title={contest.name}
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
ArrowFunction
|
() => (
<TimetableStack.Navigator screenOptions={defaultStackScreenOptions}>
<TimetableStack.Screen
component
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
ArrowFunction
|
() => (
<ResultsStack.Navigator screenOptions={defaultStackScreenOptions}>
<ResultsStack.Screen
component
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
ArrowFunction
|
({ focused, color }) => (
<Image
source={focused ? timetableFilledIcon : timetableIcon}
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
ArrowFunction
|
({ focused, color }) => (
<Image
source={focused ? scrollFilledIcon : scrollIcon}
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface Props {
contest: Contest;
onSwitchContest: (contest?: Contest) => void;
}
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type TimetableStackParamList = {
PerformanceList: { contest: Contest };
Performance: { id: string; stage: Stage };
};
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
TypeAliasDeclaration
|
export type ResultsStackParamList = {
ResultGroupList: { contest: Contest };
ResultList: { contestId: string; contestCategoryId: string };
};
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
TypeAliasDeclaration
|
type BottomTabParamList = {
Timetable: undefined;
Results: undefined;
};
|
richeterre/jumu-app
|
src/navigation/ContestNavigator.tsx
|
TypeScript
|
FunctionDeclaration
|
function calcSkipValue(input: number): number {
let blit = 0;
// 1. Run sieve first;
blit =
((0x88888888 & input) >>> 3) |
((0x44444444 & input) >>> 2) |
((0x22222222 & input) >>> 1) |
(0x11111111 & input);
// 2. Shift them to the value
blit =
((blit & 0x10000000) >>> 21) |
((blit & 0x01000000) >>> 18) |
((blit & 0x00100000) >>> 15) |
((blit & 0x00010000) >>> 12) |
((blit & 0x00001000) >>> 9) |
((blit & 0x00000100) >>> 6) |
((blit & 0x00000010) >>> 3) |
(blit & 0x00000001);
return blit;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
FunctionDeclaration
|
function blit(input: number, offset: number, value: number): number {
return (input & ~(0xFF << offset)) | (value << offset);
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
_getPage(pageId: number): Int32Array {
let page = this.pages[pageId];
if (page == null) {
page = new Int32Array(256);
this.pages[pageId] = page;
}
return page;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
_getPageIfExists(pageId: number): Int32Array | null {
const page = this.pages[pageId];
return page;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
_getSkipPage(pageId: number): Int32Array {
let page = this.skipPages[pageId];
if (page == null) {
page = new Int32Array(84);
this.skipPages[pageId] = page;
}
return page;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
_generateSkipPageWord(pageId: number, wordPos: number, value: number): void {
// Regenerate skip page for the given word.
// Each 4 bits are compacted to 1 bit - therefore 32 bits are combined to
// 8 bits. This sets 1 byte of layer 1.
// We repeat this for 3 times to generate each layer.
const skipPage = this._getSkipPage(pageId);
const skip1Pos = wordPos >>> 2;
const skip1Offset = (wordPos << 3) % 32;
const skip2Pos = (skip1Pos >>> 2);
const skip2Offset = (skip1Pos << 3) % 32;
const skip3Pos = (skip2Pos >>> 2);
const skip3Offset = (skip2Pos << 3) % 32;
const skip1 = blit(skipPage[skip1Pos], skip1Offset, calcSkipValue(value));
const skip2 = blit(skipPage[skip2Pos + 64], skip2Offset,
calcSkipValue(skip1));
const skip3 = blit(skipPage[skip3Pos + 80], skip3Offset,
calcSkipValue(skip2));
skipPage[skip1Pos] = skip1;
skipPage[skip2Pos + 64] = skip2;
skipPage[skip3Pos + 80] = skip3;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
_generateSkipPage(pageId: number): void {
// If we're regenerating entire page, we can just calculate each skip page.
const page = this._getPage(pageId);
const skipPage = this._getSkipPage(pageId);
// Mux 4 integers into one...
for (let i = 0; i < page.length; i += 4) {
let out = 0;
for (let j = 0; j < 4; j += 1) {
out |= calcSkipValue(page[i + j]) << (j * 8);
}
skipPage[i >> 2] = out;
}
// The same goes for level 1 and 2.
for (let i = 0; i < 64; i += 4) {
let out = 0;
for (let j = 0; j < 4; j += 1) {
out |= calcSkipValue(skipPage[i + j]) << (j * 8);
}
skipPage[(i >> 2) + 64] = out;
}
for (let i = 0; i < 16; i += 4) {
let out = 0;
for (let j = 0; j < 4; j += 1) {
out |= calcSkipValue(skipPage[i + j + 64]) << (j * 8);
}
skipPage[(i >> 2) + 80] = out;
}
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
clear(): void {
this.pages = [];
this.skipPages = [];
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
set(key: number, value: boolean): this {
const pageId = key >> 13;
const pageWord = (key >> 5) & 0xFF;
const page = this._getPage(pageId);
let wordValue = page[pageWord];
if (value) wordValue |= 1 << (key & 31);
else wordValue &= ~(1 << (key & 31));
page[pageWord] = wordValue;
this._generateSkipPageWord(pageId, pageWord, wordValue);
return this;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
setWord(wordPos: number, value: number): void {
const pageId = wordPos / 256 | 0;
const page = this._getPage(pageId);
const pos = wordPos % 256;
page[pos] = value;
this._generateSkipPageWord(pageId, pos, value);
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
add(value: number): this {
return this.set(value, true);
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
delete(value: number): boolean {
this.set(value, false);
// TODO Check if bit was true
return true;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
has(key: number): boolean {
return this.get(key);
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
get(key: number): boolean {
const pageId = key >> 13;
const pageByte = key >> 5;
const pageOffset = pageByte & 255;
const page = this._getPageIfExists(pageId);
if (page == null) return false;
return (page[pageOffset] & (1 << (key & 31))) !== 0;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
getWord(wordPos: number): number {
const pageId = wordPos / 256 | 0;
const page = this._getPageIfExists(pageId);
if (page == null) return 0;
return page[wordPos % 256];
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
[Symbol.iterator](): IterableIterator<number> {
return this.values();
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
forEach(
callbackfn: (value: number, value2: number, set: Set<number>) => void,
thisArg?: any,
): void {
for (const value of this.values()) {
callbackfn.call(thisArg, value, value, this);
}
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
* entries(): IterableIterator<[number, number]> {
for (const value of this.values()) {
yield [value, value];
}
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
keys(): IterableIterator<number> {
return this.values();
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
* values(): IterableIterator<number> {
for (let i = 0; i < this.pages.length; i += 1) {
const page = this.pages[i];
if (page == null) continue;
const skipPage = this.skipPages[i];
let skipPage1Val = 0;
let skipPage2Val = 0;
let skipPage3Val = 0;
// skip page 1: 0.125 bytes per 1 bit, wraps every 4 byte
// skip page 2: 0.5 bytes per 1 bit, wraps every 16 byte
// skip page 3: 2 bytes per 1 bit, wraps every 64 byte
for (let j = 0; j < page.length; j += 1) {
if (j % 64 === 0) skipPage3Val = skipPage[(j / 64 | 0) + 80];
if (j % 16 === 0) skipPage2Val = skipPage[(j / 16 | 0) + 64];
if (j % 4 === 0) skipPage1Val = skipPage[j / 4 | 0];
if (j % 2 === 0) {
if (!(skipPage3Val & (1 << ((j >> 1) % 32)))) {
j += 1;
continue;
}
}
let value = page[j];
let pos = 0;
while (value !== 0) {
if (pos % 16 === 0) {
if (!(skipPage2Val & (1 << ((j >> 2) + (pos >> 4))))) {
pos += 16;
value >>>= 16;
continue;
}
}
if (pos % 4 === 0) {
if (!(skipPage1Val & (1 << (pos >> 2)))) {
pos += 4;
value >>>= 4;
continue;
}
}
if (value & 1) yield pos + j * 32 + i * 256 * 32;
pos += 1;
value >>>= 1;
}
}
}
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
and(set: BitSet): BitSet {
const output = new BitSet();
const minPages = Math.min(set.pages.length, this.pages.length);
for (let i = 0; i < minPages; i += 1) {
const aPage = this.pages[i];
const bPage = set.pages[i];
if (aPage == null || bPage == null) {
continue;
}
const outPage = new Int32Array(256);
for (let j = 0; j < outPage.length; j += 1) {
outPage[j] = aPage[j] & bPage[j];
}
output.pages[i] = outPage;
output._generateSkipPage(i);
}
return output;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
// this AND ~set
andNot(set: BitSet): BitSet {
const output = new BitSet();
for (let i = 0; i < this.pages.length; i += 1) {
const aPage = this.pages[i];
const bPage = set.pages[i];
if (aPage == null) continue;
if (bPage == null) {
output.pages[i] = aPage;
continue;
}
const outPage = new Int32Array(256);
for (let j = 0; j < outPage.length; j += 1) {
outPage[j] = aPage[j] & ~bPage[j];
}
output.pages[i] = outPage;
output._generateSkipPage(i);
}
return output;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
or(set: BitSet): BitSet {
const output = new BitSet();
const maxPages = Math.max(set.pages.length, this.pages.length);
for (let i = 0; i < maxPages; i += 1) {
const aPage = this.pages[i];
const bPage = set.pages[i];
if (aPage == null) {
output.pages[i] = bPage;
continue;
}
if (bPage == null) {
output.pages[i] = aPage;
continue;
}
const outPage = new Int32Array(256);
for (let j = 0; j < outPage.length; j += 1) {
outPage[j] = aPage[j] | bPage[j];
}
output.pages[i] = outPage;
output._generateSkipPage(i);
}
return output;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
MethodDeclaration
|
xor(set: BitSet): BitSet {
const output = new BitSet();
const maxPages = Math.max(set.pages.length, this.pages.length);
for (let i = 0; i < maxPages; i += 1) {
const aPage = this.pages[i];
const bPage = set.pages[i];
if (aPage == null) {
output.pages[i] = bPage;
continue;
}
if (bPage == null) {
output.pages[i] = aPage;
continue;
}
const outPage = new Int32Array(256);
for (let j = 0; j < outPage.length; j += 1) {
outPage[j] = aPage[j] ^ bPage[j];
}
output.pages[i] = outPage;
output._generateSkipPage(i);
}
return output;
}
|
yoo2001818/fast-ecs
|
src/bitSet.ts
|
TypeScript
|
FunctionDeclaration
|
function toggleStackedLabels() {
const { yAxis } = this;
// CL-10676 - Return if yAxis is undefined
if (!yAxis || yAxis.length === 0) {
return;
}
const { stackTotalGroup, stacks }: any = yAxis[0] || {};
if (stacks && stackTotalGroup) {
// We need to use Lodash map, because we are iterating through an object
const labels = map(yAxis[0].stacks.column, (point: any) => point.label);
const neighbors = toNeighbors(labels);
const neighborsAreOverlapping = neighbors.some((labelsPair) => {
const [firstLabel, nextLabel]: any[] = labelsPair || [];
if (firstLabel && nextLabel) {
if (firstLabel.alignAttr && nextLabel.alignAttr) {
// We need to calculate this from getBBox, because FireFox does not
// provide clientWidth attribute
const firstLabelWidth = firstLabel.element.getBBox().width;
const firstLabelRight = firstLabel.alignAttr.x + firstLabelWidth;
const nextLabelLeft = nextLabel.alignAttr.x;
return firstLabelRight > nextLabelLeft;
}
}
return false;
});
if (neighborsAreOverlapping) {
this.userOptions.stackLabelsVisibility = 'hidden';
stackTotalGroup.hide();
} else {
this.userOptions.stackLabelsVisibility = 'visible';
stackTotalGroup.show();
}
}
}
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(
visiblePoints: any,
minAxisValue: number,
shouldCheckShapeIntersection: boolean = false) => {
const foundIntersection = toNeighbors(
// some data labels may not be rendered (too many points)
visiblePoints.filter(hasDataLabel)
).some((pointPair) => {
const [firstPoint, nextPoint]: any[] = pointPair || [];
const firstDataLabelAttr = getDataLabelAttributes(firstPoint);
const nextDataLabelAttr = getDataLabelAttributes(nextPoint);
if (shouldCheckShapeIntersection) {
const firstShapeAttr = getShapeAttributes(firstPoint);
const nextShapeAttr = getShapeAttributes(nextPoint);
return isIntersecting(firstDataLabelAttr, nextDataLabelAttr) ||
isIntersecting(firstDataLabelAttr, nextShapeAttr) ||
isIntersecting(firstShapeAttr, nextDataLabelAttr);
}
return isIntersecting(firstDataLabelAttr, nextDataLabelAttr);
});
if (foundIntersection) {
hideDataLabels(visiblePoints);
} else {
visiblePoints.forEach((point: any) => showDataLabelInAxisRange(point, minAxisValue));
}
}
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(pointPair) => {
const [firstPoint, nextPoint]: any[] = pointPair || [];
const firstDataLabelAttr = getDataLabelAttributes(firstPoint);
const nextDataLabelAttr = getDataLabelAttributes(nextPoint);
if (shouldCheckShapeIntersection) {
const firstShapeAttr = getShapeAttributes(firstPoint);
const nextShapeAttr = getShapeAttributes(nextPoint);
return isIntersecting(firstDataLabelAttr, nextDataLabelAttr) ||
isIntersecting(firstDataLabelAttr, nextShapeAttr) ||
isIntersecting(firstShapeAttr, nextDataLabelAttr);
}
return isIntersecting(firstDataLabelAttr, nextDataLabelAttr);
}
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(point: any) => showDataLabelInAxisRange(point, minAxisValue)
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(visiblePoints: any, minAxisValue: number) => {
const toggleLabel = (point: any) => {
const { dataLabel, shapeArgs } = point;
if (dataLabel && shapeArgs) {
const labelHeight = dataLabel.height + (2 * dataLabel.padding || 0);
const isOverlappingHeight = labelHeight > shapeArgs.height;
return isOverlappingHeight ? hideDataLabel(point) : showDataLabelInAxisRange(point, minAxisValue);
}
return null;
};
const isOverlappingWidth = visiblePoints.filter(hasDataLabel).some((point: any) => {
const { dataLabel } = point;
if (dataLabel) {
const labelWidth = dataLabel.width + (2 * dataLabel.padding);
return labelWidth > point.shapeArgs.width;
}
return false;
});
if (isOverlappingWidth) {
hideDataLabels(visiblePoints);
} else {
visiblePoints.forEach(toggleLabel);
}
}
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(point: any) => {
const { dataLabel, shapeArgs } = point;
if (dataLabel && shapeArgs) {
const labelHeight = dataLabel.height + (2 * dataLabel.padding || 0);
const isOverlappingHeight = labelHeight > shapeArgs.height;
return isOverlappingHeight ? hideDataLabel(point) : showDataLabelInAxisRange(point, minAxisValue);
}
return null;
}
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(point: any) => {
const { dataLabel } = point;
if (dataLabel) {
const labelWidth = dataLabel.width + (2 * dataLabel.padding);
return labelWidth > point.shapeArgs.width;
}
return false;
}
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(point: any) => point.label
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
ArrowFunction
|
(labelsPair) => {
const [firstLabel, nextLabel]: any[] = labelsPair || [];
if (firstLabel && nextLabel) {
if (firstLabel.alignAttr && nextLabel.alignAttr) {
// We need to calculate this from getBBox, because FireFox does not
// provide clientWidth attribute
const firstLabelWidth = firstLabel.element.getBBox().width;
const firstLabelRight = firstLabel.alignAttr.x + firstLabelWidth;
const nextLabelLeft = nextLabel.alignAttr.x;
return firstLabelRight > nextLabelLeft;
}
}
return false;
}
|
imnutz/gooddata-react-components
|
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.