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
518bb3748f7108b62322be86f0a88817e703858c
TypeScript
JaredBrown138/CROS
/src/app/components/messages/messages.component.ts
2.59375
3
import { Component, OnInit } from '@angular/core'; import { APIService } from '../../services/api.service'; import { MatSnackBar } from '@angular/material'; import * as moment from 'moment'; @Component({ selector: 'app-messages', templateUrl: './messages.component.html', styleUrls: ['./messages.component.css'] }...
78f5d674bb6125c6e04fb026bed740970a687df4
TypeScript
n8rzz/othello
/src/public/script/gameBoard/GameBoardController.ts
2.859375
3
import { positionToIdTranslator } from '../translator/stageCellTranslators'; import { VECTOR_FROM_POSITION } from '../constants/gameBoardConstants'; import { PLAYER } from '../constants/playerConstants'; class GameBoardController { public gameBoard: number[][] = []; public capturedPieces: number[][] = []; ...
b6ae93be9234eaf15b2790efab95dda16d3ef7f6
TypeScript
raghav-kukreti/myBlog
/old/lib/routes/crm_routes.ts
2.515625
3
import {Request, Response} from "express"; import {ContactController} from "../controllers/crm_controller"; export class Routes { public contactController : ContactController = new ContactController(); public routes(app): void { app.route('/').get((req: Request, res: Response) => res.json({...
181d5aaeda42ba160f76c1974aa3f5e06f9a6ca5
TypeScript
Reggino/adventofcode
/src/2020/06/index.ts
2.796875
3
import { readFileSync } from "fs"; import { join } from "path"; const groupsLines = readFileSync(join(__dirname, "./input.txt"), { encoding: "utf-8" }) .trim() .split("\n\n"); console.log( groupsLines .map(groupLines => groupLines .trim() .split("\n") .reduce<{ [answer: strin...
6228cf7fe52aad27d1ca73bebf62041ce8f31778
TypeScript
teves-castro/ddd-ts
/classes.ts
3.390625
3
import { Either, right, left } from "fp-ts/lib/Either" import { match, match2 } from "./functions" // --------- Implementation ---------- // export abstract class Tagged { protected readonly tag = "Tagged" } export class UnvalidatedWidgetCode extends Tagged { public readonly kind = "UnvalidatedWidgetCode" priv...
1bbd02ad3760bab4cb44a3bf44737477fdd30a07
TypeScript
DefinitelyTyped/DefinitelyTyped
/types/jsforce/api/chatter.d.ts
2.625
3
import { Connection, Callback } from '../connection'; import { Query } from '../query'; import { Stream } from 'stream'; interface BatchRequestParams extends RequestParams { method: string; url: string; richInput?: string | undefined; } interface BatchRequestResult { statusCode: string; result: Re...
916f93274cd8f32e8abe6b01b51b1be17f5820b9
TypeScript
reichert621/transcribe
/server/db/models/recording.ts
2.65625
3
import { first, last } from 'lodash'; import knex from '../knex'; import M from './types'; type RecordingParams = { id?: number; name?: string; timestamp?: any; transcription?: any; userId?: number; status?: 'IN_PROGRESS' | 'COMPLETED' | 'FAILED'; paid?: boolean; }; const Recording = () => knex('recordi...
f5b8183a69e5283b36d72012538bce150c5be718
TypeScript
goldylucks/payment-gateway
/src/services/declined-charges/declined-charges.ts
2.984375
3
export interface Declined { [merchant: string]: { reason: string; count: number }[] } export interface AddDeclinedArgs { merchant: string reason: string } export default function makeDeclinedCharges() { return (function declinedCharges() { const declined = {} as Declined return { add, getB...
9069ab317eea51aa5b3210927103d4bdeb93c091
TypeScript
vrtnev/hometask7
/src/app/app.component.ts
2.734375
3
import { Component } from '@angular/core'; import { FormGroup, FormControl, Validators, FormArray } from "@angular/forms"; interface MyUser { name?: string; surname?: string; emails?: string[]; } @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) ...
e49944b68562ceec4cff352cef03e2de5764eb52
TypeScript
AYaki-coder/node-js-RS2021Q2
/src/resources/users/user.router.ts
2.53125
3
import { Router } from 'express'; import User from '../../entities/user'; import * as usersService from './user.service'; const router = Router(); router.route('/').get(async (_, res, next) => { try { const users = await usersService.getAll(); // map user fields to exclude secret fields like "password" ...
a34c5b8574b6d6d87c460c041a742bc6e43ed164
TypeScript
nivinjoseph/n-ject
/src/child-scope.ts
2.6875
3
import { BaseScope } from "./base-scope"; import { given } from "@nivinjoseph/n-defensive"; import { ScopeType } from "./scope-type"; import { ComponentRegistry } from "./component-registry"; import { Scope } from "./scope"; import { ObjectDisposedException } from "@nivinjoseph/n-exception"; // internal export class C...
876306dc2eb0ad57a2c00b06abc26e8c3b948676
TypeScript
hellocustomer/HC.WebsiteSDK
/src/lib/core/utils/flatten-object.util.ts
3.390625
3
/** * @ignore */ export function flattenObject<T>( inputObject: T ): Record<string, string | number | boolean> { if (!inputObject || typeof inputObject !== 'object') return {}; return Object.entries(inputObject).reduce((result, current) => { const [key, value] = current; let partialResult: Record<string...
3c07be89fd8f5f0966f3cee565418ffd1ea0bf15
TypeScript
donedgardo/tic-tac-toe
/packages/game-state/src/AiPlayer.ts
2.828125
3
import { Player } from './Player'; import { Board } from './Board'; import { PlayerMark } from './PlayerMark'; import {corners, get_random, oppositeCornerMap, weakPoints} from "./winningPlaysByPositionMap"; export class AiPlayer extends Player { constructor(mark: PlayerMark) { super(mark); } getPlayIndex(bo...
33806553f5c4eed6a79321aea71196fe59c941f2
TypeScript
MannimMond86/gaen-mobile-develop
/src/gaen/dataConverter.spec.ts
2.921875
3
import dayjs from "dayjs" import { DateTimeUtils } from "../utils" import { ExposureDatum } from "../exposure" import { toExposureInfo, RawExposure } from "./dataConverters" describe("toExposureInfo", () => { describe("when there are no exposure notifications", () => { it("returns an empty ExposureInfo", () => ...
dc715a646093d0a629bf31125d474d216ad48f0a
TypeScript
minus9d/programming_contest_archive
/abc/105/b/b.ts
2.921875
3
declare var require: (x: string) => any; function Main(input: string[]) { const N = parseInt(input[0]); let flag: boolean = false; for (var a = 0; a <= N / 4; a++) { if ((N - a * 4) % 7 == 0) { flag = true; } } if(flag) { console.log('Yes') } else { console.log('No') } } Main(req...
ddf022a2b43cf9fc1449a8f6dcaa2e9234123438
TypeScript
original001/magicgame
/src/phisics.ts
2.59375
3
import {Creature} from './index' import { onGround } from './collide'; import {Box, Vector} from 'sat' const G = 9.8; export const moveCreature = ( creature: Creature, timeDelta, { x: speedX, y: speedY }, terrains ): Creature => { const { speed, box } = creature; const { x, y } = box.pos; const isOnGrou...
4c60e21feb883c2f4fa6bbd6e11408cdc77192f8
TypeScript
AkshatKumar-is-built-different/Car-Game
/main.ts
2.84375
3
input.onButtonPressed(Button.A, function () { bird.change(LedSpriteProperty.Y, -1) }) input.onButtonPressed(Button.B, function () { bird.change(LedSpriteProperty.Y, 1) }) input.onLogoEvent(TouchButtonEvent.Pressed, function () { speed += -500 music.playTone(131, music.beat(BeatFraction.Quarter)) mus...
845b1cbf030ddf3aa4fc9826b98c55874a8b3d35
TypeScript
dejavvu/tsd
/test/assert/tsd/DefBlob.ts
2.5625
3
/// <reference path="../../tsdHelper.ts" /> module helper { 'use strict'; var assert:Chai.Assert = require('chai').assert; export function serialiseDefBlob(blob:tsd.DefBlob, recursive:number = 0):any { xm.assertVar(blob, tsd.DefBlob, 'blob'); recursive -= 1; var json:any = {}; json.sha = blob.sha; if (...
e2dad39eee8dc1b393af285958e37cca963302c9
TypeScript
rhfoods/rehuo
/src/map/modules/point/modules/sort/dtos/point.sort.dto.ts
2.53125
3
import { ApiProperty } from '@nestjs/swagger'; import { BaseDTO } from '@rehuo/common/dtos/base.response.dto'; import { PageResponseDTO } from '@rehuo/common/dtos/page.response.dto'; import { Exclude, Expose, Type } from 'class-transformer'; import { ValidateNested } from 'class-validator'; /** * 点位分类信息 */ @Exclude(...
450b4084f8655f3d0c53798093ab57db339f62e4
TypeScript
AlCalzone/node-dtls-client
/src/lib/AEADCrypto.ts
3.078125
3
import * as crypto from "crypto"; import * as semver from "semver"; /** * Starting with NodeJS 10, we can use the official crypto API to do AEAD encryption * because authTagLength is now configurable. This module is a wrapper around either * node-aead-crypto or the native methods */ export interface EncryptionResu...
f7a67ae7050a3c2e593af74483979c26f78d7e4b
TypeScript
chengdonghaipu/supine
/projects/dy-form/src/lib/type.ts
2.515625
3
export type ModelPartial<T> = { [P in keyof T]?: T[P]; }; export type BreakpointType = 'xm' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
7b486103b731f6acd75242393e0e3055e7787390
TypeScript
Friends-of-Groot-Society/groot-material
/src/app/services/auth/auth-store.service.ts
2.578125
3
import { Injectable } from "@angular/core"; import { throwError, BehaviorSubject, Observable } from "rxjs"; import { User } from '../../models/User'; import { Router } from '@angular/router'; import { map, shareReplay, catchError, tap } from 'rxjs/operators' import { HttpClient, HttpErrorResponse } from "@angular/commo...
78a3e09154282104e0da381222b941b9bafb05aa
TypeScript
leonkj/vet-clinic-demo
/client/src/entity/doctor/model.ts
2.5625
3
import { iDoctor } from './interfaces'; import { store } from '../../store'; import { getDoctors, getDoctorsArray } from './selectors'; import { ClinicModel } from '../clinic/model'; export class DoctorModel { private doctor: iDoctor; constructor(doctor: iDoctor) { this.doctor = JSON.parse(JSON.stringify(doct...
9f23c2e2c9131adcb210b5846c22b92bcdb35a67
TypeScript
marcomontalbano/figma-export
/packages/core/src/lib/figmaStyles/paintStyle.ts
2.875
3
import * as Figma from 'figma-js'; import * as FigmaExport from '@figma-export/types'; import { notEmpty } from '../utils'; const extractColor = ({ color, opacity = 1 }: FigmaExport.ExtractableColor): (FigmaExport.Color | undefined) => { if (!color) { return undefined; } const toFixed = (number: ...
33d0cc5f4d649229e397bf948d473bdf672ee733
TypeScript
jweissman/reflex
/src/reflex/ReflexString.spec.ts
3.375
3
import { evaluate } from "./SpecHelper" describe('String', () => { it('is the class of words', () => { expect(evaluate("'hello'.class")).toEqual('Class(String)') expect(evaluate("'world'.class")).toEqual('Class(String)') }) describe('instance methods', () => { it('concat', () => { ...
f9cd3506ea6078b14df05d4eeb0dd0899435e542
TypeScript
latotty/snake
/lib/manual-snake.hook.ts
2.875
3
import { useState, useEffect } from 'react'; import { SnakeConfig } from '../game/snake-config'; import * as snakeGame from '../game/snake'; import { coordEq } from '../lib/coord'; const snakeLoop = ( gameTick: ( state: snakeGame.State | undefined, newDirection?: snakeGame.Direction, ) => snakeGame.State,...
45da8a7a01362bfe9560d8188bbe73197cb5df86
TypeScript
easylaneof/password-sharing
/app/frontend/src/lib/vaidation/email.ts
2.609375
3
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; export const validateEmail = (email: string) => { const result = re.test(email.toLocaleLowerCase()); if (!result) { return 'Not a valid email'; ...
04a260b55248b6ba3e72c0fc2b763e1d244adb4b
TypeScript
Navachethan-Murugeppa/lens
/src/common/utils/camelCase.ts
3.40625
3
// Convert object's keys to camelCase format import { camelCase, isPlainObject } from "lodash"; export function toCamelCase(obj: Record<string, any>): any { if (Array.isArray(obj)) { return obj.map(toCamelCase); } else if (isPlainObject(obj)) { return Object.keys(obj).reduce((result, key) => { cons...
1e3e08e072b5a7a36d3241961504985c366b6667
TypeScript
Koushik95/usc-csci-571
/hw8/client/src/app/pipes/group/group.pipe.ts
2.734375
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'group' }) export class GroupPipe implements PipeTransform { transform<T>(value: T[], perGroup: number): T[][] { const groups: T[][] = []; for (let i = 0; i < value.length; i += perGroup) { groups.push(value.slice(i, i + perGroup)); ...
1aa38b789ba5ee55a7afe00ab24567d30ff46f6b
TypeScript
skrylnikov/Phoronis-tg-bot
/src/controllers/me.ts
2.53125
3
import { Context } from 'telegraf'; export const meController = (ctx: Context) => { try { if(ctx.message?.text && ctx.from){ const text = ctx.message.text.replace('/me', '').trim(); const username = `[${ctx.from.first_name || ctx.from.last_name || ctx.from.username || 'Неопознаный космона...
5d648a41ac428bd42e94b3fb1a1f47c799397bf4
TypeScript
itsdino/discord-bot-base
/src/commands/general/Ping.ts
2.796875
3
import { command } from "../../decorators/command"; import { Command, CommandExecuteArgs } from "../../structures/Command"; @command("ping") export class PingCommand extends Command { constructor() { super({ description: "Checks if I am still online", category: "General", }); } execute({ mes...
264a3434ec305a3813e4fc1998ad2adaa6d4a2e7
TypeScript
rvilela/node-cookbook
/ts/FSUtil.ts
2.8125
3
declare var require; class FSUtil { private static myself = null; private path: string; private regExp: RegExp; private myMvMethod: any; private fs: any; private FILENAME_REGEXP; constructor(path: string, regExp: RegExp) { this.path = path; this.regExp = regExp; this.m...
1c9db0a6a3ac6c3fc2f35069993a7bdac220b375
TypeScript
MdSazzadIslam/paragraph-service
/src/schemas/contentSchema.ts
2.828125
3
import { Model, model, Schema } from "mongoose"; export interface IParagraph { id?: string; paragraph: string; numberOfSentence: number; sentence: Array<string>; } const ContentSchema: Schema = new Schema( { paragraph: { type: String, required: [true, "Paragraph is required"], unique: t...
0db59288be762774250ac7e02b760454cc456611
TypeScript
jest-community/eslint-plugin-jest
/src/rules/no-commented-out-tests.ts
2.765625
3
import type { TSESTree } from '@typescript-eslint/utils'; import { createRule } from './utils'; function hasTests(node: TSESTree.Comment) { return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test( node.value, ); } export default createRule({ name: __filename, meta: { docs: { cat...
5a802640912f45d5b03746b5f00f5303dcbc9e68
TypeScript
Podlipny/Courses
/Youtube/Picking From 20 React State Managers/examples/atomic-agilets/src/store.ts
2.65625
3
import {createState, globalBind} from '@agile-ts/core'; export const NAMES = createState<string[] | null>(null); export const SECONDS = createState(0); export const IS_RUNNING = createState(false); export const incrementSeconds = async (amount = 0.1) => { const seconds = SECONDS.value; const todos = NAMES.val...
544824e06cacbc86f93ff33ef7da9f7d8495ae99
TypeScript
jordivid/exercici-vehicles
/nivell1/models/wheel.ts
3.109375
3
export class Wheel{ public diameter:number; public brand:string; constructor(diameter:number, brand:string){ this.diameter=diameter; this.brand=brand; } public htmlCode(numero: number): string { let code: string = ` <div class="col-6 col-md-3 mb-1"> ...
9541202fd3916330375d13a70e5fcbf72ccdea6e
TypeScript
clinyong/fake-mobx
/mobx/utils/reactive.ts
2.75
3
export interface IObservers { [index: string]: IDerivation; } export interface IObservable { observers: IObservers; } export interface IDerivation { name: string; observing: IObservable[]; schedule: () => void; }
b308a86d7b7cb93c28271b9757abe75522d4245e
TypeScript
phuhgh/js-util
/src/array/typed-array/mat3/mat3-factory.ts
2.890625
3
import { ITypedArrayTupleFactory } from "../i-typed-array-tuple-factory.js"; import { ATypedTupleFactory } from "../a-typed-tuple-factory.js"; import { TTypedArray } from "../t-typed-array.js"; import { IMat3Ctor, Mat3, TMat3CtorArgs } from "./mat3.js"; import { INormalizedDataView } from "../normalized-data-view/i-nor...
6f6f1086a48652d2ebd0b07386923fa98b953d14
TypeScript
ai-FarazKhan/gettickets
/tickets/src/events/publishers/ticket-created-publisher.ts
3.09375
3
// publisher is going to emit an event to NATS streaming server. import { Publisher, Subjects, TicketCreatedEvent } from "@gettickets/common"; // Publisher base class that is a generic class, which means we need to put on those brackets and provide the Type of event that we are going to try to emit with this Publishe...
6f2bad66833d372397d8466d0050b20f2ba43966
TypeScript
DjonnyX/ng-router-parser
/src/helpers/normalize-path.ts
3.046875
3
import { parsePath } from "./path-parser"; import path from "path"; const UP_PATH_PATTERN = /\.\.(?:[\\/]|$)/g; const RESOLVE_PATH_PATTERN = /(?:^|[\\/])\.(?:[\\/]|$)/; /** * Нормализация пути * @param {string} currentPath * @param {string} observedPath * @return {string} */ export const normalizePath = (curren...
7f849aa162f1c87bd99f2318b382dc20e8ad35ab
TypeScript
Sicphy/iba-winter-2019
/Angular tasks/src/app/models/status-code.ts
2.53125
3
import {ObjectType} from './object-type'; export class StatusCode { id: number; code: string; description: string; objectType: ObjectType; objectTypeName: string; issueGrouping: boolean; createIncidents: boolean; status: string; constructor() { this.id = 0; this.code = ''; this.descripti...
90f8673fe19c56d125fad73ed899d4816bdd0f4f
TypeScript
loglife-dev/transporte-biologico_v3
/src/modules/shipping/infra/typeorm/repositories/ShippingRepository.ts
2.546875
3
import { BaseRepository } from "../../../../../shared/infra/repositories/BaseRepositories"; import { IShippingRepository } from "../../../repositories/IShippingRepository"; import { Shipping } from "../entities/Shipping"; class ShippingRepository extends BaseRepository<Shipping> implements IShippingRepository { c...
a61d17713b081198650066dcaa9b91408fd883d0
TypeScript
xJA10x/ToDoAppWithAngular
/src/app/components/todos/todos.component.ts
2.796875
3
import { Component, OnInit } from '@angular/core'; // Imports service to bring our todos data. import {TodoService} from '../../services/todo.service'; // Imports Todo model to work with todo data. import {Todo} from '../../models/Todo' @Component({ selector: 'app-todos', templateUrl: './todos.component.html', s...
9162ebec5609f28a7135cf965dd623ad517ed44c
TypeScript
murage-poc/angular-pipe-recursion
/src/app/object-value.pipe.ts
2.8125
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({name: 'objectValue'}) export class ObjectValuePipe implements PipeTransform { dynamicValues; transform(obj:{}): string[] { this.dynamicValues=[]; return this.getValueFromObject(obj); } getValueFromObject(dataObj) { for (const p...
b615c98b30f016a1f44dd77e342749658c1d27b9
TypeScript
dczwx5/learngit
/note/erget/MergeTheCards3/MergeTheCards/MiniGame_OpenDataContext/src/lib/contextEvent/IEventDispatcher.ts
2.578125
3
interface IEventDispatcher{ addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void ; once(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void ; removeEventListener(type: string, listener: Function, t...
be7161f39ff097ab575218a44295a34f6e3211f4
TypeScript
swissglider/homeOverviewIonic
/src/app/oldapp/store/error/error-msg.model.ts
2.9375
3
/** Specifies an errorMsg used within the Error Msg Store */ export interface ErrorMsg { /** id */ id: string; /** severity of the error (can be: info, warning, success, danger) */ type: 'info' | 'warning' | 'success' | 'danger'; /** text for the error */ text: string; /** action the user should take */ ...
cb4a47f0bea137d2949e59c5774685587d9c590e
TypeScript
obniz/obniz
/src/parts/Grove/Grove_RotaryAngleSensor/index.ts
2.625
3
/** * @packageDocumentation * @module Parts.Grove_RotaryAngleSensorOptionsA */ import Obniz from '../../../obniz'; import { PeripheralAD } from '../../../obniz/libs/io_peripherals/ad'; import { DriveType } from '../../../obniz/libs/io_peripherals/common'; import { PeripheralGrove } from '../../../obniz/libs/io_peri...
fa9b73b8f6076898617a3b0fe937f4690ea26ded
TypeScript
zanachka/noderdom-detached
/base/classes/XMLSerializer.ts
2.609375
3
import InternalHandler, { initializeConstantsAndPrototypes } from '../InternalHandler'; import StateMachine from '../StateMachine'; import { INode, IXMLSerializer } from '../interfaces'; export const { getState, setState, setHiddenState, setReadonlyOfXMLSerializer } = StateMachine< IXMLSerializer, IXMLSerializerPr...
c4443e4b84dcca581ce0c8319b338e239efc30f4
TypeScript
maranite/Keylab-Viper
/ts-stubs/Action.d.ts
3.46875
3
/** * Instances of this interface represent actions in Bitwig Studio, such as commands that can be launched from * the main menu or via keyboard shortcuts. * * To receive the list of all actions provided by Bitwig Studio call {Application#getActions()}. The * list of actions that belong to a certain category can b...
19ae9253b40dec5c659962c98e040c5f7264d0c0
TypeScript
hota1024/lifegame-core
/src/Types/Copyable.ts
3.140625
3
/** * Copyable interface. */ export interface Copyable<Type> { /** * Copy. */ copy(): Type }
7643f4cd3f73efb557e0b7eabd744abaef3dfe70
TypeScript
kavehsajjadi/app-wordy
/src/util/debounce.ts
2.703125
3
export function debounce(func, wait, immediate = false) { var timeout return function() { var context = this, args = arguments var later = function() { timeout = null if (!immediate) func.apply(context, args) } var callNow = immediate && !timeout clearTimeout(timeout) timeo...
45561312be5ab83bfe5afa4d3b791f0950e7aba0
TypeScript
LucasGomes9/employee_backend
/src/app/controllers/LikeController.ts
2.828125
3
import { getRepository } from 'typeorm'; import Employees from '../models/Employees'; class LikeController { async like(id: string): Promise<number> { const employeeRepository = getRepository(Employees); const employee = await employeeRepository.findOne({where: { id }}); if (!employee) { throw new ...
419426b2420a0e266372ed65d332afd5ff19b20b
TypeScript
lmenezes/x
/packages/search-types/src/facet/facet.model.ts
2.734375
3
import { Identifiable } from '../identifiable.model'; import { FacetModelName, NamedModel } from '../named-model.model'; import { Filter } from './filter/filter.model'; /** * Facet is a trait for filtering results. It uses {@link Filter} as filters. * * @public */ export interface Facet extends NamedModel<FacetMod...
cab920dd664eb304a39ad9e326bc6d7387cbd506
TypeScript
xyy277/hikaru-angular
/src/app/business/common/service/localstorage.service.ts
2.78125
3
import {Injectable} from '@angular/core'; @Injectable() export class LocalStorageService { constructor() { } read(key: string): string { const text: string = localStorage.getItem(key); if (text === null || typeof (text) === undefined || text === 'undefined') { return null; } else { re...
cd7cc69f75f9c906fe48ba2c3980c1b215f661fb
TypeScript
kaiwensun/leetcode
/2001-2500/2172.Maximum AND Sum of Array.ts
3.015625
3
function maximumANDSum(nums: number[], numSlots: number): number { const DP = []; function dfs(i, slotSetting) { if (i === nums.length) { return 0; } if (i == DP.length) { DP.push({}); } if (DP[i].hasOwnProperty(slotSetting)) { return D...
e1550702d6ab8900ea92a3efd5e6b3a578f646bb
TypeScript
whjvenyl/Valetudo
/src/api/mock/Command.ts
2.765625
3
import { IValetudoCommandApi } from "@/api"; import { MockApi } from "@/api/mock"; import { chargingResponse, cleaningResponse, idleResponse, pausedResponse, returnHomeResponse, sleepingResponse, spotCleaningResponse } from "@/api/mock/fakeResponses"; export class MockCommandApi implements IValetudoComma...
5b88cb283b44401adccc136d4ae83660f7f79552
TypeScript
bionicgym/react-native-blemulator
/src/internal/internal-types.ts
2.75
3
import { UUID, Base64 } from "../types"; import { SimulatedService, SimulatedCharacteristic, SimulatedDescriptor } from "../.."; export interface TransferService { peripheralId: string, id: number, uuid: UUID, characteristics: Array<TransferCharacteristic> } export interface TransferCharacteristic { ...
84a64e0c1479137053074470770b6ad4fe27fef3
TypeScript
viry3d/viry3d.github.io
/viry3d/web/lib/graphics/BufferGL.ts
3.046875
3
import { Graphics } from "./Graphics" export enum BufferType { None, Vertex, Index, Uniform, Image, }; export type FillFunc = (param: any, buffer: DataView) => void; export class BufferGL { Fill(param: any, fill: FillFunc) { let gl = Graphics.GetDisplay().GetGL(); let buffer = new ArrayBuffer(this.m_size)...
1abc2eae2b06689039ff8542f4dc530f8325b690
TypeScript
Drischdaan/mooncake
/src/injection/injector.ts
2.953125
3
import { IInjectableMetadata, IInjector } from "../api/injection/injector.interfaces"; import { Class, ProviderKey } from "../types"; export class Injector implements IInjector { public createInstance<T>(value: Class<T>, ...args: any[]): T { if(value === undefined) throw new Error(`Invalid class provided!...
0a682ed10603847a84bad2b73bfe7b199d9ca722
TypeScript
dalfiannur/absensi
/src/store/user-role/reducers.ts
2.8125
3
import { UserRoleTypes, UserRoleState, SET_ROLE, SET_ROLES } from './types' const initialState: UserRoleState = { role: { id: 0, name: '' }, roles: [] } export const userRoleReducer = (state = initialState, action: UserRoleTypes) => { switch (action.type) { case SET_ROLE: return { ...
72da0024c8e287bb3c753ab5c00e1ea99eb5a051
TypeScript
Vatsalshah8200/Summer_Internship
/snake game/js/index.ts
3.03125
3
//constnats let inputDir = { x: 0, y: 0 }; const foodSound = new Audio('./music/food.mp3'); const gameOverSound = new Audio('./music/gameover.mp3'); const moveSound = new Audio('./music/move.mp3'); const musicSound = new Audio('./music/music.mp3'); const speed = 9; let lastPaintTime = 0; let score = 0; let snakeArr = [...
3e75b14b404d58c89253ed374f8f3eed45694de3
TypeScript
Mondei1/DocSort
/backend/src/dummyData.ts
2.734375
3
import { Document } from "./entity/document"; import { Tag } from "./entity/tag"; import { User } from "./entity/user"; import { createRandomString } from "./libs/createRandomString"; import { createPasswordHash } from "./libs/createPasswordHash"; export async function insertDummyData() { const dummyUsers: Array<...
3738021efda01451ddd87dba3b00833cb01177ef
TypeScript
rikusv/amena-wedding
/src/app/manage/sort.pipe.ts
2.796875
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'sort' }) export class SortPipe implements PipeTransform { transform(items: any[], sorter: {property: string, ascending?: boolean}): any { function score(invitation: any, eventId: string) { return invitation.rsvp[eventId] === '' || type...
f945260305af482b78ccbb403fb4c256207c84f1
TypeScript
rocketbase-io/rollup-plugin-sequential
/src/combine-sync-functions.ts
2.515625
3
export function combineSyncFunctions(name: string, plugins: any[], once: boolean) { let ranBefore = false; let lastResult: any = undefined; return function(this: any, ...params: any) { if (once && ranBefore) return lastResult; ranBefore = true; plugins.forEach(plugin => (lastResult = plugin[name].call...
48366f9406b5126ad8d987bc4e4b9bc461dd4e01
TypeScript
Coffeekraken/coffeekraken
/packages/postcss/s-postcss-sugar-plugin/src/node/mixins/float/classes.ts
2.796875
3
import __SInterface from '@coffeekraken/s-interface'; /** * @name classes * @as @sugar.float.classes * @namespace node.mixin.float * @type PostcssMixin * @platform postcss * @status beta * * This mixin generate all the float helper classes like ```.s-float:left...
53142aebc94036a3f3b169e41215e4dedc065170
TypeScript
rudani-c/bank
/src/app/pipes/sort.pipe.ts
2.65625
3
import { Pipe, PipeTransform } from '@angular/core'; import { CommonUtil } from '../utils/common.util'; @Pipe({ name: 'sort', }) export class SortPipe implements PipeTransform { transform(array: any, field: string, order: string): any[] { if (order == 'asc' || order == 'desc') { switch (field) { ...
bd8ac5d449076715ecbe774cb4e611d5382902f4
TypeScript
motss/jsmodern
/src/map/entry.ts
2.921875
3
import type { PrototypeStruct } from '../index.js'; interface Entry<K, V> { entry(key: K): [K, V]; } export const entry: PrototypeStruct = { label: 'entry', fn: function mapEntry<K, V>(key: K): [] | [K, undefined | V] { const ctx = this as unknown as Map<K, V>; const val = !ctx.size ? undefined : ctx.ge...
0586d36bbb161d3c484e77a66893c9dc6f28a385
TypeScript
microsoft/PowerBI-visuals-AttributeSlicer
/packages/attribute-slicer/src/selection/SelectionManager.ts
2.703125
3
/* * Copyright (c) Microsoft * All rights reserved. * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to u...
becac011e16994afe331264dfc69b0a26eb58f26
TypeScript
vocodes/audio-sample-abtest
/frontend/src/audio/Experiment.ts
2.84375
3
export class FileDescriptor { name: string; relative_path: string; constructor(name: string, relative_path: string) { this.name = name; this.relative_path = relative_path; } static fromJson(json: any) : FileDescriptor { return new FileDescriptor(json.name, json.relative_path); } getWavU...
591a60a096283ceeda96f80bd289a2778d2870be
TypeScript
lbwa/docs-server
/src/generator/static.ts
2.515625
3
import BaseGenerator = require('./base') import path = require('path') const Mtj = require('mark-to-json') const formatDate = require('../utils/format-date') type normalize = (path: string) => string class StaticGenerator extends BaseGenerator { private __normalize: normalize constructor () { super() } ...
f19fe9e58139b23983077849ccb3da6c0d6594a2
TypeScript
desktop/desktop
/app/test/unit/find-forked-remotes-to-prune-test.ts
2.578125
3
import { findForkedRemotesToPrune } from '../../src/lib/stores/helpers/find-forked-remotes-to-prune' import { Branch, BranchType } from '../../src/models/branch' import { CommitIdentity } from '../../src/models/commit-identity' import { GitHubRepository } from '../../src/models/github-repository' import { PullRequest }...
83e6f6a389f588c18147825b8dccfe0b55481bea
TypeScript
Ragini-1004/Angular
/Assignment 2/1_Ass2.ts
3.59375
4
function Maximum(num:number[]):number { var iMax:number=0; for(var i=0; i< num.length; i++) { if(num[i]> iMax) { iMax=num[i]; } } return iMax; } var arr:number[]= new Array(8); arr = [23,89,6,29,56,45,77,32 ] ; var iret=Maximum(arr); console.log("Maximum number...
8a02cdc3f36d81cb4013fd356f2a05afbf024b24
TypeScript
enliberte/patterns
/behavioral/mediator/src/scheme/mediator/Mediator.ts
2.75
3
import IMediator from "./IMediator"; import SenderA from "../senders/SenderA"; import SenderB from "../senders/SenderB"; import SenderC from "../senders/SenderC"; import SenderD from "../senders/SenderD"; export default class Mediator implements IMediator { senderA: SenderA; senderB: SenderB; senderC: Send...
a4be43e768efc4cb667d33dff2792a2875cd6ad5
TypeScript
blinker-iot/blinker-js
/example/aligenie/example_aligenie_sensor.ts
2.671875
3
import { BlinkerDevice } from '../../lib/blinker'; import { AliGenie, VA_TYPE } from '../../lib/voice-assistant'; let device = new BlinkerDevice(''); let aliGenie = device.addVoiceAssistant(new AliGenie(VA_TYPE.SENSOR)); device.ready().then(() => { // 查询传感器状态 aliGenie.stateQuery.subscribe(message => { ...
8ec1305b6c48f7cf256abc1acb41d437cc35817f
TypeScript
royaltm/node-murmurhash-native
/test/types/tap.d.ts
2.625
3
/* a small restrictive subset declaration for tap */ declare module 'tap' { export interface Test { end(): void; error(error: Error, message?: string, extra?: any): void; ok(obj: any, message?: string, extra?: any): void; plan(count: number): void; strictEqual<T>(found: T, wanted: T, message?: str...
dea86f8a3f5529e73fee281b477f310417a364c2
TypeScript
ctx-core/function
/src/slice_arg_a_/index.d.ts
2.578125
3
import type { a_nowrap_T } from '../_types' /** * Returns a function where the arguments to the wrapped function are sliced with begin_idx & end_idx. */ export declare function slice_arg_a_< In extends unknown = unknown, Out extends unknown[] = unknown[] >( fn:slice_arg_a_fn_T<In, Out>, begin_idx?:number, end_idx?...
a976c1e656253fc49595252b20e7aee15f22d379
TypeScript
DBetta/cloud-service-discovery
/src/cloud/consul/utils/consul-utils.ts
2.578125
3
export class ConsulUtils { static getMetadata(tags: string[]): Map<string, string> { const metadata = new Map<string, string>(); for (const tag of tags) { const parts = tag.split('='); metadata.set(parts[0], parts[1]); } return metadata; } }
14ee02051527416175feedf4ede1cd2f681e60cc
TypeScript
ourcade/coronavirus-pop-phaser
/src/game/BallGrid.ts
2.828125
3
import Phaser from 'phaser' import BallLayoutData, { Red, Gre, Blu, Yel } from './BallLayoutData' import BallColor, { colorIsMatch } from './BallColor' import { Subject } from 'rxjs' import BallState from '~/consts/BallState' interface IGridPosition { row: number col: number } type IBallOrNone = IBall | undefine...
5d6a4ea3e7e1f2ba7f31bf48b41bbd198155e054
TypeScript
theirish81/dbsheets
/src/actions/SetVarAction.ts
2.671875
3
import { AbstractAction } from "./AbstractAction"; import { Op } from "../Op"; /** * Sets a variable */ export class SetVarAction extends AbstractAction { evaluate(params : any) : Promise<AbstractAction> { return new Promise((resolve,reject)=> { if(params.first){ ...
c3bcf1bfd9f032b6f9ff8c16fc5efb6709727cff
TypeScript
FlorianJansen1337/ScrimBuxBot
/src/cronjobs/monthly.ts
2.546875
3
import { CronJob } from 'cron'; import { Balance, Contract } from "../helper/types"; import * as fs from 'fs'; const contracts = require('../../data/contracts.json') as Contract[]; const balances = require('../../data/balances.json') as Balance[]; export const monthly = new CronJob('0 0 1 * *', function () { payOu...
74bd95fdca20fbc372679ceec5ad5885bf7576b6
TypeScript
Jhonnyc/jaebook-server
/src/services/PostCommentService.ts
2.515625
3
import { Service } from "typedi"; import { InjectRepository } from "typeorm-typedi-extensions"; import { PostComment } from "../entities/PostComment"; import { PostCommentRepository } from "../repositories/PostCommentRepository"; import { CreatePostCommentDto, UpdatePostCommentDto, } from "../dtos/PostCommentDt...
5c98c9315a4b71e0baf4b4be470ee0afa888a597
TypeScript
angelgadea/pw-component-frontend
/pw-cp-frontend/src/app/shared/pipes/capitalize-first-letter.pipe.ts
2.609375
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'capitalizeFirstLetter' }) export class CapitalizeFirstLetterPipe implements PipeTransform { transform(text: string): any { text = text.toLowerCase(); return text[0].toUpperCase() + text.substr(1).toLowerCase(); } }
2d7628ec905cbf899055057aca169821e0e0e602
TypeScript
angular/angular
/packages/compiler-cli/src/ngtsc/annotations/common/src/api.ts
3.09375
3
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Resolves and loads resource files that are referenced in Angular metadata. * * Note that `preload()` and `lo...
6c4a171ce54a552b7e3c91ce6db52dda394934b1
TypeScript
trash/ripple
/app/src/ItemRequirementsMap.ts
3.40625
3
import * as Immutable from 'immutable'; import { IItemRequirementsMapEntry, RequiredItems, IItemSearchResult } from './interfaces'; import {EventEmitter2} from 'eventemitter2'; import {Item} from './data/Item'; type ForEachCallback = ( itemType: string, itemEntry: IItemRequirementsMapEntry ) => void; /** * An ob...
3e87ca153b4368e6f14fadba544907157092ae59
TypeScript
geraldyeo/restyled
/src/mixins/compose.test.ts
2.625
3
import defaultTheme from '../index'; import * as StyledSystem from '../system'; import compose from './compose'; const theme = { ...defaultTheme, colors: { white: '#fff', black: '#000', grey: '#333' }, }; describe('compose', () => { it('should compose a style function', () => { const fn = compose( Sty...
d06cbcaad63f7d7e44f666b32a128831871cd9ef
TypeScript
garyng/Wimm
/src/api/ts/rating.ts
2.671875
3
import { ModelFilter } from './model-filter'; export class Rating extends ModelFilter { constructor( public id: number = 0, public userId: number = 0, public bookId: number = 0, public rating: number = 0, public createdAt: Date = new Date(), public updatedAt: Date = new Date(), ) { s...
e5f09e96e827911f5cb8fa89ddb18512033e1eef
TypeScript
ellisonbg/phosphor
/src/layout/SpacerItem.ts
2.9375
3
/*----------------------------------------------------------------------------- | Copyright (c) 2014-2015, S. Chris Colbert | | Distributed under the terms of the BSD 3-Clause License. | | The full license is in the file LICENSE, distributed with this software. |---------------------------------------------------------...
0f6c48a28c9b91881bb2ea6e0855b0c436ff815a
TypeScript
github/vscode-codeql
/extensions/ql-vscode/src/model-editor/library.ts
3.078125
3
import { basename, extname } from "../common/path"; // From the semver package using // const { re, t } = require("semver/internal/re"); // console.log(re[t.LOOSE]); // Modifications: // - Added version named group which does not capture the v prefix // - Removed the ^ and $ anchors // - Made the minor and patch versi...
5879fea336ae21a175e6d33bfe380a12f03c747b
TypeScript
vitoraa/clean-node
/src/presentation/controllers/ship/add-ship/add-ship-controller.ts
2.578125
3
import { AddShip } from '@/domain/usecases/ship/add-ship' import { FieldInUseError } from '@/presentation/errors/field-in-use-error' import { badRequest, forbidden, ok, serverError } from '@/presentation/helpers/http/http-helper' import { Controller, HttpResponse } from '@/presentation/protocols' import { Validation } ...
39dc8cd893c23ae94d7bab711e1a83c86ccdd9bc
TypeScript
dimunozp/curso-rxjs-inicio
/src/observables/07-interval-timer.ts
2.75
3
import {Observable, Observer, interval, timer} from 'rxjs'; const observer: Observer<any> = { next: (value: any) => console.log('next: ', value), error: null, complete: () => console.info('complete') }; const hoyEn5: Date = new Date(); hoyEn5.setSeconds(hoyEn5.getSeconds() + 5); const interval$: Observab...
70d2f43b6fcaae51341f0b0ddb81cbe071b7b5d0
TypeScript
cholnhial/deco2500
/src/app/components/photos/photos.ts
2.65625
3
import {Component} from "@angular/core"; @Component({ selector: 'component-photos', templateUrl: 'photos.html', styleUrls: ['./photos.scss'], }) export class PhotosComponent { images = []; constructor() { } onRemoveImage(imageIndex) { this.images.splice(imageIndex, 1); } onAddImage() { thi...
78ab7b9aecc7db6ed3e15146f018db7523f6ebd8
TypeScript
ryabv/learn-ts
/src/store/fileContent/reducers.ts
2.8125
3
import { GET_FILE_CONTENT_FROM_SERVER_SUCCESS } from './actions'; const defaultState = ['Hello world']; type Action = { type: string, payload: {} } export const fileContentReducer = (state = defaultState, action: Action) => { switch (action.type) { case GET_FILE_CONTENT_FROM_SERVER_SUC...
c997f9579ef2db5c0eb35a7337f648acfe019c34
TypeScript
anujshah108/mt-sinai-chat-prototype
/app/src/socket/index.ts
2.671875
3
import { Message } from "../components/MessageContainer.tsx/MessageContainer"; // api/index.js const socket = new WebSocket("ws://localhost:8080/ws"); const connect = (callback: (msg: MessageEvent) => void) => { socket.onopen = () => { console.log("Successfully Connected"); }; socket.onmessage = (msg: Mess...
bee4a382c49d419971386c5115734062144814f6
TypeScript
cloudify-cosmo/cloudify-stage
/widgets/userGroups/src/actions.ts
2.546875
3
import { map, concat, includes, filter, size, isUndefined, isEmpty } from 'lodash'; import type { SystemRole } from '../../../app/widgets/common/roles/types'; import type { Toolbox } from '../../../app/utils/StageAPI'; import type { RolesAssignment } from '../../../app/widgets/common/tenants/utils'; import type { UserG...
2edb3b5b105a17729b10a32874c60638cceda19e
TypeScript
MoonG25/wangwang
/src/utils/index.ts
2.703125
3
export const getPlayYMD = () => { const today = new Date(); const year = today.getFullYear(); const month = today.getMonth(); const day = today.getDate(); return `${year}${addZero(month)}${addZero(day)}`; }; export const addZero = (value: number) => { return ('0' + value).slice(-2); };
4d50e3f3ab8b43798d21077e5fdf3ed66a241927
TypeScript
andreimaurina/acic
/src/models/Associado.ts
2.734375
3
export class Associado { nome: string; tipo: string; email: string; telefone: string; cep: string; cidade: string; rua: string; numEndereco: number; bairro: string; constructor(tipo: string) { this.tipo = tipo; } } export class PessoaFisica extends Associado { cp...
745698fc796f8df86ad23a96bcd454ad5db74d28
TypeScript
DreamLarva/js-ts-Algorithms
/leetcode/599.两个列表的最小索引总和.ts
3.65625
4
/* 假设Andy和Doris想在晚餐时选择一家餐厅,并且他们都有一个表示最喜爱餐厅的列表,每个餐厅的名字用字符串表示。 你需要帮助他们用最少的索引和找出他们共同喜爱的餐厅。 如果答案不止一个,则输出所有答案并且不考虑顺序。 你可以假设总是存在一个答案。 示例 1: 输入: ["Shogun", "Tapioca Express", "Burger King", "KFC"] ["Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"] 输出: ["Shogun"] 解释: 他们唯一共同喜爱的餐厅是“Shogun”。 示例 2: 输...
62a61bb207aafe4765c58c999482c4dc23e7190d
TypeScript
darwinpsunny/fsdlibappangular-frontend
/src/app/signup/signup.component.ts
2.953125
3
import { Component, OnInit } from '@angular/core'; import{AuthService} from "../auth.service"; import{Router} from '@angular/router'; @Component({ selector: 'app-signup', templateUrl: './signup.component.html', styleUrls: ['./signup.component.css'] }) export class SignupComponent implements OnInit { constructo...
df1b2063a6497152f526bfadb154b23c74c49021
TypeScript
beaumontjonathan/mev
/lib/rule/NumberRule.ts
3.15625
3
import { ValidationRuleResult } from '../types'; import { defaultRuleOptions, Rule, RuleOptions } from './Rule'; export interface NumberRuleOptions extends RuleOptions {} export const defaultNumberRuleOptions: NumberRuleOptions = { ...defaultRuleOptions, initialTypeTestType: 'number', }; export class NumberRule ...
17d21eba267bc8b7269144eccd71458a84d90c20
TypeScript
denisugiarto/audiophile
/redux/slices/cartSlice.ts
3.046875
3
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import type { ProductType } from "data/types/productType"; import { toast } from "react-toastify"; import { toastAction } from "helpers/toastify"; import { RootState } from "redux/store"; //TODO: cartSlice interface interface CartSliceType { cartItems: P...