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 |
|---|---|---|---|---|---|---|
78ebd6a85a03fed3801bc1156496d5692e56aac3 | TypeScript | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/GIT-CDN-FILES/misc/mout/src/array/max.ts | 3.078125 | 3 | import makeIterator from '../function/makeIterator_';
/**
* Return maximum value inside array
*/
function max(arr, iterator?, thisObj?: any) {
if (arr == null || !arr.length) {
return Infinity;
} else if (arr.length && !iterator) {
// eslint-disable-next-line prefer-spread
return Math... |
b0c6705501382aeff724f3f1e95eb1f304979611 | TypeScript | igorosabel/MCDesigner | /src/app/model/user.model.ts | 2.8125 | 3 | import { UserInterface } from "src/app/interfaces/interfaces";
import { Utils } from "src/app/modules/shared/utils.class";
export class User {
constructor(
public id: number = null,
public token: string = null,
public email: string = null
) {}
fromInterface(u: UserInterface): User {
this.id = u.... |
8ad010045e60f91d428a6ddcc0b606f8997d7762 | TypeScript | Defcoq/ecommercetypescriptvanilla | /src/data/DataSourceLocale.ts | 2.515625 | 3 | import { AbstractDataSource } from "./DataSourceAbstrait";
import { Produit } from "./entite";
export class LocalDataSource extends AbstractDataSource {
loadProduits(): Promise<Produit[]> {
return Promise.resolve([
{ id: 1, nom: "P1", categorie: "Watersports",
... |
3a65083149ba4b8131f419da2edcd0a8b6e20d1b | TypeScript | RitsuProject/ritsu-v3 | /src/database/entities/RoomLeaderboard.ts | 2.53125 | 3 | import { prop, getModelForClass, DocumentType } from '@typegoose/typegoose'
/**
* Room Leaderboard
* @description The room leaderboard model
*/
class RoomLeaderboard {
@prop({ required: true })
_id: string
@prop({ required: true })
username: string
@prop({ required: true })
guildId: string
@prop({ ... |
edda996ade0fdd456850f6c9628f2919bf581b70 | TypeScript | ngquhuanbl/Pathfinding_Visualization | /src/utils/data-structures/queue/PriorityQueue.test.ts | 3.328125 | 3 | import PriorityQueue from './PriorityQueue';
test('return correct enqueued items', () => {
const queue = new PriorityQueue<number>();
queue.enqueue(1, 0);
queue.enqueue(2, 3);
queue.enqueue(3, 2);
expect(queue.traverse()).toEqual([1, 3, 2]);
});
test('return correct dequeued item', () => {
const queue = n... |
46c8d12c3064f51ca3905a74fb24357d73350b83 | TypeScript | clonalejandro/cloud | /src/utils/mongo.ts | 2.796875 | 3 | /** IMPORTS ***/
import mongoose from "mongoose";
export default class Mongo {
/** SMALL CONSTRUCTORS **/
private uri: string;
private App: any;
private prefix: string;
public instance: mongoose.Mongoose = mongoose;
public constructor(App: any){
const config = App.config;
... |
2e833f8da9b9fa8c12af735d66d33d7bd6a697c8 | TypeScript | remew/remew.net | /src/lib/rehype-auto-id.ts | 2.859375 | 3 | import { visit } from 'unist-util-visit';
import { headingRank } from 'hast-util-heading-rank';
import { hasProperty } from 'hast-util-has-property';
import { toString } from 'hast-util-to-string';
class Slugger {
dict = new Map<string, number>();
slug(text: string): string {
const count = this.dict.get(text) ... |
93fdf85083984506bfe3df3ac9acd1941da9e03b | TypeScript | gqxcd/teams-demo | /src/app/pipe/sorting.pipe.ts | 2.59375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { Person } from '../models/team';
@Pipe({
name: 'sorting'
})
export class SortingPipe implements PipeTransform {
transform(persons: Person[]): any {
return persons.sort((a, b) => {
if (!a.position.localeCompare(b.position))
{
... |
c00f40cb1e0fae8f06b1c30d3f7c941893219139 | TypeScript | eldimious/throw-http-errors | /src/CreateCustomError.ts | 2.96875 | 3 | const isErrorStatus = (status: number) => status >= 400 && status < 600;
// eslint-disable-next-line import/prefer-default-export
export class CreateCustomError extends Error {
readonly code: string | number;
readonly status: number;
constructor(
status: number,
name?: string,
message?: string,
... |
510308acc0722206a429b6d22c2af0aefcc332c3 | TypeScript | getoverlove/Majiang | /majiang/core/MajiangClient.ts | 2.765625 | 3 | import {
AnGangResponse,
AnGangRequest,
EatResponse,
EatRequest,
FetchResponse,
FetchResponseMode,
FetchRequest,
MessageType,
MingGangResponse,
MingGangRequest,
OverMode,
OverResponse,
OverRequest,
PengResponse,
PengRequest,
ReleaseResponse,
ReleaseRes... |
3ddecc3484e1a1c0cdf6244c537813edaaccb64b | TypeScript | end5/CoCWebOld | /src/classes/Effects/PerkDescs/PiercedFertite.ts | 2.71875 | 3 | import Perk, { PerkDesc } from '../Perk';
export default class PiercedFertite extends PerkDesc {
public description(perk?: Perk): string {
return "Increases cum production by " + Math.round(2 * perk.value1) + "% and fertility by " + Math.round(perk.value1) + ".";
}
public constructor() {
s... |
3d80ec74c44c4ae13a4511f60fe1a9ec3a97a7bf | TypeScript | jzb1205/core-draw | /package/src/middles/nodes/pointCell/pointCell.anchor.ts | 2.8125 | 3 | import { Node } from '../../../models/node'
import { Point } from '../../../models/point'
import { Direction } from '../../../models/direction'
export function pointCellAnchors (node: Node,ctx?: CanvasRenderingContext2D) {
const x = node.rect.x || 0
const y = node.rect.y || 0
const w = node.rect.width
... |
3b8befc5479c8aed3f4743ad585d7e2cf4cbbebd | TypeScript | Aryaakshitaa/Cricket-Game | /script.ts | 2.6875 | 3 | //Global Variables
var scoreT1: number;
var scoreT2: number;
var mvpTeam1 = 0;
var mvpTeam2 = 0;
var maxScore: number;
var winnerTeam: number;
var playerNum1: number;
var playerNum2: number;
//mmscore --> Man Of The Match score
var mmScore = 0;
//mmPlayer --> Man Of The Match player number
var mmPlayer: num... |
950cadfeb3905531f4c170c83adfc7addd7ad456 | TypeScript | paulscottrobson/atari-cosmos | /javascript/src/hardware/ikeypad.ts | 3.09375 | 3 | /// <reference path="../../lib/phaser.comments.d.ts"/>
/**
* Representing each key.
*
* @enum {number}
*/
enum CosmosKeys {
UP,RIGHT,LEFT,DOWN,START,PLAYERS,SKILL,FIRE
}
/**
* Keypad interface
*
* @interface IKeypad
*/
interface IKeypad {
/**
* Returns true if Cosmos key is down.
*
*... |
3093d6bd861983c9a0efea71d2fad834268dc699 | TypeScript | JCSong-89/nest | /src/dto/users/readUserProfile.dto.ts | 2.6875 | 3 | export class UserProfileDto {
username: string;
name: string;
constructor(data: { [key: string]: any }) {
this.username = data.username;
this.name = data.name;
}
}
|
4564a35bbb59be2163c0f7005847c1c30a1740a8 | TypeScript | LPegasus/react-imgclip | /src/helpers.ts | 2.6875 | 3 | import Defer from './Defer';
export type AnchorType = 'lefttop' | 'leftcenter' | 'leftbottom'
| 'righttop' | 'rightbottom' | 'rightcenter'
| 'topcenter' | 'bottomcenter';
const CANVAS_ID = `_clip-photo_${Date.now().toString()}`;
/**
* 加载图片
*
* @export
* @param {string} url 图片地址
* @returns {Promise<HTMLImage... |
990b075388fedaeb081964b4b37b69fd183966fe | TypeScript | tech6hutch/MissyBot | /src/commands/General/quote.ts | 2.65625 | 3 | import { MessageEmbed, TextChannel, GuildMember } from 'discord.js';
import { CommandStore, KlasaMessage } from 'klasa';
import MissyClient from '../../lib/MissyClient';
import MissyCommand from '../../lib/structures/base/MissyCommand';
import { GuildMessage } from '../../lib/util/types';
type MsgResolvable = KlasaMes... |
9b0f3d7daee43455d332a49c2e1bc9760a900e24 | TypeScript | zhanfei2024/freshlinker2 | /client/frontend/src/common/pipe/ellipsis.pipe.ts | 2.671875 | 3 | import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'ellipsis'
})
export class EllipsisPipe implements PipeTransform {
constructor() {
}
transform(name: string, hasType: boolean): string {
if (name.length > 10) {
if (hasType) {
return name.slice(0, 6) + '...' + name.slice(name.l... |
aa985ecfe859e89057f4a857190489398d5dd688 | TypeScript | Yelsin1395/auth-react-redux | /client/src/redux/types/alert.ts | 2.5625 | 3 | import types from "redux/actions/types";
import { Color } from "@material-ui/lab";
export interface IAlertState {
id?: any;
msg: string;
status: number;
alertType: Color | undefined;
}
interface ISetAlertAction {
type: typeof types.SET_ALERT;
payload: IAlertState;
}
interface IRemoveAlertAction {
type:... |
5baecf29344b3e7433af9b98e20031fc64a7f615 | TypeScript | oshogun/TunnelMessenger | /scripts/shared/Message.ts | 2.75 | 3 | import {Chat} from "./Chat"
import {Settings} from "./Settings"
import {User, UserType} from "./User"
import {utils} from "./Utils"
export interface Message {
display(node: HTMLElement, callback?: () => void): void;
setChat(chat: Chat): void;
setId(id: string): void;
getAuthor(): User;
getDatetime(): Date;
}
abs... |
a36848755edfd384e171de0ea6c8691a010f33b2 | TypeScript | dinocloud/mini-ts-demo | /src/paquete/paquete.service.ts | 3.15625 | 3 | // Libs
import Faker from 'faker';
// Entidades
import Paquete, { Prioridad } from './paquete.entity';
import { Pagina, RespuestaDeServidor } from '../commons/interfacesWeb';
const generadorDePaquetes = function*(idInicial: number) {
let id = idInicial;
while (true) {
const datosDelPaquete: any = {
id,
... |
c3f966556330a75389d1e2554a42c255f415815c | TypeScript | Masafir/Co-LocosAPI | /src/colocs/colocs.service.ts | 2.609375 | 3 | import { Injectable, NotFoundException, UsePipes, ValidationPipe } from '@nestjs/common';
import { Coloc } from './colocs.model';
import {v1 as uuid} from 'uuid';
import { CreateColocDto } from './dto/create-coloc.dto';
import { UpdateColocDto } from './dto/update-coloc.dto';
@Injectable()
export class ColocsService... |
bcb69b051d51638e4db165e5dcb42ae649b58926 | TypeScript | AmosChenYQ/Learn-TypeScript-Step-By-Step | /src/example/symbol.ts | 3.890625 | 4 | const s = Symbol()
const s2 = Symbol()
// console.log(s === s2) always false
const s3 = Symbol('Amos')
const s4 = Symbol('Amos')
// console.log(s3 === s4) always false
// s3 + "123" error
console.log(s4.toString()) // Symbol('Amos')
console.log(Boolean(s4)) // true
console.log(!s4) // false
let prop: string = 'name'
... |
f49a12a40b479f7fed1e1e3eb871cfaa7693582c | TypeScript | ims7inc/nhtsa-api-wrapper | /src/api/actions/GetWMIsForManufacturer.ts | 2.765625 | 3 | /**
* @module api/actions/GetWMIsForManufacturer
* @category Actions
* @description GetWMIsForManufacturer NHSTA Api Action.
*
* > **Module Exports**:
* > - Class: [GetWMIsForManufacturer](module-api_actions_GetWMIsForManufacturer.GetWMIsForManufacturer.html)
* >
* > **Types**
* > - Type: [GetWMIsForManufactur... |
a03c1e80727460db01f3860c7c7582b2655a1aa0 | TypeScript | sushanm/alogs | /projects/shortest-path/src/app/app.component.ts | 2.890625 | 3 | import { Component, OnInit } from '@angular/core';
class Point {
x: number;
y: number;
constructor(x, y) {
this.x = x;
this.y = y;
}
}
class Node {
pt: number;
dist: number;
constructor(pt, dist) {
this.pt = pt;
this.dist = dist;
}
}
@Component({
selector: 'app-root',
templateUrl:... |
bc7ed425e669801e0bbfa35f79e0142f5d621f6c | TypeScript | chikaharo/todo-react | /src/components/clock/useTime.ts | 3.140625 | 3 | import React, { useState } from 'react';
// interface useTimeProps {
// timeZone: string
// }
interface IState {
seconds: number;
minutes: number;
hours: number;
}
const useTime = (timeZone: string) => {
const [state, setState] = useState({
hours: 0,
minutes: 0,
seconds: 0,
});
React.useEf... |
d6d9c1ed7444406644705b8ae08b4e2a0548f73e | TypeScript | elvir92/todo | /src/app/helpers/util.ts | 3.09375 | 3 | import { ITodo } from '../models'
export const isEmpty = object => object && Object.keys(object).length === 0 || object === undefined || object === "undefined";
export const addToList = name => {
let list = getList();
if (!list) {
list = [];
}
let todo: ITodo = {
_id: list.length,
... |
8485b10400f4aed1e1d5457777f1a3e4aaf878e9 | TypeScript | NicolaiSchmid/express-request-cuid | /src/index.ts | 2.53125 | 3 | import cuid from "cuid";
import * as express from "express";
export default (options): express.RequestHandler => {
options = options || {};
if (options.constructor.name === "IncomingMessage") {
throw new Error(
"You might have used the module like `app.use(requestCuid)`, but it should be `app.use(reques... |
a4f9b264fc3a15b8a6ef8c81265c32027a6b5e45 | TypeScript | amit-prabhakar/Firestore-simple | /example/ts_admin/basic.ts | 2.890625 | 3 | import admin, { ServiceAccount } from 'firebase-admin'
import serviceAccount from '../../firebase_secret.json'
import { FirestoreSimple } from '../../src'
admin.initializeApp({
credential: admin.credential.cert(serviceAccount as ServiceAccount),
})
const firestore = admin.firestore()
firestore.settings({ timestampsI... |
7adb29b4923afd434ec4bb87d49a5220bf524bba | TypeScript | Fabrice-TIERCELIN/typescript-plugins-of-mine | /typescript-plugin-proactive-code-fixes/spec/extractInterfaceSpec.ts | 3.171875 | 3 | const sourceFileText = `
/**
* a fruit is a living thing, produced by trees
*/
class Fruit extends LivingThing { // suggested from anywhere inside the class declaration
/**
* use undefined for 100% transparency
*/
color: string | undefined
/** shouldn't be exported */
private creationDate: Date
/**
... |
6c1fcec98f3dded0d1221baeacfb7ad1369c4bda | TypeScript | tomoyukim/DefinitelyTyped | /types/mermaid/config.d.ts | 2.65625 | 3 | declare namespace config.sequence {
// config.sequence.messageFont.!ret
/**
*
*/
interface MessageFontRet {
/**
*
*/
fontFamily?: string;
/**
*
*/
fontSize?: number;
/**
*
*/
fontWeight?: numbe... |
e7e9622fcbee1bab4594d8c2d76093e3a5294a8a | TypeScript | microsoft/FluidFramework | /packages/drivers/local-driver/src/localSessionStorageDb.ts | 2.640625 | 3 | /*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import { EventEmitter } from "events";
import { ICollection, IDb } from "@fluidframework/server-services-core";
import { ITestDbFactory } from "@fluidframework/server-test-utils";
import { v4 as uuid... |
906a074199e108437912a03fb50acba92267a5de | TypeScript | pcsaovang/rtk-saga | /src/utils/httpClient.ts | 2.6875 | 3 | import axios, { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError } from 'axios';
import qs from 'qs';
import { API_HOST } from '../configs/vars';
import { camelizeKeys } from '../utils/stringHelper';
enum StatusCode {
Unauthorized = 401,
Forbidden = 403,
TooManyRequests = 429,
InternalServerError ... |
c08eba4b018b228e2d359d84df18e3e6cc6879bd | TypeScript | OrangeManLi/skypie | /skypie2/src/LoadingUI.ts | 2.5625 | 3 |
class LoadingUI extends egret.gui.SkinnableComponent{
private progressBar:egret.gui.ProgressBar;
public constructor(){
super();
this.skinName=skins.LoadingUISkin;
}
public setProgress(current:number, total:number):void {
if(this.progressBar)
{
this.progres... |
1223fcaba256100fba230e880e691fad980d2d8f | TypeScript | Brobz/ArcadeFightersIsh | /server/models/room.ts | 2.765625 | 3 | import type Player from './player';
import type Bullet from './bullet';
import type PowerUp from './power_up/power_up';
import type WallBlock from './wall_block';
import type ObstacleBlock from './obstacle_block';
import {SOCKET_LIST} from '../global_data';
type Block = WallBlock | ObstacleBlock;
export default class... |
cb09b0a32ebf9a08d4871114a362bef873788bd0 | TypeScript | GeoSmartCity-CIP/vmm-gsc-geoloket | /src/ts/be/vmm/eenvplus/label/Proxy.ts | 2.546875 | 3 | module be.vmm.eenvplus.label {
'use strict';
export interface Proxy {
map:(labels:Label[], proxyProp:string, idProp:string) => Proxy;
}
export function proxy(proxyObj:any, dataObj:any):Proxy {
return {
map: _.partial(map, proxyObj, dataObj)
};
}
export func... |
f4def145c2904a58b8573f8247346c52ed83047b | TypeScript | QUDUSKUNLE/HeyDay | /src/companies/companies.service.ts | 2.609375 | 3 | import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, DeleteResult } from 'typeorm';
import { CreateCompany } from './dto/create-company.input';
import { UpdateCompany } from './dto/update-company.input';
import { Company } from '../entities/company.entit... |
5150487f29400ab361501d96af60238d2c5bbd54 | TypeScript | gmdmgithub/firebase-crud | /src/app/app.component.ts | 2.53125 | 3 | import { Component } from "@angular/core";
import { AngularFireDatabase, AngularFireList } from "angularfire2/database";
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export cla... |
e018bfc74e179e3f84dfb2adc3fc32ade9fb001c | TypeScript | sushmasetti/typescript | /function.ts | 3.75 | 4 | //function with different types of parameters
function UsingParams(pRequired:boolean,pDefault:string="DBS-ID",pOptional?:number,...pRest:string[]){
console.log(pDefault);
console.log(pOptional);
console.log(pRequired);
console.log(pRest);
}
UsingParams(true);
UsingParams(false,"DBS-492341",100,"a","b","... |
b85c08ef21d12de0ba1ecd023a6e47ee4d658dac | TypeScript | MehriGolchin/planboard | /src/services/project/projectService.ts | 2.71875 | 3 | import { Project } from "../../models";
// Project Services using the Fetch API
const sendHttpRequest = <T>(method: string, url: string, data?: JSON): Promise<T> => {
return fetch(url, {
method: method,
body: JSON.stringify(data),
headers: data ? { 'Content-Type': 'application/json' } : {}... |
6cd4ec2038fa52e7aa9320debece122f67d36272 | TypeScript | HLN177/Toxicity_Prediction_Webapp | /server/src/controller/session.controller.ts | 2.796875 | 3 | import { Request, Response } from "express";
import { validatePassword } from "../service/user.service";
import { createSession, findSessions, updateSession } from "../service/session.service";
import { signJwt } from "../utils/jwt.utils";
import config from 'config';
/**
* create user session
* 1. validate user's p... |
2807839cc76eb138a3594fe92ebf007f4f323ebc | TypeScript | Eviltoastey/ligma-pong | /Source/game/listener.ts | 2.890625 | 3 | class Listener implements Observer
{
callback:Function;
context;
constructor(context)
{
this.context = context;
}
notify()
{
this.callback && this.callback.call(this.context);
}
} |
c32961d69abdb5dcf2c05933f04c8f5592ca1d33 | TypeScript | benbogo312/angular-project | /src/app/firecomps/prods/prods.component.ts | 2.5625 | 3 | import { Component, OnInit, ViewChild } from '@angular/core';
import { AngularFireDatabase } from "@angular/fire/database";
@Component({
selector: 'app-prods',
templateUrl: './prods.component.html',
styleUrls: ['./prods.component.css']
})
export class ProdsComponent implements OnInit {
prods_ar: any[] = [];
... |
173e84d54530a5d25218427a174870671299ac46 | TypeScript | scaine1/bokeh | /bokehjs/test/unit/models/scales/categorical_scale.ts | 3.03125 | 3 | import {expect} from "chai"
import {CategoricalScale} from "@bokehjs/models/scales/categorical_scale"
import {FactorRange} from "@bokehjs/models/ranges/factor_range"
import {Range1d} from "@bokehjs/models/ranges/range1d"
describe("categorical_scale module", () => {
describe("basic factors", () => {
const facto... |
303f52d7e506eedc9adcb73458f4c773c476def5 | TypeScript | fenolang/feno | /config/clear.ts | 2.625 | 3 | var assert = require('assert');
export default function clear(opts?) {
if (typeof (opts) === 'boolean') {
opts = {
fullClear: opts
};
}
opts = opts || {};
assert(typeof (opts) === 'object', 'opts must be an object');
opts.fullClear = opts.hasOwnProperty('fullClear') ?
... |
bc040ac52b536f84675f948264403e958ba8eef7 | TypeScript | longp/typescript_demo | /src/lib/Candidate.ts | 3.015625 | 3 | import ICandidate from '../interfaces/ICandidate'
import IMergedBestCandidate from '../interfaces/IMergedBestCandidate'
import * as faker from 'faker'
import { v4 as uuidv4 } from 'uuid'
import { randomNumber } from '../functions'
const skills = [
'php',
'javascript',
'docker',
'golang',
'c++',
'c',
'pyt... |
9d53ee72020535af439089b18ec4d31c1842c7f7 | TypeScript | farango0728/proyecto-angular12 | /store/src/app/shared/services/shopping-cart.service.ts | 2.609375 | 3 | import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { Product } from 'src/app/pages/products/interfaces/product.interface';
@Injectable({
providedIn: 'root',
})
export class ShoppingCartService {
products: Product[] = [];
private cartSubject = new Subject<Product[]>();... |
440d608af43849e9aaa73e94334b6a037e3974d2 | TypeScript | ppjmpd/cyrilla | /src/__tests__/checkLetter.test.ts | 2.703125 | 3 | import { checkLetter } from '../checkLetter';
import { POLISH_MODERN_ALPHABET_TO_CYRILLIC_1865 } from '../lang/pl/cyrillic1865';
const alphabet = Object.keys(POLISH_MODERN_ALPHABET_TO_CYRILLIC_1865);
const alphabetUpperCase = alphabet.map((letter) => letter.toUpperCase());
const digits = [...Array(10).keys()].map((num... |
ee0a110776c2ea304322fb91a3d2f2e0eb72ed30 | TypeScript | deng-yc/react-demo | /typings/app.d.ts | 3 | 3 |
/**
* 当前环境是否为development
*/
declare var __DEV__: boolean;
/**
* api根路径
*/
declare var __API_ROOT__: string;
/**
* 账号服务api根路径
*/
declare var __AUTH_ROOT__: string;
declare var __PAGE_SIZE__:number;
declare var __MAP_KEY__:string;
interface Window {
}
/**
* render之前调用,在完成首次渲染之前调用,此时仍可以修改组件的state。
*/
declar... |
63fd0ef34a7c4f339065fd0a6d615bc6b6b5c685 | TypeScript | phetsims/scenery | /js/nodes/TextTests.ts | 2.875 | 3 | // Copyright 2021-2023, University of Colorado Boulder
/**
* Text tests
*
* @author Michael Kauzmann (PhET Interactive Simulations)
*/
import DerivedProperty from '../../../axon/js/DerivedProperty.js';
import StringProperty from '../../../axon/js/StringProperty.js';
import Text from './Text.js';
QUnit.module( 'T... |
b83ed910fa5a7bf21e483aaeea2930812ec4f77d | TypeScript | jbcazaux/formation-react-ts | /TPs/solutions/TP-03/model/student.ts | 2.5625 | 3 | class Student {
constructor(public id: number, public lastname: string, public firstname: string, public grades : ReadonlyArray<number>) {
}
static NULL = new Student(0, '', '', [])
}
export default Student
|
4211c7c731c503d2323821a7a104e8d9d98a6a6c | TypeScript | NeelimaNekkalapudi/tmo-ui-2.0 | /src/app/validators/CreditCardValidator.ts | 3.40625 | 3 | /**
* Custom Angular 2 credit card validator - determines if the card number is of a suitable,
* minimum length and passes the
* luhn algorithm test. This does not mean the card is valid to charge against.
*
*/
import {CCValidator} from './CCValidator';
import {FormControl} from '@angular/forms';
// returns a s... |
0c4172c97cefc88a4b3fd77d33841158d4b776b7 | TypeScript | kiwiyou/mycro | /src/constants.ts | 2.5625 | 3 | import { Key, MouseButton } from './model/input'
export const LANGUAGE = {
mouseMove: '위치로 커서를 움직이기',
mouseButton: {
[MouseButton.Left]: '마우스 왼쪽 버튼',
[MouseButton.Right]: '마우스 오른쪽 버튼',
[MouseButton.Middle]: '마우스 휠',
},
mousePress: '누르고 있기',
mouseRelease: '떼기',
mouseClick: '클릭하기',
keyPress: '누... |
3fc936df101da86320dc045ea498b8c59155fcf9 | TypeScript | kavita1verma/ibm-fsd-000GCN | /UI/angular/hello-world/src/app/user/user.component.ts | 2.609375 | 3 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
message:string
users:string[]
employees:Employee[]
showTable:boole... |
350206f9880fa4a1801dbc6f9f4ca1848234258e | TypeScript | RalfNieuwenhuizen/angular2demo | /src/app/introduction.component.ts | 2.796875 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'introduction',
template: `
<h2>Introduction</h2>
<p>In this assignment we’ll be asking you to build a small Angular app (or vanilla js / framework of your choice) that talks to a public api of HackerNews. On the following page you’ll find t... |
6d0c98d7879d21cebe1b98325fd16d2500dd7e67 | TypeScript | ddvlanck/tree_index-1 | /src/persistence/state/DummyStateStorage.ts | 2.703125 | 3 | import StateStorage from "./StateStorage";
export default class DummyStageStorage extends StateStorage {
protected data: object;
constructor() {
super();
this.data = {};
}
public set(key: string, value: string) {
this.data[key] = value;
}
public get(key: string): Prom... |
2fe9a4aa66f7b0582ec8f589af52e1a4f1c5e9ab | TypeScript | brisberg/advent-of-code | /2020/4/src/passport/parser.spec.ts | 3.015625 | 3 | import {Passport} from './model';
import {parse} from './parser';
type ParserTestCase = [string, string, Passport];
describe('Passport Parser', () => {
const testCases: ParserTestCase[] = [
['return an empty passport for empty input', '', {}],
[
'fill passport with parsed fields',
'ecl:gry pid:8... |
2810e03786ca0967c94d7145568506c7dc22e4fd | TypeScript | cheapreats/auto-readme-docs | /src/utils/formatLanguages/formatLanguages.ts | 3.4375 | 3 | import getWebsiteForLanguage from "../getWebsiteForLanguage";
/** Given the api response of languages, returns it in a string arraya format
* @param {Record<string, unknown>} languages - the api response of languages
* @returns {string[]} - Returns languages in an array of strings
*/
export const formatLanguages =... |
516208613999f77fe0cb872df4a4b9dc8b25ee11 | TypeScript | faunX/ogame-2 | /frontend/src/middlewares/LoginPageProcedures.ts | 2.515625 | 3 | import {Middleware} from "redux"
import IRouterConnectivity from "../IRouterConnectivity"
import {loadOverviewPage, loginRequest, registerRequest, registerSuccessful, loginSucceeded} from "../Actions"
export function getLoginMiddleware(conn: IRouterConnectivity) : Middleware
{
return store => next => action => {
... |
a59e943a82b8ee58b0d80c9de1412d64937ecb43 | TypeScript | 210823-java-msa-wvu/Project2Team4 | /Project2/src/app/services/song.service.ts | 2.515625 | 3 | import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { SimpleSong } from '../models/simplesong';
import { Song } from '../models/song';
@Injectable({
providedIn: 'root'
})
export class SongService {
private baseUrl: string = "http... |
59aba704531d9c4a619bca0d34a9bfc65b4e53e4 | TypeScript | cocopon/tweakpane | /packages/core/src/input-binding/color/plugin-object-test.ts | 2.515625 | 3 | import * as assert from 'assert';
import {describe as context, describe} from 'mocha';
import {BindingTarget} from '../../common/binding/target.js';
import {createTestWindow} from '../../misc/dom-test-util.js';
import {TestUtil} from '../../misc/test-util.js';
import {createInputBindingController} from '../plugin.js';... |
b58001bf4904af73b4c9c10d0ca6bb28ecfcf6c5 | TypeScript | mojahige/wasm-img-to-base64 | /src/to-base64.ts | 3 | 3 | export const encode = (image: HTMLImageElement): string | void => {
const canvas = document.createElement("canvas");
const { naturalWidth, naturalHeight } = image;
canvas.width = naturalWidth;
canvas.height = naturalHeight;
const context = canvas.getContext("2d");
if (!context) {
console.error("conte... |
76cc3a06fecc26487ab5c9a04934174e50371d7d | TypeScript | deerhaven-io/gamification | /src/index.ts | 2.53125 | 3 | 'use strict';
import { initKeyBindings } from './keyBinding';
import { initMouseBindings } from './mouseBinding';
import { reRender } from './draw';
import { isBallTouchingPaddle } from './paddle';
import game from './gameState';
const { canvas, ctx, ball, bricks, brick, paddle, keyState } = game;
initKeyBindings(gam... |
76b59f28712a0598c16fa1e0362d6baef9292c34 | TypeScript | jasssim2nine/COMP2068-Lesson01 | /COMP2068-LESSON01/COMP2068-LESSON01/Scripts/game.ts | 2.703125 | 3 | class Player {
strength: number;
constructor() {
this.strength = 10;
}
jump() {
console.debug("chu");
}
}
function main() {
var jay = new Player();
jay.jump();
} |
17e9c336ffd2106a93c8f3694f5c6ff9ec5d52f2 | TypeScript | smart-cancer-navigator/Application | /src/app/routes/entry-and-visualization/genomic-data.ts | 2.78125 | 3 | import { IFilterableSearchOption } from "./filterable-search/filterable-search.component";
import { IMergeable, MergeProperties } from "./data-merging";
import { DrugReference } from "./variant-visualization/drugs/drug";
import {Injectable} from "@angular/core";
import {AssocReference} from "./variant-visualization/ass... |
08feab0b949bafb0f4d47677b5f729ad9b741a8d | TypeScript | brigadaKP/kursovoi | /AudioTrackStore/src/app/components/adminHome/menu/menu-item.service.ts | 2.78125 | 3 | export class MenuItem{
private MenuItem: string;
setMenuItem(MenuItem:string){
this.MenuItem = MenuItem;
};
getMenuItem(){
return this.MenuItem;
}
} |
7ae3c4b9854839115cfd3b8e1d5dfa660443bc7b | TypeScript | Bluefinger/repayne | /src/App/AppContainer.ts | 2.65625 | 3 | /* eslint-disable @typescript-eslint/ban-types */
import { createStream, map as mapStream, scan, throttle } from "rythe";
import merge from "mergerino";
import { render, TemplateResult } from "lit-html";
import { filter, map } from "../utils/iterables";
import {
Service,
Action,
EffectFn,
Component,
App,
Re... |
aeb9ab5645d59b557e1dd2c1f80fbb6e47066f52 | TypeScript | ebkr/r2modmanPlus | /src/model/exports/ExportMod.ts | 2.984375 | 3 | import VersionNumber from '../VersionNumber';
import ManifestV2 from '../ManifestV2';
export default class ExportMod {
private readonly name: string = '';
private readonly version: VersionNumber = new VersionNumber('0.0.0');
private readonly enabled: boolean = false;
public constructor(name: string, v... |
a230360eb209c8d4a52ab7ba284f23835bc4d3ed | TypeScript | koreanwglasses/InteractiveJS | /src/core/Axes2D.ts | 2.609375 | 3 | import { Axes, AxesArgs } from "./internal";
import * as THREE from "three";
import { Vector2, Vector3 } from "three";
import { Hotspot2D } from "../figures/Hotspot2D";
import { Figure } from "./Figure";
import { Label2D } from "../figures/Label2D";
import { Arrow2D } from "../figures/Arrow2D";
import { Point2D } from ... |
c3aa46b4df6ddfee6332f8e490b97679aa798d24 | TypeScript | fravic/kanji-krush | /fe/components/SubjectsDisplay/drawFrame.ts | 2.734375 | 3 | import { Subject } from "fe/lib/subject";
const BOTTOM_SPACE = 300;
type XY = [number, number];
export type ParticleExplosion = {
subject: Subject;
startTime: number;
endTime: number;
particles: Array<{
velocity: XY;
size: number;
}>;
blastRadius: number;
};
export type ParticleExplosionsById = ... |
0f2562c86deeadc182bd3aa789d78fecb983cc6c | TypeScript | pongkot/todo-ts-ff | /src/module/todo/repository/TodoRepository.ts | 2.515625 | 3 | import { Todo } from '../model/Todo';
import { TodoMapping } from '../mapping/TodoMapping';
export class TodoRepository {
private static Model = Todo;
private static Mapping = TodoMapping;
static async getAll(
Model = TodoRepository.Model,
toObject = TodoRepository.Mapping.toObject
): ... |
d4dc32a885c0d37d8c45e5a5f9c7f5703e55c60a | TypeScript | Wattle-bird/canvas-demos | /scenes/easyPaletteScene.ts | 2.65625 | 3 | import { CanvasTool } from '../canvasTool'
import {forEach2d} from '../utils';
export class EasyPaletteScene {
t: number;
running: boolean
paletteLength: number
run() {
if (!this.running) return;
this.c.clear()
// CODE HERE
this.c.ctx.imageSmoothingEnabled = true
this.c.ctx.fillStyle = '... |
685b06732920a849d3a85db47feedc34ba8337af | TypeScript | WhatTheFar/open-reg-backend | /src/form/form.dto.ts | 2.578125 | 3 | import {
IsString,
IsArray,
ValidateNested,
IsIn,
IsBoolean,
IsOptional,
IsMongoId,
IsInt,
} from 'class-validator';
import {
QUESTION_TYPES,
Question,
QuestionTypes,
Choice,
} from './question.model';
import { Type } from 'class-transformer';
import { Form } from './form... |
75bc1e508dd92095bc3d1ff8c0384f8634c455b4 | TypeScript | migueluvieu/KidsTV-Ionic-2.0.0-rc.3 | /src/model/YTBean.ts | 2.578125 | 3 | /**
* @export
* @class YTBean
*/
export class YTBean {
constructor(private _id:string, private _title:string, private _thumbnail:string ) {
}
get id(): string {
return this._id;
}
set id(id:string) {
this._id = id;
}
get title(): string {
return this._title;
}
set title(... |
7791571a07837c6a003e1fa7c52b6917a7607778 | TypeScript | sansanshow/fe-notes | /examples/tscript/demo2/class/abstract.ts | 3.765625 | 4 | abstract class AnimalAbs {
abstract makeSound(): void;
move(): void {
console.log(`${this.name} running....`);
}
constructor(public name:string) {};
}
class YanjingSnake extends AnimalAbs {
makeSound(): void {
console.log('listen: yanjing Snake');
}
constructor(name:string) {
super(name + Ma... |
990cf70f5229c482fd0a48f13329ebc325524903 | TypeScript | prymakD/lets-watch-it-together | /src/lib/api/utils/getSession.ts | 2.65625 | 3 | import { Session } from 'next-auth'
import {
getSession as getSessionNextAuth,
useSession as useSessionNextAuth
} from 'next-auth/client'
/** NextAuth's client with the added user's id. */
export type SessionWithId = Session & {user: {id: number}}
/**
* Server code.
*/
export async function getSession(
param?: P... |
f55ed1ee2a80b72270d626989b5d5b94eff08be9 | TypeScript | fracong/angular-web-component-utils | /src/app/model/carousel/carousel.model.ts | 2.53125 | 3 | /*
* @Author: fracong
* @Date: 2020-08-25 15:19:04
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-04-22 09:23:09
*/
export class CarouselInfo{
beginAuto: boolean; // true is auto, false is unauto
beginAutoDirection:boolean; // true is right, false is left
beginAutoInterval: number; //unit... |
bfa36a52546bbda84dbc824614cf0606ff7c3db3 | TypeScript | EvgHrn/OrdersWorker | /src/routes/index.ts | 2.546875 | 3 | import {isBefore, sub} from "date-fns";
const express = require('express');
const router = express.Router();
const iconv = require('iconv-lite');
const fs = require('fs').promises;
const fsSyncB = require('fs');
router.get('/getOrdersNumbersListByPeriod', async (req, res, next) => {
if(req.query.st !== process.env... |
b46afaca6ae1a9c3dac849e6366d701acc4bccce | TypeScript | actions-on-google/actions-on-google-nodejs | /src/framework/lambda.ts | 2.578125 | 3 | /**
* Copyright 2018 Google Inc. All Rights Reserved.
*
* 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 applica... |
a0069b09e2ee0322a4fd81dd18766bbf250f12bc | TypeScript | nfriend/deck-of-cards | /scripts/typings/deck-of-cards-server/Messages.d.ts | 2.546875 | 3 | interface Message {
messageType: string;
data: any;
}
interface ChatMessage extends Message {
data: {
playerId: string;
message: string;
};
}
interface ChatHistoryMessage extends Message {
data: {
messages: ChatMessage[];
};
}
interface RequestChatHistoryMessage extends M... |
85bed06afd327b8b93f9e0b73cd99d909ee9164b | TypeScript | lostfictions/rot.ts | /example/pubsub.ts | 3.0625 | 3 | interface Subscriber {
handleMessage(message: string, publisher: any, data: any): any;
}
const _subscribers: {
[message: string]: Subscriber[];
} = {};
const w = window as any;
w.publish = (message: string, publisher: any, data: any) => {
const subscribers = _subscribers[message] || [];
subscribers.forEach(s... |
232e6e2d63959a98b25eeac80b80f7a8dfc3cb54 | TypeScript | fterh/heimdall | /lib/forwardInboundOrOutbound.ts | 2.578125 | 3 | import { ParsedMail } from "mailparser";
import { email } from "./env";
import forwardInbound from "./forwardInbound";
import forwardOutbound from "./forwardOutbound";
/**
* Determines if a received email should be
* inbound-forwarded to personal email address,
* or outbound-forwarded as a reply to the sender.
*
... |
4ca380cea9b0850d3fea87d4afa00460913f18a4 | TypeScript | Jroosterman/board-game-helper | /src/app/components/table/table.component.ts | 2.765625 | 3 | import { Component } from '@angular/core';
/**
* This is the main component of the application that is manages the main page of the application.
* This is where everything gets loaded into.
*/
@Component({
selector: 'app-table',
templateUrl: 'table.component.html'
})
export class TableComponent {
rows = 2;
... |
82952c3482dfe6653038c33b59364bc749e3b9a1 | TypeScript | jackieaskins/bananagrams | /client/src/games/GameSidebarState.ts | 2.71875 | 3 | import { useState } from 'react';
type GameSidebarState = {
leaveGameDialogOpen: boolean;
showLeaveGameDialog: () => void;
handleLeaveGameCancel: () => void;
};
export const useGameSidebar = (): GameSidebarState => {
const [leaveGameDialogOpen, setLeaveGameDialogOpen] = useState(false);
const showLeaveGame... |
504519cc2c4746983496b826cb1eba365e558bb2 | TypeScript | aws/aws-app-mesh-examples | /blogs/ecs-service-connectivity/yelb/yelb-ui/clarity-seed-newfiles/src/app/env.service.provider.ts | 2.640625 | 3 | import { EnvService } from './env.service';
export const EnvServiceFactory = () => {
// Create env
const env = new EnvService();
// Read environment variables from browser window
const browserWindow = window || {};
const browserWindowEnv = browserWindow['__env'] || {};
// Assign environment variables f... |
477c48f2e26b5eff05bbd3f0acb6a7c25997c032 | TypeScript | sulivansimoes/QualyS | /QualySAngular/src/app/local/model/local.service.ts | 2.640625 | 3 | // COMPONENTES PADRÕES
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders , HttpErrorResponse } from '@angular/common/http';
import { catchError } from 'rxjs/operators';
import { Observable ,throwError } from 'rxjs';
// COMPONENTES PERSONALIZADOS
import { UsuarioServ... |
7734179bbd7e9e3209cf7b30cdef9e8604590e6e | TypeScript | Anoop2403/My-Repo | /src/services/employee-details/form-manager/form-models/employee-model.ts | 2.546875 | 3 | import {
viewForm,
fieldConstraint,
CustomValidatorsService
} from '../../../../framework';
import {Validators} from '@angular/forms';
interface IEmployeeDetails {
id: string;
employee_name: string;
employee_salary: string;
employee_age: string;
profile_image: string;
}
@viewForm(... |
b223834a9be211b948093895e4db1ac1bbf3160a | TypeScript | Tommo123/algorithm012 | /Week_02/242有效字母异味词/index.ts | 3.984375 | 4 | // 1、有效的字母异位词
// 判断两个字符串长度是否一致,否则返回false
// 若相等,则初始化 26 个字母哈希表,遍历字符串 s 和 t
function isAnagram(s: string, t: string): boolean {
if (s.length !== t.length) return false;
const alpha: number[] = [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... |
462671a96a03a701dc1614f1463d2819299c7d65 | TypeScript | jphilipstevens/kv-store | /src/__tests__/kv-store.ispec.ts | 3.1875 | 3 | import { v4 } from "uuid";
import { Store } from "../index";
describe("KV Integration Tests", () => {
interface StoredDataAndTimestamp {
[key: string] : number;
}
const test = (store: Store<string>, key: string, data: string[]): Promise<StoredDataAndTimestamp> => {
const storedData: StoredDataAndTimesta... |
1220cdfe2db667b155c3a507968d3a1c19658456 | TypeScript | Sunilrai486/FluidFramework | /examples/data-objects/client-ui-lib/src/controls/overlayCanvas.ts | 2.6875 | 3 | /*!
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import * as api from "@fluid-internal/client-api";
import * as ink from "@fluidframework/ink";
import { assert } from "@fluidframework/common-utils";
import * as ui from "../ui";
import { getShapes } from "./canvasC... |
39e46394cc4b5939bace2e6e744c58b6c2ade902 | TypeScript | googleapis/repo-automation-bots | /packages/auto-approve/src/process-checks/owl-bot-template-changes.ts | 2.546875 | 3 | // Copyright 2021 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
19033ec7fa15994aea75106d956eb0a2d28fb4ac | TypeScript | Jefferson00/LovePetsAPI | /src/modules/pets/providers/GeoProvider/models/IGeoProvider.ts | 2.859375 | 3 | interface ILocation{
lat: string;
lon:string;
}
export default interface IGeoProvider {
getDistance(from: ILocation, to: ILocation): number;
convertDistance(distance: number, targetUnit: string): number;
} |
60b728c90e04e57d136713262b4920cb032ba805 | TypeScript | maxbyz/sequence.js | /packages/auth/src/proof.ts | 2.578125 | 3 | import { ethers } from 'ethers'
import { Proof, ValidatorFunc, IsValidSignatureBytes32MagicValue } from '@0xsequence/ethauth'
import { sequenceContext, WalletContext } from '@0xsequence/network'
import { isValidSequenceUndeployedWalletSignature } from '@0xsequence/wallet'
export const ValidateSequenceDeployedWalletPro... |
3d246d8bac46d0eb4289f67642a3b07c9445a1b9 | TypeScript | wgbn/loteria-confere | /src/app/shared/loteria.service.ts | 2.65625 | 3 | import {Injectable} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
@Injectable({
providedIn: 'root'
})
export class LoteriaService {
private jogos: Jogo[] = [];
private concursos: Concurso[] = [];
constructor(private http: HttpClient) {
... |
1f9f3d0729e958684581cd65ca0cbc130a54d975 | TypeScript | QuillDev/TsubasaJS | /src/commands/anime/anime.ts | 2.796875 | 3 | import { Message } from "discord.js";
import { TsubasaCommand } from "../../abstract/TsubasaCommand";
import { sendEmbed, sendErrorEmbed } from "../../helper/embedHelper";
import { getImage, BooruType } from "../../helper/danbooruHelper";
export default class Anime extends TsubasaCommand {
public getName(): string... |
f807c2dc7839537f3b0ab6a363032d9fd50eb2cf | TypeScript | paperbits/paperbits-common | /src/localization/ILocaleService.ts | 2.8125 | 3 | import { LocaleModel } from ".";
export interface ILocaleService {
/**
* Searches for locales that contain specified pattern in their displayName.
* @param pattern {string} Search pattern.
*/
getLocales(): Promise<LocaleModel[]>;
createLocale(code: string, displayName: string, direction?: s... |
107dac165a2d20369c30c7dc2cf34a7e94b53baa | TypeScript | pablomag/dot-pablomag-imgserver | /src/util/Provider.ts | 2.5625 | 3 | import axios from "axios";
import path from "path";
import fs from "fs";
import { PROVIDER_URI, PROVIDER_CLIENT_ID } from "../constants";
export class Provider {
async search(keyword: string, page: number = 1): Promise<any> {
const itemsPerPage = 20;
const url = `${PROVIDER_URI}/search/photos?quer... |
977e733a79e81374296bca30e0aa2998fb61faa9 | TypeScript | volsu-infosystem/service-schedule | /backend/src/institute/dto/create-institute.dto.ts | 2.546875 | 3 | import { IsString, Length } from 'class-validator';
export class CreateInstituteDto {
@IsString()
@Length(3, 256)
readonly name: string;
}
|
1df2e928ef3162acc067efcd69663e5db0912b13 | TypeScript | Aradhey/genshin-optimizer | /src/Database/CharacterDatabase.ts | 2.921875 | 3 | import { ICharacter } from "../Types/character";
import { CharacterKey } from "../Types/consts";
import { deepClone, loadFromLocalStorage, saveToLocalStorage } from "../Util/Util";
export default class CharacterDatabase {
//do not instantiate.
constructor() {
if (this instanceof CharacterDatabase) throw Error('... |
54d9ec2c3ac1c4454ea70eac6ab42c83dec5aa11 | TypeScript | theinningclub/material-slate | /src/plugins/withLinks.ts | 2.9375 | 3 | import { Transforms, Node, Range, Editor } from 'slate'
import { ReactEditor } from 'slate-react'
import { isUrl } from '../util/url'
export type Link = Node & { url: string }
export function matchLink(node: Node): boolean {
return node.type === 'link'
}
export function insertLink(editor: Editor, url: string): voi... |