repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
maoberlehner/talk-an-introduction-to-typescript
src/classes/Car.ts
<filename>src/classes/Car.ts import { ICar } from '../interfaces/ICar'; import { IEngine } from '../interfaces/IEngine'; export class Car implements ICar { constructor(private engine: IEngine) { } public start() { this.engine.start(); } }
maoberlehner/talk-an-introduction-to-typescript
src/interfaces/IEngine.ts
export interface IEngine { kw: number; start: () => void; }
maoberlehner/talk-an-introduction-to-typescript
src/interfaces/ICar.ts
export interface ICar { start: () => void; }
QSPFoundation/qspider
apps/player/src/app/components/dialogs/input/input.dialog.tsx
import React, { useState } from 'react'; import { observer } from 'mobx-react-lite'; import { useGameManager } from '../../../game/manager'; import styled from '@emotion/styled'; import { Modal } from '../../ui-blocks/modal'; const TextInput = styled.input` width: 100%; height: 40px; padding: 2px 5px; backgrou...
QSPFoundation/qspider
apps/player/src/app/components/ui-blocks/panel.tsx
import styled from '@emotion/styled'; type PanelProps = { withPadding?: boolean }; export const Panel = styled.div<PanelProps>` width: 100%; height: 100%; border: 1px solid var(--border-color); white-space: pre-wrap; `; export const PanelWithBackground = styled(Panel)<PanelProps>` background-image: var(--b...
QSPFoundation/qspider
apps/player/src/app/components/dialogs/error/error.dialog.tsx
<gh_stars>1-10 import React, { useCallback } from 'react'; import { observer } from 'mobx-react-lite'; import { useGameManager } from '../../../game/manager'; import { Modal } from '../../ui-blocks/modal'; export const ErrorDialog: React.FC = observer(() => { const gameManager = useGameManager(); const onClose = u...
QSPFoundation/qspider
apps/player/src/app/components/ui-blocks/action-list/action-list.tsx
<filename>apps/player/src/app/components/ui-blocks/action-list/action-list.tsx import React from 'react'; import styled from '@emotion/styled'; import { QspListItem } from '@qspider/qsp-wasm'; import { ActionItem } from './action-item'; const Nav = styled.nav` outline: none; `; export const ActionList: React.FC<{ ...
QSPFoundation/qspider
apps/player/src/app/game/manager.tsx
<filename>apps/player/src/app/game/manager.tsx import React, { useState } from 'react'; import { observable, action, makeObservable, runInAction } from 'mobx'; import { fetchPlayerConfig } from './loader'; import { QspAPI, init, QspErrorData, QspListItem, QspEvents } from '@qspider/qsp-wasm'; import { prepareContent, p...
QSPFoundation/qspider
apps/player/src/app/components/content/content.tsx
<reponame>QSPFoundation/qspider<gh_stars>1-10 import React from 'react'; import { Markup } from 'interweave'; import { observer } from 'mobx-react-lite'; import { useLayout } from '../../game/layout'; import { transform } from './transformers'; const blockList = ['script']; export const Content: React.FC<{ content: s...
rnarayana/azure-samples
EventHub/EventPublisher/index.ts
<filename>EventHub/EventPublisher/index.ts<gh_stars>0 import { App } from "./app"; async function main() { const app = new App( "Endpoint=sb://<namespace>.servicebus.windows.net/;SharedAccessKeyName=<policyname>;SharedAccessKey=<key>", "<location-event-hub-name>", "<driver-event-hub-name>")...
rnarayana/azure-samples
EventHub/EventPublisher/app.ts
<filename>EventHub/EventPublisher/app.ts import { EventHubClient } from "@azure/event-hubs"; import { Guid } from "guid-typescript"; export class App { private locationClients: EventHubClient[] = []; private driverClients: EventHubClient[] = []; constructor(public connectionString:string, public locationE...
didithilmy/rucio-jupyterlab
src/utils/ActiveNotebookListener.ts
<reponame>didithilmy/rucio-jupyterlab<filename>src/utils/ActiveNotebookListener.ts<gh_stars>1-10 import { ILabShell } from '@jupyterlab/application'; import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook'; import { ExtensionStore, ExtensionState } from '../stores/ExtensionStore'; import { NotebookDIDAtt...
didithilmy/rucio-jupyterlab
src/stores/UIStore.ts
<reponame>didithilmy/rucio-jupyterlab import { Store } from 'pullstate'; import { Instance, FileDIDDetails, RucioAuthCredentials, RucioAuthType } from '../types'; export interface UIState { activeInstance?: Instance; activeAuthType?: RucioAuthType; instances?: Instance[]; authConfig?: { [instance: string]: Ruc...
didithilmy/rucio-jupyterlab
src/components/@Explore/DIDListItem.tsx
import React from 'react'; import { createUseStyles } from 'react-jss'; import { FileDIDItemDetails } from './FileDIDItemDetails'; import { CollectionDIDItemDetails } from './CollectionDIDItemDetails'; import { toHumanReadableSize } from '../../utils/Helpers'; import { ListAttachedFilesPopover } from './ListAttachedFil...
didithilmy/rucio-jupyterlab
src/stores/ExtensionStore.ts
import { Store } from 'pullstate'; import { NotebookPanel } from '@jupyterlab/notebook'; import { NotebookDIDAttachment } from '../types'; export interface ExtensionState { activeNotebookPanel?: NotebookPanel; activeNotebookAttachment?: NotebookDIDAttachment[]; } export const initialState: ExtensionState = {}; e...
didithilmy/rucio-jupyterlab
src/types.ts
export interface Instance { displayName: string; name: string; } interface RucioAuth { account?: string; } export interface RucioUserpassAuth extends RucioAuth { username: string; password: string; } export interface RucioX509Auth extends RucioAuth { certificate: string; key?: string; } export interfa...
didithilmy/rucio-jupyterlab
src/components/@Explore/InlineDropdown.tsx
import React, { useState, useEffect, useRef } from 'react'; import { createUseStyles } from 'react-jss'; const useStyles = createUseStyles({ dropdown: { position: 'relative', display: 'inline-block' }, dropdownTitle: { cursor: 'pointer' }, dropdownContent: { display: 'none', position: 'ab...
didithilmy/rucio-jupyterlab
src/components/@Notebook/NotebookAttachmentListItem.tsx
<reponame>didithilmy/rucio-jupyterlab<filename>src/components/@Notebook/NotebookAttachmentListItem.tsx import React, { useEffect, useMemo } from 'react'; import { createUseStyles } from 'react-jss'; import { useStoreState } from 'pullstate'; import { NotebookDIDAttachment, FileStatus, CollectionStatus, ResolveStatus } ...
didithilmy/rucio-jupyterlab
src/tabs/Settings.tsx
import React, { useMemo, useState, useEffect } from 'react'; import { createUseStyles } from 'react-jss'; import Select from 'react-select'; import { useStoreState } from 'pullstate'; import { UIStore, resetRucioCaches } from '../stores/UIStore'; import { Button } from '../components/Button'; import { withRequestAPI, W...
didithilmy/rucio-jupyterlab
src/utils/Helpers.ts
<reponame>didithilmy/rucio-jupyterlab import { FileDIDDetails, CollectionStatus } from '../types'; export const computeCollectionState = (files: FileDIDDetails[]): CollectionStatus | false => { if (!files) { return false; } if (files.length === 0) { return 'AVAILABLE'; } const available = files.fin...
didithilmy/rucio-jupyterlab
src/components/Spinning.tsx
<reponame>didithilmy/rucio-jupyterlab import React from 'react'; import { createUseStyles } from 'react-jss'; const useStyles = createUseStyles({ '@keyframes rotation': { from: { transform: 'rotate(0deg)' }, to: { transform: 'rotate(359deg)' } }, rotate: { animation: '$rotation 1s...
didithilmy/rucio-jupyterlab
src/components/@Settings/X509Auth.tsx
<gh_stars>1-10 import React from 'react'; import { createUseStyles } from 'react-jss'; import { TextField } from '../TextField'; import { RucioX509Auth } from '../../types'; import { Spinning } from '../Spinning'; import { FilePickerPopover } from './FilePickerPopover'; const useStyles = createUseStyles({ container:...
didithilmy/rucio-jupyterlab
tests/ApiRequest.test.ts
<filename>tests/ApiRequest.test.ts<gh_stars>1-10 import { requestAPI } from '../src/utils/ApiRequest'; jest.mock('@jupyterlab/services', () => ({ ServerConnection: { makeSettings: () => ({ baseUrl: 'http://localhost:8888/' }), makeRequest: () => ({ ok: true, json: () => ({ r...
didithilmy/rucio-jupyterlab
src/utils/NotebookListener.ts
<gh_stars>1-10 import { ILabShell } from '@jupyterlab/application'; import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook'; import { SessionManager, KernelMessage, Kernel } from '@jupyterlab/services'; import { IKernelConnection } from '@jupyterlab/services/lib/kernel/kernel'; import { Store, useStoreSt...
didithilmy/rucio-jupyterlab
src/utils/NotebookPollingListener.ts
<filename>src/utils/NotebookPollingListener.ts import { ExtensionStore } from '../stores/ExtensionStore'; import { UIStore } from '../stores/UIStore'; import { PollingRequesterRef, didPollingManager } from './DIDPollingManager'; import { NotebookDIDAttachment } from '../types'; import { actions } from './Actions'; impo...
didithilmy/rucio-jupyterlab
src/components/@Settings/FilePickerPopover.tsx
<gh_stars>1-10 import React, { useState, useEffect, useCallback } from 'react'; import { createUseStyles } from 'react-jss'; import { FixedSizeList } from 'react-window'; import AutoSizer from 'react-virtualized-auto-sizer'; import Popover from 'react-popover'; import { withRequestAPI, WithRequestAPIProps } from '../.....
didithilmy/rucio-jupyterlab
src/components/@Explore/FileDIDItemDetails.tsx
import React, { useEffect, useState } from 'react'; import { createUseStyles } from 'react-jss'; import { useStoreState } from 'pullstate'; import { UIStore } from '../../stores/UIStore'; import { Spinning } from '../Spinning'; import { withRequestAPI, WithRequestAPIProps } from '../../utils/Actions'; import { AddToNot...
didithilmy/rucio-jupyterlab
src/const.ts
export const EXTENSION_ID = 'rucio-jupyterlab'; export const METADATA_ATTACHMENTS_KEY = 'rucio_attachments'; export const COMM_NAME_KERNEL = `${EXTENSION_ID}:kernel`; export const COMM_NAME_FRONTEND = `${EXTENSION_ID}:frontend`; export const searchByOptions = [ { title: 'Datasets or Containers', value: 'datasets' },...
didithilmy/rucio-jupyterlab
src/tabs/Explore.tsx
import React, { useState, useEffect, useRef } from 'react'; import { createUseStyles } from 'react-jss'; import { VariableSizeList } from 'react-window'; import AutoSizer from 'react-virtualized-auto-sizer'; import { useStoreState } from 'pullstate'; import { UIStore } from '../stores/UIStore'; import { TextField } fro...
didithilmy/rucio-jupyterlab
src/components/TextField.tsx
import React from 'react'; import { createUseStyles } from 'react-jss'; const useStyles = createUseStyles({ control: { display: 'flex', flexDirection: 'row', border: (props: TextFieldProps) => `1px solid ${props.outlineColor || 'var(--jp-border-color1)'}`, alignItems: 'stretch' }, input: { fl...
didithilmy/rucio-jupyterlab
src/components/HorizontalHeading.tsx
import React from 'react'; import { createUseStyles } from 'react-jss'; const useStyles = createUseStyles({ heading: { borderBottom: '1px solid var(--jp-border-color2)', margin: 0, padding: '24px 16px 8px 16px', fontWeight: 'bold', textAlign: 'start', fontSize: '9pt', textTransform: 'uppe...
didithilmy/rucio-jupyterlab
src/pages/MainPanel.tsx
import React, { useState } from 'react'; import { createUseStyles } from 'react-jss'; import { useStoreState } from 'pullstate'; import { UIStore } from '../stores/UIStore'; import { MenuBar } from '../components/MenuBar'; import { Explore } from '../tabs/Explore'; import { Notebook } from '../tabs/Notebook'; import { ...
devhid/stackoverflow-clone
front-end/src/app/search-results/search-results.component.ts
import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { RetrievalService } from '../services/retrieval.service'; import { TransferService } from '../services/transfer.service'; import { Question } from '../classes/question'; import { map } from 'rxjs/operators'; @Component({ s...
devhid/stackoverflow-clone
front-end/src/app/classes/user.ts
import { Injectable } from '@angular/core'; export class User { constructor( public username: string, public email: string, public password: string, public reputation: number ) { } } @Injectable({ providedIn: 'root' }) export class UserAdapter { adapt(item: any): User ...
devhid/stackoverflow-clone
front-end/src/app/services/qa.service.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; import { Observable, of, throwError } from 'rxjs'; import { catchError, map, tap, retry } from 'rxjs/operators'; import { Question, Questions, QuestionAdapter } from '../classes/question'; imp...
devhid/stackoverflow-clone
front-end/src/app/search/search.component.ts
import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl } from '@angular/forms'; import { Router } from '@angular/router'; import { RetrievalService } from '../services/retrieval.service'; import { TransferService } from '../services/transfer.service'; import { Question } from '../classes/qu...
devhid/stackoverflow-clone
front-end/src/app/services/retrieval.service.spec.ts
import { TestBed } from '@angular/core/testing'; import { RetrievalService } from './retrieval.service'; describe('QuestionRetrievalService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { const service: RetrievalService = TestBed.get(RetrievalService); expe...
devhid/stackoverflow-clone
front-end/src/app/classes/question.ts
import { Injectable } from '@angular/core'; export class Question { constructor( public id: string, public username: string, public user_reputation: number, public title: string, public body: string, public score: number, public view_count: number, pu...
devhid/stackoverflow-clone
front-end/src/app/services/qa.service.spec.ts
<gh_stars>1-10 import { TestBed } from '@angular/core/testing'; import { QAService } from './qa.service'; describe('AddqaService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { const service: QAService = TestBed.get(QAService); expect(service).toBeTruthy();...
devhid/stackoverflow-clone
front-end/src/app/askquestion/askquestion.component.ts
import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, FormControl, FormArray, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { QAService } from '../services/qa.service'; import { MediaService } from '../se...
devhid/stackoverflow-clone
front-end/src/app/register/register.component.ts
<filename>front-end/src/app/register/register.component.ts import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl } from '@angular/forms'; import { User } from '../classes/user'; import { RegisterService } from '../services/register.service'; @Component({ selector: 'app-register', temp...
devhid/stackoverflow-clone
front-end/src/app/login/login.component.ts
<filename>front-end/src/app/login/login.component.ts import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl } from '@angular/forms'; import { HttpResponse } from '@angular/common/http'; import { User } from '../classes/user'; import { LoginService } from '../services/login.service'; const ...
devhid/stackoverflow-clone
front-end/src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; import { HttpClientModule } from '@angular/common/http'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AppRoutingModule } from './app-routin...
devhid/stackoverflow-clone
front-end/src/app/classes/answer.ts
<reponame>devhid/stackoverflow-clone import { Injectable } from '@angular/core'; export class Answer { constructor( public id: string, public user: string, public body: string, public score: number, public is_accepted: boolean, public timestamp: number, publi...
devhid/stackoverflow-clone
front-end/src/app/classes/answer.spec.ts
import { Answer } from './answer'; describe('Answer', () => { it('should create an instance', () => { expect(new Answer(null, null, null, null, null, null, null)).toBeTruthy(); }); });
devhid/stackoverflow-clone
front-end/src/app/profile/profile.component.ts
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { UserService } from '../services/user.service'; import { User } from '../classes/user'; import { Question } from '../classes/question'; import { Answer } from '../classes/answer'; import { RetrievalService } fr...
devhid/stackoverflow-clone
front-end/src/app/services/user.service.ts
<filename>front-end/src/app/services/user.service.ts import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpErrorResponse, HttpParams } from '@angular/common/http'; import { User, UserAdapter } from '../classes/user' import { Observable, of, throwError } from 'rxjs'; import { catchError, map...
devhid/stackoverflow-clone
front-end/src/app/app-routing.module.ts
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { LoginComponent } from './login/login.component'; import { RegisterComponent } from './register/register.component'; import { QuestionComponent } from './ques...
devhid/stackoverflow-clone
front-end/src/app/services/retrieval.service.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; import { Observable, of, throwError } from 'rxjs'; import { catchError, map, tap, retry } from 'rxjs/operators'; import { Question, Questions, QuestionAdapter } from '../classes/question'; imp...
devhid/stackoverflow-clone
front-end/src/app/classes/question.spec.ts
import { Question } from './question'; describe('Question', () => { it('should create an instance', () => { expect(new Question(null, null, null, null, null, null, null, null, null, null, null, null)).toBeTruthy(); }); });
devhid/stackoverflow-clone
front-end/src/app/question/question.component.ts
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { FormGroup, FormControl } from '@angular/forms'; import { Router } from '@angular/router'; import { ChangeDetectorRef } from '@angular/core' import { RetrievalService } from '../services/retrieval.service'; imp...
BetaAI/slate
packages/slate/src/interfaces/location.ts
<filename>packages/slate/src/interfaces/location.ts import { Path, Point, Range } from '..' /** * The `Location` interface is a union of the ways to refer to a specific * location in a Slate document: paths, points or ranges. * * Methods will often accept a `Location` instead of requiring only a `Path`, * `Point`...
BetaAI/slate
packages/slate/src/interfaces/point.ts
import isPlainObject from 'is-plain-object' import { produce } from 'immer' import { Operation, Path } from '..' /** * `Point` objects refer to a specific location in a text node in a Slate * document. Its path refers to the location of the node in the tree, and its * offset refers to the distance into the node's s...
BetaAI/slate
packages/slate/src/interfaces/range.ts
import { produce } from 'immer' import isPlainObject from 'is-plain-object' import { Operation, Path, Point, PointEntry } from '..' /** * `Range` objects are a set of points that refer to a specific span of a Slate * document. They can define a span inside a single node or a can span across * multiple nodes. */ e...
BetaAI/slate
packages/slate-react/src/hooks/use-read-only.ts
import { createContext, useContext } from 'react' /** * A React context for sharing the `readOnly` state of the editor. */ export const ReadOnlyContext = createContext(false) /** * Get the current `readOnly` state of the editor. */ export const useReadOnly = (): boolean => { return useContext(ReadOnlyContext)...
BetaAI/slate
packages/slate-react/src/hooks/use-selected.ts
<gh_stars>1000+ import { createContext, useContext } from 'react' /** * A React context for sharing the `selected` state of an element. */ export const SelectedContext = createContext(false) /** * Get the current `selected` state of an element. */ export const useSelected = (): boolean => { return useContext(...
BetaAI/slate
packages/slate-react/src/@types/direction.d.ts
declare module 'direction' { function direction(text: string): 'neutral' | 'ltr' | 'rtl' export default direction }
BetaAI/slate
packages/slate-react/src/index.ts
// Components export { RenderElementProps, RenderLeafProps, Editable, } from './components/editable' export { DefaultElement } from './components/element' export { DefaultLeaf } from './components/leaf' export { Slate } from './components/slate' // Hooks export { useEditor } from './hooks/use-editor' export { us...
BetaAI/slate
packages/slate-react/src/hooks/use-isomorphic-layout-effect.ts
import { useLayoutEffect, useEffect } from 'react' /** * Prevent warning on SSR by falling back to useEffect when window is not defined */ export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect
BetaAI/slate
packages/slate/src/interfaces/element.ts
<gh_stars>1-10 import isPlainObject from 'is-plain-object' import { Editor, Node, Path } from '..' /** * `Element` objects are a type of node in a Slate document that contain other * element nodes or text nodes. They can be either "blocks" or "inlines" * depending on the Slate editor's configuration. */ export in...
BetaAI/slate
packages/slate/src/transforms/selection.ts
import { Editor, Location, Point, Range, Transforms } from '..' export const SelectionTransforms = { /** * Collapse the selection. */ collapse( editor: Editor, options: { edge?: 'anchor' | 'focus' | 'start' | 'end' } = {} ) { const { edge = 'anchor' } = options const { selection ...
BetaAI/slate
packages/slate-hyperscript/src/index.ts
<reponame>BetaAI/slate<filename>packages/slate-hyperscript/src/index.ts import { createHyperscript, HyperscriptCreators, HyperscriptShorthands, } from './hyperscript' /** * The default hyperscript factory that ships with Slate, without custom tags. */ const jsx = createHyperscript() export { jsx, createHyper...
BetaAI/slate
packages/slate/src/interfaces/point-ref.ts
import { Operation, Point } from '..' /** * `PointRef` objects keep a specific point in a document synced over time as new * operations are applied to the editor. You can access their `current` property * at any time for the up-to-date point value. */ export interface PointRef { current: Point | null affinity...
BetaAI/slate
packages/slate-react/src/utils/hotkeys.ts
<gh_stars>1000+ import { isKeyHotkey } from 'is-hotkey' import { IS_APPLE } from './environment' /** * Hotkey mappings for each platform. */ const HOTKEYS = { bold: 'mod+b', compose: ['down', 'left', 'right', 'up', 'backspace', 'enter'], moveBackward: 'left', moveForward: 'right', moveWordBackward: 'ctrl+...
BetaAI/slate
packages/slate-history/src/index.ts
export * from './history' export * from './history-editor' export * from './with-history'
BetaAI/slate
packages/slate-react/src/components/text.tsx
import React, { useRef } from 'react' import { Range, Element, Text as SlateText } from 'slate' import Leaf from './leaf' import { ReactEditor, useEditor } from '..' import { RenderLeafProps } from './editable' import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect' import { KEY_TO_ELEMENT,...
BetaAI/slate
packages/slate-react/src/hooks/use-focused.ts
import { createContext, useContext } from 'react' /** * A React context for sharing the `focused` state of the editor. */ export const FocusedContext = createContext(false) /** * Get the current `focused` state of the editor. */ export const useFocused = (): boolean => { return useContext(FocusedContext) }
BetaAI/slate
packages/slate/src/interfaces/range-ref.ts
import { Operation, Range } from '..' /** * `RangeRef` objects keep a specific range in a document synced over time as new * operations are applied to the editor. You can access their `current` property * at any time for the up-to-date range value. */ export interface RangeRef { current: Range | null affinity...
kkysen/BouncingBalls
src/game.ts
import {Listener} from "./listener"; import {Canvas, CanvasConstructor} from "./svgCanvas"; export interface Vector { x: number; y: number; } export interface GameUpdater { (game: Game): void; } export interface GameRenderer { (game: Game): void; } interface PrivateActo...
kkysen/BouncingBalls
src/extensions.ts
<gh_stars>0 declare interface Object { freeze<T>(this: T): T; seal<T>(this: T): T; // _ is b/c there are other objects with slightly different clone methods _clone<T>(this: T): T; } declare interface ObjectConstructor { defineSharedProperties(object: any, sharedDescriptor: ...
kkysen/BouncingBalls
src/svgCanvas.ts
<reponame>kkysen/BouncingBalls<gh_stars>0 import {AnyImage} from "./utils"; interface SVGConstructor { <K extends keyof SVGElementTagNameMap>(tagName: K): SVGElementTagNameMap[K]; } interface SVGElementTagNameMap { "a": SVGAElement; "circle": SVGCircleElement; "clipPath": SVGClipPathEle...
kkysen/BouncingBalls
src/bouncingBalls.ts
import {CanvasCanvas} from "./canvasCanvas"; import {Listener} from "./listener"; import {Canvas, CanvasConstructor} from "./svgCanvas"; import {MathUtils, queryParams} from "./utils"; import {Ball} from "./ball"; import {Game, GameAction, GameRenderer, GameUpdater, Vector} from "./game"; export interface BouncingBall...
kkysen/BouncingBalls
src/main.ts
import {BouncingBallsGame} from "./bouncingBalls"; (function() { BouncingBallsGame.main(); })();
kkysen/BouncingBalls
src/utils.ts
<gh_stars>0 export type AnyImage = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap; export const MathUtils = { TAU: 2 * Math.PI, rad2deg(radians: number): number { return radians * 180 / Math.PI; }, deg2rad(degrees: number): number { return degrees *...
metanomi/prisma
src/packages/client/src/generation/TSClient/TSClient.ts
<reponame>metanomi/prisma import { GeneratorConfig } from '@prisma/generator-helper' import { Platform } from '@prisma/get-platform' import { getEnvPaths } from '@prisma/sdk/dist/utils/getEnvPaths' import indent from 'indent-string' import { klona } from 'klona' import path from 'path' import { DMMFClass } from '../../...
daniilnemtyrev/INNOVA
src/auth/auth.controller.ts
<reponame>daniilnemtyrev/INNOVA import { Body, Get, Post, Req, Res, UsePipes, ValidationPipe, } from '@nestjs/common'; import { Controller } from '@nestjs/common'; import { CreateUserDto } from 'src/users/dto/create-user.dto'; import { AuthService } from './auth.service'; import { Response, Request } from...
daniilnemtyrev/INNOVA
src/auth/auth.service.ts
<reponame>daniilnemtyrev/INNOVA<filename>src/auth/auth.service.ts import { HttpException, HttpStatus, Injectable, UnauthorizedException, } from '@nestjs/common'; import { CreateUserDto } from 'src/users/dto/create-user.dto'; import { UsersService } from 'src/users/users.service'; import * as bcrypt from 'bcrypt...
daniilnemtyrev/INNOVA
src/tokens/tokens.service.ts
<gh_stars>0 import { Injectable } from '@nestjs/common'; import { InjectModel } from '@nestjs/sequelize'; import { CreateTokens } from './dto/create-tokens'; import { Token, TokenCreationOptions } from './tokens.model'; import { JwtService } from '@nestjs/jwt'; @Injectable() export class TokenService { constructor( ...
daniilnemtyrev/INNOVA
src/tokens/dto/create-tokens.ts
<reponame>daniilnemtyrev/INNOVA export class CreateTokens { readonly userId: string; readonly refreshToken: string; }
daniilnemtyrev/INNOVA
src/chat/dto/messages.dto.ts
<gh_stars>0 export interface MessageDto { userId: number; name: string; text: string; }
daniilnemtyrev/INNOVA
src/chat/chat-messages.model.ts
import { Column, DataType, Model, Table } from 'sequelize-typescript'; interface MessagesCreationOptions { userId: number; name: string; text: string; } @Table({ tableName: 'messages' }) export class Messages extends Model<Messages, MessagesCreationOptions> { @Column({ type: DataType.INTEGER, }) userI...
daniilnemtyrev/INNOVA
src/tokens/tokens.model.ts
import { Column, DataType, Model, Table } from 'sequelize-typescript'; export interface TokenCreationOptions { userId: string; refreshToken: string; } @Table({ tableName: 'tokens' }) export class Token extends Model<Token, TokenCreationOptions> { @Column({ type: DataType.INTEGER, }) userId: number; @...
daniilnemtyrev/INNOVA
src/chat/chat.service.ts
import { Injectable } from '@nestjs/common'; import { InjectModel } from '@nestjs/sequelize'; import { Messages } from './chat-messages.model'; import { MessageDto } from './dto/messages.dto'; @Injectable() export class ChatService { constructor( @InjectModel(Messages) private messagesRepository: typeof Messages...
daniilnemtyrev/INNOVA
src/tokens/tokens.module.ts
import { SequelizeModule } from '@nestjs/sequelize'; import { forwardRef, Module } from '@nestjs/common'; import { TokenService } from './tokens.service'; import { Token } from './tokens.model'; import { JwtModule } from '@nestjs/jwt'; import { ConfigModule } from '@nestjs/config'; @Module({ controllers: [], provi...
daniilnemtyrev/INNOVA
src/auth/auth.module.ts
import { forwardRef, Module } from '@nestjs/common'; import { AuthService } from './auth.service'; import { AuthController } from './auth.controller'; import { UsersModule } from 'src/users/users.module'; import { JwtModule } from '@nestjs/jwt'; import { TokensModule } from 'src/tokens/tokens.module'; import { Sequeliz...
qiqiboy/react-material-formutil
index.d.ts
// Type definitions for react-material-formutil@>0.0.3 // Project: react-material-formutil // Definitions by: qiqiboy <https://github.com/qiqiboy> import { FormControlProps } from '@material-ui/core/FormControl'; import React from 'react'; import { EasyFieldComponentProps } from 'react-formutil'; export * from 'react...
CommonsBuild/pollen-cred-fetcher
src/utils.ts
import { sourcecred } from 'sourcecred' import { config } from 'dotenv' import fetch from 'node-fetch' import { PollenData } from './types' config() const loadLedger = async (): Promise<any> => { try { const ledgerFileURI = process.env.REPO_AND_BRANCH + 'data/ledger.json' const ledgerFileResponse = await f...
CommonsBuild/pollen-cred-fetcher
src/types/index.d.ts
import { Document } from 'mongoose' export type PollenData = { accounts: any, credParticipants: any } export interface ICredParticipant extends Document { credPerInterval: number[], cred: number, id: string } export interface IAccount extends Document { identity: { id: string, subtype: string, ...
CommonsBuild/pollen-cred-fetcher
src/index.ts
<reponame>CommonsBuild/pollen-cred-fetcher import fetchPollenData from './utils' import connectDB from './config/db' import Account from './models/Account' import CredParticipant from './models/CredParticipant' const updatePollenData = async (): Promise<void> => { try { await connectDB() console.log(`${Dat...
CommonsBuild/pollen-cred-fetcher
src/models/CredParticipant.ts
import { model, Schema, Model } from 'mongoose' import { ICredParticipant } from '../types' const CredParticipantSchema: Schema = new Schema({ credPerInterval: { type: Array, required: true }, cred: { type: Number, required: true }, id: { type: String, unique: true, required: true } }) const CredParticipant: Mo...
CommonsBuild/pollen-cred-fetcher
src/config/db.ts
import { connect } from 'mongoose' import { config } from 'dotenv' config() export default async function connectDB() { try { await connect( process.env.MONGODB_URI, { useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: false, useCreateIndex: true ...
Howard86/spring-webflux-angular
reactive-client/src/app/reactive.service.ts
<reponame>Howard86/spring-webflux-angular<gh_stars>0 import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { Quote } from './quote'; @Injectable({ providedIn: 'root', }) export class ReactiveService { private url = 'http://localhost:8080/quotes-reactive'; private urlPaged = 'http:...
Howard86/spring-webflux-angular
reactive-client/src/app/block.service.ts
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { Quote } from './quote'; @Injectable({ providedIn: 'root', }) export class BlockService { private url = 'http://localhost:8080/quotes-blocking'; private urlPaged = 'http://loc...
Howard86/spring-webflux-angular
reactive-client/src/app/quote/quote.component.ts
import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; import { ReactiveService } from '../reactive.service'; import { BlockService } from '../block.service'; import { Quote } from '../quote'; @Component({ selector: 'app-quote', templateUrl: './quote.component.html', styleUrls: ['./quote.component...
usman250994/koa2-ts-init
src/index.ts
import * as debug from 'debug'; import * as Koa from 'koa'; import * as loggerMiddleware from 'koa-bunyan-logger'; import * as jsonMiddleware from 'koa-json'; import errorMiddleware from './middleware/error'; import requestMiddleware from './middleware/request'; import routeMiddleware from './route'; import conf f...
jasonjstewart/hardhat-quick-start
scripts/deploy.ts
<filename>scripts/deploy.ts import { Contract, ContractFactory } from "ethers" import { ethers } from "hardhat" const main = async(): Promise<any> => { const GLDToken: ContractFactory = await ethers.getContractFactory("GLDToken") const gLDToken: Contract = await GLDToken.deploy(100) await gLDToken.deplo...
block65/express-async-wrapper
lib/index.ts
<gh_stars>0 import type { RequestHandler } from 'express'; import type * as core from 'express-serve-static-core'; import type { JsonValue } from 'type-fest'; // eslint-disable-next-line @typescript-eslint/ban-types type ValidResponseBody<T> = Buffer | JsonValue | T; type ValidRequestBody = Buffer | JsonValue | any; ...
tj-actions/glob2
__tests__/main.test.ts
import * as core from '@actions/core' import * as path from 'path' import {promises as fs} from 'fs' import {normalizeSeparators, tempfile} from '../src/utils' import {run} from '../src/main' const defaultEnv = { 'INPUT_FILES-SEPARATOR': '\n', 'INPUT_FILES-FROM-SOURCE-FILE-SEPARATOR': '\n', 'INPUT_EXCLUDED-FILE...
tj-actions/glob2
src/main.ts
import * as path from 'path' import * as core from '@actions/core' import * as glob from '@actions/glob' import {promises as fs} from 'fs' import { getDeletedFiles, getFilesFromSourceFile, normalizeSeparators, escapeString, tempfile } from './utils' const DEFAULT_EXCLUDED_FILES = [ '!node_modules/**', '...
MagnoBelloni/ImpactaAngular4
src/app/services/cursos.service.ts
<gh_stars>0 import { Injectable } from '@angular/core'; import { ICurso } from '../classes/Iinterface.curso'; import { Http, Response, Headers ,RequestOptions } from '@angular/http'; import { Observable } from 'rxjs/Rx'; import 'rxjs/Rx'; @Injectable() export class CursosService { //acesso ao HTTP private ur...