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 |
|---|---|---|---|---|---|---|
3ceefcb4879e203133eb1fa7d6be231d41c770bd | TypeScript | mdnaufalh/mit_placement | /backend/src/staff/infrastructure/repositories/CollegeRepository.ts | 2.578125 | 3 | import ICollegeRepository from "../../core/interfaces/ICollegeRepository";
import { course } from "../models";
import { Course } from "../../core/types";
class CollegeRepository implements ICollegeRepository {
async fetchAllCourses(collegeId: number): Promise<Array<Course>> {
return (
await course
... |
963e848b28ca084e2f8d19ed9e3abb6fb753cd50 | TypeScript | hadrien-thomas-zenika/kata-rxjs | /src/app/users/users.repository.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { User } from './user';
import { delay } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class UsersRepository {
private users: User[] = [
{
id: 'user1',
name: 'john'
},
{
id: ... |
29f274210625983c3232028622c92eec4a344d1e | TypeScript | UnicornInReverse/YoshisAdventure | /dev/behavior/moveVertical.ts | 2.9375 | 3 | class MoveVertical implements Behavior{
public yoshi : Yoshi;
public mh: MoveHorizontal;
public idle: Idle;
public dead: Dead;
public shoot: Shoot;
constructor(y : Yoshi){
this.yoshi = y;
}
public performBehavior() : void{
this.yoshi.div.style.transf... |
e09cab306ef2803da2853960838113ab99f23735 | TypeScript | Cloudstek/alfred-hugo | /src/updater.ts | 2.59375 | 3 | import { Cache } from '@cloudstek/cache';
import moment from 'moment';
import readPkg from 'read-pkg-up';
import axios from 'axios';
import semver from 'semver';
import { LatestVersion, UpdateSource } from './types';
/**
* Hugo updater
*/
export class Updater {
private readonly cache: Cache;
private readonl... |
306db5f3be9523705046a10f0ce42a87bd4eb2f8 | TypeScript | brendan-codes/service-example | /src/app/form/form.component.ts | 2.625 | 3 | import { Component, OnInit } from '@angular/core';
import { HttpService } from '../http.service';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.css']
})
export class FormComponent implements OnInit {
// define some form objects
username = null;
altu... |
e9daafe9dc9a1cb97a90efa9a93fe8f71234f6ca | TypeScript | npmdoc-dev/npmdoc-generator | /src/helpers.ts | 3.0625 | 3 | import { request } from 'gaxios';
interface PackageMetadata {
latest: string;
}
/**
* Get the latest tag for a given npm module
* @param {string} package name of the package
* @returns The semver version with the latest tag
*/
export async function getLatest(packageName: string) {
if (!packageName) {
thro... |
c26bb3e8319a4011219ef94dabad32f8ac9a2860 | TypeScript | prabhugopal/weather-mate | /src/models/city.ts | 2.734375 | 3 | type Cord = {
lon : number,
lat : number
}
type City = {
id: number,
name: string,
state: string,
country: string,
coord: Cord
}
export type Location = {
city: City
} |
b382f5ae82e75069054ee534de6d1afcb24aeb94 | TypeScript | molstar/molstar | /src/mol-model-props/computed/secondary-structure/dssp/turns.ts | 2.65625 | 3 | /**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Sebastian Bittrich <sebastian.bittrich@rcsb.org>
*/
import { DSSPContext, DSSPType } from './common';
/**
* The basic turn pattern is a single H bon... |
349f30051758d6b02a50c0e4554bfac2642d8e28 | TypeScript | tomsoftware/Settlers.ts | /src/resources/gfx/index-file.ts | 2.78125 | 3 | import { BinaryReader } from '../file/binary-reader';
import { IndexFileItem } from './index-file-item';
import { ResourceFile } from './resource-file';
export class IndexFile extends ResourceFile {
protected offsetTable: Int32Array;
public get length(): number {
return this.offsetTable.length;
}
... |
2f868371bfeca43cd89bac0d131df11583f1b2a6 | TypeScript | dianas11/childToParentInteraction | /src/app/child/child.component.ts | 2.8125 | 3 | import { Component, OnInit, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-child',
templateUrl: './child.component.html',
styleUrls: ['./child.component.css']
})
export class ChildComponent implements OnInit {
// step 4 to be able to send the emit event out to the parent component we... |
13dcdc428c891a571acbcda1f81607316eede68a | TypeScript | FilipeNeiva/TC-ely | /atividade3/app/ts/personagens.ts | 3.453125 | 3 | class Personagem {
protected _id: number;
protected _nome: string;
protected _energia: number;
protected static id: number = 0;
constructor(nome: string){
this._energia = 100;
this._nome = nome;
this._id = Personagem.id;
Personagem.id += 1;
}
estaVivo(): boo... |
a4a8013b515c5b01ab2652e38212f2a41f92f04b | TypeScript | JoabsonDeSouza/livrocast | /src/utils/formatTime.ts | 3.09375 | 3 | export function calculateTotalValue(length: number) {
const minutes = Math.floor(length / 60);
const seconds_int = length - minutes * 60;
const seconds_str = seconds_int.toString();
const seconds = seconds_str.substr(0, 2);
const time = minutes + ':' + seconds;
const result =
(minutes < 10 ? '0' + minut... |
6ee4093e41a40d00b8cf21b548075a0696455b77 | TypeScript | allenli178/deno-algorithm | /challenges/leetcode/0-99/1-e-two-sum/brute-force-functional.ts | 3.484375 | 3 | /**
* Monday Jan 11, 2021, created by hylerrix
* Runtime: 148 ms, faster than 6.56% of TypeScript online submissions for Two Sum.
* Memory Usage: 45 MB, less than 11.29% of TypeScript online submissions for Two Sum.
*/
function twoSum(nums: number[], target: number): number[] {
let answer: number[] = []
nums.fo... |
1a2b508f19dbd4c750478f75d1510a2f94f9edc2 | TypeScript | aleclarson/ee-ts | /spec/ee.spec.ts | 3.28125 | 3 | /* tslint:disable:no-empty */
import { EventEmitter as EE } from '../src/ee'
interface A {
foo(): void
bar(a: number, b: number): number
}
test('nullish listeners', () => {
let ee = new EE<A>()
ee.on('foo', undefined)
ee.on({ foo: null })
expect(ee[EE.ev]).toEqual({})
})
/**
* Recurring listeners
*/
t... |
bb45b2b1e45a8b552a3ac28d7abbadd662cfd73a | TypeScript | chdtu-fitis/deanoffice-frontend | /src/app/components/grade/grade-runner/models/GradeRunners.ts | 2.9375 | 3 | import {Course} from './Course';
import {Student} from './Student';
export class GradeRunners {
courses: Course[] = [];
constructor(public student: Student) {}
addCourse(course: Course): void {
const foundCourse = this
.courses
.find(coursesItem => coursesItem.isEqual(course))
;
if (fo... |
ce609e94d775f694e4016caa7b25963c4d88d77d | TypeScript | wreilly/email-fabricator | /src/app/hbsp/hbsp.service.ts | 2.515625 | 3 | /* tslint:disable:no-string-literal */
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {BehaviorSubject, Subject, Observable, ObservableInput, of, throwError} from 'rxjs';
import {catchError, map, tap } from 'rxjs/operators';
import { Store } from '@ngrx/store';
/*... |
fcc4cb00c8f0779fb7611ab736d16c1d15ded4ce | TypeScript | AuHau/bee-js | /src/utils/data.ts | 2.515625 | 3 | import { Readable } from 'stream'
// eslint-disable-next-line require-await
export async function prepareData (
data: string | Buffer | Readable
): Promise<Buffer | Readable> {
if (typeof data === 'string') {
return Buffer.from(data)
}
return data
}
|
18f1950a16628b64394192ec8db09bed26fbef5e | TypeScript | wu-ToStar/Web-base | /TypeScript/03类/src/05接口.ts | 4.15625 | 4 | (() => {
type myType = {
name: string;
age: number;
};
const obj: myType = {
name: "to",
age: 1,
};
/**
* 接口可以在定义的时候去限制类的结构
* 接口的所有的属性都不能有实际的值
* 接口只定义对象的结构,而不考虑实际值
* 在接口中所有的方法都是抽象方法
*/
interface myInterface {
n... |
c9aa08e804af33ccff9300048996fed12e96f44a | TypeScript | isabella232/sourcegraph-vscode | /src/git.ts | 2.921875 | 3 | import execa from 'execa'
import * as path from 'path'
import { log } from './log'
import { getRemoteUrlReplacements } from './config'
/**
* Returns the names of all git remotes, e.g. ["origin", "foobar"]
*/
async function gitRemotes(repoDir: string): Promise<string[]> {
const { stdout } = await execa('git', ['r... |
7e6f989a2a751e7d3122881765094cc4f1bea94c | TypeScript | alzuma/hotbark | /src/DI/ServiceDecorator.ts | 2.625 | 3 | import { GenericClassDecorator } from './GenericClassDecorator';
import { Type } from './Type';
export const Service = (): GenericClassDecorator<Type<object>> => {
return (target: Type<object>) => {
// do something with `target`, e.g. some kind of validation or passing it to the Injector and store them
... |
ad53b134afd7dd2716e258996bb499a09ba9bed9 | TypeScript | alvarezGarciaMarcos/git-repo-creator | /src/utils/configuration/configuration-utils.ts | 2.875 | 3 | import * as path from 'path'
import * as fs from 'fs-extra'
import Command from '@oclif/command';
import { IRepoConfig } from './config';
import { ConfigurationType } from './config';
interface AppConfiguration {
github: IRepoConfig;
gitlab: IRepoConfig;
bitbucket: IRepoConfig;
}
export class Configuratio... |
a9a6c912c56c3a41aa0b9612564f52009259bc00 | TypeScript | krakenui/octopus-mongo | /src/common/helper.ts | 3.484375 | 3 | export function randomString(length: number): string {
let result: string = "";
let characters: string =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let charactersLength: number = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.ran... |
376276aae02fcc5e9b4c892ebb798e51195fc6cf | TypeScript | srichandmalladi/CorporateQnA | /CorporateClient/src/app/models/answer.model.ts | 2.6875 | 3 | export class Answer {
id: number;
userId: number;
questionId: number;
description: string;
dateCreated: Date;
isBestAnswer: boolean;
constructor(args) {
this.id = +(args.id || 0);
this.userId = +(args.userId || localStorage['userId']);
this.questionId = +args.questionId;
this.description ... |
6b58cbfdbd651259bb77b8442eff2aa69c63d1ad | TypeScript | Jubrillionaire/user-hobbies | /backend/controllers/hobbies-controller.ts | 2.65625 | 3 | import { Request, Response } from 'express';
import Hobby from '../models/Hobby';
import User from '../models/User';
const getAllHobbies = async (req: Request, res: Response) => {
const id: string = req.params.id;
try {
const hobbies = await Hobby.find({user: id});
return res.status(200).json... |
aae6f89139681104e3b3d7ce2e413ddfae362045 | TypeScript | ozzyjones/eslint-string-wrapper | /src/StringWrapper.ts | 3.15625 | 3 | 'use strict';
import { JavascriptExpressionParser } from './JavascriptExpressionParser';
import { StringExpression } from './StringExpression';
import { StringExpressionParser } from './StringParser';
import { VSCodeExtensions } from './VSCodeExtensions';
export class StringWrapper {
private quoteCharacter: stri... |
cb842ae4402384a262a5cca3e463944d28313c0b | TypeScript | tschm2/eMMA | /ConversationalUI/src/pages/about/about.ts | 2.765625 | 3 | import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { BarcodeScanner } from 'ionic-native';
@Component({
selector: 'page-about',
templateUrl: 'about.html'
})
export class AboutPage {
constructor(public navCtrl: NavController) {
}
showThis(elem) {
BarcodeS... |
8cb2ca0c7d52b9da9e6a0cf1f3ca4c8dbee57906 | TypeScript | hfaulds/athena | /src/entities/Asteroid.ts | 2.515625 | 3 | import { Vec2, Polygon } from 'planck-js'
import Entity from './Entity'
import rand from '../util/rand'
export default class Asteroid extends Entity {
static createRandom(assets, components, position, world) {
var asteroidTextures = Object.keys(assets["textures"]["meteors"]);
var textureName = asteroidTextu... |
6a982434fec964686bf04c1d5e9074b8315b5810 | TypeScript | nervosnetwork/neuron | /packages/neuron-wallet/src/models/chain/block-header.ts | 2.84375 | 3 | import TypeChecker from '../../utils/type-checker'
export default class BlockHeader {
public version: string
public timestamp: string
public hash: string
public parentHash: string
public number: string
public epoch: string
constructor(version: string, timestamp: string, hash: string, parentHash: string,... |
29082e133f281deb2b7482e751d84c00322854e5 | TypeScript | navikt/syfooversikt | /test/utils/veiledereUtils.test.ts | 2.625 | 3 | import { expect } from 'chai';
import { filterVeiledereWithActiveOppgave } from '@/utils/veiledereUtils';
import { PersonOversiktStatusDTO } from '@/api/types/personoversiktTypes';
describe('veiledere utils', () => {
describe('filterVeiledereWithActiveOppgave', () => {
it('Returns empty list if no oppgaver', () ... |
5a7f789d7628e3d1b247910118bfa0f5facd10dc | TypeScript | alexsando86/covid19-practice | /src/util/MakeRandomColor.ts | 3.078125 | 3 | class MakeRandomColor {
count: number;
colorArray: string[];
constructor(count: number) {
this.count = count;
this.colorArray = [];
}
randomColor() {
return Math.floor(Math.random() * 255);
}
setRgbaColor() {
for (let i = 0; i < this.count; i++) {
this.colorArray.push(`rgba(${this.randomColor()},${th... |
79784f65be35f3cd0c0d33a25b8b1b7b780ac92b | TypeScript | umardev500/tracking-dockerize | /client/helpers/saveState.ts | 2.828125 | 3 | export interface StateProps {
state: any;
}
export const saveState = ({ state }: StateProps): void => {
try {
const serializedState = JSON.stringify(state);
localStorage.setItem('state', serializedState);
} catch (err) {
// Ignore error
}
};
|
4154b6cbde32ed9867586c62ea4296d109763990 | TypeScript | hggntg/base | /utilities/.generated/src/add-try-catch-wrapper.ts | 3.15625 | 3 | export function addTryCatchWrapper(ClassImp: any, funcName){
let func: Function = ClassImp.prototype[funcName];
let funcString = func.toString();
let paramsString = funcString.split("(")[1].split(")")[0];
let expression = `ClassImp.prototype["${funcName}"] = function ${funcName}(${paramsString}){
try{
re... |
92412d8b2d11fd569fad1068f230d46a62425a16 | TypeScript | Amarilo/vacation-planner | /src/app/services/vacation/vacation.service.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { DatabaseService } from '../database/database.service';
import { Subject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class VacationService {
totalVacations = 20;
publicHolidays: any = [];
years: any = [];
yearsEmitter: Subject<any> = new Sub... |
eae95fdf0d16f0e2799f986a59b6956d9a2bc049 | TypeScript | wdpm/vue-shop | /src/utils/DateFormat.ts | 3.4375 | 3 | // 格式化日期(和时间)
class DateFormat {
// format 参数可以由以下格式组合:
/*
YYYY
YY
MM
MMM
MMMM
DD
hh
mm
ss
*/
// 区分大小写;可以添加空格或其他符号;不要使用上面未包含的格式。
// 参考资料:
// https://www.w3.org/TR/NOTE-datetime
// https://en.wikipedia.org/wiki/Date_format_by_country
public static format(
date: string | number | Dat... |
d61aa8f4472da640822af3d38d171a152edcd374 | TypeScript | FIFALibrary/dbmaster-cli | /lib/utils/aggregate.utils.ts | 3.015625 | 3 | import { RawData } from '../interfaces';
export interface Aggregated {
value: string | number;
count: number;
}
export const aggregateFn = (agg: Aggregated[], data: RawData, field: string): void => {
const value = data[field];
const index = agg.findIndex((f) => f.value === value);
if (index === -1) {
ag... |
5560d06c037c5bcdb45f27b39832d3a39452d4c6 | TypeScript | a-wizard-work/FontBundles-Converter | /src/utils/api-client.ts | 2.65625 | 3 | const apiClient = (
url: string,
{
method,
data,
headers: customHeaders,
noJsonInResponse,
...customConfig
}: any = {}
): Promise<any> => {
const config = {
method: method ?? "GET",
body: data ? JSON.stringify(data) : undefined,
headers: {
"Content-Type": data ? "applicatio... |
098b81d1acbf6afcafd49cb18192f75302d0b30b | TypeScript | little-green-man/nova-taskfinder | /src/parsers/composer.ts | 2.71875 | 3 | class Composer {
packageProcessName: string;
packageJsonPath: string;
tasks: any[];
constructor() {
this.tasks = [];
this.packageProcessName = 'composer';
this.packageJsonPath = `${nova.workspace.path}/composer.json`;
}
findTasks() {
const composerFile = nova.fs.stat(this.packageJsonPath);
if (compose... |
a82bf009976b1ce40f94f6a02f9d03e0cdf6bf84 | TypeScript | zalibhai2121/TCSStackTraining | /typescript/typesOfLoop.ts | 3.46875 | 3 | let num:Array<number> = [100,200,300,400,500,600];
console.log("Classical loop: ");
for(let i = 0; i<num.length; i++){
console.log(num[i]);
}
console.log("For in loop: ");
for(let i in num){
console.log("Index "+ i+ "is " + num[i]);
}
console.log("using of loop --- use most in angular");
for(let n of num){
... |
917c6c7adfa9f18276fc90aa1485376b3857fd2e | TypeScript | tylercole8899/passionproject | /src/type.d.ts | 2.546875 | 3 | interface SingleCoin {
id: string,
name: string,
symbol: string,
rank: number,
price_usd: string,
percent_change_1h: string,
percent_change_24h: string,
percent_change_7d: string
}
interface SingleCoinState {
data: SingleCoin
}
interface CoinTableData {
data: SingleCoin[],
... |
4d9a34ed42a74a78ab420104235d2e19e1c6545f | TypeScript | heremaps/harp.gl | /@here/harp-webtile-datasource/lib/WebTileDataSource.ts | 2.609375 | 3 | /*
* Copyright (C) 2019-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE
* SPDX-License-Identifier: Apache-2.0
*/
import { TileKey, TilingScheme, webMercatorTilingScheme } from "@here/harp-geoutils";
import { CopyrightInfo, DataSource, DataSourceOptions, Tile } from "@here/harp-mapview... |
c930c538a5149dd301dcaaa4828a0938598c73a3 | TypeScript | boostcamp-2020/Project01-C-User-Event-Collector | /backend/src/route/playlist/controller.ts | 2.515625 | 3 | import { Request, Response, NextFunction } from 'express';
import * as playlistService from '../../services/playlist';
const getPlaylists = async (req: Request, res: Response, next: NextFunction): Promise<any> => {
try {
const playlists = await playlistService.getPlaylists();
if (!playlists) return res.statu... |
35350027e49c13e17ce6a62b7c520b6d300d3a95 | TypeScript | scottdao/picture-collection-apply | /web/src/store/reducers/counter.ts | 3.0625 | 3 | import { ADD, MINUS } from '../constants/counter'
const INITIAL_STATE = {
num: 0
}
import { handleActions } from 'redux-actions';
const initState = {};
const counter = handleActions(
{
[ADD]: (state, { payload }) => {
// console.log(state)
return { ...state, num: state.num+1};
... |
807505204b128fba8ad6de7530aed53e4dc6deac | TypeScript | nguyer/aws-sdk-js-v3 | /clients/browser/client-translate-browser/types/DetectedLanguageLowConfidenceException.ts | 2.53125 | 3 | import { ServiceException as __ServiceException__ } from "@aws-sdk/types";
/**
* <p>The confidence that Amazon Comprehend accurately detected the source language is low. If a low confidence level is acceptable for your application, you can use the language in the exception to call Amazon Translate again. For more inf... |
7aec2b831e01ae8b0d92de875c86a7c5415ea85b | TypeScript | Nash-BETA/HeadFirstObjectOriented | /session_1/1-1/Guitar.ts | 2.90625 | 3 | export class Guitar {
serialNumber: string;
price: number;
builder: string;
model: string;
type: string;
backWood: string;
topWood: string;
public constructor(serialNumber: string, price: number,
builder: string, model: string, type: string,
backWood: string, topWood: s... |
afc98d09989ce71a6cfc6ce6c0fe55ac073444d1 | TypeScript | zhaobenx/Virus-game | /src/js/shapes.ts | 3.296875 | 3 | import { Node } from "./core"
export class Shape extends Node {
x: number;
y: number;
color: string;
ctx: CanvasRenderingContext2D;
}
export class Vector2 {
x: number;
y: number;
constructor(x: number = 0, y: number = 0) {
this.x = x;
this.y = y;
}
norm(): Vector2 {
... |
cb2e3276cc6dc4388a7c541ecac4d7a522991f1e | TypeScript | khirayama/clap | /web/src/clap/components/ComponentPool.ts | 2.921875 | 3 | export class ComponentPool {
private static pool: { [key: string]: any } = {};
public static register(nodeType: string, component: any) {
ComponentPool.pool[nodeType] = component;
}
public static take(nodeType: string) {
return ComponentPool.pool[nodeType];
}
}
|
0daccb5b9cfd02a6d47972afdbf76edc2d485407 | TypeScript | jrmce/moveon | /src/moveon.ts | 2.546875 | 3 | import * as vscode from 'vscode';
export class MoveOn {
private disposable: vscode.Disposable;
private position: vscode.Position;
private line: vscode.TextLine;
private config: vscode.WorkspaceConfiguration;
private moveOnChars: string[];
private disabled: boolean;
constructor() {
... |
889112e14b9522de5aea5ba2339eb1e005126e23 | TypeScript | gonnavis/3d-game-shaders-for-beginners | /demonstration/three.js/lib/three.js/src/core/BufferGeometry.d.ts | 2.796875 | 3 | import { BufferAttribute } from './BufferAttribute';
import { Box3 } from './../math/Box3';
import { Sphere } from './../math/Sphere';
import { Matrix4 } from './../math/Matrix4';
import { Vector2 } from './../math/Vector2';
import { Vector3 } from './../math/Vector3';
import { Object3D } from './Object3D';
import { Ge... |
73004ad32c2ed1a0fd71e2d50ccd9e9c4f1643a8 | TypeScript | pawelparker/Nirikshak | /packages/core/tests/jestMatchers/bodyMatchers.test.ts | 2.59375 | 3 | import { toMatchBody } from "../../src/jestMatchers/bodyMatchers";
const Entries: {
input: boolean;
expected: boolean;
output: {
pass: boolean;
message: string;
};
}[] = [
{
input: true,
expected: true,
output: {
pass: true,
message: "... |
bc2b5378795c6fef7cdcfdc4aee211f499500172 | TypeScript | kemicofa/rgng | /enums/type.ts | 2.65625 | 3 | export enum Type {
MALE = "male",
FEMALE = "female",
LAST = "last"
} |
be772323b142dc274231c5b38df2f4467e6b7c51 | TypeScript | passosfe/aiticketmanager | /server/src/app/models/User.ts | 2.546875 | 3 | import bcrypt from 'bcryptjs';
import {
Length,
IsNotEmpty,
IsEmail,
IsString,
MinLength,
IsBoolean,
IsOptional,
IsDate,
IsUUID,
} from 'class-validator';
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
BaseEntity,
BeforeIns... |
795bc8c9b4633984cf523db2254a18a40a172ba2 | TypeScript | JoshuaKGoldberg/TypeStat | /src/shared/NameGenerator.ts | 3.296875 | 3 | /**
* Generates new names that are unique per file.
*/
export class NameGenerator {
private readonly countsPerBase = new Map<string, number>();
public constructor(private readonly sourceFileName: string) {}
public generateName(base: string) {
const existingCount = this.countsPerBase.get(base);
... |
0294c314bd087f535f10b18ad94784bf9891df8d | TypeScript | tlaukkan/reality-space | /src/common/reality/Decode.ts | 2.78125 | 3 | import {Encode} from "./Encode";
export class Decode {
static login(parts: string[]) : [string, string, string, string] {
return [
parts[1],
Decode.decodeString(parts[2]),
parts[3],
parts[4]];
}
static loginResponse(parts: string[]) : [string, strin... |
e6531bd7e61150ca946b3aa12fee48d4f07db488 | TypeScript | Scyllizzy/Fall-2019-PigDiceGame | /typescript/dice.ts | 3.53125 | 4 | /**
* Generates a random number between the min and max value.
* Min is inclusive.
* Max is exclusive.
* @param minValue Minimum value for randomly generated number inclusive.
* @param maxValue Maximun value for randomly generated number exclusive.
*/
function generateRandomValue(minValue:number, maxValue:number)... |
52dadd42784b1cfa361ad367a4bc53e89d5e9871 | TypeScript | ZsZs/processpuzzle-util | /projects/processpuzzle-util-lib/src/lib/classes/object-util/object-util.spec.ts | 3.40625 | 3 | import { ObjectUtil } from './object-util';
describe('ObjectUtil behaviour', () => {
const nullObject: any = null;
const undefinedObject = undefined ;
const notNullObject: any = 'something';
const stringObject = 'some string';
const numberObject = 128;
const classInstance: Date = new Date();
befo... |
09aabb3e3936c8d58c805e37d6e7dff9138975b4 | TypeScript | rheehot/dynamo1 | /src/connection/from-dynamo-attribute.ts | 2.78125 | 3 | import { AttributeValue, AttributeMap } from 'aws-sdk/clients/dynamodb'
export function fromDynamoAttributeMap(item: AttributeMap): {[key: string]: any} {
return Object.keys(item).reduce((carry, key) => Object.assign(carry, {
[key]: fromDynamoAttribute(item[key]),
}), {})
}
export function fromDynamoAttribute... |
86d2b4e64b548f0039c46db2f909b3ebebc14575 | TypeScript | vvakar/dynamic-programming | /algos/Levenshtein-memoize.ts | 3.90625 | 4 | /**
* Levenshtein distance using recursion/memoizing, also known as top-down solution.
*
* Strategy:
* 1. we only need to memoize based on a and b length rather than a and b because it's always going to be the tail end of each.
* 2. we additionally memoize each step taken so we can reconstruct the path
*
* St... |
ebe3908a4e6fa60286e667b090d5a76be75ea43b | TypeScript | LearnItWell2018/DevFrontcontroller | /src/app/model/CustomerAddress.ts | 2.53125 | 3 | export class CustomerAddress {
private id:String;
private pincode:String;
private street:String;
private roomorflatno:String;
private nearestLandMark:String;
constructor(id:String, pincode:String, street:String, roomorflatno:String, nearestLandMark:String) {
this.id = id;
... |
fca20eef303fed10d054a70ad6f9632716a69224 | TypeScript | linuxninja39/GeneAnnotationClient | /src/app/pipes/first-item.pipe.ts | 2.734375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { Log } from 'ng2-logger';
const log = Log.create('FirstItemPipe');
@Pipe({
name: 'firstItem'
})
export class FirstItemPipe implements PipeTransform {
transform(itemList: Array<any>, orderField: string, ascending: boolean = true): any {
let func;
... |
402f77199f37dfa8c370ab502bc424eb408dff11 | TypeScript | drahoja9/AutoGram | /frontend/src/lib/parse/Lexer.ts | 3.9375 | 4 | /**
* Abstract base convenience class for all lexers.
*/
export default abstract class LexerBase<TokType, Token> {
/** Currenly inspected character. */
protected curr: string;
/** Source buffer that is currently being lexed. Always ends with a nul character. */
protected buff: string;
/** Next token to be l... |
c48c177af5c1bff4ea390f13313f72746a09583c | TypeScript | webbegg/RunoX | /src/commands/start-game.command.ts | 2.96875 | 3 | import { GameCommand } from "./game.command";
import { GameState } from "../models/game-state.model";
import { Card } from "../models/card.model";
export class StartGameCommand extends GameCommand {
execute(state: GameState) {
const handsLength = 7; // randomDeck.length / 4; // 4 jugadores
if (!state.player... |
d65b7284bb07ff11544f32b102d30965bc2ac6ab | TypeScript | shreyakaushik1/Test_material | /src/app/views/form/form.component.ts | 2.6875 | 3 | import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import {Observable} from 'rxjs';
import {map, startWith} from 'rxjs/operators';
export interface Office{
name: string;
}
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./for... |
a1da06077566392758f7d95da7581006cd3ea54a | TypeScript | Swasth-Digital-Health-Foundation/C19CareAssist | /gateway/src/utils/auth-helper.ts | 2.59375 | 3 | import * as moment from 'moment';
const NodeRSA = require('node-rsa');
const jwt = require('jsonwebtoken');
const crypto = require('crypto');
import { ACCESSTOKEN_SECRET, REFRESHTOKEN_SECRET, API_TOKEN_PRIVATEKEY, API_TOKEN_PUBLICKEY } from './secrets';
import logger from '../utils/logger'
const generateToken = (param... |
837ef8989ffc2960599225252959dee089e82383 | TypeScript | kristianmandrup/zebkit | /src/ui/core/Manager.ts | 2.5625 | 3 | /**
* UI manager class. The class is widely used as base for building
* various UI managers like paint, focus, event etc. Manager is
* automatically registered as input and component events listener
* if it implements appropriate events methods handlers
* @class zebkit.ui.Manager
* @constructor
*/
import ... |
32151410d7d5d1387ef3b211e0a49305bd87e0ec | TypeScript | MaddozS/punto-de-venta-frontend | /renderer/utils/formatMoney.ts | 2.90625 | 3 | import Dinero from "dinero.js";
const withNoExtraFormat = (formatedPrice: string) =>
formatedPrice.replace(/MX/g, "");
const withCustomFormat = (priceString: string) => `${priceString} MXN`;
const formatMoney = (amount: number) => {
const priceObject = Dinero({ amount: amount * 100, currency: "MXN" });
const p... |
6528f50e0b78b1fe796bc41d63486590af517b03 | TypeScript | efried/language-buffet | /ts/main.ts | 3.609375 | 4 | const ajv = new require('ajv')() // Why is this difficult to add a type annotation to?
const jsonStrings = require('./jsonStrings')
const playerSchema = {
type: 'object',
required: ['name', 'winPercent'],
properties: {
name: {type: 'string'},
winPercent: {type: ['number', 'null']},
},
}
interface Playe... |
88cf188b157187fe1a8f3d7d72d27e16acc7f350 | TypeScript | link1900/scottdbnet | /src/games/simpleCanvas/CanvasElement.ts | 3.09375 | 3 | import { v4 as uuid } from "uuid";
export interface CanvasElementProps {
id?: string;
name?: string;
visible?: boolean;
active?: boolean;
}
export default class CanvasElement {
public id: string;
public name: string;
public visible: boolean;
public active: boolean;
constructor({
id = uuid(),
... |
b0efb8075f2d2f9003ffcbf287a6977587384060 | TypeScript | Devidian/devidian-tv-api | /src/user-account/entities/user-account.entity.ts | 2.578125 | 3 | import { BaseEntity, MongoCollection } from '#/utils';
import { Exclude, Expose } from 'class-transformer';
import { IsEmail, IsNotEmpty, IsOptional, Length } from 'class-validator';
import { hostname } from 'os';
import { cpuUsage } from 'process';
export class UserAccountEntity extends BaseEntity {
@IsNotEmpty()
@... |
73a61c0d5fee43ec613546e3b6f92140cad5285a | TypeScript | BLing88/recipe-developer | /server/src/validate.ts | 2.671875 | 3 | require("dotenv").config();
import jwt from "jsonwebtoken";
import jwksClient from "jwks-rsa";
const client = jwksClient({
jwksUri: `https://${process.env.AUTH0_DOMAIN}/.well-known/jwks.json`,
});
const getKey: jwt.GetPublicKeyOrSecret = (header, callback) => {
client.getSigningKey(header.kid!, (err, key) => {
... |
ebd14581810e306e12cdeb1e30ddca84aab31d62 | TypeScript | akritii1/dbs_test | /Ritesh_TS_Day1/smallest.ts | 3.421875 | 3 | function smallest (n1:number,n2:number):number{
if(n1>n2)
return n2;
else
return n1;
}
console.log("Smallest is :"+smallest(20,100)); |
6eac1a3a30930a644a7fd121209aa0514879f1f1 | TypeScript | pp123pp/tweakpane | /lib/plugin/util.ts | 2.953125 | 3 | import {
InputParams,
InputParamsOption,
InputParamsOptionDictionary,
} from '../api/types';
import {findConstraint} from './common/constraint/composite';
import {Constraint} from './common/constraint/constraint';
import {ListConstraint, ListItem} from './common/constraint/list';
import {StepConstraint} from './comm... |
41108e05f1caca135b06ffaffa20ea91a1130236 | TypeScript | Areyesfigueroa/Data-Structures-Practice | /src/DataStructures/Queue/Queue.ts | 3.9375 | 4 | export{}
export class Queue<Type> {
#elements:Type[] = [];
//Add element from the back
enqueue: (e:Type) => void = (e) => {
this.#elements.push(e);
}
//Remove element from the front
dequeue: () => Type | undefined = () => {
return this.#elements.shift();
}
isEmpt... |
3f3506d85a8f6be706b6fa756b0697c07baa6cb3 | TypeScript | hillmychen/react-typescript-template | /src/api/common/types.ts | 2.65625 | 3 | /*
* @Author: Hughie
* @Date: 2021-04-18 18:10:20
* @LastEditors: Hughie
* @LastEditTime: 2021-04-18 18:17:05
* @Description:
*/
// 登录接口
export interface LoginRequest {
/** 手机号 */
phone: string
/** 密码 */
password: string
}
export interface LoginResponse {
/** ID */
id: number
/** 用户昵称 */
nicknam... |
1d4638f34cb9c4cfa03f013bfd1fba39b9054037 | TypeScript | avaschenko/la-components | /packages/utils/src/formatters/spaceSeparateThousands/spaceSeparateThousands.test.ts | 3.078125 | 3 | import spaceSeparateThousands from './spaceSeparateThousands';
import expect from 'expect.js';
describe('spaceSeparateThousands', () => {
const testOptions = [
{ input: 0, output: '0' },
{ input: 1, output: '1' },
{ input: -1, output: '-1' },
{ input: 1.1, output: '1.1' },
{ input: 1000, output:... |
33ea0f9b870126969007d6eb703e058c66f2fba8 | TypeScript | mtuduri/angular2-mdl | /dist/components/common/animations.d.ts | 2.609375 | 3 | export interface AnimationPlayer {
onDone(fn: () => void): void;
play(): void;
}
export declare class NativeWebAnimationPlayer implements AnimationPlayer {
private element;
private keyframes;
private duration;
private easing;
private onDoneCallback;
constructor(element: any, keyframes: {... |
c8748db3f1505c206378b01fc4ced9946b59cc25 | TypeScript | b4nst/stream-mock | /src/writable/BufferWritableMock.ts | 3.3125 | 3 | /**
* @module writable
*/
import {Writable, WritableOptions} from 'stream'
import {chunk2Buffer} from '../helpers'
import IWritableMock from './IWritableMock'
/**
* BufferWritableMock is a writable stream working in normal (buffer) mode.
*
* @example
* ```typescript
* import { BufferWritableMock } from 'strea... |
dc03285e1ff74f82328215aefc07f41256c9bddf | TypeScript | PeterStaev/NativeScript-Status-Bar | /sample/StatusBarSample/typings/tns-core-modules/ui/core/view.d.ts | 2.953125 | 3 | declare module "ui/core/view" {
import style = require("ui/styling");
import dependencyObservable = require("ui/core/dependency-observable");
import proxy = require("ui/core/proxy");
import gestures = require("ui/gestures");
import color = require("color");
import observable = require("data/obse... |
489f75bb5de7782a96ce980dba58eb2c8a45ed96 | TypeScript | mshzidan22/akoam-scraper-api | /src/app.ts | 2.53125 | 3 | import express from 'express';
import { AkoamLink } from './AkoamLink';
import {run} from './script'
var path = require('path');
const app = express();
const port = process.env.PORT || 3000
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname + '/index.html'));
})
app.get('/akoamapi', (req, res) => {
... |
998e8e05d5affe85111e70db7139c21468fc9845 | TypeScript | edwinvillota/portfolio_v2_api | /src/users/dao/users.dao.ts | 2.8125 | 3 | import { User } from '../models/User';
import { CreateUserDto } from '../dto/create.user.dto';
import { PutUserDto } from '../dto/put.user.dto';
import { PatchUserDto } from '../dto/patch.user.dto';
import debug from 'debug';
const log: debug.IDebugger = debug('app:in-memory-dao');
type PatchUserAttributesType = keyo... |
ba445159cba1541d04d9fa73cf9ae6003f1699f0 | TypeScript | jacobclarke92/waverider-tonejs | /src/fileManager.ts | 2.515625 | 3 | import { Store } from 'redux'
import { ReduxStoreType, ThunkDispatchType } from './types'
import { downloadData } from './utils/blobUtils'
import { updateProjectMeta } from './reducers/project'
import { overwriteInstruments } from './reducers/instruments'
import { overwriteEffects } from './reducers/effects'
import { o... |
652fc4a0e3efabdd05e11eb7eb0fef8790e0fa0a | TypeScript | wybosys/nnt.game.h5 | /project/src/nnt/gui/bitmap.ts | 2.609375 | 3 | module nn {
// 和使用textmerge划分的数据保持一致
export type Point9 = [number, number, number, number];
export abstract class CBitmap extends Widget {
constructor(res?: TextureSource) {
super();
}
dispose() {
super.dispose();
}
protected _initSignals()... |
cb761950e29da81733bc2c605e603efd2b7615b9 | TypeScript | gsanta/silhouette-people | /src/model/objects/game_object/GameObjectState.ts | 2.796875 | 3 | import { GameObject } from "./GameObject";
export enum GameObjectStateName {
CharacterIdleState = 'CharacterIdleState',
CharacterWalkingState = 'CharacterWalkingState',
BikeIdleState = 'BikeIdleState',
BikeMovingState = 'BikeMovingState'
}
export abstract class GameObjectState {
protected _is... |
c1c6b5e47e8a976de08b4140bfa58c8538e0144a | TypeScript | RamiroMaydana/API-express-ts-mongo | /src/rutas/UsuarioRutas.ts | 2.765625 | 3 | // Modulos de Express
import { Request, Response, NextFunction, Router} from 'express';
// Esquema de documento Usuario
import Usuario from '../modelos/Usuario';
class UserRouter {
router: Router;
constructor(){
this.router = Router();
this.routes();
}
async obtenerUsuarios(req: Reque... |
f9e74b6bee2634098da7e16ac1c280acce706aa4 | TypeScript | jinleili/rum-app | /src/utils/formatPath.ts | 2.5625 | 3 | import { isWindow } from 'utils/env';
export default (path: string, options: { truncateLength: number }) => {
const _path = isWindow ? path.replaceAll('/', '\\') : path;
return _path.length > options.truncateLength
? `...${_path.slice(-options.truncateLength)}`
: _path;
};
|
bcf196a332c026c08b9867fa93cca87703088373 | TypeScript | brice-dymas/pedag | /src/main/webapp/app/entities/administrateur/administrateur.model.ts | 2.734375 | 3 | import { IUser } from 'app/entities/user/user.model';
import { Grade } from 'app/entities/enumerations/grade.model';
export interface IAdministrateur {
id?: number;
nom?: string;
prenom?: string | null;
email?: string;
grade?: Grade;
user?: IUser | null;
}
export class Administrateur implements IAdministr... |
866131d8fccb06328f54e1d83a82da01d76ae1d9 | TypeScript | I-dela/KLM-Project-FrontEnd | /src/app/services/equipment.service.spec.ts | 2.578125 | 3 | import {getTestBed, TestBed} from '@angular/core/testing';
import {EquipmentService} from './equipment.service';
import {Equipment, EquipmentStatus} from '../models/equipment';
import {EquipmentType} from '../models/equipmentType';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testi... |
ee83cbc78517447ef95a2f90bba79e12c939d0fd | TypeScript | ByzantineFailure/UNIAC-Player | /src/lib/handlers/party_api.ts | 2.609375 | 3 | import {Express, Response} from "express";
import {Spotify} from "../spotify";
import {AsyncHandler, ErrorCodes, Handler, IAddTrackRequest, IErrorMessage, IGetPlayStateResponse} from "../../types/api";
import * as Paths from "../paths";
import { Authentication, redirectForAuth } from "./auth";
const TRACK_URI_REGEX =... |
d13559ab1918dce0bf510911af234ac5e5602bbc | TypeScript | isabella232/hotspot-app | /src/utils/location.ts | 3.34375 | 3 | import * as Location from 'expo-location'
export type LocationCoords = { latitude: number; longitude: number }
export const reverseGeocode = async (latitude: number, longitude: number) =>
Location.reverseGeocodeAsync({ latitude, longitude })
export const getCurrentPosition = async (
accuracy: Location.LocationAc... |
5fc3b19a9ee88b021a8ee9fcb2ad65f2610d9919 | TypeScript | intjr/github-state | /projects/simple-store/src/app/store/actions.ts | 2.65625 | 3 | import { Resort } from './models';
import { Action } from './store';
export enum SidenavActionTypes {
HideSidenav = '[Sidenav] Hide Sidenav',
ShowSidenav = '[Sidenav] Show Sidenav'
}
export class HideSidenav implements Action {
readonly type = SidenavActionTypes.HideSidenav;
}
export class ShowSidenav implemen... |
7a52a6a0bb15fc642a7c2bbfaa5fa5ed309e31e2 | TypeScript | boltex/morejs | /src/moreOutline.ts | 2.5625 | 3 | import * as vscode from 'vscode';
import { More } from './more';
/**
* * Structural node type used by the model.
* (vscode needs TreeItem via getTreeItem in the TreeDataProvider)
*/
export interface PNode {
header: string;
gnx: string;
children: PNode[];
parent?: PNode;
selected?: boolean;
}
/*... |
4fbdf58d39a8f2acc22b13962db347b9ca1faa5c | TypeScript | martindesc/TechnoWeb | /2-typescript wNM/src/server.ts | 2.546875 | 3 | import express = require('express')
const app = express()
const port: string = process.env.PORT || '8080'
import { MetricsHandler } from './metrics'
app.get('/metrics.json', (req: any, res: any) => {
MetricsHandler.get((err: Error | null, result?: any) => {
if (err) {
throw err
}
res.js... |
b08b8f6dd12b934f32d459c4b9a8920c1a543f44 | TypeScript | ZeroCho/DefinitelyTyped | /types/parse5-htmlparser2-tree-adapter/parse5-htmlparser2-tree-adapter-tests.ts | 2.5625 | 3 | import * as parse5 from "parse5";
import treeAdapter = require('parse5-htmlparser2-tree-adapter');
// htmlparser2 AST
const htmlparser2Document = parse5.parse("<html>", {
treeAdapter
});
htmlparser2Document; // $ExpectType Document
htmlparser2Document.name; // $ExpectType "root"
htmlparser2Document.type; // $Expe... |
8514a1b4f0fd58020ae3bc0cc271fdc19fd3ac20 | TypeScript | felixroos/blog | /content/components/common/isPrime.ts | 3.203125 | 3 | // returns true if the given number is prime
export const isPrime = num => {
for (let i = 2, s = Math.sqrt(num); i <= s; i++)
if (num % i === 0) return false;
return num > 1;
} |
e8c90903da629c3ffa5e088ce6b3e94ff9c866d1 | TypeScript | zeroc0d3/graphql-zeus | /src/TreeToTS/functions/fullSubscriptionConstruct.ts | 2.734375 | 3 | import { StringFunction } from './models';
export const fullSubscriptionConstruct: StringFunction = {
ts: `
const fullSubscriptionConstruct = (fn: SubscriptionFunction) => (
t: 'query' | 'mutation' | 'subscription',
tName: string,
) => (o: Record<any, any>, variables?: Record<string, any>) =>
fn(queryConstruct... |
9a884555f9ab2f768c68163fa3ed59f0a4d41cd7 | TypeScript | kenchris/lit-element | /src/lit-element.ts | 2.59375 | 3 | import { html, render } from '../node_modules/lit-html/lib/lit-extended.js';
import { TemplateResult } from '../node_modules/lit-html/lit-html.js';
export { html } from '../node_modules/lit-html/lib/lit-extended.js';
export { TemplateResult } from '../node_modules/lit-html/lit-html.js';
export interface PropertyOptio... |
c42325d69c76a271ee946b4389a2d2bf4f15e4c1 | TypeScript | ryefimchuk/responsive-box | /src/media-queries/compiler/parser/features/width-node.ts | 2.640625 | 3 | import { FeatureNode } from './feature-node';
export class WidthNode extends FeatureNode {
constructor(width: number) {
super('width', width);
}
public toJS(): string {
return `width === ${this.value}`;
}
} |
90a2c9eb52777c1c33b3101a5e68bbb7202d48c6 | TypeScript | korirsammy/DatingApp | /DatingApp-SPA/src/app/_directives/hasRole.directive.ts | 2.53125 | 3 | import { Directive, Input, ViewContainerRef, TemplateRef, OnInit } from '@angular/core';
import { AuthService } from '../_services/auth.service';
@Directive({
selector: '[appHasRole]'
})
export class HasRoleDirective implements OnInit {
@Input() appHasRole:string[];
isVisble=false;
constructor(private viewContain... |
d98ef666c964f0cfd2db8d64365502d016c572cf | TypeScript | halbtale/graphql-project | /graphql-typescript/src/structure/user/UserResolver.ts | 2.625 | 3 | import { DocumentType } from '@typegoose/typegoose';
import {Resolver, Query, Arg, Ctx, Authorized, FieldResolver, ResolverInterface, Root, Mutation} from 'type-graphql'
import { CommentModel } from '../comment/CommentModel';
import { Comment } from '../comment/CommentSchema';
import { ContextType } from '../context/Co... |
9cad010ecd41b70ee07d7f0a6c885783547ce013 | TypeScript | Devcon4/Sparrow | /src/models/Member.ts | 2.5625 | 3 | export default class Member {
id = '';
fullName = '';
avatarUrl = '';
constructor(init: Partial<Member>) {
Object.assign(this, init);
}
}
|
8bb2187c553bd09e0d824bb90872462b85db8562 | TypeScript | qiwi/repocrawler | /packages/reporters/src/main/ts/parsers.ts | 2.515625 | 3 | import { PackageJson } from '@qiwi/npm-types'
import { TRepoCrawlerReportResultItem } from '@qiwi/repocrawler-common'
import { ILogger } from '@qiwi/substrate'
import { parse } from '@yarnpkg/lockfile'
import {
EDependencyType,
TDependency,
TDepsSource,
TFoldedDependency,
} from './interfaces'
import { getRepo... |