Datasets:

blob_id
large_stringlengths
40
40
language
large_stringclasses
1 value
repo_name
large_stringlengths
5
119
path
large_stringlengths
4
271
score
float64
2.52
4.84
int_score
int64
3
5
text
stringlengths
26
4.09M
86e9b88f8745f6efcdb6e75ffd55b4b2cb890fb7
TypeScript
DurnitsinSimon/next-music-project
/server/src/track/schemas/track.schema.ts
2.609375
3
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document } from 'mongoose'; import * as mongoose from 'mongoose'; import { ApiProperty } from '@nestjs/swagger'; export type TrackDocument = Track & Document; @Schema() export class Track { @ApiProperty({example: 'Benz track', description: 'Tr...
73bed6d3d66dcdf970fac1919018730938ac13a8
TypeScript
nicholasmcconnell/proof-of-concept
/typescript/intersection.ts
3.6875
4
class Person { name: string; constructor(name: string) { this.name = name; } talk() { console.log('Hello my name is: ' + this.name); } } class Address { street: string; zipcode: number; constructor(street: string, zipcode: number) { this.street = street; ...
8a3999d301fbe882ce65109ce73418aef39cd12f
TypeScript
EliasMachuanin/CalculadoraInfinita
/src/ExpresionOperacion.ts
3.015625
3
import Expresion from "./Expresion"; import Contexto from "./Contexto" import OperacionFactory from "./OperacionFactory"; export class ExpresionOperacion extends Expresion { public interpret(a : Contexto){ let aux = a, aux2; aux2 = this.traducirOperacion(aux) if(aux2!=null){ a...
9597e6ac3f086a7d57ac9cb1843cd9485142f8dd
TypeScript
exhibiton/tsoha-blog
/frontend/src/store/reducers/auth-reducer.ts
2.65625
3
import { ADMIN_LOGIN_FAIL, ADMIN_LOGIN_LOADING, ADMIN_LOGIN_SUCCESS, ADMIN_LOGOUT, LOGIN_FAIL, LOGIN_LOADING, LOGIN_SUCCESS, LOGOUT, } from '../../actions/auth-actions' import { SIGN_UP_FAILED, SIGN_UP_FULFILLED, SIGN_UP_LOADING } from '../../actions/auth-actions' import { IAction } from '../../types/re...
1d4a3d630e732b443896ba7460f7462de702253c
TypeScript
dhia06/BrainTravauxPubliques
/src/entities/piece_vue.entity.ts
2.5625
3
import { PieceProjet } from 'src/Model/PieceProjet.entity'; import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn, OneToMany } from 'typeorm'; import { Prestation } from './pretation_vue.entity'; import { Types } from './Types.entity'; @Entity() //cette entité n'est pas utilisé dans notre projet elle...
827106c2179bec60dd151d5f7012bb14a35ec4fc
TypeScript
vbuglov/rct_utils
/src/dateTime/parse.d.ts
2.875
3
/** * Преобразовывает дату в строку по указанному формату. Все * * @category dateTime * @method * @since v0.1.0 * @param {date | string} date - дата которую нужно привести к нужному виду * @param {string} symbol - разделитель для даты * @param {string} mode - мод для преобразования даты, по умоляанию "D...
d86a9bed960292e5eed26103ffb12778d7782451
TypeScript
747-diego/holbertonschool-web_react
/0x00-TypeScript/task_2/js/main.ts
3.65625
4
interface DirectorInterface { workFromHome(): string; getCoffeeBreak(): string; workDirectorTasks(): string; } interface TeacherInterface { workFromHome(): string; getCoffeeBreak(): string; workTeacherTasks(): string; } export class Director implements DirectorInterface { workFromHome() { const home =...
0954543ac257e6ba22de8f1913f3f12a5275fde9
TypeScript
zhangyuantao/guessGame
/guess/libs/modules/utils/utils.d.ts
2.6875
3
declare module utils { /** * 自定义事件分发 */ class EventDispatcher { private static instance; static getInstance(): EventDispatcher; private listeners; addEventListener(type: string, listener: Function, thisObj: any, refObj?: any): void; once(type: string, listener: ...
3d5d3322f31911c945ade3ce2a30be33ebb711b5
TypeScript
XGHeaven/ichest
/src/core/download.ts
2.5625
3
import { parse } from "url"; import { git, npm, npmSlience } from "./shell"; import { join } from "path"; import { mkdirSync, readdirSync, writeFileSync } from "fs"; const GIT_SERVERS = ['gitee.com', 'github.com'] const defaultPackageJSON = { "name": "@ichest/private-node-package", "version": "0.0.0", "descripti...
5c09f59dc0f598a2d2d8b0dc5f7bc1d01ba23771
TypeScript
Marconymous/web-chess
/src/chess/assets/js/move.ts
2.625
3
function dragElement(elmnt: HTMLElement) { let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; elmnt.onmousedown = dragMouseDown; function dragMouseDown(e: MouseEvent) { e = e || window.event; e.preventDefault(); pos3 = e.clientX; pos4 = e.clientY; document.onmouseup = close...
ea3a9524abb52d54807d8fb874c409b1664f6b02
TypeScript
zavgorodny/Yodelay
/src/reducers/index.ts
2.71875
3
import { combineReducers } from "redux"; // needs clarifying -- how does it recognizes increment and why does it need an alias import {test, testState} from './test' import {uploadProto, initialProtoStateType} from './uploadProto' import {updateMenu, initialMenuStateType} from './updateMenu' export interface RootStat...
fa34f027f3fc48859f22f271ce05681d1031a2cf
TypeScript
Lona/serialization
/src/utils.ts
2.875
3
export function assertNever(x: never): never { throw new Error('Unknown type: ' + x['type']) } // Math.random()-based (RNG) // // when executing uuid in JSCore, we don't have access to Crypto, // so it fails. Instead we will fallback to a Math.random RNG. // We don't really care about enthropy so it's fine. export f...
0e69a802a49e405b7e2e4da00df53d9653ff235a
TypeScript
512354087/react-antd-ts-template
/src/store/user/reducers.ts
2.546875
3
import { SET_USERINFO, UserActionTypes, User } from './types' import { Roles } from '../../router/config' import { getUser } from '@/utils/cookie' const userName = getUser() ? getUser().username : 'Donie' const initialState: User = { username: userName, token: '', role: Roles.Admin } export function userReducer(...
c8a3b7041c76cab5e9a5cbefc3dedb1e19d623fb
TypeScript
hackages/wiliam-react-hackjam
/src/utils/isMovieTitleContain.ts
2.71875
3
import { IMovie } from "../types"; import { tokenize, compareTokens } from "./tokenize"; export const isMovieTitleContain = (movie: IMovie, searchTerms: string): boolean => { const searchTokens = tokenize(searchTerms); const titleTokens = tokenize(movie.title); const tokensMatches = compareTokens(searchTokens, t...
fcc9a57b696b0b0bfea1dcc64b56570a5e0e8c2a
TypeScript
cahamilton/music-mashup
/assets/scripts/actions/images/__tests__/images.actions.test.ts
2.640625
3
/** @format */ import axios from 'axios'; import { IMAGES_PENDING, IMAGES_UPDATE, imagesPending, imagesSearch, imagesUpdate, } from '../images.actions'; import type { ActionImagesPending, ActionImagesUpdate, } from '../images.actions'; import type { StateInfo } from '../../../reducers/info/info.reducers...
46903c49d604e4bccd60a5c11b083d445591a7cf
TypeScript
aaginskiy/mediabot
/packages/mediabot/src/utils/metadata-editor/set.ts
2.671875
3
import { get, set } from 'lodash' import { ValidatorBuilder } from '.' import * as TH from 'fp-ts/lib/These' const applySet: ValidatorBuilder = (action) => (entry) => get(entry, action.parameter) === action.value ? TH.right(entry) : TH.both( [ { path: action.parameter, ...
96cabdc0de66c6cb1d7a024179676ae5b6aacaf8
TypeScript
Dogdriip/homete
/frontend/src/modules/auth/saga.ts
2.625
3
import { call, put, takeLatest } from "redux-saga/effects"; import { LOGIN, loginAsync, LOGOUT, logoutAsync } from "./actions"; import { toast } from "react-semantic-toasts"; import "react-semantic-toasts/styles/react-semantic-alert.css"; import firebase from "firebase/app"; import * as api from "../../lib/api"; import...
821e5918505257d20b89f33e321e1f9485842fe6
TypeScript
shravanshetty5/RxJs_Test
/main.ts
3.34375
3
import { Observable, Observer } from 'rxjs'; let num = [1, 5, 10]; let source = Observable.create((observer) => { let index = 0; let produceValue = () => { observer.next(num[index++]); if(index < num.length) { setTimeout(produceValue, 2000); } else { observer.c...
e53b2e2acde843aa21996b6377c57387e2ae4493
TypeScript
ultorhash/project-react
/src/actions/SingleUsersActions.ts
2.625
3
import { Dispatch } from 'redux'; import * as actionTyps from '../actions/actionTypes/SingleUserTypes'; import { ISingleUser } from '../entities/SingleUser'; export const getSingleUsers = (): Promise<ISingleUser[]> => ((dispatch: Dispatch) => { return fetch('https://jsonplaceholder.typicode.com/users') .th...
79cf1aa9269990723bb9ed2b6e500ccd877c4ed6
TypeScript
Tmusvit/assistant-conversation-nodejs
/src/conversation/prompt/content/table.ts
2.859375
3
/** * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
379ae7ccaced306010f3a43b821eb322617848cf
TypeScript
gmahota/nodejs-eschool-api
/src/repository/eschool/academicYearRepository.ts
2.59375
3
import AcademicYear from "../../models/eschool/academicYear"; import { getRepository, getConnection } from "typeorm"; interface Key { id?: any; } const findById = async function findById(id: string): Promise<AcademicYear> { const Repository = getRepository(AcademicYear); const data: AcademicYear = await Reposi...
4c51bb59daa361c0298acdca9159f3e77c1017d7
TypeScript
leonardo-teles/typescript
/inferencia_de_tipos/inferencia_de_tipos.ts
3.8125
4
//Inferência de tipo é o TS determinar o tipo de uma variável, mesmo que você não defina esse tipo let quantidade = 20; // quantidade = "qualquer"; -> não compila! let x = [1, 2, null]; // array de 'number' // x[0] = true; => não compila! //Contextual Typing window.onmousedown = function(evento) { console.log(ev...
29f456e9e30636bbc7c2bae0cb3a802d0ddb3aba
TypeScript
influxdata/ui
/src/shared/components/dateRangePicker/utils.ts
2.515625
3
import {isISODate} from 'src/shared/utils/dateTimeUtils' import {isValidStrictly} from 'src/utils/datetime/validator' export const isValidDatepickerFormat = (d: string): boolean => { return ( isValidStrictly(d, 'YYYY-MM-DD HH:mm') || isValidStrictly(d, 'YYYY-MM-DD HH:mm:ss') || isValidStrictly(d, 'YYYY-...
f4478990cf73e34a45b75ce7e425c185bf1633eb
TypeScript
SonofSyn/Exercise_Algorithms
/Project_MaxSumSubArr/src/findMax.ts
3.203125
3
export let maxSubSum = (iArr: number[]): number[] => { let backSum: number = 0 let backArr: number[] = [] let tempSum: number = 0 let length: number = iArr.length iArr.map((e, eIx) => { tempSum = 0 for (let i = eIx; i < length; i++) { if (0 > tempSum + iArr[i]) break ...
8527a9ad638b58c3693ff5a062e25e4f6a84481b
TypeScript
EkStep-DevCon-2020/Paathshala
/src/app/client/src/app/modules/cbse-program/class/McqForm.ts
2.84375
3
import * as _ from 'lodash-es'; export class McqOptions { constructor(public body: string) { } } export interface McqData { question: string; options: Array<McqOptions>; answer?: string; learningOutcome?: string; bloomsLevel?: string; maxScore?: number; } export interface McqConfig { templateId?: str...
c285a67c3131ff025a3b1e8bd81892b6739d6e05
TypeScript
chbrown/streaming
/batcher.ts
3.21875
3
import {Transform} from 'stream'; /** Batcher transforms a stream of <T> into a stream of Array<T>, where each array has at most `size` elements (the last chunk may have fewer, but more than 0). */ export class Batcher<T> extends Transform { protected batchBuffer: any[] = []; constructor(protected batchSize: numbe...
1614ccfa7cae2a4fe39a460edcad9567dc5ff728
TypeScript
ThatTokenGirl-utilities/http
/src/middleware/__tests__/contentTypeMiddlewareFactory.spec.ts
2.671875
3
import { contentType } from ".."; import { addMiddleware, clone, HttpRequest } from "../../requests"; describe("middleware: contentType", () => { test("adds content type to header", async () => { const requester = jest.fn(); const request: HttpRequest = { url: "request-url", method: "POST" }; const reque...
e8f977dcd55b8fbf6dc60e066c2d7234a381ca2c
TypeScript
wongnai/version-pong
/src/update/watchPeerDependencies/utils/addPrefixVersionOfPeerDependency/index.test.ts
2.546875
3
import addPrefixVersionOfPeerDependency from '.' describe('addPrefixVersionOfPeerDependency', () => { it('should be return empty string', () => { expect(addPrefixVersionOfPeerDependency(null as any)).toBe('') }) it('should return version with prefix', () => { expect(addPrefixVersionOfPeerDependency('2.0...
07a4790fb37c09e0a967ab53521a1b48b1007d26
TypeScript
alex-black112/flagship
/libs/git/src/utils/extract-repo-id.util.ts
3.046875
3
const REPO_URL_REGEX = /(?:git@|ht{2}ps?:\/{2})(?:.*:.*@)?.*@?(?:w{3}.)?\w*\.\w*[/:](.*\/.*)/; /** * Matches any of the following extracting `someName/test` * * - git@github.com:someName/test.git * - http://github.com/someName/test.git * - http://www.github.com/someName/test.git * - http://someName:something@git...
8352154612243d5dd19bbcaf8a4ae7f367e055a0
TypeScript
nghiaqh/manga-db-lb
/src/models/chapter.model.ts
2.515625
3
import { Entity, model, property, hasMany, belongsTo, } from '@loopback/repository'; import { Image } from './image.model'; import { Manga } from './manga.model'; import { Volume } from './volume.model'; @model() export class Chapter extends Entity { @property({ type: 'number', id: true, genera...
a5da0e8cfc1e3b2f07dbc7e14bc63c4a05c8402e
TypeScript
cancerberoSgx/ts-refactor
/src/fix/format.ts
2.625
3
import { format } from 'ts-simple-ast-extra' import { code } from '../cli/inquire/ansiStyle' import { FIX } from '../fix' import { ToolOptionName } from '../toolOption' import { FormatSettingsFix } from './abstract/formatSettingsFix' export const formatFix = new FormatSettingsFix({ action(options) { const o = { ...
1523eb61fa4b6dfdcd682f9cf7a5e2b3d52880c4
TypeScript
weoking/modern.js
/packages/cli/webpack/src/utils/generateMetaTags.ts
2.765625
3
/** * Copyright JS Foundation and other contributors. * * This source code is licensed under the MIT license found in the * LICENSE file at * https://github.com/jantimon/html-webpack-plugin/blob/main/LICENSE * * Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90...
8fcb1e0380e2a4a14bcc5aef374247ffd0015c29
TypeScript
Altazi-Hussein/metaplex
/js/packages/graphql/src/common/models/auctions/entities/PriceFloor.ts
2.984375
3
import BN from 'bn.js'; import { JsonProperty, Serializable } from 'typescript-json-serializer'; import { PriceFloorType } from '../enums'; @Serializable() export class PriceFloor { @JsonProperty() type!: PriceFloorType; // It's an array of 32 u8s, when minimum, only first 8 are used (a u64), when blinded price...
9115783bcf2f275870e669c114da364b82739042
TypeScript
kylin0802/use-hooks
/src/hooks/usePreviousValue.ts
2.828125
3
import { useRef } from "react"; export function usePreviousValue(value: any) { const previousRef = useRef(undefined); // initialize it with undefined const previousValue = previousRef.current; previousRef.current = value; // remember the value for next render, see above statement. return previousValue; }
7f8dfaf2ca3ae9f25a113db93205d031eb554672
TypeScript
Opentrons/opentrons
/components/src/hooks/useToggle.ts
3.609375
4
import { useReducer } from 'react' export type UseToggleResult = [boolean, () => void] /** * React hook to toggle a boolean value * * @param {boolean} [intialValue=false] (initial toggle value) * @returns {[boolean, () => void]} (value and setValue tuple) * * @example * import * as React from 'react' * import...
164098f58723311a792bbae6f854a469d2166510
TypeScript
SwevenSoftware/BlockCOVID-web
/src/Api/accountAPI.ts
2.78125
3
import axios, { AxiosResponse, AxiosStatic } from "axios" export class accountAPI { private axios: AxiosStatic constructor(axios: AxiosStatic) { this.axios = axios } login(data: { username: string password: string }): Promise<AxiosResponse> { const config = { headers: { "Content-Type": "application/j...
12c9f9154ef8387fe77b7832bd210122c563b825
TypeScript
blank1u/ts-demo
/src/基础篇/demo2.ts
3.703125
4
//已有数组 let arr: number[] = [1, 2, 2]; let arr2 = new Array<number>(4); interface NumberArray { [index: number]: number; } let arr3: NumberArray = [1, 2, 2]; //类数组 function sum() { let args: IArguments = arguments; // args.callee(); } //元组 // let arrAny: any[] = [1, '测试']; let tuple1: [number, string, boolean]...
1113b4b6feb2d4f57821f87b88c07500b9ac6c0d
TypeScript
vv-vim/vv
/packages/electron/src/main/installCli.ts
2.75
3
import { dialog } from 'electron'; import { execSync } from 'child_process'; import which from 'src/main/lib/which'; const showInstallCliDialog = () => dialog.showMessageBoxSync({ message: 'Command line launcher', detail: `With command line launcher you can run VV from terminal: $ vv [filename] Do you wish...
6213e50d62f7bdf676caa139b8aa973cd950379b
TypeScript
sveingunnarlarsen/ReactChatWidgetTest
/lib/ChatbotClient/index.d.ts
2.640625
3
import * as protocol from './messages'; export declare enum ClientEvent { Connected = "connected", Disconnected = "disconnected", Reconnected = "reconnected", Errd = "errd" } export interface ConnectResult { success: boolean; error?: any; } export declare class ChatbotClient { pr...
ff867980748b97907e37f8abce765459f9fad2d8
TypeScript
coveo/search-ui
/src/misc/Assert.ts
3.015625
3
import { Logger } from '../misc/Logger'; import { Utils } from '../utils/Utils'; import * as _ from 'underscore'; export class Assert { private static logger = new Logger('Assert'); static failureHandler = (message?: string) => { Assert.logger.error('Assertion Failed!', message); if (window['console'] &&...
40db08cbae77dcb7ad08a870976e0de629226bf6
TypeScript
matbottini/dev-challenge
/src/use-cases/make-loan/make-loan.controller.ts
2.515625
3
import { Request, Response } from 'express' import { CommonError } from '../../services/errors/common-error' import { FormattedInstallment } from '../../services/utils/interface' import { IMakeLoanRequestDTO } from './make-loan.dto' import { MakeLoanUseCase } from './make-loan.use-case' export class MakeLoanController...
28285eb53533c2ec84e99c77a279026bae72488f
TypeScript
Senspark/ee-x
/src/ts/src/services/internal/LazyFullScreenAd.ts
2.578125
3
import { AdObserver, AdResult, IFullScreenAd, } from "../../ads"; import { ICapper } from "../../ads/internal"; import { ObserverHandle, ObserverManager, Utils, } from "../../core"; export class LazyFullScreenAd extends ObserverManager<AdObserver> implements IFullScreenAd { private _ad?: IF...
e5ededec84a1e3594b23eafabda995db05f134de
TypeScript
tbhuabi/article-server
/src/routes/api/article.ts
2.515625
3
import { Request, Response } from 'express'; import { DBArticle } from '../../data-base/index'; import { responseHeaders } from '../utils/response-headers'; import { getBody } from '../utils/request-body'; import { compile } from '../../article-creator/write-article'; const dbArticle = new DBArticle(); // 发布文章 expor...
0d64587900a2c9f7aa60fff756076bebc3ba8b68
TypeScript
NguyenVuNhan/react-basic-blog-webapp
/src/hooks/useObservable.ts
2.953125
3
import { useEffect, useState } from "react"; import { Observable } from "rxjs"; import { map } from "rxjs/operators"; const useObservable = <T1, T2 = undefined>( o: Observable<T1>, selector: (val: T1) => T2 extends undefined ? T1 : T2 ): (T2 extends undefined ? T1 : T2) | undefined => { const [value, setValue] =...
d1ca7a18ad5d9b2553c9761f054b8b18b57e5ad9
TypeScript
czizzy/engine
/packages/rhi-webgl/src/GLTextureCubeMap.ts
2.625
3
import { IPlatformTextureCubeMap, Logger, TextureCubeFace, TextureCubeMap, TextureFormat } from "@oasis-engine/core"; import { GLTexture } from "./GLTexture"; import { WebGLRenderer } from "./WebGLRenderer"; /** * Cube texture in WebGL platform. */ export class GLTextureCubeMap extends GLTexture implements IPlatform...
ef5315de27be7d52db27f8b50cdc31ec20db6e0f
TypeScript
Ekskursantas/RamasjangRosa
/src/loudmotion/events/CoreEventDispatcher.ts
2.671875
3
import {GenericDataEvent} from "src/loudmotion/events/GenericDataEvent"; import {Logger} from "src/loudmotion/utils/debug/Logger"; export class CoreEventDispatcher { private static _instance:CoreEventDispatcher; private _activeEventMap:any; private timer:number; private _activeFuncList:Function[]; constructor()...
a3bb38349ae6b2e361fe8d06d71ce1d92d7ac686
TypeScript
muhsina-abdulla/Gotham-Cares-Wireframe-and-Website
/GothamWebsite/src/app/editform/editform.component.ts
2.953125
3
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; import { Outlet } from '../outlet.model'; import { OutletlistService } from '../outletlist.service'; /** * This component is the form for editing an existing outlet. * ...
1b5383251b50a9e22b8482be32e2716f5ee5b3f5
TypeScript
badforlabor/hackts
/patch.ts
3
3
import * as ts from "typescript"; class PatchInfo { head: boolean // 是否是开头 pos: number // 需要插入内容的位置 cnt: number constructor(head, pos, cnt) { this.head = head this.pos = pos; this.cnt = cnt } } function dopatch(info: PatchInfo): string { let ret =...
6a2aec4fd6d736121b480fed9c1e032102774672
TypeScript
CondensateCrew/condensate-desktop-app
/src/renderer/redux/reducers/currentBrainstorm/currentBrainstorm.ts
2.703125
3
import { ActionObject, Brainstorm } from '@/interfaces' type state = Brainstorm | { }; const currentBrainstorm = (state: state = { }, action: ActionObject) => { switch (action.type) { case 'ADD_CURRENT_BRAINSTORM': return action.currentBrainstorm case 'REMOVE_CURRENT_BRAINSTORM': return {} c...
eb0426d6fd14827ba8dcf800f063b21d5842bab6
TypeScript
usackoka/OLC2_PY2_REACT
/src/compilador/AST/Expresiones/Arreglo.ts
2.875
3
import { Entorno } from "../Entorno"; import { Expresion } from "../Expresion"; import { TipoArreglo } from "./TipoArreglo"; export class Arreglo extends Expresion{ limite:Expresion; valores:Array<Expresion>; public constructor(TIPO:Object,limite:Expresion,valores:Array<Expresion>,fila:number,columna:num...
10e7f4bc41f1448f58bb55b8697d3116dbded315
TypeScript
future4code/Noh-Ah-Jeong
/semana18/cookenu/src/endpoints/login.ts
2.609375
3
import { Request, Response } from "express" import { selectUserByEmail } from "../datas/selectUserByEmail" import { generateToken } from "../services/authenticator" import { compareHash } from "../services/hashManager" export const login = async (req: Request, res: Response) => { try { if (!req.body.email ...
bada052c682e206b2a91ce6bbe6a2859b841d50a
TypeScript
xandone/wxgame-egret
/plane-shooter/src/game/Bullet.ts
2.796875
3
class Bullet extends egret.Bitmap { private tName: string; private static cacheDict: Object = {}; public constructor(texture: egret.Texture, tName: string) { super(texture); this.texture = texture; this.tName = tName; } public static produce(tName: string) { if (Bu...
266ae284f4215cc63470d8dc3f49a745096e72eb
TypeScript
DivXPro/toybox
/src/utils/index.ts
3.203125
3
import moment from 'moment'; type DateValue = moment.Moment | moment.Moment[] | string | string[] | number | number[] | Date; export const isNil = (value: any) => value === null || value === undefined; export const parseValueToMoment = ( value?: DateValue, formatter?: string, ): moment.Moment | moment.Moment[] ...
962e3ce8d47eece36bcf3dc2a98d779f4d73eb87
TypeScript
xhudec/react-query-demo
/src/pages/countries/CountryList/hooks/useDetailDialog.ts
2.890625
3
import { useReducer } from 'react' export interface IDetailDialogState { isOpen: boolean countryCode: string | null } export type TDetailDialogAction = | { type: 'OPEN_DIALOG'; payload: { countryCode: string } } | { type: 'CLOSE_DIALOG' } const initialDetailDialogState: IDetailDialogState = { isOpen: false...
7bf969840149e6f7b7bca17bed630f905ace012d
TypeScript
rheehot/tgrid
/src/protocols/workers/WorkerServer.ts
2.546875
3
//================================================================ /** @module tgrid.protocols.workers */ //================================================================ import { Communicator } from "../../components/Communicator"; import { IServer } from "../internal/IServer"; import { IWorkerSystem } from "./inte...
ff45a60691b1f9daa544ae3b2911f917f10a5ea7
TypeScript
JaredDicaprio/BuyMeNear
/contract/assembly/index.ts
2.875
3
/* * AssemblyScript smart contract for Donations * * Learn more about writing NEAR smart contracts with AssemblyScript: * https://docs.near.org/docs/develop/contracts/as/intro * */ import { Context, logging, u128, ContractPromiseBatch } from "near-sdk-as"; import { Donation } from "./models/donation"; import { U...
9e88fd69563670f7ab060b89ab12fa00a16b11cf
TypeScript
PhilCuster/queller-bot-wotr
/ui/src/app/view/game-flow/phase-two/phase-two.component.ts
2.53125
3
import { Component, OnInit, Input } from "@angular/core"; import { FormGroup, FormControl, Validators } from "@angular/forms"; import { Strategy } from "src/app/model/enum/strategies"; import { StrategyService } from 'src/app/service/strategy.service'; import { PhaseService } from 'src/app/service/phase.service'; @Com...
b4c7fe9367149317e2078e26dec22c44bdd2e3d4
TypeScript
AutumnFish/nestjs_study
/src/module/posts/providers/demo/demo.service.ts
2.984375
3
import { Injectable } from '@nestjs/common'; import { Post } from 'src/module/posts/interface/post.interface'; // 添加了这个装饰器 才是服务 @Injectable() export class DemoService { // 只读属性 post // 类型是 Post数组 初始值是一个 空数组 private readonly posts:Post[]=[] // 获取post数据的方法 // :Post 是返回的数据类型 findAll():Post[]{ ...
e4cd026b3c12a45173718f2ccf29516769025b57
TypeScript
enricleon/island-map-generator
/src/constants/colors.ts
2.53125
3
import { ColorType } from '../enums/color-type'; var terrain = new RGBColor(); terrain.red = 249; terrain.green = 227; terrain.blue = 154; var water = new RGBColor(); water.red = 59; water.green = 138; water.blue = 168; const TERRAIN_COLORS = {}; TERRAIN_COLORS[ColorType.Terrain] = terrain; TERRAIN_COLORS[ColorType...
04c5e3c0da40f71c3f45b808c43af8ae35fb4eb7
TypeScript
decahedronio/entity
/src/EntityBuilder.ts
3.4375
3
import { Entity, PartialPropsJson } from './Entity'; import { Buildable, Constructor } from './support/Type'; import { TypeMetadata } from './support/metadata/TypeMetadata'; import { defaultMetadataStorage } from './support/storage'; import { isEntityType } from './support/isEntityType'; import { StringHelper } from '....
9ccf904c5f3b0adf24229f07c115f4c4e0509cb8
TypeScript
masaeedu/minio-js
/src/main/bucket-policy.ts
2.78125
3
/* * Minio Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENS...
575e203e58840ac2ab99040b9135fcaf3258b260
TypeScript
ddc-fullstack/archive-ddc-express-twitter
/apis/src/lib/getProfileByProfileEmail.ts
2.59375
3
import { connect } from '../database'; import {Profile} from "../interfaces/Profile"; export async function getProfileByProfileEmail (profileEmail: string) : Promise<Profile|undefined> { const mysqlConnection = await connect(); const [rows] = await mysqlConnection.execute('SELECT BIN_TO_UUID(profileId) as pr...
ef167a0ff4b119016fe8239bd44c71e4f3559b58
TypeScript
RobinKa/ga-bot
/src/evaluator.ts
2.953125
3
import { Additive, ASTKinds, Constant, Expression, FunctionCall, InnerOuter, Multiplicative, parse, Power, Primary, Unary } from "./__generated__/ga" export function makeEvaluator(algebra: any): (expr: string) => any { const unaryOperations: Record<string, any> = { "~": algebra.Reverse, "!": a...
952155e03986580afaaf9a824b1fe658d1c3cef2
TypeScript
drake7707/dwarvenanno
/src/simulation/core/entity/TileEntity.ts
2.765625
3
import { Area } from "../Area"; import { IMetadata } from "../metadata/IMetadata"; import { Position } from "../Position"; import { World } from "../World"; import { TileEntityDefinition } from "./TileEntityDefinition"; export class TileEntity { protected position: Position; private readonly _definit...
fbd1a9096c618cad1f62dd403900f76c86106921
TypeScript
cancerberoSgx/accursed
/spec/assets/project1/src/other/string_test2.ts
2.84375
3
const chalk = null as any const _ = null as any const a = 'a' + 2 + 'b' + 'c' + `${Math.PI}` const b = `${a} b c ${Math.PI} g ${function() { return 1 }.toString()}` /** * Adapted from inquirer sources. The paginator keeps track of a pointer index in a list and returns* a subset of the choices if the list is too l...
102ba6d81ad2804075375c215b72ce5947e82cf2
TypeScript
dested/pipsga.me
/client/src/game/common/hexBoard.ts
2.75
3
import {GridHexagonConstants} from './hexLibraries/gridHexagonConstants'; import {GridHexagon} from './gridHexagon'; import {HexUtils, Node} from './hexLibraries/hexUtils'; export class HexBoard { hexList: GridHexagon[] = []; hexBlock: {[key: number]: GridHexagon} = {}; boardSize = {width: 0, height: 0}; game...
2855427fd4870aee89891012dff91bdd828cb464
TypeScript
ckull/airbnb-apollo
/packages/server/src/modules/User/resolvers.ts
2.546875
3
import { User } from '../../entity/User' import { UserArgs } from './interface' const resolvers = { Query: { users: async (parent: any, args: UserArgs) => { return await User.find() }, user: async (parent: any, args: UserArgs) => { return } }, Mutation: { addUser: async (paren...
0476186f7d3e32ac15965e39ed528e2e07edf07b
TypeScript
eudpna/kiritan-solfege
/game/object/kiritan/blink.ts
2.59375
3
import { getRandomInt } from "../../../lib/math"; import { GameCtx } from "../../GameCtx"; export function blink(gctx: GameCtx) { // if (gctx.state.playingKiritanVoices.length !== 0) return gctx.state.eye = 'close' setTimeout(() => { gctx.fire(gctx => { gctx.state.eye = 'open' ...
0aa784b536c88a6c30f93087af018a7175500958
TypeScript
JSH1995/HAGO2
/src/class/pixi/init/PIXIBaseAsset.ts
2.890625
3
/** * 기본 텍스쳐 로드 되기 전에 객체를 생성 할 수 있도록 json은 함께 번들링함. */ class PIXIBaseAssetSprite extends PIXI.Sprite { constructor(t?:any) { super(t); } } // var atlasJson = require("./../../../entry_texture/base_asset.json"); var atlasJson:any; export class PIXIBaseAsset { private _sheet:PIXI.Spritesheet; ...
6856c0f410cf23a38e987d05529a1bfa17a98fb7
TypeScript
stinglmo/EIA2_SoSe21
/Inheritance/Meadow Test/superclassFlower.ts
2.875
3
namespace TestM { // Vererbt alles an die Subklassen: poppy, sunflower und tulip export class SuperclassFlower { x: number; y: number; constructor(_x: number, _y: number) { this.x = _x; this.y = _y; } //Methode draw // draw(): void { ...
36e9eada3b41ead053add065bd7c26f5a4cfceaa
TypeScript
assirati/pxt-inventura
/main.ts
2.890625
3
//% color="#22AA8D" icon="\uf02d" namespace inventura { /** * Calculates heat index (in °C) based on temperature (in °C) and air humidity. * @param tempC temperature (in °C), eg: 0 * @param relHum air humidity (in %), eg: 0 */ //% block="heat index (°C) Temp. = $tempC Humid. = $relHum" //% ...
8659839387eab470e51c756b4c359b6a5862d9a2
TypeScript
RaulCote/testing-react-query-blueprint-ui
/src/utils/shared/useIntersectionObserver.ts
2.671875
3
import { RefObject, useEffect } from "react"; const intersectionOptions = { root: null, rootMargin: "5px", threshold: 0.1 }; export default function useIntersectionObserver( ref: RefObject<HTMLElement>, callback: ( entry: IntersectionObserverEntry, observer: IntersectionObserver ) => void, shouldStop:...
04e0d22ec43cd4bd20c6732a1f8cc8995e18edaa
TypeScript
DreamHacks/sc2a-web
/src/libs/format.ts
2.5625
3
declare function require(path: string) : any; const fecha = require('fecha') export function date(date: string | Date, format: string = 'YYYY-MM-DD hh:mm A'): string { if (date instanceof Date) { return fecha.format(date, format) } else { return fecha.format(new Date(date), format) } }
2deea5e966bb27611dd4d8c0d614b0de0c8c8380
TypeScript
5310H/alarmo
/custom_components/alarmo/frontend/localize/localize.ts
2.59375
3
import * as ca from './languages/ca.json'; import * as cs from './languages/cs.json'; import * as en from './languages/en.json'; import * as es from './languages/es.json'; import * as et from './languages/et.json'; import * as fr from './languages/fr.json'; import * as it from './languages/it.json'; import * as ...
98ec7c462faef933dc36db500bdc1cb9f39cb450
TypeScript
superman2211/space-arena
/src/game/layers/ships.ts
2.71875
3
import { Point } from '../../geom/point'; import { Component } from '../../graphics/component'; import { randomInt, randomFloat, math2PI, mathPI2, mathAtan2, mathAbs, deltaAngle, } from '../../utils/math'; import { Layer } from './layer'; import { enemy } from '../units/enemy'; import { player } from '../units/player'...
4f012bf127b2ba6166ea1b34049c3021ce8b1cca
TypeScript
jhoijune/algorithm
/src/Programmers/searchLyrics.ts
3.515625
4
import {} from 'module'; declare global { interface String { reverse(): string; } } String.prototype.reverse = function (this: string) { return this.split('').reverse().join(''); }; class TrieNode { char: string; count: number = 1; children: Map<string, TrieNode> = new Map(); constructor(char: s...
fcad8e361c507193857a4bfe9567fea0ce96e38f
TypeScript
lindapaiste/layout-animated
/src/useAnimatedTranslate.ts
3.078125
3
import {Animated} from "react-native"; import {useEffect, useRef} from "react"; import {TimerSettings} from "./types"; /** * takes props translateX and translateY which change suddenly to new values * and returns animated values translateX and translateY for a smooth transition * according to the optional timer set...
f9ae321f291fa9d1723938df0351c873af3c4016
TypeScript
DNCarroll/Weapons
/ULFBERHT/Prototypes/Window.ts
2.5625
3
interface Window { SplitPathName(): Array<string>; PageLoaded(postLoadFuntion, e?); PushState(stateobj, title, url); Dimensions(): { Height: number; Width: number; }; Show(viewKey, parameters?: Array<any>); Exception(...parameters: any[]); } Window.prototype.Exception = function (...parameters: ...
d80591f514c1b07b2c675c9a0c53fcabb1523f34
TypeScript
AryanshMahato/todo-nest-prisma
/src/app.controller.ts
2.546875
3
import { Body, Controller, Get, NotFoundException, Param, Patch, Post, } from '@nestjs/common'; import { AppService } from './app.service'; import { Todo, User } from '@prisma/client'; import { CreateTodo } from './Validation/todo'; @Controller() export class AppController { constructor(private readonl...
222cd09c1171dcb801f242927dcab1ae57d595f0
TypeScript
ringcentral/ringcentral-js-widgets
/packages/ringcentral-widgets/components/CallingSettingsPanel/i18n/it-IT.ts
2.515625
3
import { callingOptions } from '@ringcentral-integration/commons/modules/CallingSettings'; export default { title: "Chiamata", [callingOptions.softphone]: "{brand} for Desktop", [callingOptions.browser]: "Browser", [callingOptions.jupiter]: "{brand}", makeCallsWith: "Effettua chiamate con", ringoutHint: "Ch...
221f4e6c9ac115c85cfc90e0043dbbf75e3651a1
TypeScript
Yuni-Q/mini-notion
/backend/passport/index.ts
2.59375
3
import passport from "passport"; import { OAuth2Strategy } from "passport-google-oauth"; passport.serializeUser(function (user, done: any) { done(null, user); }); passport.deserializeUser(function (obj, done: any) { done(null, obj); }); passport.use( new OAuth2Strategy( { clientID: process.env.GOOGLE...
2563a02b6f907c63740130ad326deba696730b34
TypeScript
implydata/immutable-class
/packages/eslint-plugin-immutable-class/src/rules/readonly-implicit-fields.ts
2.578125
3
/* * Copyright 2022 Imply Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
a0ffeeabb4ec53538d63522d755e7c99ca7567da
TypeScript
oim5nu/clean-architecture-express-ts
/src/core/book/use-cases/add-book.ts
2.53125
3
import { IBookEntity, IAddBookParams } from '../book'; import { IBooksDB } from '../data-access/books-db'; // TODO: // export interface AddBook { // add(book: IAddBookParams): Promise<IBookEntity>; // }; export type IAddBook = (body: IAddBookParams) => Promise<any>; // export const buildAddBook = ({ booksDB } : { b...
9fc06f889a3526f985ed6acfca4868c03503f64b
TypeScript
silverbeen/Study-TypeScript
/next-todo/pages/api/todos/index.ts
2.96875
3
import { NextApiRequest, NextApiResponse } from "next"; import { resolve } from "path/posix"; import { TodoType } from "../../../types/todo"; import File from "../data/todos.json"; // api/todos 경로로 api 여청이 되면 "hello next" export default async (req: NextApiRequest, res: NextApiResponse) => { // 파일 읽기 fs 요청 꼭 해줘야함!! ...
b10b664b25867a0272b2b2c7e3219fcd6bb2b703
TypeScript
robvenn/sennen-backend-coding-test
/src/utils/validators.ts
3.640625
4
import R from 'ramda'; /* * returns true if value is a number, or otherwise false */ export const isNumber = R.is(Number); /* * Validates if a value is a number */ export const validateNumber = (value: unknown): void => { if (!isNumber(value)) { throw new TypeError(`Value ${value} must be a number, g...
6c3ed8f65b6e9654019c6080ec0f75cb3a30d0a8
TypeScript
bisu8018/p2p_exchange_front_end
/src/vuex/controller/CustomTokenController.ts
2.96875
3
import {VuexTypes} from "@/vuex/config/VuexTypes"; import {Store} from "vuex"; import CustomToken from "@/vuex/model/CustomToken"; export default class CustomTokenController { store: Store<any>; constructor (vuexStore: Store<any>) { this.store = vuexStore } setMyToken(tokenInfo: CustomToken)...
bafea6caaf83102af89dec0dde97119f302a8ac0
TypeScript
1910javareact/Demos
/1Week/garden-book/src/repositories/garden-dao.ts
2.875
3
import { Garden } from '../models/garden'; import { PoolClient } from 'pg'; import { connectionPool } from '.'; import { multiGardenDTOConvertor, gardenDTOtoGarden } from '../util/Gardendto-to-garden'; //the purpose of this file is to contain functions for interacting with the database //we don't have one yet, but whe...
2edd5a088747d82ba3bc950273e370219fe6b873
TypeScript
hazeee123/Calc-Components-Final
/src/app/result/result.component.ts
2.75
3
import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'app-result', templateUrl: './result.component.html', styleUrls: ['./result.component.css'] }) export class ResultComponent implements OnInit { constructor() { } ngOnInit(): void { } result = 0; @Input() finalRes !: stri...
7acdc274f96e0fe3d2d18c97ed8faa16720eb139
TypeScript
ruen89/react-native-spatial-navigation
/src/helpers.ts
3
3
/* Dependencies ================================================================== */ import type { NextFocusElements, PrioritizedSpatialDirection, SpatialDirection2, SpatialLayoutObject, SpatialObject, UpdateLayoutProps, } from './types'; /* Return an object with the x0,x1,y0 & y1 coordinates and dimensi...
6ae52218e0b3b75de44ebe2f84fc9d7debec0590
TypeScript
humppa123/resilience-typescript
/src/app/resilience/baselineProxy.ts
3.046875
3
import { TimeSpansInMilliSeconds } from '../utils/timespans'; import { Logger } from '../contracts/logger'; import { Guard } from '../utils/guard'; import { ResilienceProxy } from '../contracts/resilienceProxy'; import { Guid } from 'guid-typescript'; import { timer } from '../utils/timer'; import { logFormatter } from...
e0aa615f5b085bd8c7bfeb906e7eacacbf1789d2
TypeScript
Ram4GB/WebBanHangPhanLop
/src/modules/combo/reducers.ts
2.515625
3
import { createReducer, createAction } from "@reduxjs/toolkit"; import { ICombo } from "../../common/interface"; import { MODULE_NAME } from "./models"; export interface IComboState { comboList: Array<ICombo>; } const initialValue: IComboState = { comboList: [], }; export const getListComboAction = createAction<...
03b3c4ae9239b969f3b9d31206ecb44381cf64b1
TypeScript
XTStudio/ts-debugger
/examples/index.ts
2.65625
3
/// <reference path="../node_modules/xt-studio/types/index.d.ts" /> function a() { let x = 1 while (true) { return 999 } console.log(x, "1231231") } a() console.log(888)
4488f23a8e3abbf7742bdb591e49054085085a75
TypeScript
Mrostcik/WWW
/memy/logging.ts
2.625
3
import * as sqlite from 'sqlite3'; import sha256 from 'crypto-js/sha256' function hashPassword(password: string){ return sha256(password); } function addUser(db: sqlite.Database, login: string, password: string){ const passwordHashed = hashPassword(password).toString(); return new Promise((resolve, reject...
30362e6c38c0c25ec3dd172bca2f16d69cdeb25d
TypeScript
DmitriyPredelin/chat_and_play
/src/store/sea-battle-reducers/sea-battle-helper.ts
2.8125
3
import { CellType, ICell } from "common/interface"; import { MATRIX_SIZE } from "./sea-battle-reducer"; export function defaultMatrix(size: any, defaultValue = 0) { return Array(size) .fill(0) .map(() => { return Array(size).fill(defaultValue); }); } export function getSearchCell(newMatrix: ICell[...
ec268f2004ee6a5716cf8218be95b61cb9543939
TypeScript
xeho91/colors
/source/cli/commands/build/json.ts
2.640625
3
import { buildJSONfile } from "../../helpers/json.ts"; import { success } from "../../utils/log.ts"; import { Command, Input } from "../../deps.ts"; import type { BuildOptions } from "../../types.ts"; const json = new Command() .description("Build JSON data file with colors config.") .action(async ({ output }: Buil...
206bc0b3d7949026a623bc2e5cecf7be426f2c06
TypeScript
OliverBenz/AccountBook_Frontend
/src/app/services/account.service.ts
2.671875
3
import { LinkService } from './link.service'; import { Account } from '../classes/account/account'; import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { HttpHeaders } from '@angular/common/http'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; const httpOpti...
20d7a2e710475442422b25ccf887de32b57f9faa
TypeScript
Jonathan-ulises/Introduccion_TS
/src/ejercicios/01_tipos_basicos.ts
3.125
3
/* ===== Código de TypeScript ===== */ let nombre: string = 'Strider' //El pipe especifica que puede ser de dos tipos (number o String) let hp: number | string = 95; let estaVivo: boolean = false; hp = 'FULL' console.log(nombre, hp)
beaf90c51acb3be8451953f7e9bbd673046412e5
TypeScript
lineCode/tailwind-mobile
/src/types/Toast.d.ts
2.796875
3
interface Props { /** * Component's HTML Element * * @default 'div' */ component?: string; /** * Object with Tailwind CSS colors classes * */ colors?: { /** * Toast bg in iOS theme * * @default 'bg-toast-ios' */ bgIos?: string; /** * Toast bg in Material th...
2dade8069328f069e27aa8580aacaaece1bbe59c
TypeScript
yisraelx/authllizer
/packages/@authllizer/core/src/storages/cookie.ts
2.859375
3
import { IToken } from '../tokens/token'; import isFunction from '../utils/is-function'; import { IMemoryStorageOptions, MemoryStorage } from './memory'; import { IStorage } from './storage'; export interface ICookieStorageOptions extends IMemoryStorageOptions { expire: () => (Date | number) | Date | number; p...
93cbb6f264eb3d9f2ea31c925ffb6cf5a0dbd21b
TypeScript
rakeshsontakke/srca-ui
/src/app/tasks/factory/task-component.factory.ts
2.546875
3
import { ComponentFactoryResolver, ViewContainerRef, Type, Injectable } from '@angular/core'; import { Task } from '../model/Task'; import { TASK_COMPONENT_MAP } from '../constants/tasks.constants'; @Injectable({ providedIn: 'root' }) export class TaskComponentFactory { taskComponentMap = TASK_COMPONENT_MAP; ...