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 |
|---|---|---|---|---|---|---|
4857cd10ce1d389c60078777c0e0c7b7cad6bc20 | TypeScript | StateFlex/StateFlex | /src/utils/htmlElements.util.ts | 2.875 | 3 | // HTML elements that the user can choose from
interface htmlElementInt {
width: number;
height: number;
attributes: Array<string>;
}
interface htmlElementsInt {
[key: string]: htmlElementInt;
}
const HTMLelements: htmlElementsInt = {
image: {
width: 100,
height: 100,
attributes: ['className', '... |
3964688763e3e62bb0102841e4ffe51dd588cc0d | TypeScript | gfawcett22/ScheduleGraph | /FrontEnd/src/app/schedule/run.component.ts | 2.515625 | 3 | import {Component, Input, OnInit} from '@angular/core';
import {IRun} from "./run";
enum colors{
lightblue,
lightgreen,
lightred,
lightgray,
lightyellow
}
@Component({
selector: 'app-run',
styles: ['.run {display:inline-block; border:1px solid black; height:60px; position:absolute}'],
template: `
<di... |
45c49803f140c605217f743ce6bcccd103c6289b | TypeScript | pagopa/io-dev-api-server | /src/features/fastLogin/nonceHandler.ts | 2.828125 | 3 | import { randomBytes } from "crypto";
import { pipe } from "fp-ts/lib/function";
import { Request } from "express";
import * as O from "fp-ts/lib/Option";
import { getDateMsDifference } from "../../utils/date";
export const NONCE_EXPYRING_MS = 30000;
export type NonceInfo = {
nonce: string;
instantiationDate: Dat... |
fa4dd84d5817c366d8d9cfd79c6b8370a7400fcd | TypeScript | NotWoods/color-breakdown | /src/db-worker/process-entry.ts | 2.9375 | 3 | import { HistoryEntry, PaletteEntry } from '../entry';
/**
* Convert Data URI representing an image into a blob with the same data.
* @see https://stackoverflow.com/questions/12168909/blob-from-dataurl
*/
export function dataUriToBlob(dataUri: string) {
const [header, data] = dataUri.split(',', 2);
// sepa... |
c11872286bdefc12c6f1ff8ece4571715e49177d | TypeScript | chronologic/automate-api | /src/middleware/authMiddleware.ts | 2.578125 | 3 | import { Response, NextFunction } from 'express';
import logger from '../logger';
import { UnauthorizedError } from '../errors';
import { RequestWithAuth } from '../models/Models';
import { UserService } from '../services/user';
export const authMiddleware = async (req: RequestWithAuth, res: Response, next: NextFunct... |
1bc52c38afa500da309417bb703f62677cd71362 | TypeScript | nihaux/yarec | /src/getToken.ts | 2.59375 | 3 | import { BadAuthorizationCodeError } from './errors';
import { ScopeEnum } from './types';
import { makePost } from './utils/makePost';
import { getBasicAuthHeader } from './utils/getBasicAuthHeader';
import { validateTokenResponse } from './utils/validateTokenResponse';
export type CommonGetAccessTokenArgs = {
read... |
6106d22609d5c4dd37bb293e4197f05b12b35814 | TypeScript | cadavidf/angular-cli | /packages/angular_devkit/schematics/src/rules/schematic.ts | 2.5625 | 3 | /**
* @license
* Copyright Google Inc. 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
*/
import { of as observableOf } from 'rxjs';
import { last, map } from 'rxjs/operators';
import { ExecutionOptions, Rul... |
3353a9a1b611da8a95ee1214f6119f300fe178f4 | TypeScript | elko-dev/nodejs-graphql-typescript-template | /src/service/user.service.ts | 2.6875 | 3 | import {UserEntity} from "../models/user.entity";
import {
QueryGetUserArgs,
MutationSignUpUserArgs, MutationSignUpAuthorizedUserArgs
} from "../graphql/generated";
import {getRepository, Repository} from "typeorm";
import {Auth, AuthDetails} from "../auth/auth";
import {isValidEmail} from "../utils/validation.... |
ed12bb6c5c6080c225a44618c273bf0eafb9410a | TypeScript | triptease/google-ads | /src/extract.ts | 3.359375 | 3 | import { isArray, forOwn } from "lodash";
import Long from "long";
type Primitives = string | number | undefined | null | Long;
type CastPrimitive<V> = V extends Long ? number : V;
type MapReturnType<X> = X extends Primitives
? CastPrimitive<X>
: X extends { value?: infer V }
? CastPrimitive<V>
: X extends Arr... |
c7f0ec8a4bca594549b3bd4c2684e957f2ac616a | TypeScript | CabbageSlices/KnN | /src/utils/__tests__/flatten-obj.test.ts | 3.46875 | 3 | import computePathsToNestedAttributes, { defaultPathFormatter } from 'utils/flatten-obj'
it('default path formatter combines path and connects with a .', () => {
const path = ['value', 'value2', 'depth3']
expect(defaultPathFormatter(path)).toBe('value.value2.depth3')
const path2 = <string[]>[]
expe... |
cdc146c617824202fb88def6eee518f181f4a21b | TypeScript | matt783/dex-react | /src/utils/validation.ts | 3.0625 | 3 | import { ValidationError, ObjectSchema } from '@hapi/joi'
import { ValidationResolver } from 'react-hook-form'
import { validInputPattern } from 'utils'
export function preventInvalidChars(event: React.KeyboardEvent<HTMLInputElement>): void {
if (
event.key !== 'Backspace' &&
event.key !== 'Delete' &&
!v... |
5e6eaed2da16d4d7a4f73c7f062b4ce4c3daeb8f | TypeScript | achavez73/angularHello | /src/app/app.component.ts | 2.8125 | 3 | import { UsuariosService } from './usuarios.service';
import { Component, OnInit } from '@angular/core';
import { PostsService } from './posts.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers : [
UsuariosService
]
})
export cl... |
bca976550dfb5a56840cb527af863ba8ba44845c | TypeScript | bobheadxi/seer | /web/src/math/aggregates/index.ts | 2.96875 | 3 | import { Participant } from '@/api/types';
// overviews
export interface TeamOverview {
aggs?: CompiledTeamAggregations,
}
export interface PlayerOverview {
tier?: string;
aggs?: CompiledPlayerAggregations;
}
export interface PlayerOverviews { [name: string]: PlayerOverview }
export interface Overviews {
t... |
93fc4e288d6613a5371fb273ecf3e8101818cdc9 | TypeScript | jaybyron/melody | /packages/melody-idom/src/node_data.ts | 2.578125 | 3 | /**
* Copyright 2015 The Incremental DOM Authors.
* Copyright 2017 trivago N.V.
*
* 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
*
... |
bcc25f170f75e07a49111c532709d9acc5ac9114 | TypeScript | samchon/ecol | /src/linear/DequeCollection.ts | 3.078125 | 3 | import { Deque } from "tstl/container/Deque";
import { ICollection } from "../basic/ICollection";
import { IForwardIterator } from "tstl/iterator/IForwardIterator";
import { CollectionEvent } from "../basic/CollectionEvent";
import { EventDispatcher } from "../basic/EventDispatcher";
export class DequeCollection<T>
... |
a43c7bf00f16f0d06868235f978b6edd946f4d2d | TypeScript | asaleh267/exercises-in-programming-style | /chapter9/index.ts | 3.765625 | 4 | // This way using class
import { write, readFile } from "fs";
class TFTheOne {
value;
constructor(v) {
this.value = v;
}
bind(func) {
this.value = func(this.value);
return this;
}
// print data
printMe(data) {
console.log(data.slice(0, 25))
}
/... |
d36288de326830d38faa9c1b59a771046dcb0c17 | TypeScript | Dirichi/football | /src/client/graphics/box_graphics.ts | 2.671875 | 3 | import { EVENTS } from "../../constants";
import { EventQueue } from "../../event_queue";
import { Field } from "../../game_objects/field";
import { IAnimationEngine } from "../../interfaces/ianimation_engine";
import { IBoxSchema } from "../../interfaces/ibox_schema";
export class BoxGraphics {
public engine: IAnim... |
ff5de8fea5f0dd4938950fd82a00ccadac855e52 | TypeScript | tarvyn/data-structures | /src/queue.ts | 3.609375 | 4 | import { LinkedList } from './linked-list';
export interface Queue<T> {
enqueue: (value: T) => void;
dequeue: () => T | undefined;
isEmpty: () => boolean;
toArray: () => T[];
}
export class ArrayQueue<T = unknown> implements Queue<T> {
private readonly list: T[] = [];
enqueue(value: T): void {
this.l... |
1bef5be6cf1a859e7528f7f628b65e0741a98a4f | TypeScript | AlexandrePereira0011/jogopw | /jogo/src/app/classes/weapons.ts | 2.59375 | 3 | export class Weapons {
constructor(api: any){
this.name = api.nome;
this.atk = api.Atk;
this.TipoDeArma = api.TipoDeArma;
this.Durabilidade = api.Durabilidade;
this.idPersonagem = api.IDPersonagem;
}
name;
Durabilidade;
atk;
idPersonagem;
Tipo... |
c1677f034a6f7c8edc21bb70895d56d049d254d5 | TypeScript | anli/rna-scorebook | /src/screens/menu-add/use-menu-items.ts | 2.640625 | 3 | import R from 'ramda';
import {useState} from 'react';
type Group = {
name: string;
maxCount: number;
items: [string, string][];
};
const useMenuItems = () => {
const [pickedMap, setPickedMap] = useState<{
[key: string]: boolean;
}>({});
const rolls = Object.entries(rollsMap);
const specials = Objec... |
4186c9c843a938219643859f95b60c7daab8c60f | TypeScript | tom-hewitt/engine | /src/editor/utils/colorUtils.ts | 2.546875 | 3 | export function rgbToInt({ r, g, b }: rgb) {
// 16^4 = 65536
// 16^2 = 256
return r * 65536 + g * 256 + b;
}
|
1f2f4981ba5a6efe8f23cf686dee1c876dc86e7f | TypeScript | ablahsini/ematchit | /ematchitFront/src/app/resume.ts | 2.859375 | 3 | export class Resume {
id:number;
name:string;
file:string;
public static fromJson(json: Object): Resume {
var resume = new Resume()
resume.name = json['name']
resume.file = json['file']
return resume;
}
} |
14f8a2da30030fe1ee057b75044321fa937df43a | TypeScript | l3miage-azizm/examen-2021-s6-8hk8iq | /src/app/games.service.ts | 2.828125 | 3 | import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { Game, newGame } from './Game';
interface GamesServiceInterface {
readonly gamesObs: Observable<Game[]>;
newGame(): void;
play(id: number, col: number): void;
}
@Injectable({
providedIn: 'root'
})
export cl... |
c602b7f2d941e86f73b00a68ed48c17a6f09a801 | TypeScript | yanche/compiler | /src/language/RegEx/astprocess.ts | 2.75 | 3 |
import { IdGen, flatten, CharCode, NodeId } from "../../utility";
import { ASTNode } from "../../compile";
import { createNFA, NFA, Transition } from "../../automata";
export abstract class ASTNode_REGEX extends ASTNode {
public toNFATransition(idGen: IdGen, start: NodeId, terminal: NodeId): ReadonlyArray<Transit... |
d84c61e683c5c7644c407dbb2573ac029ea01a07 | TypeScript | leandrosineriz/LaboratorioIII | /Clase4/htdocs/Clase4/javascript/validaciones.ts | 2.5625 | 3 | namespace Test{
let xhttp:XMLHttpRequest=new XMLHttpRequest();
export function ValidarUsuario()
{
var usuario:string=(<HTMLInputElement>document.getElementById("txtUsu")).value;
var contraseña=(<HTMLInputElement>document.getElementById("txtPass")).value;
xhttp.open("GET","backend/... |
5c10098dde3224183ade3000416130354be50e94 | TypeScript | Sergyus/pwa | /src/api/generated/types.d.ts | 2.796875 | 3 | export type Maybe<T> = T | null;
export type Exact<T extends { [key: string]: unknown }> = {
[K in keyof T]: T[K];
};
export type MakeOptional<T, K extends keyof T> = Omit<T, K> &
{ [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> &
{ [SubKey in K]: Maybe<T[SubKey]> };
... |
b8f909ff0c82553480000368d1acf060f8e855c7 | TypeScript | catull/calendariale | /src/calendar/RomanCalendar.ts | 2.984375 | 3 | import { amod, mod } from '../Astro';
import { INVALID_COUNT, INVALID_LEAP_DAY, INVALID_MONTH, Month, ROMAN_MONTH_MAX_DAYS, RomanEvent } from '../Const';
import { JulianCalendar } from './JulianCalendar';
import type { JulianDate } from './JulianDate';
import { RomanDate } from './RomanDate';
import { CalendarDateVali... |
85d08a2dc836eedd926cd6fde8a3ff9dc2243a29 | TypeScript | molvqingtai/yunzhixin-official | /src/hooks/useDebounce.ts | 3.046875 | 3 | import { useState } from 'react'
const useDebounce = (func: Function, delay: number): (() => void) => {
const [prevTime, setPrevTime] = useState(+new Date())
return (...args: []) => {
const nowTime = +new Date()
console.log('prevTime', nowTime - prevTime)
if (nowTime - prevTime >= delay) {
setPr... |
9ee06d6ae5219329417673b05b7bf113785e912b | TypeScript | marcokam/Nudge | /Nudge.ClientSDK/Util/fp/Instances/Compare.test.ts | 3.53125 | 4 | import { Compare } from "./Compare";
import { propOr } from "../object";
import { Comparator } from "../function";
const flipDir = <A>(f: Comparator<A>) => (a: A, b: A) => f(a, b) === 0 ? 0 : f(a, b) === -1 ? 1 : -1;
const ascNum = (a: number, b: number) => a === b ? 0 : a < b ? -1 : 1;
const ascString = (a: str... |
c081a59b8849020c6109c2ebfe359b903513f80d | TypeScript | vuestorefront/storefront-ui | /packages/sfui/shared/utils/browser.ts | 2.546875 | 3 | export const isBrowser = typeof window !== 'undefined';
export const isReduceMotionEnabled = isBrowser && window?.matchMedia('(prefers-reduced-motion: reduce)').matches;
declare global {
interface Navigator {
userAgentData?: {
platform: string;
brands: {
brand: string;
version: string... |
45db8c9502b3bb2a7a027f321dca713f72494155 | TypeScript | vold-io/stellium | /src/@stellium-common/tools/sort_functions.ts | 3.09375 | 3 | export const sortByKey = (collection: Array<any>, key: string): Array<any> => {
return collection.sort((a, b) => {
if (a[key] < b[key]) return -1;
if (a[key] > b[key]) return 1;
return 0;
});
};
|
6d58fc89f1c0c32afd2f84351aa6072b01335731 | TypeScript | corefunc/corefunc | /array/search/search-linear.ts | 3.4375 | 3 | export function arraySearchLinear(array: number[], target: number): number {
for (let index = 0; index < array.length; index++) {
if (array[index] === target) {
return index;
}
}
return -1;
}
|
5c93b15241874b0d81e73c708ec6665d3979e9b4 | TypeScript | mickielreid/Auth0-Spring-Angular | /Angular/src/app/shared/SortingTypesHolder.ts | 3.015625 | 3 |
import { Student } from 'src/app/classes/student';
// this class holds all the interface and types needed to sort the student and admin tables
export type SortColumn = keyof Student | '' ;
export type SortDirection = 'asc' | 'desc' | '';
export const rotate: {[key: string]: SortDirection} = { 'asc': 'desc', 'desc': '... |
d1a3cd5a62bbd2a65e78d784b639111823861d9e | TypeScript | chewtoys/api-1 | /app/Models/HouseType/index.ts | 2.546875 | 3 | /**
* @description Тип дома
*/
export default (sequelize: any, Sequelize: any) => {
const HouseType = sequelize.define("house_type", {
house_type_id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false,
notEmpty: true
},
name: {
type: S... |
06a6148654d69157cb79432f63308b2d8d8d35e2 | TypeScript | cotsell/-Ang-OldNote-Cli | /src/app/service/gater.service.ts | 2.515625 | 3 | import { Injectable, EventEmitter } from '@angular/core';
// 이 서비스는 Give And Take하는 용도의 중개자 서비스에요.
// 한번에 여러개의 구독자가 생기는 경우에는 어떻게 할 지 고민을 해봐야 겠어요.
// 배열을 막 이렇게 끼얹나?
@Injectable()
export class GaterService {
giveEvent: EventEmitter<any> = new EventEmitter();
takeEvent: EventEmitter<any> = new EventEmitter();
con... |
9f9173de27ddd3b7d0fced08364d803d16b24595 | TypeScript | ryoboua/starship_royal | /game/classes/Game.ts | 2.609375 | 3 | import Lobby from "../../shared/classes/Lobby"
import AsteroidField from "./AsteroidField"
import { ClientModel, GameModel, Level, PlayerPositionUpdate, GameActionContext as GameFrontEndContext, GameState, PlayerScores } from "../../shared/interfaces";
import { GRID_SIZE, ROUND_TIME, GAME_OVER_REASONS } from "../consta... |
294fb817b933354f2f17803aae83998668f5b466 | TypeScript | anselmstordeur/myTsChess | /Pieces/Rook.ts | 2.859375 | 3 | /**
* Created by Anselm Stordeur on 11/24/16.
*/
import {Piece} from "../Piece";
import {Player} from "../Player";
import {Vector} from "../Primitives/Vector";
export class Rook extends Piece {
/**
* Creates a new Rook
* @param {Vector} position
* @param {Player} player
* @param {object} options
* ... |
6a0badbf27ea276d9cb195c8c40e9356092cdd51 | TypeScript | sourvinos/transfers-v3.9 | /ClientApp/src/app/shared/pipes/format-number.pipe.ts | 2.703125 | 3 | import { Pipe, PipeTransform } from '@angular/core'
import { HelperService } from '../services/helper.service'
@Pipe({ name: 'formatNumber' })
export class FormatNumberPipe implements PipeTransform {
//#region variables
private language = ''
private seperators = []
private regEx = /(\d)(?=(\d{3})+(?... |
4395154257cf975e407df2e6306ef0067a149e78 | TypeScript | smeup/ketchup | /packages/ketchup/src/managers/kup-debug/kup-debug-declarations.ts | 3.0625 | 3 | /**
* Interface for the logs of KupDebug.
*/
export interface KupDebugLog {
category: KupDebugCategory;
date: Date;
id: string;
element: string | Object;
message: string;
}
/**
* Interface for printed logs.
*/
export interface KupDebugLogPrint {
[index: string]: {
date: string;
... |
406e10f8aa93097290c7042541e12350d2a8d97d | TypeScript | ucll-algoritmisch-denken/testing-framework | /src/animation/number-animation-builder.ts | 3.171875 | 3 | import { IAnimation } from './animation';
import { constant } from './constant';
import { sequence } from './sequence';
import { linear } from './linear-animation';
function appendJump<T>(animation : IAnimation<T>, value : T) : IAnimation<T>
{
const appended = constant(value, 0);
return sequence(animation, a... |
9be8dbc922b0de9945024618428599624ce3913c | TypeScript | maziac/asm-api-doc-tool | /src/labelsfile.ts | 3.234375 | 3 | import { readFileSync } from 'fs';
import { HierarchyEntry } from './hierarchyentry';
/**
* Class to represent the list file.
*/
export class LabelsFile {
/// All the lines of text read from the file.
public lines: Array<string>;
/**
* Reads the labels file.
* @param filename
*/
c... |
f1f86980d5737f826465af62a89c2d970991cfce | TypeScript | taoyuan/biner | /src/encoding-length.ts | 2.96875 | 3 | import {isUserType, isType} from './util';
import * as symbols from './internal/symbols';
import {Metadata} from './internal/meta';
/**
* Get the number of bytes to encode `obj` using `schema`.
* @param {*} obj Any valid js object.
* @param {Object} schema
* @returns {number}
*/
export function encodingLength(obj... |
800f7918d93456c202c67749885ffa2344dabf00 | TypeScript | SSmJaE/cxmooc-tools | /src/internal/app/mooc.ts | 2.734375 | 3 | import {CxPlatform} from "../../mooc/chaoxing/platform";
import {ZhsPlatform} from "../../mooc/zhihuishu/platform";
import {Course163Platform} from "../../mooc/course163/platform";
import {IEventListener} from "@App/internal/utils/event";
import {Task} from "@App/internal/app/task";
// 事件
export type MoocEvent = "comp... |
27bfa9dd37f34136c226313d9deb5bd3e95863c0 | TypeScript | AkashSDas/typescript_code_snippets | /01_basic_types/basic_types.ts | 4.4375 | 4 | // ****** Basic types ******
// ===================
// Boolean
// ===================
let isDone: boolean = true;
let isAlive: boolean = false;
// ===================
// Number
// ===================
// As in JavaScript, all numbers in TypeScript are either floating point values or BigIntegers.
// These floating poin... |
5292b1f76eb34cafd7343baf97ee9677cc512bcf | TypeScript | JSProxy/tooldir | /设计模式/share/src/factory.ts | 3.96875 | 4 | //简单工厂
interface IComputer {
opend(): void
}
class IntelComputer implements IComputer {
public opend(){
console.log('这是 intel 的电脑')
}
}
class AmdComputer implements IComputer {
public opend(){
console.log('这是 amd 的电脑')
}
}
class ComputerFactory {
public produce(type: String): ... |
c70167eb8525c751e8de209bded95f9e7c444093 | TypeScript | Richardowsky/remme-client-js | /packages/remme-transaction-service/src/index.ts | 2.5625 | 3 | import { RemmeMethods, IRemmeApi } from "remme-api";
import { IRemmeAccount } from "remme-account";
import { sha512, NodeConfigRequest } from "remme-utils";
import * as protobuf from "remme-protobuf";
import { IRemmeTransactionService } from "./interface";
import {
BaseTransactionResponse,
IBaseTransactionResp... |
65ce3d6fd2147c380bdb34eabbac1e37c0e12a32 | TypeScript | juniorpb/r3-ts-cli | /src/lib/route.ts | 2.640625 | 3 | import chalk from 'chalk';
import fs from 'fs';
import CLI from 'clui';
// Libs
const Spinner = CLI.Spinner;
class Route {
private setImport(file: any, importStr: string) {
const data = fs.readFileSync(file, 'utf-8');
const result = data.replace(/\/\* Routes \*\//g, importStr);
fs.writeFileSync(file, r... |
8a3b4ceea3dd497a3754b3c79b43b0599b1eb652 | TypeScript | uber/baseweb | /src/helpers/responsive-helpers.ts | 2.703125 | 3 | /*
Copyright (c) Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
import type { Breakpoints, Theme } from '../styles';
import type { Responsive } from '../layout-grid';
import type { MediaQueryPageMargins, PageMargins } f... |
f03f971b9e90334449f99b4e3b448e2b55610957 | TypeScript | eirikhm/smokeJs | /src/math/Vector2D.ts | 3.8125 | 4 | class Vector2D
{
public x:number;
public y:number;
constructor(x = 0, y = 0)
{
this.x = x;
this.y = y;
}
public add(vector:Vector2D):void
{
this.x += vector.x;
this.y += vector.y;
}
get magnitude():number
{
return Math.sqrt(this.x * this... |
9342215f83d44c4caacf1b362f7eb35858aca6fe | TypeScript | lowcodeunit/lcu-hamburger-menu | /projects/common/src/lib/models/hamburger-menu.model.ts | 3.0625 | 3 | export class HamburgerMenuModel {
public Label:string;
public Url:string;
public Disabled:string;
public Icon?:string;
public Param?:string;
/**
*
* @param label The string to be displayed in the menu
*
* @param icon The icon that accompanies the menu string
*
*... |
0aa2ad58501c872431fa9bb8baa056d3c6706f86 | TypeScript | chapagain/neon-dash | /src/app/services/visualization.service.ts | 2.5625 | 3 | /*
* Copyright 2017 Next Century Corporation
* 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 ... |
ae40d1e866af50407606c9d4879e076f55b84289 | TypeScript | Modern-Knowledge/serious-game-backend | /src/util/mail/Recipient.ts | 2.90625 | 3 | /*
* https://nodemailer.com/message/addresses/
*/
export class Recipient {
public readonly name: string;
public readonly address: string;
/**
* @param name name of the recipient
* @param address email of the recipient
*/
constructor(name: string, address: string) {
this.name =... |
bf18556f2e32d1d1c67daa9964d61ffa71b1c29e | TypeScript | lennyferrell/terminus-ui | /terminus-ui/src/validators/validators/numbers/numbers.spec.ts | 2.96875 | 3 | // tslint:disable: no-non-null-assertion
import { FormControl } from '@angular/forms';
import { numbersValidator } from './numbers';
describe(`numbersValidator`, () => {
beforeEach(() => {
this.validatorFn = numbersValidator(2);
});
describe(`if the control is invalid`, () => {
test(`should return ... |
3ba07857e259c323e901d497a749e0b2b5924759 | TypeScript | kmccullough/recipe-book | /src/app/component/view/collection/collection-item.service.ts | 3.078125 | 3 | export interface ItemValue {
key: string;
itemValue: any;
}
/**
* Store and access registered view components
*/
export class CollectionItemService {
values = new Map<string, ItemValue>();
constructor() { }
/**
* Register view component by key with optional predicate
* @param key Unique key to reg... |
7f3c8bb29b8f18c8e00a67a3bcd975b5075f2f4a | TypeScript | lgmf/ng-rxjs-store | /src/app/contact/components/contact-list.component.ts | 2.53125 | 3 | import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Contact } from '../store';
export interface ClickedEvent {
id: number;
}
@Component({
selector: 'app-contact-list',
template: `
<h1 class="title">{{ title }}</h1>
<ul class="list-group">
<li *ngFor="let item of data" ... |
5b95a5c7af78b8d742a63388612a49e55c44a192 | TypeScript | BiloCode/Food-Proyect | /packages/web/src/application/core/puntuaction/UpdateUserDataInPuntuactions.ts | 2.5625 | 3 | import firebase from "firebase";
import { FirebaseCollectionNames } from "config/constans";
type UpdatedData = {
_id: string;
fullName: string;
profileImageUrl: string;
};
class UpdateUserDataInPuntuactions {
public static exec = async (userData: UpdatedData) => {
const db = firebase.firestore();
con... |
56aac75371122c0febd814bca8f6a7c7c04394eb | TypeScript | HenriSup/DabTheWave | /assets/Scripts (5)/RythmBorderBehavior (31)/script.ts | 2.734375 | 3 | class RythmBorderBehavior extends Sup.Behavior {
private timeAlive:number
private isPlayerBorder:boolean=false
awake() {
this.timeAlive=0
this.actor.spriteRenderer.setOpacity(-1)
}
update() {
this.setSprite()
if (this.actor.spriteRenderer.getOpacity()==-1){
this.actor.spriteRenderer.set... |
3bb043ee43afedf68864d922c2fe6a304310f8b3 | TypeScript | SmartCampus/ecoknowledge | /backend/src/TimeBox.ts | 2.796875 | 3 | /// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/moment/moment.d.ts" />
/// <reference path="../typings/moment-timezone/moment-timezone.d.ts" />
var moment = require('moment');
var moment_timezone = require('moment-timezone');
import Clock = require('./Clock');
class TimeBox {
... |
2768e5e45407310b8bbb9546e3112f6c631e04e8 | TypeScript | alexander-shipilov/positron | /utils/observer/types/ObserverCallback.ts | 2.96875 | 3 | import { ObserverInterface } from "./Observer.interface";
import { ObserverRecord } from "./ObserverRecord";
/**
* Callback function to call when observer event occurred
*/
export type ObserverCallback<
Record extends ObserverRecord<unknown>,
Observer extends ObserverInterface<unknown, unknown, Record>
> = (reco... |
21e3aa26af0ed29ee6829c6a36b970636b1c44f9 | TypeScript | tryguba/form_service | /src/source/patterns/singleton/decorators/constructor-parameter/functional.ts | 3 | 3 | import { ConstantConstructorParameter, FunctionConstructorParameter } from '../../constructor-parameter';
import { getMetadataStorage } from '../../singleton.metadata.storage';
import { SingletonStorage } from '../../singleton.storage';
export function Functional<Type>(operator: (storage: SingletonStorage) => Type): P... |
3c908b17db2de4cfc7f8a2aa7ccb1f2bfd3b1ddb | TypeScript | lovefcaaa/abc | /examples/ultra_cat_app/cat/cat.ts | 2.625 | 3 | export class Cat {
id?: number;
name?: string;
age?: number;
}
export interface CatDTO {
name: string;
age: number;
}
|
9d01fb022a04a3ae5182dc05fc2cfab840db9580 | TypeScript | Kamiapp-fr/kami-flash | /dist/types/enum/ColorProgressBar.d.ts | 2.78125 | 3 | /**
* Determine the progress bar color should be used which each type.
* @enum ColorProgressBar
*/
declare enum ColorProgressBar {
OK = "#008e72",
ERROR = "#ff0056",
WARNING = "#ff3000",
INFO = "#0081ff"
}
export default ColorProgressBar;
|
cde44e473e0c81e3370b7919c4e98e8e4e9cf1c0 | TypeScript | iBhavesh/expo-template-redux_tookit-typescript | /src/features/counter/counter.ts | 2.734375 | 3 | import { createSlice } from "@reduxjs/toolkit";
type InitialState = {
count: number;
};
const initialState: InitialState = {
count: 0,
};
const counter = createSlice({
name: "counterSlice",
initialState,
reducers: {
increment: (state) => {
state.count++;
},
decrement: (state) => {
s... |
3468b4483bd7628d3dbc3862ebcb7ecc8b4b3893 | TypeScript | ConfidentCannabis/react-query | /src/core/queryInstance.ts | 2.75 | 3 | import { uid, isServer, isDocumentVisible, Console } from './utils'
import { Query, QueryState } from './query'
import { BaseQueryConfig } from './types'
// TYPES
export type OnStateUpdateFunction<TResult, TError> = (
state: QueryState<TResult, TError>
) => void
// CLASS
export class QueryInstance<TResult, TError... |
f19238acda088bdc96596611b3539ee595b3e83c | TypeScript | kaoengine/kao-blog-react-ssr-yaml | /src/server/index.ts | 2.78125 | 3 | import * as http from "http";
import app from "./app";
import { parse } from "path";
// Look for Markdown files in /posts non-recursively
const context = require.context("/posts", false, /\.md$/);
const posts = context.keys().map((filePath) => {
const slug = parse(filePath).name;
const post = context(filePath);
... |
35356b746401afb59e7aafd457f11da8929cb84a | TypeScript | slooi/AntSimulation | /src/client/main.ts | 2.90625 | 3 | import Game from "./Game";
console.log("Main.ts loaded");
/* DEPENDENCIES */
const canvas = document.getElementById("canvas") as HTMLCanvasElement;
/* MAIN CODE */
const game = new Game({ canvas });
window.addEventListener("keydown", (e) => {
// Note pheromones dissapear only in render stage
// game.speed d... |
bd69c82ede7c325234b51b73dddaaf6e4e6a7797 | TypeScript | ymolists/polyhedra-viewer | /src/math/operations/__tests__/prismOps.test.ts | 2.71875 | 3 | import { elongate, gyroelongate, shorten, turn } from "../prismOps"
import { Polyhedron } from "math/polyhedra"
describe("elongate", () => {
describe("canApplyTo", () => {
function expectApplyTo(name: string, value: boolean = true) {
expect(elongate.canApplyTo(Polyhedron.get(name))).toEqual(value)
}
... |
1444f0910d355e85e0b41e2761b96051709fe832 | TypeScript | jolocom/jolocom-lib | /tests/recovery/socialRecovery.test.ts | 2.59375 | 3 | import { SocialRecovery } from '../../ts/recovery/socialRecovery'
import { expect } from 'chai'
import { testDID32, testSecret32, testShares } from '../data/recovery.data'
describe('Social Recovery', () => {
it('should create and combine', function() {
const amount = 255
const threshold = 50
const shards... |
80e887e312d5ebc5f63b8f9237b63c3e4638d137 | TypeScript | ProgramowanieZespoloweIS2021/frontend | /src/state/_redux/user/module.ts | 2.71875 | 3 | export type User = {
id: number;
email: string;
firstName: string;
surname: string;
};
export type UserModule = {
authorized: boolean | null;
id: number | null;
email: string | null;
};
export const initialState: UserModule = {
authorized: null,
id: null,
email: null,
};
|
ae8322230947d7c749bdaab8efb16e060457efcc | TypeScript | RoTour/robin-tourne-cvsite-client | /src/app/models/post.model.ts | 2.75 | 3 | export class Post {
id!: number;
ownerName!: string;
text!: string;
createdAt!: Date;
updatedAt!: Date;
constructor(id: number, text: string, createdAt: Date, updatedAt: Date, ownerName: string) {
this.id = id;
this.text = text;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
th... |
9cd51da30ef2f36d4ff5c3c0b7eb6de796d8cfdc | TypeScript | Zoweb/Buildr | /packages/Client/src/ts/logging/LogLevel.ts | 3.109375 | 3 | import {LogColour} from "./LogColour";
export enum LogLevel {
LEMON,
DEBUG,
INFO,
WARN,
ERROR
}
export function getLevelColour(level: LogLevel): LogColour {
switch (level) {
case LogLevel.LEMON: return LogColour.PURPLE;
case LogLevel.DEBUG: return LogColour.BLUE;
case L... |
49b1801e9c773c88e48135baee6355a7a216b042 | TypeScript | westvo/q-a-site | /src/questions/questions.service.ts | 2.53125 | 3 | import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { CreateQuestionDto } from './dto/create-question.dto';
import { UpdateQuestionDto } from './dto/update-question.dto';
import { Question } from './entities/question.entity';
@In... |
c31af09b68ef67d7bb537334165b3313d5b4c7ed | TypeScript | sandialabs/common | /src/COMMONWeb/app/classes/applications.ts | 2.828125 | 3 | interface IApplicationInfo {
name: string;
version: string;
}
export interface IDeviceApplications {
deviceID: number;
applications: IApplicationInfo[];
timestamp: string;
}
class DeviceApplications {
deviceID: number;
applications: IApplicationInfo[];
timestamp: Date;
constructo... |
be4e5e383807142d178ece173b275401a2a341e2 | TypeScript | lucianoadan/mumablue-challenge | /front/src/app/core/models/api-response.ts | 2.59375 | 3 | export interface ApiResponse<T> {
errors: string[];
message: string;
payload: T;
} |
f9b22201927b7ebb8ea2fba8f5fb1bf6d9b09012 | TypeScript | taikeguluer/dapp-boilerplate | /src/Translation/Translation.ts | 2.78125 | 3 | import { env, utils } from 'decentraland-commons'
import * as flat from 'flat'
import * as fs from 'fs'
import * as path from 'path'
export interface TranslationData {
[key: string]: string
}
export interface TranslationCache {
locale?: TranslationData
}
export class Translation {
static DEFAULT_LOCALE = 'en'
... |
872df9cc5812eb2d7e8d32febfd5ded73e61b25c | TypeScript | North-West-Wind/NWWbot | /src/commands/information/role-info.ts | 2.859375 | 3 | import { PermissionResolvable, Role } from "discord.js";
import { NorthClient, NorthInteraction, NorthMessage, FullCommand } from "../../classes/NorthClient.js";
import * as Discord from "discord.js";
import { color } from "../../function.js";
class RoleInfoCommand implements FullCommand {
name = "role-info"
desc... |
b6939ee20ad9a20b04f94bcc888b915e9bc926bf | TypeScript | iorveth/hydra | /substrate-query-framework/cli/src/generate/RelationshipGenerator.ts | 2.703125 | 3 | import { WarthogModel, Field, ObjectType, makeRelation } from '../model';
import { generateJoinColumnName, generateJoinTableName } from './utils';
import { camelCase } from 'lodash';
export class RelationshipGenerator {
private _visited: string[];
model: WarthogModel;
constructor(model: WarthogModel) {
this... |
4109a9c741d7de331ebb33cb002510778fd09ad6 | TypeScript | LLehtola/pokemon-trainer-angular | /src/app/components/signup/signup.component.ts | 2.515625 | 3 | import { Component, OnInit } from '@angular/core';
import {
FormGroup,
FormControl,
Validators,
AbstractControl,
} from '@angular/forms';
import { AuthService } from '../../services/auth.service';
/**
* Renders the signup.
* User's name gets stored in localstorage and authService updates its observable user.... |
f68c88e5780339e8f2b94e2a32355425811f8efc | TypeScript | AzureCloudMonk/breakout | /index.ts | 3.140625 | 3 | let canvasElem = document.getElementById("canvas") as HTMLCanvasElement;
let canvasBounds = canvasElem.getBoundingClientRect();
const POWER_UP_RADIUS = 10;
interface PowerUpType {
color(): string;
execute(x: number, y: number): void;
}
class ExtraBall implements PowerUpType {
color() {
return "grey";
}
e... |
a527d6e21c2a873453c8dcf557b1994cec20e37f | TypeScript | mrjasonweaver/list-organizer | /clientapp/src/app/models/contacts.ts | 2.609375 | 3 | // state
export interface IContact {
id: number;
firstName: string;
lastName: string;
email: string;
role: string;
organization: string;
phone: string;
status: boolean;
}
export interface IContactsState { page: number; contacts: IContact[]; }
export interface IContactsListState { contacts: IContact[]; }... |
36881b1fc6302875f5da04258dd0232d413ad63b | TypeScript | vladyslav/Jira-like-app | /client/src/app/SwitchModes.ts | 2.609375 | 3 | import { defaultQueryParams } from './Config';
import Initialize from './interfaces/Initialize';
import RenderTickets from './RenderTickets';
import TicketService from './services/TicketService';
export default class SwitchModes implements Initialize {
storage: void;
checkbox: HTMLInputElement | null;
backlog:... |
c9e9b201e1c8c1d99be3be6062176a4fa8dd1d0d | TypeScript | lizhenheng0203/express_ts | /src/utils/result.ts | 2.671875 | 3 | // import { CODE_SUCCESS,CODE_ERROR } from "./constant"
export class Result {
private data: any
private msg: string
private code: number
constructor(data: any = undefined, msg: string = '操作成功', code: number = 0) {
this.data = data
this.code = code
this.msg = msg
}
} |
d16944ed3d53dc836a3f5f752b3573b9802a7c01 | TypeScript | DeusDaSilva/php-react-to-do-app | /frontend/src/context/Reducer.ts | 2.953125 | 3 | import { ToDoState } from "typings";
import { Actions, ActionType } from "./Actions";
export const getInitialState = (): ToDoState => ({ todos: [] })
export const todoReducer = (state: ToDoState, action: Actions): ToDoState => {
switch (action.type) {
case ActionType.AddToDo:
return {
todos: [...s... |
ce985081cc7e2c9d47b364a5b541f29fef0e93c4 | TypeScript | crowcl52/examen_front | /src/app/redux/user.reducers.ts | 2.671875 | 3 | import * as fromUser from './user.actions';
import { User } from '../models/user.model';
export interface USerState {
data: User;
}
const initState: USerState = {
data: null
}
export function userReducer( state = initState, action: fromUser.actions ): USerState{
switch(action.type){
case fromUse... |
984cb05ce7c5768db8beb73500239d657f54d4ee | TypeScript | mosure/ci-webex-bot | /src/interfaces/bots.ts | 2.671875 | 3 | export interface Bot {
say(message: string): void;
}
export interface IBots {
getBot(id: string): Bot | undefined;
}
|
ff5e04da71863afbadcf872422b28eee85a3e17e | TypeScript | pedroalvesbatista/hinkskalle | /frontend/tests/_data.ts | 2.5625 | 3 | import axios from 'axios';
import { Container, plainToContainer, Upload, plainToUpload, User, plainToUser, Collection, plainToCollection, Entity, plainToEntity, SearchResult, plainToSearchResult } from '@/store/models';
import { map as _map } from 'lodash';
export function makeTestUser() {
return {
id: "1",
... |
a8a58a1b733478665050f234ae160c56dd1f01fd | TypeScript | kingOfQj/webgpu-renderer | /src/core/Light.ts | 2.734375 | 3 | /**
* Light.ts
*
* @Author :dtysky(dtysky@outlook.com)
* @Date : 6/11/2021, 9:57:52 PM
*/
import { mat4, vec3 } from 'gl-matrix';
import geometries from '../buildin/geometries';
import Material from './Material';
import Mesh from './Mesh';
import Node from './Node';
export enum ELightType {
INVALID = 0,
A... |
993b12fb2e4a335fb1523d2a2744814f67b757ce | TypeScript | mukeshsoni/deepnotes-editor | /src/Editor/decorators.ts | 2.625 | 3 | import linkify from 'linkify-it';
import memoizeOne from 'memoize-one';
import { ContentBlock, CompositeDecorator } from 'draft-js';
import escapeStringRegexp from 'escape-string-regexp';
import Hashtag from './components/Hashtag';
import SearchHighlight from './components/SearchHighlight';
import Link from './compone... |
c86842d2db28eb2852d33c0fe6bd7f4ca11292c3 | TypeScript | jonathanlingnau/EIA-2 | /Aufgabe 9/aufgabe9.ts | 2.578125 | 3 | //Aufgabe: Aufgabe 9
//Name: Jonathan Lingnau
//Matrikel: 255645
//Datum: 30.05.17
//
//Hiermit versichere ich, dass ich diesen Code selbst geschrieben habe.
//Er wurde nicht kopiert und auch nicht diktiert.
namespace Form {
window.addEventListener("load", init);
let eissorten: string[] = ["... |
7ce80100fa7dc45fde993257b6012b8e79e21125 | TypeScript | fasterthanlime/bamb | /game/src/ai/compute-score.ts | 2.921875 | 3 | import { GameState, CellState } from "../types";
import { GameBase } from "../game-base";
export function computeScore(
game: GameBase,
state: GameState,
player: number,
): number {
let valueOwned = 0;
let countCell = (cell: CellState) => {
if (!cell.cardId) {
return;
}
let card = game.ca... |
bbd11385ef6bb0214ef1b03afd8358b1efadab6a | TypeScript | milangstojkovic/servicebook | /src/Containers/DataProvider/DataProvider.reducer.ts | 2.6875 | 3 | import ACTION_TYPE from '../../Store/actionTypes';
import { IDataProviderActions } from './DataProvider.actions';
import { IDataProviderState } from './DataProvider.state';
const initState: IDataProviderState = {
users: { data: null, error: false, loading: false },
vehicles: { data: null, error: false, loading... |
9b814b2459a0223cd5e40278f261d74a9e1b21eb | TypeScript | stugen/uhb-live | /src/ui/utils/clientId.ts | 2.515625 | 3 | import randomstring from 'randomstring'
export const getClientId = (): string => {
return window.sessionStorage.getItem('client') || ''
}
export const setClientId = (): void => {
const clientId = getClientId()
if (clientId === '') {
window.sessionStorage.setItem('client', randomstring.generate())
... |
332cfddb269cddeea825b084a98dc7faa848a31c | TypeScript | JeongGeun/YoutubeClone-fe | /src/components/reducer/ui_reducer.ts | 2.703125 | 3 | import { TOGGLE_DRAWER } from '../actions/home/type';
const initialState = {
open: false,
};
export default function Toggle(state = initialState, action) {
switch (action.type) {
case TOGGLE_DRAWER:
return { ...state, open: !state.open };
default:
return state;
}
}
|
202b6064c07ef8fad308d1daef610c8e06551f9e | TypeScript | yu3211/studyCode | /mordanSample/source/ts/google/unknownkey/app2.ts | 2.90625 | 3 | async function executeAjax() {
try {
return new Promise(
( resolve:(result:Array<json>) => void , reject) => {
let result = $.ajax({type: 'GET'
, url: 'https://maps.googleapis.com/maps/api/geocode/json'
, dataType: 'json'
... |
38b5f7d5cde3411fcaabd7bd92c244dac7769624 | TypeScript | moses0072/myFlix-Angular-Client | /src/app/fetch-api-data.service.ts | 2.75 | 3 | import { Injectable } from '@angular/core';
import { catchError } from 'rxjs/internal/operators';
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { map } from 'rxjs/operators';
//import { Router } from '@angular/router';
//Declari... |
b2d0e772ca02e8177f6aea79f09fdf70bac427b3 | TypeScript | sakibrahmanchy/storefront | /src/entities/customer.entity.ts | 2.515625 | 3 | import {
Column,
Entity,
JoinColumn,
OneToMany,
PrimaryGeneratedColumn,
} from 'typeorm';
import { BaseEntity } from './base.entity';
import { Sale } from './sale.entity';
@Entity()
export class Customer extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column()
customer_name: string;
@... |
d354e7b8081ee33dba2900e0a6320e85c0d7aee0 | TypeScript | kylejlin/fitview | /src/axes.ts | 2.625 | 3 | const axes: Axes = {} as Axes;
export default axes;
updateAxes();
window.addEventListener("resize", updateAxes);
window.addEventListener("orientationchange", updateAxes);
function updateAxes() {
if (window.innerWidth > window.innerHeight) {
axes.major = window.innerWidth;
axes.minor = window.innerHeight;
... |
17d5925ee811442c1a8f2835959156ba59049dc5 | TypeScript | kdechant/eamon | /client/adventures/cliffs-of-fire/commands.ts | 2.8125 | 3 | import Game from "../../core/models/game";
import {Monster} from "../../core/models/monster";
import {CommandException} from "../../core/utils/command.exception";
declare let game: Game;
export var custom_commands = [];
custom_commands.push({
name: "wave",
verbs: ["wave"],
description: "Waves something in the ... |
4555226844b7d40b808b16b8dff7a011c95cee68 | TypeScript | Santiagovar/Proyecto_eventos | /proyecto_nuevo/src/providers/UsuarioService.ts | 2.578125 | 3 | import {Injectable} from '@angular/core';
//UrlSearchParams sirve para mandar parametros
import {Http,URLSearchParams } from '@angular/http';
import {URL_SERVICIOS} from "../config/url.servicios";
import {AlertController,Platform } from "ionic-angular";
import {Storage} from '@ionic/storage';
@Injectable()
export ... |
69312575c102a04fb987cf25320e9cce43d0eea7 | TypeScript | lanemt/definitelytyped.github.io | /types/amap-js-api/lngLat.d.ts | 3.03125 | 3 | declare namespace AMap {
class LngLat {
/**
* 构造一个地理坐标对象
* @param lng 经度
* @param lat 纬度
* @param noAutofix 是否自动修正
*/
constructor(lng: number, lat: number, noAutofix?: boolean);
/**
* 移动当前经纬度坐标得到新的坐标
* @param east 移动经度,向右为正值
... |