type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
MethodDeclaration |
video(url: string) {
return this.attachment({type: 'video', payload: {url}})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
file(url: string) {
return this.attachment({type: 'file', payload: {url}})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
location(lat: number, long: number, url: string) {
return this.attachment({type: 'location', payload: {url, coordinates: {lat, long}}})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
protected validate() {
const {recipientId, senderId, items} = this.data
if (recipientId === undefined)
throw `The recipient is missing, use .to(recipientId) to set the recipient`
if (senderId === undefined) throw `The sender is missing, use .from(senderId) to set the sender`
if (items.length === 0) throw `The message to send with the event is missing`
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
protected build() {
const {recipientId, senderId, items} = this.data
const entry = items.map(({timestamp, ...data}) => {
return {
id: recipientId,
time: timestamp,
messaging: [
{
timestamp,
sender: {id: senderId},
recipient: {id: recipientId},
...data,
},
],
} as EventEntry
})
return {object: 'page', entry} as WebhookEvent
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
private message(data: Omit<MessageEvent, 'mid'>) {
const mid = `m-${nextFakeMessageId++}`
const item = {timestamp: this.data.timestamp, message: {mid, ...data}}
return this.clone({items: [...this.data.items, item]})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
private attachment(data: EventAttachment) {
return this.message({attachments: [data]})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
FunctionDeclaration |
async function fetchPackageDetail() {
try {
const detailPkg = await API.getPackage({
packageName: packageName,
version: version,
repositoryKind: repositoryKind,
repositoryName: repositoryName,
});
let metaTitle = `${detailPkg.normalizedName} ${detailPkg.version} · ${
detailPkg.repository.userAlias || detailPkg.repository.organizationName
}/${detailPkg.repository.name}`;
updateMetaIndex(metaTitle, detailPkg.description);
setDetail(detailPkg);
if (currentHash) {
setCurrentHash(undefined);
}
if (isUndefined(activeChannel) && detailPkg.repository.kind === RepositoryKind.OLM) {
if (detailPkg.defaultChannel) {
setActiveChannel(detailPkg.defaultChannel);
} else if (detailPkg.channels && detailPkg.channels.length > 0) {
setActiveChannel(detailPkg.channels[0].name);
}
}
setApiError(null);
window.scrollTo(0, 0); // Scroll to top when a new version is loaded
setIsLoadingPackage(false);
scrollIntoView();
} catch (err) {
if (err.kind === ErrorKind.NotFound) {
setApiError(
<>
<div className={`mb-4 mb-lg-5 h2 ${styles.noDataTitleContent}`}>
Sorry, the package you requested was not found.
</div>
<p className={`h5 mb-4 mb-lg-5 ${styles.noDataTitleContent}`}>
The package you are looking for may have been deleted by the provider, or it may now belong to a different
repository. Please try searching for it, as it may help locating the package in a different repository or
discovering other alternatives.
</p>
<p className={`h6 ${styles.noDataContent}`} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(props: Props) => {
const history = useHistory();
const [isLoadingPackage, setIsLoadingPackage] = useState(false);
const [packageName, setPackageName] = useState(props.packageName);
const [repositoryKind, setRepositoryKind] = useState(props.repositoryKind);
const [repositoryName, setRepositoryName] = useState(props.repositoryName);
const [version, setVersion] = useState(props.version);
const [detail, setDetail] = useState<Package | null | undefined>(undefined);
const { tsQueryWeb, tsQuery, pageNumber, filters, deprecated, operators, verifiedPublisher, official } =
props.searchUrlReferer || {};
const [apiError, setApiError] = useState<null | string | JSX.Element>(null);
const [activeChannel, setActiveChannel] = useState<string | undefined>(props.channel);
const [currentHash, setCurrentHash] = useState<string | undefined>(props.hash);
useScrollRestorationFix();
useEffect(() => {
if (!isUndefined(props.packageName) && !isLoadingPackage) {
setPackageName(props.packageName);
setVersion(props.version);
setRepositoryKind(props.repositoryKind);
setRepositoryName(props.repositoryName);
}
}, [props, isLoadingPackage]);
async function fetchPackageDetail() {
try {
const detailPkg = await API.getPackage({
packageName: packageName,
version: version,
repositoryKind: repositoryKind,
repositoryName: repositoryName,
});
let metaTitle = `${detailPkg.normalizedName} ${detailPkg.version} · ${
detailPkg.repository.userAlias || detailPkg.repository.organizationName
}/${detailPkg.repository.name}`;
updateMetaIndex(metaTitle, detailPkg.description);
setDetail(detailPkg);
if (currentHash) {
setCurrentHash(undefined);
}
if (isUndefined(activeChannel) && detailPkg.repository.kind === RepositoryKind.OLM) {
if (detailPkg.defaultChannel) {
setActiveChannel(detailPkg.defaultChannel);
} else if (detailPkg.channels && detailPkg.channels.length > 0) {
setActiveChannel(detailPkg.channels[0].name);
}
}
setApiError(null);
window.scrollTo(0, 0); // Scroll to top when a new version is loaded
setIsLoadingPackage(false);
scrollIntoView();
} catch (err) {
if (err.kind === ErrorKind.NotFound) {
setApiError(
<>
<div className={`mb-4 mb-lg-5 h2 ${styles.noDataTitleContent}`}>
Sorry, the package you requested was not found.
</div>
<p className={`h5 mb-4 mb-lg-5 ${styles.noDataTitleContent}`}>
The package you are looking for may have been deleted by the provider, or it may now belong to a different
repository. Please try searching for it, as it may help locating the package in a different repository or
discovering other alternatives.
</p>
<p className={`h6 ${styles.noDataContent}`}>
NOTE: The official Helm <span className="font-weight-bold">stable</span> and{' '}
<span className="font-weight-bold">incubator</span> repositories were removed from Artifact Hub on
November 6th as part of the deprecation plan announced by the Helm project. For more information please
see <ExternalLink href="https://helm.sh/blog/charts-repo-deprecation/">this blog post</ExternalLink> and{' '}
<ExternalLink href="https://github.com/helm/charts/issues/23944">this Github issue</ExternalLink>.
</p>
</> | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
if (!isUndefined(props.packageName) && !isLoadingPackage) {
setPackageName(props.packageName);
setVersion(props.version);
setRepositoryKind(props.repositoryKind);
setRepositoryName(props.repositoryName);
}
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
setIsLoadingPackage(true);
fetchPackageDetail();
/* eslint-disable react-hooks/exhaustive-deps */
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
return () => {
setIsLoadingPackage(false);
};
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
setIsLoadingPackage(false);
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(channel: string) => {
history.replace({
search: `?channel=${channel}`,
});
setActiveChannel(channel);
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(wrapperClassName?: string): JSX.Element | null => (
<div className={wrapperClassName}>
<InstallationModal
package | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(): string | FalcoRules | undefined => {
let rules: string | FalcoRules | undefined;
if (
!isUndefined(detail) &&
!isNull(detail) &&
!isNull(detail.data) &&
!isUndefined(detail.data) &&
!isUndefined(detail.data.rules)
) {
if (isArray(detail.data.rules)) {
rules = map(detail.data.rules, 'Raw').join(' ');
} else {
rules = detail.data.rules as FalcoRules;
}
}
return rules;
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(): OPAPolicies | undefined => {
let policies: OPAPolicies | undefined;
if (
!isUndefined(detail) &&
!isNull(detail) &&
!isNull(detail.data) &&
!isUndefined(detail.data) &&
!isUndefined(detail.data.policies)
) {
policies = detail.data.policies;
}
return policies;
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(): string | undefined => {
let manifest: string | undefined;
if (
!isUndefined(detail) &&
!isNull(detail) &&
!isNull(detail.data) &&
!isUndefined(detail.data) &&
!isUndefined(detail.data.manifestRaw)
) {
manifest = detail.data.manifestRaw as string;
}
return manifest;
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(): CustomResourcesDefinition[] | undefined => {
let resources: CustomResourcesDefinition[] | undefined;
if (detail && detail.crds) {
let examples: CustomResourcesDefinitionExample[] = detail.crdsExamples || [];
resources = detail.crds.map((resourceDefinition: CustomResourcesDefinition) => {
return {
...resourceDefinition,
example: examples.find((info: any) => info.kind === resourceDefinition.kind),
};
});
}
return resources;
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(resourceDefinition: CustomResourcesDefinition) => {
return {
...resourceDefinition,
example: examples.find((info: any) => info.kind === resourceDefinition.kind),
};
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(info: any) => info.kind === resourceDefinition.kind | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(): JSX.Element | null => {
const resources = getCRDs();
if (!isUndefined(resources) && resources.length > 0) {
return (
<div className={`mb-5 ${styles.codeWrapper}`}>
<AnchorHeader level={2} scrollIntoView={scrollIntoView} title="Custom Resource Definitions" />
<CustomResourceDefinition resources={resources} normalizedName={detail!.normalizedName} />
</div> | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(withRepoInfo: boolean, extraStyle?: string): JSX.Element => (
<>
<OfficialBadge official={isPackageOfficial(detail)} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
if (props.hash !== currentHash) {
setCurrentHash(props.hash);
if (isUndefined(props.hash) || props.hash === '') {
window.scrollTo(0, 0);
} else {
scrollIntoView();
}
}
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(id?: string) => {
const elId = id || props.hash;
if (isUndefined(elId) || elId === '') return;
try {
const element = document.querySelector(elId);
if (element) {
element.scrollIntoView({ block: 'start', inline: 'nearest', behavior: 'smooth' });
if (isUndefined(id)) {
history.replace({
pathname: history.location.pathname,
hash: elId,
state: {
searchUrlReferer: props.searchUrlReferer,
fromStarredPage: props.fromStarredPage,
},
});
} else if (props.hash !== elId) {
history.push({
pathname: history.location.pathname,
hash: elId,
state: {
searchUrlReferer: props.searchUrlReferer,
fromStarredPage: props.fromStarredPage,
},
});
}
}
} finally {
return;
}
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
(): { content: JSX.Element; titles: string } | null => {
if (isNull(detail) || isUndefined(detail)) return null;
let additionalTitles = '';
const additionalContent = (
<>
{(() => {
switch (detail.repository.kind) {
case RepositoryKind.Falco:
let rules: string | FalcoRules | undefined = getFalcoRules();
if (!isUndefined(rules)) {
additionalTitles += '# Rules\n';
}
return (
<>
{!isUndefined(rules) && (
<div className={`mb-5 ${styles.codeWrapper}`}>
<AnchorHeader level={2} scrollIntoView={scrollIntoView} title="Rules" />
{(() => {
switch (typeof rules) {
case 'string':
return (
<div className="d-flex d-xxl-inline-block mw-100 position-relative">
<BlockCodeButtons content={rules} filename={`${detail.normalizedName}-rules.yaml`} />
<SyntaxHighlighter
language="yaml"
style={tomorrowNight}
customStyle={{ padding: '1.5rem' }}
>
{rules}
</SyntaxHighlighter>
</div>
);
default:
return (
<ResourcesList
resources={rules}
normalizedName={detail.normalizedName}
kind={detail.repository.kind}
/>
);
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
switch (detail.repository.kind) {
case RepositoryKind.Falco:
let rules: string | FalcoRules | undefined = getFalcoRules();
if (!isUndefined(rules)) {
additionalTitles += '# Rules\n';
}
return (
<>
{!isUndefined(rules) && (
<div className={`mb-5 ${styles.codeWrapper}`}>
<AnchorHeader level={2} scrollIntoView={scrollIntoView} title="Rules" />
{(() => {
switch (typeof rules) {
case 'string':
return (
<div className="d-flex d-xxl-inline-block mw-100 position-relative">
<BlockCodeButtons content={rules} filename={`${detail.normalizedName}-rules.yaml`} />
<SyntaxHighlighter
language="yaml"
style={tomorrowNight}
customStyle={{ padding: '1.5rem' }}
>
{rules}
</SyntaxHighlighter>
</div>
);
default:
return (
<ResourcesList
resources={rules}
normalizedName={detail.normalizedName}
kind={detail.repository.kind}
/> | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
switch (typeof rules) {
case 'string':
return (
<div className="d-flex d-xxl-inline-block mw-100 position-relative">
<BlockCodeButtons content={rules} filename={`${detail.normalizedName}-rules.yaml`} />
<SyntaxHighlighter
language="yaml"
style={tomorrowNight}
customStyle={{ padding: '1.5rem' }} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
ArrowFunction |
() => {
switch (detail.repository.kind) {
case RepositoryKind.TektonTask:
return (
<TektonManifestModal
normalizedName={detail.normalizedName}
manifestRaw={getManifestRaw()}
/>
);
case RepositoryKind.Helm:
return (
<div className="mb-2">
<ValuesSchema
hasValuesSchema={detail.hasValuesSchema}
packageId={detail.packageId}
version={detail.version!}
normalizedName={detail.normalizedName}
searchUrlReferer={props.searchUrlReferer}
fromStarredPage={props.fromStarredPage}
visibleValuesSchema={
!isUndefined(props.visibleModal) && props.visibleModal === 'values-schema'
}
visibleValuesSchemaPath={
!isUndefined(props.visibleModal) && props.visibleModal === 'values-schema'
? props.visibleValuesSchemaPath
: undefined
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
InterfaceDeclaration |
interface Props {
searchUrlReferer?: SearchFiltersURL;
fromStarredPage?: boolean;
packageName: string;
version?: string;
repositoryKind: string;
repositoryName: string;
hash?: string;
channel?: string;
visibleModal?: string;
visibleValuesSchemaPath?: string;
visibleTemplate?: string;
} | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
isPackageOfficial(detail) | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
tsQueryWeb ? (
< | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
getBadges(false, 'mt-1') | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
getBadges(true, 'mt-3 mt-md-0') | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
isNull(detail) | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
isNull(apiError) | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
getInstallationModal('mb-2') | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
getManifestRaw() | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
isNull(detail | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
MethodDeclaration |
isNull(additionalInfo) | danielhass/hub | web/src/layout/package/index.tsx | TypeScript |
InterfaceDeclaration |
export default interface DataProps {
title?: string;
content?: string;
date?: string;
location?: string;
picture?: string;
initialValue?:any;
clear?:any;
} | danielhampikian/ionic5_react_app | realtime_database/src/components/DataProps.ts | TypeScript |
ArrowFunction |
(s: number[]) => this.onSelectionChanged(s) | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
ArrowFunction |
() => (this.defaultPointColor as any) | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration | /**
* Create points, set their locations and actually instantiate the
* geometry.
*/
private addSprites(scene: THREE.Scene) {
// Create geometry.
this.geometry = new THREE.BufferGeometry();
this.createBufferAttributes();
let canvas = document.createElement('canvas');
let image = this.image || canvas;
// TODO(b/31390553): Pass sprite dim to the renderer.
let spriteDim = 28.0;
let tex = this.createTexture(image);
let pointSize = (this.sceneIs3D ? this.pointSize3D : this.pointSize2D);
if (this.image) {
pointSize = IMAGE_SIZE;
}
this.uniforms = {
texture: {type: 't', value: tex},
imageWidth: {type: 'f', value: image.width / spriteDim},
imageHeight: {type: 'f', value: image.height / spriteDim},
fogColor: {type: 'c', value: this.fog.color},
fogNear: {type: 'f', value: this.fog.near},
fogFar: {type: 'f', value: this.fog.far},
sizeAttenuation: {type: 'bool', value: this.sceneIs3D},
isImage: {type: 'bool', value: !!this.image},
pointSize: {type: 'f', value: pointSize}
};
let haveImage = (this.image != null);
this.renderMaterial = new THREE.ShaderMaterial({
uniforms: this.uniforms,
vertexShader: VERTEX_SHADER,
fragmentShader: FRAGMENT_SHADER,
transparent: !haveImage,
depthTest: haveImage,
depthWrite: haveImage,
fog: true,
blending: (this.image ? THREE.NormalBlending : this.blending),
});
this.pickingMaterial = new THREE.ShaderMaterial({
uniforms: this.uniforms,
vertexShader: VERTEX_SHADER,
fragmentShader: FRAGMENT_SHADER,
transparent: false,
depthTest: true,
depthWrite: true,
fog: false,
blending: (this.image ? THREE.NormalBlending : this.blending),
});
// And finally initialize it and add it to the scene.
this.points = new THREE.Points(this.geometry, this.renderMaterial);
scene.add(this.points);
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
private calibratePointSize() {
let numPts = this.dataSet.points.length;
let scaleConstant = 200;
let logBase = 8;
// Scale point size inverse-logarithmically to the number of points.
this.pointSize3D = scaleConstant / Math.log(numPts) / Math.log(logBase);
this.pointSize2D = this.pointSize3D / 1.5;
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
private setFogDistances(nearestPointZ: number, farthestPointZ: number) {
if (this.sceneIs3D) {
this.fog.near = nearestPointZ;
// If there are fewer points we want less fog. We do this
// by making the "far" value (that is, the distance from the camera to the
// far edge of the fog) proportional to the number of points.
let multiplier = 2 -
Math.min(this.dataSet.points.length, NUM_POINTS_FOG_THRESHOLD) /
NUM_POINTS_FOG_THRESHOLD;
this.fog.far = farthestPointZ * multiplier;
} else {
this.fog.near = Infinity;
this.fog.far = Infinity;
}
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration | /**
* Set up buffer attributes to be used for the points/images.
*/
private createBufferAttributes() {
let numPoints = this.dataSet.points.length;
this.pickingColors = new Float32Array(numPoints * RGB_NUM_BYTES);
let colors = new THREE.BufferAttribute(this.pickingColors, RGB_NUM_BYTES);
// Fill pickingColors with each point's unique id as its color.
for (let i = 0; i < numPoints; i++) {
let color = new THREE.Color(i);
colors.setXYZ(i, color.r, color.g, color.b);
}
this.renderColors = new Float32Array(numPoints * RGB_NUM_BYTES);
colors.array = this.renderColors;
/** Indices cooresponding to highlighted points. */
let hiArr = new Float32Array(numPoints);
let highlights = new THREE.BufferAttribute(hiArr, INDEX_NUM_BYTES);
/**
* The actual indices of the points which we use for sizeAttenuation in
* the shader.
*/
let indicesShader =
new THREE.BufferAttribute(new Float32Array(numPoints), 1);
// Create the array of indices.
for (let i = 0; i < numPoints; i++) {
indicesShader.setX(i, this.dataSet.points[i].dataSourceIndex);
}
// Finally, add all attributes to the geometry.
this.geometry.addAttribute('position', this.positionBuffer);
this.positionBuffer.needsUpdate = true;
this.geometry.addAttribute('color', colors);
this.geometry.addAttribute('vertexIndex', indicesShader);
this.geometry.addAttribute('isHighlight', highlights);
this.colorSprites(null);
this.highlightSprites(null, null);
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
private colorSprites(colorAccessor: (index: number) => string) {
if (this.geometry == null) {
return;
}
let colors = this.geometry.getAttribute('color') as THREE.BufferAttribute;
colors.array = this.renderColors;
let getColor: (index: number) => string = (() => undefined);
if (this.image == null) {
getColor =
colorAccessor ? colorAccessor : () => (this.defaultPointColor as any);
}
for (let i = 0; i < this.dataSet.points.length; i++) {
let color = new THREE.Color(getColor(i));
colors.setXYZ(i, color.r, color.g, color.b);
}
colors.needsUpdate = true;
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
private highlightSprites(
highlightedPoints: number[], highlightStroke: (index: number) => string) {
if (this.geometry == null) {
return;
}
let highlights =
this.geometry.getAttribute('isHighlight') as THREE.BufferAttribute;
for (let i = 0; i < this.dataSet.points.length; i++) {
highlights.setX(i, 0.0);
}
if (highlightedPoints && highlightStroke) {
let colors = this.geometry.getAttribute('color') as THREE.BufferAttribute;
// Traverse in reverse so that the point we are hovering over
// (highlightedPoints[0]) is painted last.
for (let i = highlightedPoints.length - 1; i >= 0; i--) {
let assocPoint = highlightedPoints[i];
let color = new THREE.Color(highlightStroke(i));
// Fill colors array (single array of numPoints*3 elements,
// triples of which refer to the rgb values of a single vertex).
colors.setXYZ(assocPoint, color.r, color.g, color.b);
highlights.setX(assocPoint, 1.0);
}
colors.needsUpdate = true;
}
highlights.needsUpdate = true;
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration | /* Updates the positions buffer array to reflect the actual data. */
private updatePositionsArray() {
// Update the points.
for (let i = 0; i < this.dataSet.points.length; i++) {
// Set position based on projected point.
let pp = this.dataSet.points[i].projectedPoint;
this.positionBuffer.setXYZ(i, pp[0], pp[1], pp[2]);
}
if (this.geometry) {
this.positionBuffer.needsUpdate = true;
}
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
removeAllFromScene(scene: THREE.Scene) {
scene.remove(this.points);
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration | /**
* Generate a texture for the points/images and sets some initial params
*/
createTexture(image: HTMLImageElement|HTMLCanvasElement): THREE.Texture {
let tex = new THREE.Texture(image);
tex.needsUpdate = true;
// Used if the texture isn't a power of 2.
tex.minFilter = THREE.LinearFilter;
tex.generateMipmaps = false;
tex.flipY = false;
return tex;
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onDataSet(dataSet: DataSet, spriteImage: HTMLImageElement) {
this.dataSet = dataSet;
this.image = spriteImage;
this.points = null;
if (this.geometry) {
this.geometry.dispose();
}
this.geometry = null;
this.calibratePointSize();
let positions =
new Float32Array(this.dataSet.points.length * XYZ_NUM_BYTES);
this.positionBuffer = new THREE.BufferAttribute(positions, XYZ_NUM_BYTES);
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onSelectionChanged(selection: number[]) {
this.defaultPointColor =
(selection.length > 0) ? POINT_COLOR_GRAYED : POINT_COLOR;
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onSetDayNightMode(isNight: boolean) {
this.blending = (isNight ? BLENDING_NIGHT : BLENDING_DAY);
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onRecreateScene(
scene: THREE.Scene, sceneIs3D: boolean, backgroundColor: number) {
this.sceneIs3D = sceneIs3D;
this.fog = new THREE.Fog(backgroundColor);
scene.fog = this.fog;
this.addSprites(scene);
this.colorSprites(null);
this.highlightSprites(null, null);
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onUpdate() {
this.updatePositionsArray();
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onResize(newWidth: number, newHeight: number) {} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onPickingRender(camera: THREE.Camera, cameraTarget: THREE.Vector3) {
if (!this.geometry) {
return;
}
// Fog changes point colors, which alters the IDs.
this.fog.near = Infinity;
this.fog.far = Infinity;
this.points.material = this.pickingMaterial;
this.pickingMaterial.uniforms.isImage.value = false;
let colors = this.geometry.getAttribute('color') as THREE.BufferAttribute;
colors.array = this.pickingColors;
colors.needsUpdate = true;
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
MethodDeclaration |
onRender(rc: RenderContext) {
if (!this.geometry) {
return;
}
this.colorSprites(rc.colorAccessor);
this.highlightSprites(rc.highlightedPoints, rc.highlightStroke);
this.setFogDistances(
rc.nearestCameraSpacePointZ, rc.farthestCameraSpacePointZ);
this.points.material = this.renderMaterial;
this.renderMaterial.uniforms.isImage.value = !!this.image;
let colors = this.geometry.getAttribute('color') as THREE.BufferAttribute;
colors.array = this.renderColors;
colors.needsUpdate = true;
} | ZhengyaoJiang/tensorflow | tensorflow/tensorboard/components/vz-projector/scatterPlotWebGLVisualizerSprites.ts | TypeScript |
FunctionDeclaration |
export function Home() {
const history = useHistory();
const { user, signInWithGoogle } = useAuth();
const [roomCode, setRoomCode] = useState('');
async function handleCreateRoom() {
if (!user) {
await signInWithGoogle();
}
history.push('/rooms/new');
}
async function handleJoinRoom(event: FormEvent) {
event.preventDefault();
if (roomCode.trim() === '') return;
const roomRef = await database.ref(`rooms/${roomCode}`).get();
if (!roomRef.exists()) {
toast.error('Room does not exists.');
return;
}
if (roomRef.val().endedAt) {
toast.info('Room already closed.');
return;
}
history.push(`/rooms/${roomCode}`);
}
return (
<Container>
<Aside>
<ImgBackground
src={illustrationImg}
alt="Ilustração simbolizando perguntas e respostas"
/>
<Strong>Crie salas de Q&A ao-vivo</Strong>
<TextAside>Tire as dúvidas da sua audiência em tempo-real</TextAside>
</Aside>
<Main>
<MainContent>
<Logo>Letmeask</Logo>
<ButtonMain onClick={handleCreateRoom}>
<ImgButton src={googleIconImg} alt="Logo do Google" />
Crie sua sala com o Google
</ButtonMain>
<Separator>ou entre em uma sala</Separator>
<Form onSubmit={handleJoinRoom}>
<Input
type="text"
placeholder="Digite o código da sala"
onChange={(event) => setRoomCode(event.target.value)} | william-james-pj/Letmeask-NLW06 | src/pages/Home/index.tsx | TypeScript |
FunctionDeclaration |
async function handleCreateRoom() {
if (!user) {
await signInWithGoogle();
}
history.push('/rooms/new');
} | william-james-pj/Letmeask-NLW06 | src/pages/Home/index.tsx | TypeScript |
FunctionDeclaration |
async function handleJoinRoom(event: FormEvent) {
event.preventDefault();
if (roomCode.trim() === '') return;
const roomRef = await database.ref(`rooms/${roomCode}`).get();
if (!roomRef.exists()) {
toast.error('Room does not exists.');
return;
}
if (roomRef.val().endedAt) {
toast.info('Room already closed.');
return;
}
history.push(`/rooms/${roomCode}`);
} | william-james-pj/Letmeask-NLW06 | src/pages/Home/index.tsx | TypeScript |
ArrowFunction |
() => {
const baseComponent = (props?: object) => <TestThemeProvider><DisabledPanel id='disabled-panel' { | adrielsand/adrbrowsiel-core | components/adrbrowsiel_rewards/resources/ui/components/disabledPanel/spec.tsx | TypeScript |
ArrowFunction |
(props?: object) => <TestThemeProvider><DisabledPanel id | adrielsand/adrbrowsiel-core | components/adrbrowsiel_rewards/resources/ui/components/disabledPanel/spec.tsx | TypeScript |
ArrowFunction |
() => {
it('matches the snapshot', () => {
const component = baseComponent()
const tree = create(component).toJSON()
expect(tree).toMatchSnapshot()
})
it('renders the component', () => {
const wrapper = shallow(baseComponent())
const assertion = wrapper.find('#disabled-panel').length
expect(assertion).toBe(1)
})
} | adrielsand/adrbrowsiel-core | components/adrbrowsiel_rewards/resources/ui/components/disabledPanel/spec.tsx | TypeScript |
ArrowFunction |
() => {
const component = baseComponent()
const tree = create(component).toJSON()
expect(tree).toMatchSnapshot()
} | adrielsand/adrbrowsiel-core | components/adrbrowsiel_rewards/resources/ui/components/disabledPanel/spec.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = shallow(baseComponent())
const assertion = wrapper.find('#disabled-panel').length
expect(assertion).toBe(1)
} | adrielsand/adrbrowsiel-core | components/adrbrowsiel_rewards/resources/ui/components/disabledPanel/spec.tsx | TypeScript |
ArrowFunction |
props => {
const Slots = getSlots<ICollapsibleSectionTitleProps, ICollapsibleSectionTitleSlots>(props, {
root: 'button',
chevron: Icon,
text: Text,
});
const buttonProps = getNativeProps<React.HTMLAttributes<HTMLButtonElement>>(props, buttonProperties);
return (
<Slots.root {...buttonProps} ref={props.focusElementRef}>
{!props.chevronDisabled && <Slots.chevron iconName="ChevronDown" />} | Adloya/fluentui | packages/react-experiments/src/components/CollapsibleSection/CollapsibleSectionTitle.view.tsx | TypeScript |
ClassDeclaration | /**
* The content and the mode of a file.
* Default file mode is a text file which has code '100644'.
* If `content` is not null, then `content` must be the entire file content.
* See https://developer.github.com/v3/git/trees/#tree-object for details on mode.
*/
export declare class FileData {
readonly mode: FileMode;
readonly content: string | null;
constructor(content: string | null, mode?: FileMode);
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
ClassDeclaration |
export declare class PatchSyntaxError extends Error {
constructor(message: string);
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* GitHub definition of tree
*/
export interface TreeObject {
path: string;
mode: FileMode;
type: 'blob' | 'tree' | 'commit';
sha?: string | null;
content?: string;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* The domain of a repository
*/
export interface RepoDomain {
repo: string;
owner: string;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* The domain for a branch
*/
export interface BranchDomain extends RepoDomain {
branch: string;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* The descriptive properties for any entity
*/
export interface Description {
title: string;
body: string;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* The user options for creating GitHub PRs
*/
export interface CreatePullRequestUserOptions {
upstreamOwner: string;
upstreamRepo: string;
message: string;
description: string;
title: string;
branch?: string;
force?: boolean;
fork?: boolean;
primary?: string;
maintainersCanModify?: boolean;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* GitHub data needed for creating a PR
*/
export interface CreatePullRequest {
upstreamOwner: string;
upstreamRepo: string;
message: string;
description: string;
title: string;
branch: string;
force: boolean;
primary: string;
maintainersCanModify: boolean;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* The user options for creating GitHub PR review comment
*/
export interface CreateReviewCommentUserOptions {
owner: string;
repo: string;
pullNumber: number;
pageSize?: number;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* The user options for creating GitHub PR review comment
*/
export interface CreateReviewComment {
owner: string;
repo: string;
pullNumber: number;
pageSize: number;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* The file content of the original content and the patched content
*/
export interface FileDiffContent {
readonly oldContent: string;
readonly newContent: string;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
InterfaceDeclaration |
export interface Hunk {
readonly oldStart: number;
readonly oldEnd: number;
readonly newStart: number;
readonly newEnd: number;
readonly newContent: string[];
readonly previousLine?: string;
readonly nextLine?: string;
} | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
TypeAliasDeclaration |
export declare type FileMode = '100644' | '100755' | '040000' | '160000' | '120000'; | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
TypeAliasDeclaration | /**
* The map of a path to its content data.
* The content must be the entire file content.
*/
export declare type Changes = Map<string, FileData>; | bcoe/release-please | node_modules/code-suggester/build/src/types/index.d.ts | TypeScript |
FunctionDeclaration |
export function getJsonObj(obj: ConditionalInputLink, isParentJsonObj?: boolean): object {
const jsonObj = {
...(isParentJsonObj ? obj : (model.FlowPortLink.getJsonObj(obj) as ConditionalInputLink)),
...{
"fromLink": obj.fromLink ? model.OutputLink.getJsonObj(obj.fromLink) : undefined,
"fieldMap": obj.fieldMap ? model.FieldMap.getJsonObj(obj.fieldMap) : undefined,
"condition": obj.condition ? model.Expression.getJsonObj(obj.condition) : undefined
}
};
return jsonObj;
} | naikvenu/oci-typescript-sdk | lib/dataintegration/lib/model/conditional-input-link.ts | TypeScript |
InterfaceDeclaration | /**
* The information about the conditional input link.
*/
export interface ConditionalInputLink extends model.FlowPortLink {
"fromLink"?: model.OutputLink;
"fieldMap"?:
| model.RuleBasedFieldMap
| model.DirectFieldMap
| model.CompositeFieldMap
| model.DirectNamedFieldMap;
"condition"?: model.Expression;
"modelType": string;
} | naikvenu/oci-typescript-sdk | lib/dataintegration/lib/model/conditional-input-link.ts | TypeScript |
ArrowFunction |
(val?: string) => true | chengjunjian2020/low-code-large-screen | src/components/common/checkbox/checkbox.tsx | TypeScript |
ArrowFunction |
(val: string) => {
context.emit("update:modelValue", val);
context.emit("onUpdate:modelValue", val);
} | chengjunjian2020/low-code-large-screen | src/components/common/checkbox/checkbox.tsx | TypeScript |
ArrowFunction |
() => <ElCheckbox class | chengjunjian2020/low-code-large-screen | src/components/common/checkbox/checkbox.tsx | TypeScript |
MethodDeclaration |
setup(props, context) {
const checkboxValue = ref(props.modelValue);
watch(checkboxValue, (val: string) => {
context.emit("update:modelValue", val);
context.emit("onUpdate:modelValue", val);
}, { immediate: true })
return () => <ElCheckbox class="low-code-checkbox" v-model={checkboxValue.value}></ElCheckbox>
} | chengjunjian2020/low-code-large-screen | src/components/common/checkbox/checkbox.tsx | TypeScript |
FunctionDeclaration |
function buildStatements({ statements }: SerializedBlock, blocks: SerializedBlock[], symbolTable: SymbolTable, env: Environment): Program {
if (statements.length === 0) return EMPTY_PROGRAM;
return new BlockScanner(statements, blocks, symbolTable, env).scan();
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
ClassDeclaration |
export default class Scanner {
constructor(private block: SerializedTemplateBlock, private meta: TemplateMeta, private env: Environment) {
}
scanEntryPoint(): EntryPoint {
let { block, meta } = this;
let symbolTable = SymbolTable.forEntryPoint(meta);
let program = buildStatements(block, block.blocks, symbolTable, this.env);
return new EntryPoint(program, symbolTable);
}
scanLayout(): Layout {
let { block, meta } = this;
let { blocks, named, yields, hasPartials } = block;
let symbolTable = SymbolTable.forLayout(named, yields, hasPartials, meta);
let program = buildStatements(block, blocks, symbolTable, this.env);
return new Layout(program, symbolTable, named, yields, hasPartials);
}
scanPartial(symbolTable: SymbolTable): PartialBlock {
let { block } = this;
let { blocks, locals } = block;
let program = buildStatements(block, blocks, symbolTable, this.env);
return new PartialBlock(program, symbolTable, locals);
}
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
ClassDeclaration |
export class BlockScanner {
public env: Environment;
private stack = new Stack<ChildBlockScanner>();
private reader: SyntaxReader;
constructor(statements: SerializedStatement[], private blocks: SerializedBlock[], private symbolTable: SymbolTable, env: Environment) {
this.stack.push(new ChildBlockScanner(symbolTable));
this.reader = new SyntaxReader(statements, symbolTable, this);
this.env = env;
}
scan(): Program {
let statement: StatementSyntax;
while (statement = this.reader.next()) {
this.addStatement(statement);
}
return this.stack.current.program;
}
blockFor(symbolTable: SymbolTable, id: number): InlineBlock {
let block = this.blocks[id];
let childTable = SymbolTable.forBlock(this.symbolTable, block.locals);
let program = buildStatements(block, this.blocks, childTable, this.env);
return new InlineBlock(program, childTable, block.locals);
}
startBlock(locals: string[]) {
let childTable = SymbolTable.forBlock(this.symbolTable, locals);
this.stack.push(new ChildBlockScanner(childTable));
}
endBlock(locals: string[]): InlineBlock {
let { program, symbolTable } = this.stack.pop();
let block = new InlineBlock(program, symbolTable, locals);
this.addChild(block);
return block;
}
addChild(block: InlineBlock) {
this.stack.current.addChild(block);
}
addStatement(statement: StatementSyntax) {
this.stack.current.addStatement(statement.scan(this));
}
next(): StatementSyntax {
return this.reader.next();
}
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
ClassDeclaration |
class ChildBlockScanner {
public children: InlineBlock[] = [];
public program = new LinkedList<StatementSyntax>();
constructor(public symbolTable: SymbolTable) {}
addChild(block: InlineBlock) {
this.children.push(block);
}
addStatement(statement: StatementSyntax) {
this.program.append(statement);
}
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
ClassDeclaration |
class SyntaxReader {
current: number = 0;
last: StatementSyntax = null;
constructor(private statements: SerializedStatement[], private symbolTable: SymbolTable, private scanner: BlockScanner) {}
next(): StatementSyntax {
let last = this.last;
if (last) {
this.last = null;
return last;
} else if (this.current === this.statements.length) {
return null;
}
let sexp = this.statements[this.current++];
return buildStatement(sexp, this.symbolTable, this.scanner);
}
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
MethodDeclaration |
scanEntryPoint(): EntryPoint {
let { block, meta } = this;
let symbolTable = SymbolTable.forEntryPoint(meta);
let program = buildStatements(block, block.blocks, symbolTable, this.env);
return new EntryPoint(program, symbolTable);
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
MethodDeclaration |
scanLayout(): Layout {
let { block, meta } = this;
let { blocks, named, yields, hasPartials } = block;
let symbolTable = SymbolTable.forLayout(named, yields, hasPartials, meta);
let program = buildStatements(block, blocks, symbolTable, this.env);
return new Layout(program, symbolTable, named, yields, hasPartials);
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
MethodDeclaration |
scanPartial(symbolTable: SymbolTable): PartialBlock {
let { block } = this;
let { blocks, locals } = block;
let program = buildStatements(block, blocks, symbolTable, this.env);
return new PartialBlock(program, symbolTable, locals);
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
MethodDeclaration |
scan(): Program {
let statement: StatementSyntax;
while (statement = this.reader.next()) {
this.addStatement(statement);
}
return this.stack.current.program;
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
MethodDeclaration |
blockFor(symbolTable: SymbolTable, id: number): InlineBlock {
let block = this.blocks[id];
let childTable = SymbolTable.forBlock(this.symbolTable, block.locals);
let program = buildStatements(block, this.blocks, childTable, this.env);
return new InlineBlock(program, childTable, block.locals);
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
MethodDeclaration |
startBlock(locals: string[]) {
let childTable = SymbolTable.forBlock(this.symbolTable, locals);
this.stack.push(new ChildBlockScanner(childTable));
} | wycats/glimmer | packages/glimmer-runtime/lib/scanner.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.