type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
MethodDeclaration
updateEvent(id: string, title: string, content: string, image: File | string, startDate: string, endDate: string, category: string, is_private: Boolean, max_users: Number, eventFee: Number, eventManagerName: string, eventManagerEmail: string, eventManagerPhone: string, street: string, city: string, state: string, country: string, zipcode: string) { let eventData: Event | FormData; if (typeof image === 'object') { eventData = new FormData(); const address = [{ street: street, city: city, state: state, country: country, zipcode: zipcode }]; const event_manager = [{ name: eventManagerName, email: eventManagerEmail, phone: eventManagerPhone }]; eventData.append('id', id); eventData.append('title', title); eventData.append('content', content); eventData.append('image', image, title); eventData.append('startDate', startDate); eventData.append('endDate', endDate); eventData.append('category', category); const privacy = (is_private === true); eventData.append('is_private', privacy.toString()); eventData.append('max_users', max_users.toString()); eventData.append('eventFee', eventFee.toString()); eventData.append('event_manager', JSON.stringify(event_manager)); eventData.append('address', JSON.stringify(address)); } else { const privacy = (is_private === true); eventData = { id: id, title: title, content: content, imagePath: image, startDate: startDate, endDate: endDate, category: category, is_private: privacy, max_users: max_users, eventFee: eventFee, event_manager: { name: eventManagerName, email: eventManagerEmail, phone: eventManagerPhone }, address: { street: street, city: city, state: state, country: country, zipcode: zipcode }, creator: null, verify: false }; } this.http .put(BACKEND_URL + id, eventData) .subscribe(response => { this.router.navigate(['/']); }); }
sonusourav/instigo-webapp
src/app/events/events.service.ts
TypeScript
MethodDeclaration
deleteEvent(eventId: string) { return this.http.delete(BACKEND_URL + eventId); }
sonusourav/instigo-webapp
src/app/events/events.service.ts
TypeScript
MethodDeclaration
deleteEventTBA(eventTBA: any, eventId: string) { return this.http.delete<{message: string}>(BACKEND_URL + 'tba?eventId=' + eventId + '&eventTBAId=' + eventTBA._id ) .subscribe(response => { console.log(response.message); this.eventTBA.announcements.splice(this.eventTBA.announcements.indexOf(eventTBA),1); this.eventTBAUpdated.next({ eventTBA: this.eventTBA }); }) }
sonusourav/instigo-webapp
src/app/events/events.service.ts
TypeScript
ClassDeclaration
@Component({ selector: 'dashboard', template: ` <h1>Another Component</h1> <h3>name from input : {{name}} </h3> ` }) export class AnotherComponent { // @Input() name: string; constructor() { console.log(this.name); } }
yishaiz/Angular2-Tour-of-Heroes-RC6
app/Another/another.component.ts
TypeScript
FunctionDeclaration
export function FixtureSearchHeader({ onOpen }: Props) { React.useEffect(() => { function handleWindowKeyDown(e: KeyboardEvent) { const metaKey = e.metaKey || e.ctrlKey; if (metaKey && e.keyCode === KEY_P) { e.preventDefault(); onOpen(); } } window.addEventListener('keydown', handleWindowKeyDown); return () => window.removeEventListener('keydown', handleWindowKeyDown); }, [onOpen]); return ( <Container> <Button onClick={onOpen}> <SearchIconContainer> <SearchIcon /> </SearchIconContainer> <SearchLabel>Search fixtures</SearchLabel> </Button> </Container> ); }
roth1002/react-cosmos
packages/react-cosmos-playground2/src/plugins/FixtureSearch/FixtureSearchHeader.tsx
TypeScript
FunctionDeclaration
function handleWindowKeyDown(e: KeyboardEvent) { const metaKey = e.metaKey || e.ctrlKey; if (metaKey && e.keyCode === KEY_P) { e.preventDefault(); onOpen(); } }
roth1002/react-cosmos
packages/react-cosmos-playground2/src/plugins/FixtureSearch/FixtureSearchHeader.tsx
TypeScript
ArrowFunction
() => { function handleWindowKeyDown(e: KeyboardEvent) { const metaKey = e.metaKey || e.ctrlKey; if (metaKey && e.keyCode === KEY_P) { e.preventDefault(); onOpen(); } } window.addEventListener('keydown', handleWindowKeyDown); return () => window.removeEventListener('keydown', handleWindowKeyDown); }
roth1002/react-cosmos
packages/react-cosmos-playground2/src/plugins/FixtureSearch/FixtureSearchHeader.tsx
TypeScript
ArrowFunction
() => window.removeEventListener('keydown', handleWindowKeyDown)
roth1002/react-cosmos
packages/react-cosmos-playground2/src/plugins/FixtureSearch/FixtureSearchHeader.tsx
TypeScript
TypeAliasDeclaration
type Props = { onOpen: () => unknown; };
roth1002/react-cosmos
packages/react-cosmos-playground2/src/plugins/FixtureSearch/FixtureSearchHeader.tsx
TypeScript
ArrowFunction
(props: NavProps) => { return ( <nav {...props} className={["Nav", props.className].join(" ")}> {props.children} </nav>
azu/dynamic-css-component-example
src/component/Nav.tsx
TypeScript
TypeAliasDeclaration
export type NavProps = { children: ReactNode; } & HTMLAttributes<HTMLElement>;
azu/dynamic-css-component-example
src/component/Nav.tsx
TypeScript
ArrowFunction
async ({ traceId, data }: GetByClientIdParams): Promise<WebComponentConfig> => { try { logger.info('Getting config by customerId...', { traceId, data }) const itemToGet = generateSchemaItem(data) const result = await dynamoDBMapper.get(itemToGet) logger.info('Get config by customerId successfully', { traceId, result }) return result } catch (error) { await logger.error('Get config by customerId failed', { traceId, error: stringifyError(error) }) throw error } }
BobinMathew/foundations
packages/web-components-config-server/src/routes/web-components-config/api.ts
TypeScript
ArrowFunction
async ({ traceId, data }: CreateParams): Promise<WebComponentConfig> => { try { const itemToCreate = generateSchemaItem(data) const result = await dynamoDBMapper.put(itemToCreate, { condition: { type: 'And', conditions: [ new FunctionExpression('attribute_not_exists', new AttributePath('customerId')), new FunctionExpression('attribute_not_exists', new AttributePath('appId')), ], }, }) logger.info('Create config successfully', { traceId, result }) return result } catch (error) { await logger.error('Create config failed', { traceId, error: stringifyError(error) }) throw error } }
BobinMathew/foundations
packages/web-components-config-server/src/routes/web-components-config/api.ts
TypeScript
ArrowFunction
async ({ traceId, data }: UpdateParams): Promise<WebComponentConfig> => { try { logger.info('Patching config...', { traceId, data }) const { customerId, appId, ...rest } = data const oldItem = await getConfigByClientId({ traceId, data: { customerId, appId } }) const itemToUpdate = generateSchemaItem({ ...oldItem, ...rest }) const result = await dynamoDBMapper.update(itemToUpdate) logger.info('Patch config successfully', { traceId, result }) return result } catch (error) { await logger.error('Patch config failed', { traceId, error: stringifyError(error) }) throw error } }
BobinMathew/foundations
packages/web-components-config-server/src/routes/web-components-config/api.ts
TypeScript
ArrowFunction
async ({ traceId, data }): Promise<WebComponentConfig> => { try { logger.info('Updating config...', { traceId, data }) const itemToUpdate = generateSchemaItem(data) const result = await dynamoDBMapper.put(itemToUpdate) logger.info('Update config successfully', { traceId, result }) return result } catch (error) { await logger.error('Update config failed', { traceId, error: stringifyError(error) }) throw error } }
BobinMathew/foundations
packages/web-components-config-server/src/routes/web-components-config/api.ts
TypeScript
ArrowFunction
async ({ traceId, data }: DeleteParams): Promise<WebComponentConfig> => { try { logger.info('Deleting config...', { traceId, data }) const itemToDelete = generateSchemaItem(data) const result = await dynamoDBMapper.delete(itemToDelete) logger.info('Delete config successfully', { traceId, result }) return result } catch (error) { await logger.error('Delete config failed', { traceId, error: stringifyError(error) }) throw error } }
BobinMathew/foundations
packages/web-components-config-server/src/routes/web-components-config/api.ts
TypeScript
ArrowFunction
(): void => { const { exprInputValue: expr } = this.state; const queryStart = Date.now(); this.props.onExecuteQuery(expr); if (this.props.options.expr !== expr) { this.setOptions({ expr }); } if (expr === '') { return; } if (this.abortInFlightFetch) { this.abortInFlightFetch(); this.abortInFlightFetch = null; } const abortController = new AbortController(); this.abortInFlightFetch = () => abortController.abort(); this.setState({ loading: true }); const endTime = this.getEndTime().valueOf() / 1000; // TODO: shouldn't valueof only work when it's a moment? const startTime = endTime - this.props.options.range / 1000; const resolution = this.props.options.resolution || Math.max(Math.floor(this.props.options.range / 250000), 1); const params: URLSearchParams = new URLSearchParams({ query: expr, }); let path: string; switch (this.props.options.type) { case 'graph': path = 'query_range'; params.append('start', startTime.toString()); params.append('end', endTime.toString()); params.append('step', resolution.toString()); break; case 'table': path = 'query'; params.append('time', endTime.toString()); break; default: throw new Error('Invalid panel type "' + this.props.options.type + '"'); } fetch(`${this.props.pathPrefix}/${API_PATH}/${path}?${params}`, { cache: 'no-store', credentials: 'same-origin', signal: abortController.signal, }) .then(resp => resp.json()) .then(json => { if (json.status !== 'success') { throw new Error(json.error || 'invalid response JSON'); } let resultSeries = 0; if (json.data) { const { resultType, result } = json.data; if (resultType === 'scalar') { resultSeries = 1; } else if (result && result.length > 0) { resultSeries = result.length; } } this.setState({ error: null, data: json.data, warnings: json.warnings, lastQueryParams: { startTime, endTime, resolution, }, stats: { loadTime: Date.now() - queryStart, resolution, resultSeries, }, loading: false, }); this.abortInFlightFetch = null; }) .catch(error => { if (error.name === 'AbortError') { // Aborts are expected, don't show an error for them. return; } this.setState({ error: 'Error executing query: ' + error.message, loading: false, }); }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
() => abortController.abort()
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
resp => resp.json()
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
json => { if (json.status !== 'success') { throw new Error(json.error || 'invalid response JSON'); } let resultSeries = 0; if (json.data) { const { resultType, result } = json.data; if (resultType === 'scalar') { resultSeries = 1; } else if (result && result.length > 0) { resultSeries = result.length; } } this.setState({ error: null, data: json.data, warnings: json.warnings, lastQueryParams: { startTime, endTime, resolution, }, stats: { loadTime: Date.now() - queryStart, resolution, resultSeries, }, loading: false, }); this.abortInFlightFetch = null; }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
error => { if (error.name === 'AbortError') { // Aborts are expected, don't show an error for them. return; } this.setState({ error: 'Error executing query: ' + error.message, loading: false, }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(expr: string): void => { this.setState({ exprInputValue: expr }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(range: number): void => { this.setOptions({ range: range }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(): number | moment.Moment => { if (this.props.options.endTime === null) { return moment(); } return this.props.options.endTime; }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(endTime: number | null) => { this.setOptions({ endTime: endTime }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(resolution: number | null) => { this.setOptions({ resolution: resolution }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(type: PanelType) => { if (this.props.options.type === type) { return; } this.setState({ data: null }); this.setOptions({ type: type }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(stacked: boolean) => { this.setOptions({ stacked: stacked }); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ArrowFunction
(warning, index) => ( <Row key={index}> <Col>{warning && <Alert color
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
ClassDeclaration
class Panel extends Component<PanelProps, PanelState> { private abortInFlightFetch: (() => void) | null = null; constructor(props: PanelProps) { super(props); this.state = { data: null, lastQueryParams: null, loading: false, warnings: null, error: null, stats: null, exprInputValue: props.options.expr, }; } componentDidUpdate({ options: prevOpts }: PanelProps) { const { endTime, range, resolution, type } = this.props.options; if ( prevOpts.endTime !== endTime || prevOpts.range !== range || prevOpts.resolution !== resolution || prevOpts.type !== type ) { this.executeQuery(); } } componentDidMount() { this.executeQuery(); } executeQuery = (): void => { const { exprInputValue: expr } = this.state; const queryStart = Date.now(); this.props.onExecuteQuery(expr); if (this.props.options.expr !== expr) { this.setOptions({ expr }); } if (expr === '') { return; } if (this.abortInFlightFetch) { this.abortInFlightFetch(); this.abortInFlightFetch = null; } const abortController = new AbortController(); this.abortInFlightFetch = () => abortController.abort(); this.setState({ loading: true }); const endTime = this.getEndTime().valueOf() / 1000; // TODO: shouldn't valueof only work when it's a moment? const startTime = endTime - this.props.options.range / 1000; const resolution = this.props.options.resolution || Math.max(Math.floor(this.props.options.range / 250000), 1); const params: URLSearchParams = new URLSearchParams({ query: expr, }); let path: string; switch (this.props.options.type) { case 'graph': path = 'query_range'; params.append('start', startTime.toString()); params.append('end', endTime.toString()); params.append('step', resolution.toString()); break; case 'table': path = 'query'; params.append('time', endTime.toString()); break; default: throw new Error('Invalid panel type "' + this.props.options.type + '"'); } fetch(`${this.props.pathPrefix}/${API_PATH}/${path}?${params}`, { cache: 'no-store', credentials: 'same-origin', signal: abortController.signal, }) .then(resp => resp.json()) .then(json => { if (json.status !== 'success') { throw new Error(json.error || 'invalid response JSON'); } let resultSeries = 0; if (json.data) { const { resultType, result } = json.data; if (resultType === 'scalar') { resultSeries = 1; } else if (result && result.length > 0) { resultSeries = result.length; } } this.setState({ error: null, data: json.data, warnings: json.warnings, lastQueryParams: { startTime, endTime, resolution, }, stats: { loadTime: Date.now() - queryStart, resolution, resultSeries, }, loading: false, }); this.abortInFlightFetch = null; }) .catch(error => { if (error.name === 'AbortError') { // Aborts are expected, don't show an error for them. return; } this.setState({ error: 'Error executing query: ' + error.message, loading: false, }); }); }; setOptions(opts: object): void { const newOpts = { ...this.props.options, ...opts }; this.props.onOptionsChanged(newOpts); } handleExpressionChange = (expr: string): void => { this.setState({ exprInputValue: expr }); }; handleChangeRange = (range: number): void => { this.setOptions({ range: range }); }; getEndTime = (): number | moment.Moment => { if (this.props.options.endTime === null) { return moment(); } return this.props.options.endTime; }; handleChangeEndTime = (endTime: number | null) => { this.setOptions({ endTime: endTime }); }; handleChangeResolution = (resolution: number | null) => { this.setOptions({ resolution: resolution }); }; handleChangeType = (type: PanelType) => { if (this.props.options.type === type) { return; } this.setState({ data: null }); this.setOptions({ type: type }); }; handleChangeStacking = (stacked: boolean) => { this.setOptions({ stacked: stacked }); }; render() { const { pastQueries, metricNames, options } = this.props; return ( <div className="panel"> <Row> <Col> <ExpressionInput value={this.state.exprInputValue} onExpressionChange={this.handleExpressionChange} executeQuery={this.executeQuery} loading={this.state.loading} enableAutocomplete={this.props.enableAutocomplete} queryHistory={pastQueries} metricNames={metricNames} /> </Col> </Row> <Row> <Col>{this.state.error && <Alert color="danger">{this.state.error}</Alert>}</Col> </Row> {this.state.warnings?.map((warning, index) => ( <Row key={index}> <Col>{warning && <Alert color="warning">{warning}</Alert>}</Col> </Row> ))} <Row> <Col> <Nav tabs> <NavItem> <NavLink className={options.type === 'table' ? 'active' : ''} onClick={() => this.handleChangeType(PanelType.Table)}
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
InterfaceDeclaration
interface PanelProps { options: PanelOptions; onOptionsChanged: (opts: PanelOptions) => void; useLocalTime: boolean; pastQueries: string[]; metricNames: string[]; removePanel: () => void; onExecuteQuery: (query: string) => void; pathPrefix: string; enableAutocomplete: boolean; }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
InterfaceDeclaration
interface PanelState { data: any; // TODO: Type data. lastQueryParams: QueryParams | null; loading: boolean; warnings: string[] | null; error: string | null; stats: QueryStats | null; exprInputValue: string; }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
InterfaceDeclaration
export interface PanelOptions { expr: string; type: PanelType; range: number; // Range in milliseconds. endTime: number | null; // Timestamp in milliseconds. resolution: number | null; // Resolution in seconds. stacked: boolean; }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
EnumDeclaration
export enum PanelType { Graph = 'graph', Table = 'table', }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
MethodDeclaration
componentDidUpdate({ options: prevOpts }: PanelProps) { const { endTime, range, resolution, type } = this.props.options; if ( prevOpts.endTime !== endTime || prevOpts.range !== range || prevOpts.resolution !== resolution || prevOpts.type !== type ) { this.executeQuery(); } }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
MethodDeclaration
componentDidMount() { this.executeQuery(); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
MethodDeclaration
setOptions(opts: object): void { const newOpts = { ...this.props.options, ...opts }; this.props.onOptionsChanged(newOpts); }
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
MethodDeclaration
render() { const { pastQueries, metricNames, options } = this.props; return ( <div className="panel"> <Row> <Col> <ExpressionInput value={this.state.exprInputValue} onExpressionChange={this.handleExpressionChange} executeQuery={this.executeQuery} loading={this.state.loading} enableAutocomplete={this.props.enableAutocomplete} queryHistory={pastQueries} metricNames={metricNames} /> </Col> </Row> <Row> <Col>{this.state.error && <Alert color="danger">{this.state.error}</Alert>}</Col> </Row> {this.state.warnings?.map((warning, index) => ( <Row key={index}> <Col>{warning && <Alert color="warning">{warning}</Alert>}</Col> </Row> ))} <Row> <Col> <Nav tabs> <NavItem> <NavLink className={options.type === 'table' ? 'active' : ''} onClick={() => this.handleChangeType(PanelType.Table)}
4linux/prometheus
web/ui/react-app/src/pages/graph/Panel.tsx
TypeScript
FunctionDeclaration
export function useRoom(roomId: string) { const { user } = useAuth(); const [questions, setQuestions] = useState<Question[]>([]); const [title, setTitle] = useState(''); useEffect(() => { const roomRef = database.ref(`rooms/${roomId}`); roomRef.on('value', room => { const databaseRoom = room.val(); const firebaseQuestions: FirebaseQuestions = databaseRoom.questions; const parsedQuestions = Object.entries(firebaseQuestions ?? {}).map(([key, value]) => { return { id: key, content: value.content, author: value.author, isHighlighted: value.isHighlighted, isAnswered: value.isAnswered, likeCount: Object.values(value.likes ?? {}).length, likeId: Object.entries(value.likes ?? {}).find(([key, like]) => like.authorId === user?.id)?.[0], } }); setTitle(databaseRoom.title); setQuestions(parsedQuestions); }) return () => { roomRef.off('value') } }, [roomId, user]); return { questions, title } }
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
ArrowFunction
() => { const roomRef = database.ref(`rooms/${roomId}`); roomRef.on('value', room => { const databaseRoom = room.val(); const firebaseQuestions: FirebaseQuestions = databaseRoom.questions; const parsedQuestions = Object.entries(firebaseQuestions ?? {}).map(([key, value]) => { return { id: key, content: value.content, author: value.author, isHighlighted: value.isHighlighted, isAnswered: value.isAnswered, likeCount: Object.values(value.likes ?? {}).length, likeId: Object.entries(value.likes ?? {}).find(([key, like]) => like.authorId === user?.id)?.[0], } }); setTitle(databaseRoom.title); setQuestions(parsedQuestions); }) return () => { roomRef.off('value') } }
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
ArrowFunction
room => { const databaseRoom = room.val(); const firebaseQuestions: FirebaseQuestions = databaseRoom.questions; const parsedQuestions = Object.entries(firebaseQuestions ?? {}).map(([key, value]) => { return { id: key, content: value.content, author: value.author, isHighlighted: value.isHighlighted, isAnswered: value.isAnswered, likeCount: Object.values(value.likes ?? {}).length, likeId: Object.entries(value.likes ?? {}).find(([key, like]) => like.authorId === user?.id)?.[0], } }); setTitle(databaseRoom.title); setQuestions(parsedQuestions); }
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
ArrowFunction
([key, value]) => { return { id: key, content: value.content, author: value.author, isHighlighted: value.isHighlighted, isAnswered: value.isAnswered, likeCount: Object.values(value.likes ?? {}).length, likeId: Object.entries(value.likes ?? {}).find(([key, like]) => like.authorId === user?.id)?.[0], } }
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
ArrowFunction
([key, like]) => like.authorId === user?.id
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
ArrowFunction
() => { roomRef.off('value') }
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
TypeAliasDeclaration
type FirebaseQuestions = Record<string, { author: { name: string; avatar: string; }; content: string; isAnswered: boolean; isHighlighted: boolean; likes: Record<string, { authorId: string; }> }>
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
TypeAliasDeclaration
type Question = { id: string; author: { name: string; avatar: string; }; content: string; isAnswered: boolean; isHighlighted: boolean; likeCount: number; likeId: string | undefined; }
cunhaedu/letmeask
src/hooks/useRoom.ts
TypeScript
ClassDeclaration
@Component({ selector: "app", templateUrl: `client/views/app.component.html` }) export class AppComponent { appName: string = "Angular 2 Express" }
swapnilpatil427/Angular2-express-starter
client/app.component.ts
TypeScript
FunctionDeclaration
export default function CardView({ tasks }: CardViewProps) { return ( <> <Grid container spacing={3}> <AddTask /> {tasks.map((task) => ( <TaskItemCard key={task.id} task={task} /> ))} </Grid> </> ); }
kintaro335-sp/mytodotasks
client/src/components/tasks/cardview/CardView.tsx
TypeScript
ArrowFunction
(task) => ( <TaskItemCard key={task.id}
kintaro335-sp/mytodotasks
client/src/components/tasks/cardview/CardView.tsx
TypeScript
InterfaceDeclaration
export interface App { name: string; contributors: string[]; version: number; apdex: number; host: string[]; }
gagle/apdex-board
src/app/board/models/app.interface.ts
TypeScript
ClassDeclaration
@ApiTags('评论/留言') @Controller('comments') export class CommentsController { constructor(private commentsService: CommentsService) {} @ApiOperation({ summary: '留言列表' }) @Get('/list') getComments( @Query() query: GetCommentsDto, ): Promise<{ data: Comment[]; total: number }> { return this.commentsService.getComments(query); } @ApiOperation({ summary: '写评论/写留言' }) @Post('/create') @UseGuards(AuthGuard('jwt')) @ApiBearerAuth() createComment( @Body() data: CreateCommentDto, @GetUser() visitor: Visitor, ): Promise<{ data: Object }> { return this.commentsService.createComment(data, visitor); } @ApiOperation({ summary: '点赞评论/留言' }) @Patch('/like/:id') likeComment( @Param('id', ParseIntPipe) id: number, ): Promise<{ data: Comment }> { return this.commentsService.likeComment(id); } }
Fengfengfeng-up/Nest-personal-website
apps/web/src/comments/comments.controller.ts
TypeScript
MethodDeclaration
@ApiOperation({ summary: '留言列表' }) @Get('/list') getComments( @Query() query: GetCommentsDto, ): Promise<{ data: Comment[]; total: number }> { return this.commentsService.getComments(query); }
Fengfengfeng-up/Nest-personal-website
apps/web/src/comments/comments.controller.ts
TypeScript
MethodDeclaration
@ApiOperation({ summary: '写评论/写留言' }) @Post('/create') @UseGuards(AuthGuard('jwt')) @ApiBearerAuth() createComment( @Body() data: CreateCommentDto, @GetUser() visitor: Visitor, ): Promise<{ data: Object }> { return this.commentsService.createComment(data, visitor); }
Fengfengfeng-up/Nest-personal-website
apps/web/src/comments/comments.controller.ts
TypeScript
MethodDeclaration
@ApiOperation({ summary: '点赞评论/留言' }) @Patch('/like/:id') likeComment( @Param('id', ParseIntPipe) id: number, ): Promise<{ data: Comment }> { return this.commentsService.likeComment(id); }
Fengfengfeng-up/Nest-personal-website
apps/web/src/comments/comments.controller.ts
TypeScript
ClassDeclaration
export default class Application { constructor(private metadata: Metadata, private pages: Map<string, Page>, private styles?: Array<StyleProperty>, private scripts?: Array<ScriptResource>) { this.metadata = metadata; this.pages = pages; this.styles = styles; this.scripts = scripts; } getMetadata(): Metadata { return this.metadata; } getPages(): Map<string, Page> { return this.pages; } getStyles(): Array<StyleProperty> { return this.styles; } getScripts(): Array<ScriptResource> { return this.scripts; } }
juancancela/turbo-hub
src/lib/models/Application.ts
TypeScript
MethodDeclaration
getMetadata(): Metadata { return this.metadata; }
juancancela/turbo-hub
src/lib/models/Application.ts
TypeScript
MethodDeclaration
getPages(): Map<string, Page> { return this.pages; }
juancancela/turbo-hub
src/lib/models/Application.ts
TypeScript
MethodDeclaration
getStyles(): Array<StyleProperty> { return this.styles; }
juancancela/turbo-hub
src/lib/models/Application.ts
TypeScript
MethodDeclaration
getScripts(): Array<ScriptResource> { return this.scripts; }
juancancela/turbo-hub
src/lib/models/Application.ts
TypeScript
ArrowFunction
async (_parent: any, _args: any, context: any) => await getTenantBoundSubjectModel(context).find({}).exec()
zilurrane/fbapp-api
src/graphql/resolvers/subject.resolver.ts
TypeScript
ArrowFunction
async (_parent: any, { id }: any, context: any) => await getTenantBoundSubjectModel(context).findById(id).exec()
zilurrane/fbapp-api
src/graphql/resolvers/subject.resolver.ts
TypeScript
ClassDeclaration
@Component({ selector: 'gml-time-instant', templateUrl: './TimeInstantComponent.html' }) export class TimeInstantComponent extends EditorComponent<TimeInstant> { @Input() public model: TimeInstant; constructor(componentFactoryResolver: ComponentFactoryResolver, viewContainerRef: ViewContainerRef) { super(componentFactoryResolver, viewContainerRef); } protected createModel() { return undefined; } }
52North/smle
src/app/editor/components/gml/TimeInstantComponent.ts
TypeScript
MethodDeclaration
protected createModel() { return undefined; }
52North/smle
src/app/editor/components/gml/TimeInstantComponent.ts
TypeScript
ArrowFunction
({ name, children, className, onMouseDown, onClick, }) => { const { delayedStatus, animationSpeed } = useContext(ValidationContext) const [previousStatus, setPreviousStatus] = useState(LoadingStatus.Normal) const [animation, setAnimation] = useState(baseCss) useEffect(() => { const delayToNormal = () => { setTimeout(() => { setAnimation(baseCss) }, animationSpeed) } if (previousStatus !== delayedStatus) { if ( previousStatus === LoadingStatus.Error && delayedStatus === LoadingStatus.Normal ) { setAnimation(errorToNormal) delayToNormal() } if ( previousStatus === LoadingStatus.Success && delayedStatus === LoadingStatus.Normal ) { setAnimation(successToNormal) delayToNormal() } if (delayedStatus === LoadingStatus.Success) { setAnimation(normalToSuccess) } if (delayedStatus === LoadingStatus.Error) { setAnimation(normalToError) } setPreviousStatus(delayedStatus) } }, [delayedStatus, previousStatus, animationSpeed]) const disabled = delayedStatus !== LoadingStatus.Normal return ( <button type="submit" disabled={disabled} name={name} className={className} onMouseDown={onMouseDown} onClick={onClick} > {children} </button>
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
() => { const delayToNormal = () => { setTimeout(() => { setAnimation(baseCss) }, animationSpeed) } if (previousStatus !== delayedStatus) { if ( previousStatus === LoadingStatus.Error && delayedStatus === LoadingStatus.Normal ) { setAnimation(errorToNormal) delayToNormal() } if ( previousStatus === LoadingStatus.Success && delayedStatus === LoadingStatus.Normal ) { setAnimation(successToNormal) delayToNormal() } if (delayedStatus === LoadingStatus.Success) { setAnimation(normalToSuccess) } if (delayedStatus === LoadingStatus.Error) { setAnimation(normalToError) } setPreviousStatus(delayedStatus) } }
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
() => { setTimeout(() => { setAnimation(baseCss) }, animationSpeed) }
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
() => { setAnimation(baseCss) }
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
({ theme }) => theme.transition.all
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
({ theme }) => theme.breakpoint.small
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
({ theme }) => theme.font.family
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
({ theme }) => theme.color.black[700]
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
({ theme }) => theme.color.peach[300]
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ArrowFunction
({ theme }) => theme.color.peach[200]
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
InterfaceDeclaration
export interface ButtonProps { className?: string name?: string onMouseDown?: (e: MouseEvent<HTMLButtonElement>) => void onClick?: (e: MouseEvent<HTMLButtonElement>) => void }
philscott-dev/stagg-ekg-plus-scheduler
src/components/FormElements/FormButton.tsx
TypeScript
ClassDeclaration
@Component({ selector: 'app-address-dialog', templateUrl: './address-dialog.component.html', styleUrls: ['./address-dialog.component.scss'] }) export class AddressDialogComponent implements OnInit { action: string; item: any = {}; formValid: boolean; listTipoDireccion: any[] = [ { value: '', label: '-- SELECCIONA --' }, { value: 'Domicilio', label: 'Domicilio' }, { value: 'Trabajo', label: 'Trabajo' }, { value: 'Otro', label: 'Otro' } ]; constructor( public device: DeviceService, public dialogRef: MatDialogRef<AddressDialogComponent>, @Optional() @Inject(MAT_DIALOG_DATA) public data: DialogDataGeneric ) { const dataInput = { ...data }; this.action = dataInput.action; this.item = dataInput.data; } ngOnInit() { } doAction(isValid: boolean) { if (isValid) { this.dialogRef.close({ event: this.action, data: this.item }); } } closeDialog() { this.dialogRef.close({ event: 'Cancelar' }); } }
ks-proyects/giflo
src/app/pages/private/home/address-dialog/address-dialog.component.ts
TypeScript
MethodDeclaration
doAction(isValid: boolean) { if (isValid) { this.dialogRef.close({ event: this.action, data: this.item }); } }
ks-proyects/giflo
src/app/pages/private/home/address-dialog/address-dialog.component.ts
TypeScript
MethodDeclaration
closeDialog() { this.dialogRef.close({ event: 'Cancelar' }); }
ks-proyects/giflo
src/app/pages/private/home/address-dialog/address-dialog.component.ts
TypeScript
ArrowFunction
({ color = 'currentColor', title, ...props }, svgRef) => { const titleId = useMemo( () => title ? 'title-' + Math.random().toString(36).substr(2, 9) : undefined, [title] ); return ( <svg xmlns="http://www.w3.org/2000/svg" width={16} height={16} fill="none" viewBox="0 0 16 16" aria-hidden={!title} ref={svgRef} aria-labelledby={titleId} {
hashicorp/design-system
packages/flight-icons/svg-react/download-16.tsx
TypeScript
ArrowFunction
() => title ? 'title-' + Math.random().toString(36).substr(2, 9) : undefined
hashicorp/design-system
packages/flight-icons/svg-react/download-16.tsx
TypeScript
MethodDeclaration
title ? <title id={titleId}>{title}
hashicorp/design-system
packages/flight-icons/svg-react/download-16.tsx
TypeScript
ArrowFunction
(specularLayer) => { gsap.to(specularLayer, { y: top - 0.075 * height, x: left - 0.075 * width, width: width * 1.15, height: height * 1.15, borderRadius: radius, duration: 0.15, }); }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
ArrowFunction
(specularLayer) => { gsap.to(specularLayer, { x: newX, y: newY, duration: 0.15, backgroundImage: `radial-gradient(circle at ${Math.abs( left - pointerX )}px ${Math.abs( top - pointerY )}px, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0) 60%)`, }); }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
ClassDeclaration
export class LiftPointer implements Pointer { private specularLayer: SpecularLayer; private targetElement: Element; private targetElementValues: { top: number; left: number; width: number; height: number; zIndex: number; }; private cssLiftClass: string; private liftStyle: Element; private pointerElement: HTMLElement; constructor(pointerElement: HTMLElement, targetElement: HTMLElement) { this.specularLayer = new SpecularLayer(); this.cssLiftClass = 'pointer-lift-type'; this.liftStyle = null; this.pointerElement = pointerElement; this.targetElement = targetElement; } public init(): void { const { width, height, top, left } = this.targetElement.getBoundingClientRect(); const targetStyles = window.getComputedStyle(this.targetElement); const radius: number = parseFloat(targetStyles.borderRadius); const zIndex: number = parseFloat(targetStyles.zIndex); const targetBgColor: string = targetStyles.backgroundColor; this.targetElementValues = { top, left, width, height, zIndex, }; this.addLiftStyle(); this.specularLayer.init(); this.pointerElement.classList.add(this.cssLiftClass); gsap.to(this.pointerElement, { y: top - 0.075 * height, x: left - 0.075 * width, width: width * 1.15, height: height * 1.15, borderRadius: radius, duration: 0.15, filter: `drop-shadow(0 -3px 12px ${targetBgColor}) drop-shadow(0 3px 6px black)`, }); this.specularLayer.update((specularLayer) => { gsap.to(specularLayer, { y: top - 0.075 * height, x: left - 0.075 * width, width: width * 1.15, height: height * 1.15, borderRadius: radius, duration: 0.15, }); }); gsap.to(this.targetElement, { scale: 1.15, duration: 0.15, }); } public onUpdate(pointerX: number, pointerY: number): void { const scale = 1.15; const { top, left, width, height } = this.targetElementValues; const scaledWidth = width * scale; const scaledHeight = height * scale; const deltaX = -(left - 0.075 * width - pointerX + scaledWidth / 2) / 10; const deltaY = -(top - 0.075 * height - pointerY + scaledHeight / 2) / 12; const newX = left - 0.075 * width + deltaX; const newY = top - 0.075 * height + deltaY; gsap.to(this.pointerElement, { x: newX, y: newY, duration: 0.15, }); this.specularLayer.update((specularLayer) => { gsap.to(specularLayer, { x: newX, y: newY, duration: 0.15, backgroundImage: `radial-gradient(circle at ${Math.abs( left - pointerX )}px ${Math.abs( top - pointerY )}px, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0) 60%)`, }); }); gsap.to(this.targetElement, { x: deltaX, y: deltaY, duration: 0.15, }); } public onReset(): void { this.removeLiftStyle(); this.specularLayer.destroy(); this.pointerElement.classList.remove(this.cssLiftClass); gsap.to(this.pointerElement, { duration: 0.15, filter: 'none', }); gsap.to(this.targetElement, { scale: 1, x: 0, y: 0, duration: 0.15, }); } private removeLiftStyle(): void { this.liftStyle.parentElement.removeChild(this.liftStyle); } private addLiftStyle(): void { const style = document.createElement('style'); style.innerHTML = ` .${this.cssLiftClass} { background-color: rgba(0,0,0,0.05); z-index: ${this.targetElementValues.zIndex - 1}; } `; this.liftStyle = style; document.head.appendChild(this.liftStyle); } }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
MethodDeclaration
public init(): void { const { width, height, top, left } = this.targetElement.getBoundingClientRect(); const targetStyles = window.getComputedStyle(this.targetElement); const radius: number = parseFloat(targetStyles.borderRadius); const zIndex: number = parseFloat(targetStyles.zIndex); const targetBgColor: string = targetStyles.backgroundColor; this.targetElementValues = { top, left, width, height, zIndex, }; this.addLiftStyle(); this.specularLayer.init(); this.pointerElement.classList.add(this.cssLiftClass); gsap.to(this.pointerElement, { y: top - 0.075 * height, x: left - 0.075 * width, width: width * 1.15, height: height * 1.15, borderRadius: radius, duration: 0.15, filter: `drop-shadow(0 -3px 12px ${targetBgColor}) drop-shadow(0 3px 6px black)`, }); this.specularLayer.update((specularLayer) => { gsap.to(specularLayer, { y: top - 0.075 * height, x: left - 0.075 * width, width: width * 1.15, height: height * 1.15, borderRadius: radius, duration: 0.15, }); }); gsap.to(this.targetElement, { scale: 1.15, duration: 0.15, }); }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
MethodDeclaration
public onUpdate(pointerX: number, pointerY: number): void { const scale = 1.15; const { top, left, width, height } = this.targetElementValues; const scaledWidth = width * scale; const scaledHeight = height * scale; const deltaX = -(left - 0.075 * width - pointerX + scaledWidth / 2) / 10; const deltaY = -(top - 0.075 * height - pointerY + scaledHeight / 2) / 12; const newX = left - 0.075 * width + deltaX; const newY = top - 0.075 * height + deltaY; gsap.to(this.pointerElement, { x: newX, y: newY, duration: 0.15, }); this.specularLayer.update((specularLayer) => { gsap.to(specularLayer, { x: newX, y: newY, duration: 0.15, backgroundImage: `radial-gradient(circle at ${Math.abs( left - pointerX )}px ${Math.abs( top - pointerY )}px, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0) 60%)`, }); }); gsap.to(this.targetElement, { x: deltaX, y: deltaY, duration: 0.15, }); }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
MethodDeclaration
public onReset(): void { this.removeLiftStyle(); this.specularLayer.destroy(); this.pointerElement.classList.remove(this.cssLiftClass); gsap.to(this.pointerElement, { duration: 0.15, filter: 'none', }); gsap.to(this.targetElement, { scale: 1, x: 0, y: 0, duration: 0.15, }); }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
MethodDeclaration
private removeLiftStyle(): void { this.liftStyle.parentElement.removeChild(this.liftStyle); }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
MethodDeclaration
private addLiftStyle(): void { const style = document.createElement('style'); style.innerHTML = ` .${this.cssLiftClass} { background-color: rgba(0,0,0,0.05); z-index: ${this.targetElementValues.zIndex - 1}; } `; this.liftStyle = style; document.head.appendChild(this.liftStyle); }
VoloshchenkoAl/custom-pointer
src/pointers/Lift/LiftPointer.ts
TypeScript
ClassDeclaration
@Component({ selector: 'cmp-471', template: '<strong>471</strong>&nbsp;', }) export class Cmp471Component { add471(x: number) { return x + 471; } }
thelgevold/remote-builder
angular-demo/src/airplane/team4/mod7/cmp1/cmp.ts
TypeScript
MethodDeclaration
add471(x: number) { return x + 471; }
thelgevold/remote-builder
angular-demo/src/airplane/team4/mod7/cmp1/cmp.ts
TypeScript
ArrowFunction
() => { let component: SafariComponent; let fixture: ComponentFixture<SafariComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ SafariComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(SafariComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); }
gderick-1/laitayo
src/app/safari/safari.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [ SafariComponent ] }) .compileComponents(); }
gderick-1/laitayo
src/app/safari/safari.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(SafariComponent); component = fixture.componentInstance; fixture.detectChanges(); }
gderick-1/laitayo
src/app/safari/safari.component.spec.ts
TypeScript
FunctionDeclaration
function isNumeric(baseIngredientWeight) { return !isNaN(baseIngredientWeight) }
stuartleaver/seasons-of-serverless
03-the-longest-kebab/api/KebabCalculator/index.ts
TypeScript
InterfaceDeclaration
export interface LocalMove { mark: MarkType; markIndex: number; }
Ian-Gilbert/uttt-angular
angular/src/app/data/local-move.model.ts
TypeScript
ClassDeclaration
export declare class MoveColumnController { private loggerFactory; private columnController; private gridPanel; private dragAndDropService; private gridOptionsWrapper; private needToMoveLeft; private needToMoveRight; private movingIntervalId; private intervalCount; private logger; private pinned; private centerContainer; private lastDraggingEvent; private failedMoveAttempts; private eContainer; constructor(pinned: string, eContainer: HTMLElement); init(): void; getIconName(): string; onDragEnter(draggingEvent: DraggingEvent): void; onDragLeave(draggingEvent: DraggingEvent): void; onDragStop(): void; private normaliseX(x); private workOutNewIndex(displayedColumns, allColumns, dragColumn, hDirection, xAdjustedForScroll); private checkCenterForScrolling(xAdjustedForScroll); onDragging(draggingEvent: DraggingEvent, fromEnter?: boolean): void; private normaliseDirection(hDirection); private attemptMoveColumns(allMovingColumns, hDirection, xAdjusted, fromEnter); private getNewIndexForColMovingLeft(displayedColumns, allColumns, dragColumn, x); private getNewIndexForColMovingRight(displayedColumns, allColumns, dragColumnOrGroup, x); private ensureIntervalStarted(); private ensureIntervalCleared(); private moveInterval(); }
contata-dennemeyer/ag-grid
dist/lib/headerRendering/moveColumnController.d.ts
TypeScript
MethodDeclaration
getIconName(): string;
contata-dennemeyer/ag-grid
dist/lib/headerRendering/moveColumnController.d.ts
TypeScript
MethodDeclaration
onDragEnter(draggingEvent: DraggingEvent): void;
contata-dennemeyer/ag-grid
dist/lib/headerRendering/moveColumnController.d.ts
TypeScript
MethodDeclaration
onDragLeave(draggingEvent: DraggingEvent): void;
contata-dennemeyer/ag-grid
dist/lib/headerRendering/moveColumnController.d.ts
TypeScript
MethodDeclaration
onDragStop(): void;
contata-dennemeyer/ag-grid
dist/lib/headerRendering/moveColumnController.d.ts
TypeScript