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 |
|---|---|---|---|---|---|---|
753698eaabcb11f567c8112c769a3e920767ca43 | TypeScript | ngAnzar/rpc | /src/runtime/client.ts | 2.546875 | 3 | import { Inject, Injectable } from "@angular/core"
import { of, throwError } from "rxjs"
import { map, switchMap } from "rxjs/operators"
import { HTTPTransport, Transport } from "./transport"
export abstract class Client {
public abstract readonly transport: Transport
}
export interface MethodOptions {
nam... |
7dbd92790b5eaed40021a344f6f5fe519dfda36c | TypeScript | desktop/desktop | /app/src/models/author.ts | 3.828125 | 4 | /** This represents known authors (authors for which there is a GitHub user) */
export type KnownAuthor = {
readonly kind: 'known'
/** The real name of the author */
readonly name: string
/** The email address of the author */
readonly email: string
/**
* The GitHub.com or GitHub Enterprise login for
... |
1d32dbf5b97c7c62b9478325ef05cfd190bc2e66 | TypeScript | Pendrokar/magia-ts | /js/scroll.ts | 2.71875 | 3 | export class Scroller {
// Declare variables:
private debug : boolean = false;
private paperHeight : number = 1610;
private viewHeight : number = 0;
private scrollTopOffset : number = 240 - this.paperHeight;
private scrollBottomOffset : number = this.scrollTopOffset - this.paperHeight;
private scrollTimer : numb... |
2bb10839ee045c9658d6ebd8d58073a75a9a10e8 | TypeScript | project-koku/koku-ui | /src/api/accountSettings.ts | 2.578125 | 3 | import axios from 'axios';
import type { PagedLinks, PagedMetaData } from './api';
export interface AccountSettingsData {
cost_type?: string;
currency?: string;
}
export interface PagedMetaDataExt extends PagedMetaData {
limit?: number;
offset?: number;
}
export interface AccountSettings {
meta: PagedMeta... |
54ce65a634026814b1802314ef92b3e9ad863ffc | TypeScript | nestjs/nest | /packages/microservices/helpers/kafka-parser.ts | 2.875 | 3 | import { isNil } from '@nestjs/common/utils/shared.utils';
import { KafkaParserConfig } from '../interfaces';
export class KafkaParser {
protected readonly keepBinary: boolean;
constructor(config?: KafkaParserConfig) {
this.keepBinary = (config && config.keepBinary) || false;
}
public parse<T = any>(data... |
fb7b4d9eb6b65e3858b93259f03c8bfb7a647397 | TypeScript | webkam11/tensorflowjs-iris-demo | /src/index.ts | 2.75 | 3 | import * as tf from "@tensorflow/tfjs"
import iris from "./resources/iris.json";
import irisTesting from "./resources/iris-testing.json";
// convert/setup our data
const trainingData = tf.tensor2d(iris.map(item => [
item.sepal_length, item.sepal_width, item.petal_length, item.petal_width,
]))
const outputData = tf.t... |
1b3e51df670d0de30119d2d7fb59da355f3f21e5 | TypeScript | richardfigueroa/shopifyrichard | /src/helpers/omdb_api.ts | 2.96875 | 3 | import { Movie } from "../models/Movie";
const OMDB_API_KEY = process.env.REACT_APP_OMDB_API_KEY || "";
const searchMoviesWithQuery = async (
query: string,
callback: (results: Movie[], error: Error | null) => void
) => {
const trimmedQuery = query.trim();
if (trimmedQuery.length === 0) {
callback([], nul... |
ed1a090f8b8aadcb2ca1554ca1d4e2b09da414ce | TypeScript | tgbaldo/flashcards-api-node-typescript | /src/application/Deck/GetAllDeck.ts | 2.6875 | 3 | import RepositoryFactory from '../../domain/Core/RepositoryFactory';
import Deck from '../../domain/Deck/Deck';
import DeckRepository from '../../domain/Deck/DeckRepository';
import GetDeckOutput from './GetDeckOutput';
export default class GetAllDeck {
deckRepository: DeckRepository;
constructor (repositoryFacto... |
b0c0bec7daba0b976714c8613e2d6e3e57ea37de | TypeScript | kripton-it/matrix-ui | /src/lib/matrix.ts | 3.375 | 3 | import autobind from 'autobind'
import { isSquare } from 'src/lib/analyzer'
export type Items = number[][];
export type Rows = number[][];
export type Row = number[];
export interface Size { width: number; height: number }
export type Initiator = (x?: number, y?: number, size?: Size) => number
export default class M... |
dd4368db4f16407a043d1a5cbd7dbf4e247c6a24 | TypeScript | linux-china/kotlin-is-like-typescript | /code/range-operator.ts | 3.078125 | 3 | import * as _ from 'lodash';
const names = ["Anna", "Alex", "Brian", "Jack"];
const count = names.length;
for (let i of _.range(0, count)) {
console.log(`Person ${i + 1} is called ${names[i]}`)
}
// Person 1 is called Anna
// Person 2 is called Alex
// Person 3 is called Brian
// Person 4 is called Jack
|
f99a79c011f2bc406e3e82ce9a8f51fcda4b9d5d | TypeScript | maxgherman/ts-haskell | /test/ghc/base/maybe/monoid.test.ts | 3.09375 | 3 | import tap from 'tap'
import { compose } from 'ghc/base/functions'
import { monoid as createMonoid } from 'ghc/base/maybe/monoid'
import { MaybeBox, $case as maybeCase, just, nothing } from 'ghc/base/maybe/maybe'
import { FunctionArrowSemigroup, semigroup as createSemigroup } from 'ghc/base/function-arrow/semigroup'
im... |
16d0450f0c2751563049ce5d11d2eb928ea5f92e | TypeScript | gherz-lau/babana-rebuild | /src/app/components/items/item-box/item-box.component.ts | 2.546875 | 3 | import { Component, OnInit, SkipSelf } from '@angular/core';
import { ItemsService } from './../../../services/items.service';
@Component({
selector: 'app-item-box',
templateUrl: './item-box.component.html',
styleUrls: ['./item-box.component.scss'],
})
export class ItemBoxComponent implements OnInit {
construc... |
c07f4212279c2dfb03a6e1aca409edd5dce21438 | TypeScript | acmeframework/af-documents | /src/lib/properties/normalizers/noop-normalizer.ts | 2.6875 | 3 | import { Normalizer, NormalizerOptions } from './normalizer';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface NoopNormalizerOptions extends NormalizerOptions {}
export class NoopNormalizer<
T = any,
O extends NoopNormalizerOptions = NoopNormalizerOptions
> extends Normalizer<T, ... |
031a2063496111c31e1050e521a6db6576be8087 | TypeScript | jacobwindsor/MetabMaster | /src/app/pathway.service.ts | 2.734375 | 3 | import { Injectable } from '@angular/core';
import {FirebaseService} from "./firebase.service";
import {Observable, Subject} from "rxjs/Rx";
export interface Pathway {
id: string;
WPId: number;
title: string;
description: string;
userId: string;
createdAt: number;
reversedCreatedAt: number;
}
@Injectabl... |
9c61eedb7ada337156848fe5df1385c5135e612d | TypeScript | JoseEncinoza/Mystique_desktop | /src/app/modules/marketing/promocion/config-promocion/segundo-paso/segundo-paso.component.ts | 2.671875 | 3 | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-segundo-paso',
templateUrl: './segundo-paso.component.html',
styleUrls: ['./segundo-paso.component.scss']
})
export class SegundoPasoComponent implements OnInit {
listaTipoParam: ITipoParametro[]=[
{id:1,nombre:"Datos básicos... |
c9576f90a20f8b6ef8380be0f7a81c4940821e40 | TypeScript | AlexisK/finance | /src/app_modules/directives/scroll-css.directive.ts | 2.78125 | 3 | import {Directive, ElementRef, Input, HostListener, AfterViewInit} from '@angular/core';
@Directive({selector : '[scrollCss]'})
export class ScrollCssDirective implements AfterViewInit {
@Input() scrollCss: any;
constructor(private el: ElementRef) {
}
ngAfterViewInit() {
this.normalizeData(... |
75c9eea3ccc0457f48dd19cf46cd3114a935b0b7 | TypeScript | gulfofmaine/Neracoos-1-Buoy-App | /src/Shared/erddap/metadata.ts | 2.6875 | 3 | import { ErddapDataset } from './types'
/**
* Return the metadata URL for a given dataset.
*
* @param dataset Source dataset to extract URL from.
* @returns String with URL to ERDDAP server dataset metadata.
*/
export function datasetInfoJson(dataset: ErddapDataset): string {
return dataset.server + '/info/'... |
854e3f7241dd960dc5ade167a02d9850b00dc3cd | TypeScript | lbeder/openzeppelin-upgrades | /packages/core/src/utils/log.ts | 2.78125 | 3 | import chalk from 'chalk';
import { indent } from './indent';
export function logWarning(title: string, lines: string[] = []): void {
const parts = [chalk.yellow.bold('Warning:') + ' ' + title + '\n'];
if (lines.length > 0) {
parts.push(lines.map(l => indent(l, 4) + '\n').join(''));
}
console.error(part... |
ee8abc548da15ee7e7064a44ba5885c85390095e | TypeScript | mmoskal/dapjs | /src/util.ts | 2.921875 | 3 | import {ApReg, DapVal, Reg} from "./dap/constants";
export const readUInt32LE = (b: Uint8Array, idx: number) => {
return (b[idx] |
(b[idx + 1] << 8) |
(b[idx + 2] << 16) |
(b[idx + 3] << 24)) >>> 0;
};
export const bufferConcat = (bufs: Uint8Array[]) => {
let len = 0;
for (const b ... |
11fcc5a484c6e43725c8cb97330094c7384ffca4 | TypeScript | sheweichun/future | /packages/free-canvas-shared/src/pos.ts | 3.203125 | 3 |
type PosRect = {
left:number,
top:number,
_left:number,
_top:number,
}
const MINI_NUMBER = 0.0000000001
function fixPercent(percent:number){
return percent < MINI_NUMBER ? MINI_NUMBER : percent
}
function fixValue(val:number){
// return val;
return Math.floor(val);
}
function getRelativ... |
4e77fca9b6e6be8bc6eeb1d7fe688372d3d3bd7f | TypeScript | Meowchacho/core-ts | /src/EntityLoader.ts | 3.078125 | 3 | export interface IEntityLoaderConfig {
area?: string;
bundle?: string;
path?: string;
db?: string;
}
export interface IDataSource {
name: string;
resolvePath(config: { path: string; bundle: string; area: string }): string;
hasData(config: IEntityLoaderConfig): Promise<any>;
fetchAll?(config: IEntityLoaderConfi... |
34589bec7a6cd1d0d4850aa9492f7ace5d76814b | TypeScript | SergioEGGit/Project_Translator_From_Java_To_Javascript_And_Python_SEG | /Source Code/Backend/Traductores/Javascript/src/AnalizadorLexicoSintactico/If.ts | 3.109375 | 3 | // Imports
// Clase Abstracta
import { Instruccion } from "./Instruccion";
// Metodo Identacion
import { AgregarIdentacion } from "./Variables_Metodos";
// Clase Principal
export class If extends Instruccion {
// Constructor
constructor(Linea: number, Columna: number, private Condicion: Instruccion, private... |
b5e2c352862fb5b38c326f654ec878e72269e5b1 | TypeScript | JosephWaldman/JB-FinalProject-2020---Client-Angular8 | /src/app/Manager Area/manage-users/manage-users.component.ts | 2.546875 | 3 | import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FileUploader } from 'ng2-file-upload';
@Component({
selector: 'manage-users',
templateUrl: './manage-users.component.html',
styleUrls: ['./manage-users.component.css']
})
export class ManageUsersCompone... |
e2b7992efb806bef4c0425159898fa5937f62ee5 | TypeScript | jamescarr/frontend-learning | /testing/ts-with-jest/src/main.spec.ts | 3.234375 | 3 | import {isInternalLink, GenericNumber} from './main';
describe('internal link checker', () => {
it('should return false given external link', () => {
expect(isInternalLink('https://google.com')).toBe(false)
})
it('should return true given internal link', () => {
expect(isInternalLink('/som... |
2067adc15f632b1ad5e758e5946818a8a7fe659c | TypeScript | guzmanoj/diffx | /chrome-extension/src/utils/get-object-map.ts | 3.515625 | 4 | export interface ObjectMap {
id: string,
key: string,
value: string,
type: 'string' | 'boolean' | 'number' | 'array' | 'object',
children: ObjectMap[]
}
export function getObjectMap(obj: any, id = ''): ObjectMap[] {
return Object.keys(obj)
.map(key => {
const value = obj[key];
return {
id: id + key,
... |
2b4b9ddf57aa29991027400f3799ba29120a427b | TypeScript | ulfik/angular-projects | /src/app/common/pipes/filter.pipe.ts | 2.625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'arrayOfObjectsFilter',
pure: false
})
export class FilterPipe implements PipeTransform {
transform(value: any, key: any, objectValue: any): any {
if (!value.length || !objectValue) {
return value;
}
return value.filter((element... |
1f4f5cf4974edeb26297a813ec058dd84bb243a4 | TypeScript | netanelgilad/deaven | /src/prophet/eval/eval.ts | 2.515625 | 3 | import { ESFunction } from "../Function/Function";
import { TExecutionContext } from "../execution-context/ExecutionContext";
import { Any, Undefined } from "../types";
import { tuple } from "@deaven/tuple";
import { TESString } from "../string/String";
import { unsafeCast } from "@deaven/unsafe-cast.macro";
import { e... |
a6904d3b50c7ad5afad10e7125897b7c683592f1 | TypeScript | razjel/dependency-injection-test | /src/common/actionFlow/action/process/AFLegacyBaseProcess.ts | 2.890625 | 3 | /*
* a
*/
/*
* a
*/
import {afProcess} from "../decorators/AFActionDecorators";
/**
* can be async or singular
*/
export class AFLegacyBaseProcess {
/** namespace */
public pbxLib = {
singular: false,
playbackBlocking: false,
// mark processes which might stop to work when we change how process return ... |
44aaa2bc2797cf85656c708cbf02a6810ef6bbde | TypeScript | Kabir-Sagi/Employee-Portal-App | /src/app/services/employee.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {retry} from 'rxjs/operators';
import {Observable} from 'rxjs';
import {IEmployee} from '../IEmployee';
@Injectable({
providedIn: 'root'
})
export class EmployeeService {
constructor(private _httpClient:HttpClient)... |
1596ddf8058b85bccdbe5b94eef432c2cb5c92da | TypeScript | meighan/slack-admin-tools | /admin_app_management-master/auth.ts | 2.609375 | 3 | import express = require('express');
import bodyParser = require('body-parser');
require('dotenv').config();
const authApp: express.Application = express();
authApp.use(bodyParser.json());
authApp.use(function (error: Error, req: any, res: any, next: any) {
if (error instanceof SyntaxError) {
res.send("B... |
acde968a718102f42c88da53778abbc3a912d59a | TypeScript | nadermedhet148/Nodejs-Streamers | /src/CopyFile.ts | 2.671875 | 3 | import {createReadStream , createWriteStream} from 'fs';
const readStream = createReadStream("logs" , {
});
const writeStream = createWriteStream("logs2");
// will send the
readStream.pipe(writeStream)
readStream.on("close", (e) => console.log("closed" , e));
readStream.on("drain", (e) => console.log("closed ", e)... |
8ba92f32a2e4bec12e2064b97164946fb782807a | TypeScript | joyan828/ts-practice | /src/temp/practice.ts | 4.34375 | 4 | // basic types
let count: number = 0
count += 1
const done: boolean = true
const numbers: number[] = [1, 2, 3]
const messages: string[] = ['hello', 'world']
let mightBeUndefined: string | undefined = undefined
let nullableNumber : number | null = null
let color: 'red' | 'orange' | 'yellow' = 'red'
color = 'orange'... |
dbaa19105ddcc4c41a53ae1f71dea959cbcde81c | TypeScript | tanshio/amplify-sns-to-slack | /src/lambda/amplify/index.ts | 2.765625 | 3 | import axios from 'axios'
const PREFIX = `Your build status is `
const STATUSES = ['STARTED', 'SUCCEED', 'FAILED'] as const
type StatusType = typeof STATUSES[number]
type messageType = {
[k in StatusType]: any
}
const createSlackMessage = (msg: string): any => {
return [
{
type: 'section',
text: ... |
a8a2f8ba906268280f987237477bebea9063ff98 | TypeScript | jeromeraffin/blackjack | /src/core/services/api.ts | 2.859375 | 3 | import axios, { AxiosResponse } from 'axios';
import Deck from '../types/Deck';
import Card from '../types/Card';
// setup the base API URL
axios.defaults.baseURL = 'https://deckofcardsapi.com/api/';
export async function getNewDeck(): Promise<Deck> {
const response: AxiosResponse<Deck> = await axios.get(
'deck... |
e2be6860442e8770643d943c93638520ed4a31e5 | TypeScript | conventional-changelog/commitlint | /@commitlint/load/src/utils/load-parser-opts.ts | 2.71875 | 3 | import {ParserPreset} from '@commitlint/types';
type Awaitable<T> = T | PromiseLike<T>;
function isObjectLike(obj: unknown): obj is Record<string, unknown> {
return Boolean(obj) && typeof obj === 'object'; // typeof null === 'object'
}
function isParserOptsFunction<T extends ParserPreset>(
obj: T
): obj is T & {
... |
5583afa051a70b52536c35bfe9799cef1e8baa1d | TypeScript | nishantnaithani97/TypeScript_Node | /test/routes/userLogin.test.ts | 2.78125 | 3 | /**
* USER LOGIN TEST FILE
* This file contains the test cases for testing the user"s login function.
*/
require("../../src/database");
import request from "supertest";
import Users from "../../src/models/Users";
import app from "../../src/app";
import Register from "../fixtures/register";
import Login from "../fixt... |
e7d8adc101ec9abfad6caf8ce6f8928d2999f939 | TypeScript | murtekbey/ReCapProject-SPA | /src/app/store/auth/auth.reducer.ts | 2.546875 | 3 | import { createReducer, on } from '@ngrx/store';
import { setUserDetail, deleteUserDetail } from './auth.actions';
import { UserDetailDto } from '../../models/dtos/userDetailDto';
export interface AuthState {
userDetailDto?: UserDetailDto;
}
const initialAuthState: AuthState = {
userDetailDto: undefined,
};
expo... |
867fd06d32205aca297a40ccc2199d17eaaf0f59 | TypeScript | JamesNikolaidis/e-Cinema | /eCinemaApplication/src/app/objects/userComments.object.ts | 3.125 | 3 | export class UserComments{
private userName:string;
private message:string;
constructor(userName:string,message:string){
this.userName = userName;
this.message=message;
}
public setUserName(userName:string):void{
this.userName= userName
}
public setMessage(message:... |
4ce257e22f0d34794216942749656623d531b029 | TypeScript | zhouhoujun/type-task | /packages/core/src/activities/Dependence.ts | 2.5625 | 3 | import { IActivity, InjectAcitityToken, DependenceConfigure, Activity } from '../core';
import { Registration, Type } from '@ts-ioc/core';
import { Task } from '../decorators';
import { ControlActivity } from './ControlActivity';
/**
* dependence activity inject token.
*
* @export
* @class InjectDependenceActivity... |
6381f53692219cdaee3d0b23de521f4b69472135 | TypeScript | langzitc/fastweb | /web/src/core/util.ts | 2.765625 | 3 | export function findTarget(data: any, action: string): any {
let target = null;
if(Array.isArray(data)) {
for(let i = 0; i < data.length; i ++) {
if(data[i].action === action) {
target = data[i];
}else if(data[i].options) {
target = findTarg... |
65e21b9b7d8f7418d6d1f5fd1615232aa9714cc4 | TypeScript | onyettr/c-stack | /stack_check.ts | 3.328125 | 3 | #include <stdio.h>
#include "stack.h"
#test create_negative
Stack_t *sp;
printf("create_negative\n");
sp = StackCreate(-1);
fail_unless(sp == NULL, "negative create failed");
#test create_positive
Stack_t *sp;
printf("create_positive\n");
sp = StackCreate(5);
fail_un... |
11cca2b0b603999da519003bfcf11e4b5c5ac8f4 | TypeScript | adaapp-sd3/advanced-programming-2-jade-genevieve | /src/models/crops/Bean.ts | 2.96875 | 3 | import Crop from "../abstract/Crop"
import Farm from "../Farm";
import Farmer from "../Farmer";
class Bean extends Crop {
name: string = "Bean"
genus: string = "Legume"
imgUrl: string = "/img/twtr/1f331.png"
eats: string = "water"
thirst: number = 5
farm: Farm
farmer!: Farmer
constructor(farm: Farm... |
f3b12ad701017c7c232c4159a607b4ddcd41a433 | TypeScript | PoorlyDefinedBehaviour/discord-clone-backend | /src/chat/Chat.ts | 2.984375 | 3 | import Observer from "../interfaces/Observer";
import Observable from "../interfaces/Observable";
type Dictionary<T> = {
[key: string]: T;
};
export default class Chat implements Observable {
private observers: Dictionary<Set<Observer>> = {};
public subscribe(server_id: string, observer: Observer): void {
... |
cc127cf19fcd81ed5e64f775ef1d1310d5461b8b | TypeScript | developeramarish/Financial-Planner-Forecast-Ledger | /FPFL-UI/src/app/core/services/common/general-util.service.ts | 2.890625 | 3 | import { Injectable } from '@angular/core';
import { IClaims } from '../../model/claims';
/**
* General Application Utilities: Creates a singleton Service that provides
* or createss the Local Storage Claims object or the user OID contained within
*/
@Injectable({
providedIn: 'root'
})
export class GeneralUtilSer... |
0bbe3ac044d91faeea39c90b56a8bf56652bb081 | TypeScript | Vbitz/globalgamejam2018 | /oldGame/src/Building.ts | 2.78125 | 3 | import * as THREE from 'three';
import {LoadedMesh} from './common';
export enum BuildingHoverState {
Deselected,
Hovered,
Selected,
}
const modelData = JSON.parse(
require('fs').readFileSync(__dirname + '/../res/building.json', 'utf8'));
export class Building extends THREE.Mesh {
material: THREE.MeshPho... |
7a4cb80db82022e25b91b7dd9021cb2c2a2a0e64 | TypeScript | green-fox-academy/danielTiringer-todo-app | /main.ts | 2.71875 | 3 | 'use strict'
const fs = require('fs');
import { listFunctions } from './taskClasses';
import { taskList } from './taskClasses';
// let fileContent = 'I can write';
// fs.writeFileSync('message.txt', fileContent);
let args: string[] = process.argv;
let danielsToDoList = new taskList;
let mainProcess = () => {
if ... |
682a2c6f9aa2320f50d3eb2d398fe37988cfc6ec | TypeScript | dgp1130/bxpb | /packages/protoc-plugin/src/generators/services.ts | 2.640625 | 3 | import * as path from 'path';
import { FileDescriptorProto } from 'google-protobuf/google/protobuf/descriptor_pb';
import { CodeGeneratorResponse } from 'google-protobuf/google/protobuf/compiler/plugin_pb';
/**
* Returns an iterable of generated BXPB services from the given *.proto file and its descriptor.
*/
export... |
0e2ffcf98af9a8a85c831a26f69c329790124a5b | TypeScript | amoskim71/roadside-app | /server/src/user/entity/user.entity.ts | 2.515625 | 3 | import { Entity, PrimaryGeneratedColumn, Column, OneToOne } from 'typeorm';
import { UserRole } from '../user-role.interface';
import { Customer } from './customer.entity';
import { Professional } from './professional.entity';
@Entity()
export class User {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ u... |
fdf35c3b1fee34d6bf0c6bd2b56b7e5fc5896280 | TypeScript | kschuetz/calculator | /src/display/stack/models.ts | 3.578125 | 4 | import * as Immutable from 'immutable';
export interface Entry {
readonly lineCount: number;
lines(index: number): string;
}
class SimpleEntry implements Entry {
readonly text: string;
constructor(text: string) {
this.text = text;
}
get lineCount(): number {
return 1;
};
... |
febdab58b1f1cdbe2b2510f533a7ac000ecccebe | TypeScript | gainamit/FirstRepo | /pre-requisites/02-typescript-basics/after/03-interface-05-implementing-interfaces-in-classes.ts | 3.78125 | 4 | /**
* One or more interfaces can be implemented by a class - the class's properties and methods then have to implement the properties and methods in the interfaces
*/
(function() {
interface IncreaseLifespan {
( incr: number ) : void
}
interface IBreed {
name: string;
averageLife... |
4547ac31f1d7afe050ced578055c800c24d51e25 | TypeScript | HevertonOGS/gazin-test | /backend/src/modules/developers/repositories/fakes/FakeDevelopersRepository.ts | 2.796875 | 3 | import { v4 as uuid } from 'uuid';
import IDevelopersRepository from '@modules/developers/repositories/IDevelopersRepository';
import ICreateDeveloperDTO from '@modules/developers/dtos/ICreateDeveloperDTO';
import Developer from '../../infra/typeorm/entities/Developer';
class FakeDevelopersRepository implements IDev... |
c24f6ab973273bfb5fa9ba8e0d145a254739a587 | TypeScript | AkiaCode/saidbysoloisbaka | /commands/saebasol.ts | 2.578125 | 3 | import { Command, CommandContext, GuildTextChannel, Embed } from "../deps.ts"
import { Rest } from "../packages/doujinshiman/models/rest.ts"
export class SaebasolCommand extends Command {
name = 'saebsol'
aliases = ['sbl']
async execute(ctx: CommandContext) {
if (ctx.args[0] === undefined) return c... |
137cb23afe074c964271686c92ffed9200ca87db | TypeScript | ana-ya/ionic | /src/util/dom-controller.ts | 2.921875 | 3 | /**
* Adopted from FastDom
* https://github.com/wilsonpage/fastdom
* MIT License
*/
import { nativeRaf } from './dom';
import { removeArrayItem } from './util';
export type DomCallback = { (timeStamp: number) };
export class DomDebouncer {
private writeTask: Function = null;
private readTask: Function = nul... |
8668f1456111ff86047531c897672dd0674504f5 | TypeScript | ghidoz/item-manager | /src/app/shared/wishlist/wishlist.service.ts | 2.640625 | 3 | import { Injectable } from '@angular/core';
import { Item } from '../item';
@Injectable()
export class WishlistService {
wishlist: Item[] = [];
constructor() { }
add(item: Item){
this.wishlist.push(item);
}
remove(id: number){
this.wishlist = _.reject(<any>this.wishlist, (item: ... |
39aed2733249f367ca1a79edf6da0d1b0f0e88ea | TypeScript | bth1994/CR-MacroLabs-TypeScript-Casino | /Casino/BlackjackPlayer.ts | 3.265625 | 3 | import {Cards} from "./Card";
import {CardFactory} from "./CardFactory";
import {CardShuffler} from "./CardShuffler";
import Deck from "./Deck";
import Wallet from "./Wallet";
class BlackjackPlayer{
private hand: Array<Cards>;
private canHit: Boolean;
protected firstName: string;
protected lastName: string;
protected... |
67c1d56a208e085b57659202dd99a5613cd0318f | TypeScript | alocquet/aoc-2016 | /src/day-05/step-1/index.ts | 2.703125 | 3 | import { Day5 } from '../day-05';
import { Index } from '../model';
export class Day5Step1 extends Day5 {
execute(input: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
let res = '';
let curIndex = new Index(0, '');
for (let idx = 0; idx < 8... |
a9a9e49f807e4ff88f076e151490d5aefb268d5f | TypeScript | haifahrul/ng-bootstrap | /e2e-app/src/app/typeahead/autoclose/typeahead-autoclose.e2e-spec.ts | 2.5625 | 3 | import {openUrl, expectFocused, sendKey, rightClick} from '../../tools.po';
import {TypeaheadAutoClosePage} from './typeahead-autoclose.po';
import {Key} from 'protractor';
describe('Typeahead Autoclose', () => {
let page: TypeaheadAutoClosePage;
const expectTypeaheadToBeOpen = async(message: string) => {
exp... |
b320e03ae1422372a7449be28c4a354aa9e3aa4d | TypeScript | SocketDB/plugin-validate | /test/validate.test.ts | 2.765625 | 3 | import { nodeify } from 'socketdb/dist/node';
import schemaPlugin, { JSONSchemaType } from '../src';
type Data = {
[key: string]: {
player: {
[id: string]: {
name: string;
x: number;
y: number;
};
};
};
};
const schema: JSONSchemaType<Data> = {
type: 'object',
required: [],
additionalPropert... |
5b59e24414a2b4a9bb5d519384dc19555402f2ab | TypeScript | patrykkowalski0617/elevator-symulator | /src/components/car/logic/carTarget.ts | 3.03125 | 3 | // This part of code is supposed to be run
// after ShaftContext update allCarsFloorAssignments by addCarFloorAssignment
const carTarget = (
floorAssignments: number[],
carState: string,
currentFloor: number
) => {
let target: number | undefined;
const above = floorAssignments.filter(item => item ... |
f12c5b218fa30d03ee685018df6ab7f9da155f45 | TypeScript | nozgurozturk/marvin | /cli/src/models/repo.ts | 2.546875 | 3 | export type PackageVersion = {
current: string;
last: string;
};
export type Package = {
name: string;
version: PackageVersion;
file: string;
isOutdated: boolean;
};
export type Repo = {
id?: string;
userID: string;
name: string;
owner: string;
path: string;
provider: string;
packageList: [P... |
bacc982f51ea3b7b49d70c94350d66bf63e79ce3 | TypeScript | arjun-1/kafkaSaur | /src/broker/saslAuthenticator/oauthBearer.ts | 2.53125 | 3 | /**
* The sasl object must include a property named oauthBearerProvider, an
* async function that is used to return the OAuth bearer token.
*
* The OAuth bearer token must be an object with properties value and
* (optionally) extensions, that will be sent during the SASL/OAUTHBEARER
* request.
*
* The implement... |
aef7ab7062726633a7bc277568d97a9143d7fdaf | TypeScript | V4Fire/Core | /lib/core/async/interface.d.ts | 2.6875 | 3 | /*!
* V4Fire Core
* https://github.com/V4Fire/Core
*
* Released under the MIT license
* https://github.com/V4Fire/Core/blob/master/LICENSE
*/
import type Async from '../../core/async';
import type { Task, MarkReason, ClearReason, BoundFn, ClearFn, AsyncProxyOptions, ClearProxyOptions } from '../../core/async/modu... |
e37e9510c59b3314738e77cb5d08b9fa0fbea370 | TypeScript | denniske/gartic | /server/src/index.ts | 2.953125 | 3 | // This is the Edge Chat Demo Worker, built using Durable Objects!
// ===============================
// Introduction to Modules
// ===============================
//
// The first thing you might notice, if you are familiar with the Workers platform, is that this
// Worker is written differently from others you may ha... |
b7e746b23cc887c28a68da2c55f067f4c3b43a4c | TypeScript | framptonjs/frampton | /packages/core/src/main/utils/is-empty.ts | 3.578125 | 4 | import isNothing from './is-nothing';
/**
* Returns a boolean telling us if a given value doesn't exist or has length 0
*
* @name isEmpty
* @method
* @memberof Frampton.Utils
* @param {*} obj
* @returns {Boolean}
*/
export default function is_empty(obj: any): boolean {
if (typeof obj === 'string') {
retu... |
26f4faa2eb18b7204368791db3c91c9817a9ca84 | TypeScript | YasminElbahar/Eia2Aufgaben | /Canvas/Canvas_script.ts | 2.640625 | 3 | namespace Canvas {
document.addEventListener("DOMContentLoaded", init);
let canvas: HTMLCanvasElement;
let crc2: CanvasRenderingContext2D;
interface Canvas {
x: number;
y: number;
width: number;
height: number;
}
interface Point {
x: number;... |
77b15eb8031d99f3eb7d1cdfa720a5e1359818b6 | TypeScript | shunwuyu/lesson_md | /interview/basic_know/datastructor/link/link_test.ts | 3.515625 | 4 | import LinkedList from "./lib/linked_list";
const linkedList = new LinkedList();
linkedList.push(12);
linkedList.push(13);
linkedList.push(14);
linkedList.push(15);
linkedList.push(16);
linkedList.push(17);
linkedList.push(18);
linkedList.push(19);
// 移除索引为2的元素
linkedList.removeAt(2);
// 获取0号元素
console.log(linkedList... |
34f4c7dee351d980df311cf9dfc5dd1468a7c9cc | TypeScript | Maarkis/ADI6-PORTAL | /src/app/models/response/base-response.ts | 2.609375 | 3 | export class BaseResponse<T> {
public success: boolean;
public message: string;
public result: T;
}
|
578cdbc2b6aa91e8c92e5bc0bca084a6d767c90d | TypeScript | Manogel/eprint-nestjs | /src/modules/section/section.service.ts | 2.546875 | 3 | import { Injectable } from '@nestjs/common';
import { CreateSectionDto } from './dto/create-section.dto';
import { UpdateSectionDto } from './dto/update-section.dto';
@Injectable()
export class SectionService {
create(createSectionDto: CreateSectionDto) {
return 'This action adds a new section';
}
findAll()... |
f04f9e2967f3345b1ba1a5032e5e47e53b310c53 | TypeScript | cisikawa/dojo-protractor | /integration/features/data/testability.data.ts | 2.578125 | 3 | export class TestabilityData {
private readonly testabilityHeader;
private readonly testabilityBody;
constructor() {
this.testabilityHeader = 'Testability';
this.testabilityBody = 'The Testability service provides testing hooks that can be accessed ' +
'from the browser and by services such as Prot... |
b588ab4df8f69d19d6b340411f3229f1c4e3c587 | TypeScript | svatal/plovouci-filmoteka | /tvScraper/src/eventsMerger.ts | 2.859375 | 3 | import {
ITvEventInfo,
ITvMovie,
ITvEvent,
IBasicTvEventInfo,
IExtendedEventInfo,
isSameMovie
} from "shared/event";
export function merge(events: ITvEventInfo[]): ITvMovie[] {
return events.reduce(tryAppendEventToMovies, <ITvMovie[]>[]);
}
function tryAppendEventToMovies(
movies: ITvMovie[],
e: ITv... |
27ee3edcca50b1a4ebb3ba1d4de588f167045ade | TypeScript | JGdijk/ng-rds | /src/rds/statements/orderby-statement.ts | 3.34375 | 3 | export class OrderByStatement {
private statement;
constructor(statement){
this.statement = statement;
}
public order(data: any[]): any[] {
// todo we have to throw a big error when the key of the order doesn't exist on the object
let statement = this.statement;
if (s... |
30b2e3a71fab90caaf7f836ad3b5ee9ce4416abb | TypeScript | melquisedecfelipe/magrathea | /backend/src/controllers/SignInController.ts | 2.609375 | 3 | import axios from 'axios';
import { Request, Response } from 'express';
export default class SignInController {
public async auth(request: Request, response: Response) {
const { code } = request.params;
if (!code) {
return response.status(404).json({
message: 'Código de acesso inválido.',
... |
799b0cd0c48a000327bc07c6ef8c4267ac5dc113 | TypeScript | zachmart/distriprob | /src/outward/FloatUtil.ts | 2.6875 | 3 | "use strict";
/**
* (C) Copyright Zachary Martin 2018.
* Use, modification and distribution are subject to the
* Boost Software License:
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (th... |
8d56d8087d8b033b8a186cdc1d6fc28851ef4fe8 | TypeScript | fabig4da/ts-node-server | /src/middleware/users/userMiddleware.ts | 2.578125 | 3 | import { CustomValidator} from "express-validator";
import User from "../../models/users/user";
export const emailExist: CustomValidator = async(email: string)=>{
try {
const user = await User.findOne({email})
console.log(user)
if(user)
return Promise.reject('Email already exist... |
193b671a3c8154bf6702f5abedb4ee642c694c5a | TypeScript | ysabri/GitDrive | /src/git-drive/app/sync.ts | 2.734375 | 3 | import {
GRepository,
User,
WorkSpace,
} from "../../model/app";
import { Commit } from "../../model/git";
import { writeRepoInfo } from "../../util/metafile";
import {
commit,
fetchAll,
getCommit,
getStatus,
pushBranch,
} from "../git";
/**
* The big sync function, assumes very little ... |
dd4ef98301ccc9085b36922759ddae115c9b62ca | TypeScript | EmiliaNica/boilerplate | /frontend/src/app/teacherRecords.ts | 2.625 | 3 |
export class teacherRecords{
constructor(public student:string, public grade:number){
this.student = student;
this.grade = grade;
}
} |
f5bc1f002e479947a7d1266403ed0520c50ba514 | TypeScript | HappyCerberus/streambot | /src/backbone/backbone.ts | 2.5625 | 3 | import * as zmq from "zeromq"
import { MessageTypes } from "../lib/types"
import { PublisherQueue } from "../lib/publisher_queue"
async function listen(name: string, sub: zmq.Subscriber, pub: PublisherQueue) {
let id = 0;
for await (const [topic, msg] of sub) {
console.log(`BACKBONE | ${name} | receive... |
fb9b2dd369207bf895cbd37d113ad2699f589359 | TypeScript | aniket1101/xcode-projects | /TicTacToe/cloud-functions/functions/src/onGameCreate.ts | 2.765625 | 3 | import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
interface StartGame {
player: "x" | "o"
uid: string
}
const gamesPath = "/games"
const path = "/start/{gameId}"
const handler = async (snapshot: functions.database.DataSnapshot, context: functions.EventContext) => {
... |
e60f5112f061316892df1f57e0e1a6c55a58b351 | TypeScript | lukkerr/PraticaSistemaBancario | /app/ts/model/cliente.ts | 2.890625 | 3 | class Cliente {
private _nome : string;
private _cpf : string;
private _conta : Conta;
constructor (nome : string, cpf : string, conta : Conta) {
this._nome = nome;
this._cpf = cpf;
this._conta = conta;
}
get nome() : string {
return this._nome;
}
set ... |
0f465a8ec58b1e60c8628de4dc4297b9dcc62727 | TypeScript | duytrantlu/stl-test | /src/configs/auth/basic-auth.lib.ts | 2.515625 | 3 | /**
* @module auth
* @author DuyTM
* @description basic authenticate library
* @version 1.0.0
*/
import * as jwt from 'jsonwebtoken';
import { pick, omitBy, isNil } from 'lodash';
import { Request, Response, NextFunction, RequestHandler } from 'express';
import { AuthConfig } from './auth.config';
import { Const... |
3e5a1a0d093fd0fbe3dc3562b07b56be58035a5e | TypeScript | joaquinenriquez/Proyecto-vacio-Angular-con-Router-Bootstrap-y-Fontawersome | /src/app/services/auth.service.ts | 2.640625 | 3 | import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { IUsuario } from '../models/iusuario';
// Firebase
import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/firestore';
import { AngularFireAuth } from '@angular/fire/auth';
@Injectable({
providedIn: 'root'
})... |
e57bfe45240f97180d678ac6a92304915b28be2c | TypeScript | home-assistant/probot-home-assistant | /src/util/text_parser.ts | 2.859375 | 3 | import { GitHubAPI } from "probot/lib/github";
import { fetchIssueWithCache } from "./issue";
import { fetchPRWithCache } from "./pull_request";
interface PullOrBodyTask {
checked: boolean;
description: string;
}
interface IntegrationDocumentationLink {
link: string;
integration: string;
}
export class Parse... |
b0051e76d042b64d0d775930eaeef17da58c8469 | TypeScript | montalvomiguelo/cli | /packages/cli-kit/src/public/common/function.test.ts | 2.78125 | 3 | import {debounce, memoize} from './function.js'
import {describe, test, expect} from 'vitest'
describe('memoize', () => {
test('memoizes the function value', () => {
// Given
let value = 0
function functionToMemoize() {
value += 1
return value
}
const memoizedFunction = memoize(functi... |
f0afd38a3e888d0e00bf431c27227644e2583f9d | TypeScript | vcing/leetcode-ts | /1-100/88.merge-sorted-array.ts | 4.0625 | 4 | /*
* @lc app=leetcode id=88 lang=javascript
*
* [88] Merge Sorted Array
*
* https://leetcode.com/problems/merge-sorted-array/description/
*
* algorithms
* Easy (33.99%)
* Total Accepted: 318.8K
* Total Submissions: 922.7K
* Testcase Example: '[1,2,3,0,0,0]\n3\n[2,5,6]\n3'
*
* Given two sor... |
eed53df4fdd8ce52f9f95f6dac11fd0ee6729cbc | TypeScript | ArcticZeroo/linguistics-website | /src/api/linguistics/ipa/consonants.ts | 2.65625 | 3 | enum PlaceOfArticulation {
bilabial,
labiodental,
interdental,
alveolar,
palatal,
velar,
glottal
}
enum MannerOfArticulation {
stop,
fricative,
affricate,
nasal,
flap,
retroflexLiquid,
lateralLiquid,
glide
}
enum Voicing {
voiceless, voiced
}
interface ... |
99ffe73a31086dc09de10b66635748c65fc0bb59 | TypeScript | BEAR-finance/explorer | /kernel/packages/decentraland-ecs/src/decentraland/math/Vector2.ts | 3.875 | 4 | import { Matrix } from './Matrix'
import { FloatArray, Epsilon } from './types'
import { Scalar } from './Scalar'
/** @public */
export type ReadOnlyVector2 = {
readonly x: number
readonly y: number
}
/**
* Class representing a vector containing 2 coordinates
* @public
*/
export class Vector2 {
/**
* Crea... |
384fcc380e0c8870b373c8b397ef2347acfd1beb | TypeScript | ckesoglou/31242-AIP | /src/models/Offer.ts | 2.71875 | 3 | import { Model } from "sequelize";
import User from "./User";
// Class definition
export interface IOfferAttributes {
id: string;
author: string;
completed_by?: string;
proof_of_completion?: string;
details: string;
created_time: Date;
completion_time?: Date;
is_completed: boolean;
}
class Offer exte... |
43662437600fdb035ea55ee6b276b5f28daa4c69 | TypeScript | arthur791004/react-context-enhancer | /src/Subscription.ts | 2.71875 | 3 | class Subscription {
listeners: Function[] = [];
subscribe = (subscribeFn: Function) => {
this.listeners.push(subscribeFn);
};
unsubscribe = (subscribeFn: Function) => {
this.listeners = this.listeners.filter(
(listener) => listener !== subscribeFn
);
};
notify = () => {
this.listen... |
acaf06d566bbcd9cfb45b2c656b308b9eafebe20 | TypeScript | Botvinnik94/TFG_SC2_CompetitionManager | /functions/src/dao/firebase/FirebaseBotDAO.ts | 2.546875 | 3 | import { AbstractPlayerDAO } from "../AbstractPlayerDAO";
import { Bot } from "../../model/StarcraftTournamentElements/Bot";
import { Db } from "../../firebase/Db";
import { BotFirebaseConverter } from "./Converters/BotFirebaseConverter";
export class FirebaseBotDAO extends AbstractPlayerDAO<Bot> {
async update(p... |
d6ab91a33f56707de780572c60a16ad025b4f1f0 | TypeScript | jurnvdwerk/opdracht-spel | /main.ts | 2.953125 | 3 | input.onButtonPressed(Button.A, function () {
sprite.move(-1)
})
input.onButtonPressed(Button.B, function () {
sprite.move(1)
})
let pixel: game.LedSprite = null
let sprite: game.LedSprite = null
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
`)
basic.showLeds(`
.... |
3fe24994186bf8f905da131912ec0a9625fd4183 | TypeScript | Aoi-hosizora/GithubIssueCounter_TamperMonkey | /src/ts/utils.ts | 2.859375 | 3 | import Axios from "axios";
import { Global } from "./global";
/**
* Check the url and return the username or null if this is not a repository list page.
* @param url document url
* @returns username or null
*/
export function checkUrl(url: string): string | null {
const preserveKeywords = [
'', 'pulls'... |
ab6e1cd3936c221f9116983c376c9ecb09f05ced | TypeScript | open-flash/avm1-decompiler | /ts/src/lib/cfg/edge.ts | 2.546875 | 3 | import { Action } from "avm1-types/raw/action";
import { PartialExpr } from "../partial-expr";
import { Cfg } from "./cfg";
export type Edge =
ActionEdge
| ConditionalEdge
| ExpressionEdge
| IfFalseEdge
| IfTestEdge
| IfTrueEdge
| MarkerEdge
| SimpleEdge
| SubCfgEdge;
export enum EdgeType {
Action... |
d3cb47a227374779ee965e9a660e87c7e9d75d5b | TypeScript | AndrewB330/Jarvis330 | /src/telegram/api_telegram.ts | 2.6875 | 3 | import {Context, Telegraf} from "telegraf";
import {TelegramConfig} from "../config";
import {readFileSync} from "fs";
const TELEGRAM_API = new Telegraf(TelegramConfig.getBotToken());
const ADMIN_CHAT_ID = TelegramConfig.getAdminChatId();
interface KeyboardButton {
text: string;
handler: () => Promise<void>;
... |
fee01beecf5cbc82417c8132dc499ee402b9d332 | TypeScript | liviambrasil/api-repoprovas | /src/entities/semesters.ts | 2.546875 | 3 | import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
import Subject from "./subjects";
@Entity('semester')
export default class Semester {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
@OneToMany(() => Subject, subject => subject.semesterId)
subject: Subject[];
} |
48b9666beba0bbe0074831f8b3ac2b77b092f8fa | TypeScript | AlexZeitler/react-mvu-todo | /src/Types.d.ts | 2.671875 | 3 | declare type Task = {
id?: number,
title: string,
finished: boolean
}
declare type AppState = Array<Task>
declare type AppMsg = { type: 'AddTask'; task: Task } | { type: 'FinishTask', id: number }
|
f828823d6d8a1f1c21b1c77d962e7560ded6b473 | TypeScript | elzup/tools | /src/components/Kotobaru/useWordle.ts | 2.65625 | 3 | import { useState } from 'react'
import useSWR from 'swr'
import { initGame, WordleGame } from '../../utils/wordle'
type Word = {
full: string
chars: string
}
const wordParse = (text: string): Word[] =>
text
.trim()
.split('\n')
.map((line) => line.split(','))
.map(([full, chars]) => ({ full, ch... |
e15171e90fa2f03c0094ef362bcb25964a9a3ac2 | TypeScript | joserochadocarmo/github-vsc | /extensions/github-vsc/src/d.ts/array.d.ts | 2.515625 | 3 | interface Array<T> {
compact(): Array<NonNullable<T>>;
}
|
fa2f708313f76da28962c7060d90bab636ee33a7 | TypeScript | sygnowskip/angular-dynamic-validation | /library/src/services/object-merge/object-merge.service.ts | 2.671875 | 3 | import { Injectable } from "@angular/core";
@Injectable()
export class ObjectMergeService {
public deepMerge(jsonRules: any, customRules: any) {
const isObject = (item: any) => (item && typeof item === 'object' && !Array.isArray(item));
const output = Object.assign({}, jsonRules);
if (isObject(jsonRules... |
d4399c04f8e813aeb86e6e469453633dcc48ead2 | TypeScript | HelloContract/cosmos-staking-dapp | /src/__test__/validator.test.ts | 3.015625 | 3 | import { validDelegate, validUndelegate, isDecimalOverflow } from '../lib/validator'
describe('test isDecimalOverflow', () => {
const cases = [{
num: '0',
places: 6,
result: false
}, {
num: '0.00001',
places: 6,
result: false
}, {
num: '0.0000000001',
places: 6,
result: true
... |
3e9a1ffbd77a5139ceafc550bf80c479ae85c44d | TypeScript | tarepan/TheHome | /src/widgets/sleeps/domain.ts | 3.203125 | 3 | import { DateTime as dt, Duration } from "luxon";
// domain: sleepHistroy => sleep indexes
type wakeupUNIXtime = number;
// e.g. 1572534000000 for "2019-11-01T00:00:00+09:00"
type sleepLengthUNIXtime = number;
// e.g. 25200000 for "just 7 hours"
// data
export type SleepRecord = [wakeupUNIXtime, sleepLengthUNIXtime]... |