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 |
|---|---|---|---|---|---|---|
72d66136389d4ec8e6be1dd97969f620c0d03a18 | TypeScript | AmineBlel/todo_list_api | /src/graphql/schema/index.ts | 2.578125 | 3 | import { buildSchema } from 'graphql';
export default buildSchema(`
type Task {
_id: ID!
title: String!
description: String!
date: String!
isCompleted: Boolean!
creator: User!
comments: [Comment!]
sharedWith: [User!]
}
type User {
_id: ID!
firstName: String!
lastName: String!
email: String!
p... |
5667a47053f3de82a5c3ece394c6d9a43306fd25 | TypeScript | skatheriya/atm | /app.ts | 3.234375 | 3 | import { Denomination } from "./models";
import Atm from "./atm";
const denomination = [
Denomination.TWO_THOUSAND,
Denomination.FIVE_HUNDRED,
Denomination.TWO_HUNDRED,
Denomination.HUNDRED
];
const atm = new Atm(denomination);
askForDeposit(); // first time deposit in atm
const question = +prompt(
"Please... |
74d37d5e7120c9275dd98195984d9a652caaff99 | TypeScript | gravida/bms | /src/api/music.ts | 2.6875 | 3 | import Network from '@/common/http'
interface User {
id: number;
username: string;
password: string;
sex: number;
}
export default class ClientApi {
clientApi = {
/**
* method post
*
* body:{username:string,password:string}
* response: success =>User
... |
3eadfb6decd51778488a871f3066d803dad906da | TypeScript | samchon/tstl | /src/internal/tree/UniqueSetTree.ts | 2.921875 | 3 | //================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
import { SetTree } from "./SetTree";
import { XTreeNode } from "./XTreeNode";
import { UniqueTreeSet } from "../container/associ... |
7f21d3a971afc38ce757b1bca8e05254ac53a4c8 | TypeScript | zincbase/zincdb | /src/Library/ObjectTools/deepReduce.spec.ts | 3.3125 | 3 | namespace ZincDB {
export namespace ObjectTools {
const numberTypeReducer = (val: any, result: number[]) => {
if (typeof val === "number")
return result.concat(val);
else
return result;
}
describe("deepReduce:", () => {
it("Allows getting a list of all numbers from a nested object", () => {
... |
ef31ec78582d3f5719b640ce4e2a97f4223d263e | TypeScript | emmetio/math-expression | /src/parser.ts | 3.828125 | 4 | import Scanner, { isWhiteSpace, isNumber } from '@emmetio/scanner';
export const enum TokenType {
Number = 'num',
Op1 = 'op1',
Op2 = 'op2',
Null = 'null'
}
export const enum Operator {
Plus = 43, // +
Minus = 45, // -
Multiply = 42, // *
Divide = 47, // /
IntDivide = 92, // \
L... |
a56a6931c048643f81401f304e854ce682671dbc | TypeScript | leone2016/rxjs | /curso-rxjs-inicio/src/observables/02-unsubscribe-add.ts | 3.203125 | 3 |
import { Observable, Subscriber, Observer } from 'rxjs';
const observer: Observer<any> = {
next: value => console.log( '[next]:', value ),
error: error=> console.warn ('[erro]', error),
complete: ()=> console.info('Completado')
}
const intervalo$ =new Observable<number>( subs =>{
//creando conta... |
21125bc94c15cf4645a93afef081f803de2b60ff | TypeScript | yants95/b2wdigital | /src/presentation/controllers/planet/search-planet-by-name-controller/search-planet-by-name-controller.ts | 2.578125 | 3 |
import { SearchPlanetByName } from '@/domain/usecases/planet/search-planet-by-name'
import { ok, serverError } from '@/presentation/helpers/http/http-helper'
import { Controller } from '@/presentation/protocols/controller'
import { HttpRequest, HttpResponse } from '@/presentation/protocols/http'
export class SearchPl... |
9532aa0c52a004e9b607345eadc338ff0314f6e0 | TypeScript | elementary/houston | /src/lib/database/database.ts | 2.5625 | 3 | /**
* houston/src/lib/database/database.ts
* The main database class
*
* @exports {Class} Database - The master database connection class
*/
import { inject, injectable } from 'inversify'
import * as Knex from 'knex'
import * as path from 'path'
import { Config } from '../config'
import { Log } from '../log'
/*... |
bb4f71907bf7d6183ca788d73586ddbdc53ec91c | TypeScript | MrHarrisonBarker/OpenEvent | /OpenEvent.Web/ClientApp/src/app/_models/Category.ts | 2.6875 | 3 | export interface Category
{
Id: string;
Name: string;
}
export interface CategoryViewModel
{
Id: string;
Name: string;
}
export interface PopularCategoryViewModel extends CategoryViewModel
{
Score: number;
}
|
2f5ea2039499cff7f24aed171fc7fcbb3cff4c10 | TypeScript | Asha20/ring-menu | /src/builder/h.ts | 2.875 | 3 | import { AnyObject } from "../util/util";
function hs<T extends keyof SVGElementTagNameMap>(tagName: T) {
return function _h(attrs: AnyObject, children: SVGElement[] = []) {
const el = document.createElementNS("http://www.w3.org/2000/svg", tagName);
setAttributes(el, attrs);
children.forEach(child => el.... |
8d2ab66d0cfb06093bdee657b11c6ea2ff4f5593 | TypeScript | BognarPal/ts-app | /src/node/database/repositories/base-repository.ts | 2.921875 | 3 | import {
FindConditions,
FindManyOptions,
FindOneOptions,
Repository,
} from "typeorm";
import { environment } from "../../environment";
import { BaseEntity, IBaseEntity } from "../entities/base";
import { getDbConnection } from "../get-db-connection";
import { PostgresError } from "../postgres/postgres-error";... |
57c7f8ec22cd3bf3b1eb1b73cd1056735b4c7af2 | TypeScript | 1172208932/ddcw | /src/view/PromotionView.ts | 2.578125 | 3 | /**
* 右边的菜单栏
*/
module module {
export class PromotionView extends ui.view.PromotionViewUI {
private goodsType:number = 1; // 商品类型,用来标记当前购买的商品。1是一元好礼 2是折扣优惠
constructor () {
super();
this.ani1.play(0, true);
}
showPromotionView():void {
this.on(La... |
040904b1649dccfa31f8ef8049950336340b6f6d | TypeScript | kaidouji85/gbraver-burst-core | /src/effect/pilot-skill/index.ts | 3.046875 | 3 | import type { PlayerId } from "../../player/player";
import type { GameState, GameStateX } from "../../state/game-state";
import { PlayerState } from "../../state/player-state";
import { batteryBoost } from "./battery-boost";
import { batteryEnchantment } from "./battery-enchantment";
import { buffPower } from "./buff-... |
ca91e7b5faec79ba304c1b220c8818cd8640abd2 | TypeScript | juanzitelli/foodtrucks-kindalab-backend | /src/controllers/foodtrucks.controller.ts | 2.796875 | 3 | import { RequestHandler } from "express";
import { getClosestFoodTrucks } from "../services/foodtrucks.service";
import { FoodTruck } from "../types/FoodTruck";
import _ from "lodash";
export const getFoodTrucksByCoordinates: RequestHandler = async (req, res, next) => {
let { lat, lon, lim } = req.query;
const l... |
92993d94881c648cd3b57798fa522988900b0238 | TypeScript | Wolf-Team/NodeVK-TypeScript | /src/Session/Session.ts | 2.671875 | 3 | import ConfigSession, { getDefaultConfig } from './ConfigSession.js';
import VKAPIException, { VKAPIError } from "../VKAPIException.js";
import request, { RequestData } from "../request.js";import MessagesAPI from "../API/messages.js";
import PhotosAPI from "../API/photos.js";
import UsersAPI from '../API/users.js';
im... |
26dba282bc8375369f75575506daaa151e3e1f1f | TypeScript | NPatel10/xr3ngine | /packages/engine/tests/common/createPrefab.test.ts | 2.609375 | 3 | import { Component } from "../../src/ecs/classes/Component";
import { Types } from "../../src/ecs/types/Types";
import { System } from "../../src/ecs/classes/System";
import {
getComponent,
hasComponent, removeEntity,
} from "../../src/ecs/functions/EntityFunctions";
import { registerSystem, unregisterSystem } from... |
f1466b3220a5828fbe74c3b55d741d1bcea792e1 | TypeScript | SuyashDeshmukh/OnceSaid | /src/Quote.ts | 2.765625 | 3 | export class Quote {
author: string;
quote: string;
tags: Array<string>;
constructor(author: string, quote: string, tags: Array<string>) {
this.author = author;
this.quote = quote;
this.tags = tags;
}
}
|
5b4a8ea324225a4171a47128b6603e644b0ebda4 | TypeScript | elgervb/html5api | /src/app/html5-api/speech/speech.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import { Html5Api } from '../html5api';
@Injectable()
export class SpeechService implements Html5Api {
private defaultVoice: SpeechSynthesisVoice;
private defaultPitch = 1;
private defaultRate = 1;
constructor() { }
getVoices(): SpeechSynthesisVoice[] {
retu... |
74905d241c17e79b9aad986452683501bf0269de | TypeScript | ha-et/rarity-frontend | /src/hooks/useRarityName.ts | 2.625 | 3 | import { useMulticall2Contract, useRarityNameContract } from './useContract'
import { useCallback } from 'react'
interface GoldInterface {
summoner_name: (id: string) => Promise<string>
multicall_summoner_name: (ids: string[]) => Promise<string[]>
}
export default function useRarityName(): GoldInterface {
... |
f59d89d682e038e8b47404e8e8488821c33ab816 | TypeScript | msabo1/sortable-properties | /src/constructible.type.ts | 3.078125 | 3 | /**
* Type that can be constructed.
*/
export interface Constructible<T = any> {
new (...args: any[]): T;
}
|
0705a632131c36bc8cb5026f32f7553807461c8f | TypeScript | jpenna/calories-control | /server/api/v1/auth.ts | 2.578125 | 3 | import express from 'express';
import passport from 'passport';
import passportJwt from 'passport-jwt';
import passportLocal from 'passport-local';
import jwt from 'jsonwebtoken';
import UserModel from '../../db/models/users';
const { Strategy: JwtStrategy, ExtractJwt } = passportJwt;
const { Strategy: LocalStrategy ... |
a5ad44381bdb0335b5ff5c131d4f4a457d9dcc9d | TypeScript | Teleology/ts-design | /src/strategy/strategy.ts | 3.84375 | 4 | interface Strategy {
calculate(salary: number):number;
}
function StrategyFactory(muliplier: number) {
return new class MyStrategy implements Strategy {
calculate(salary: number): number {
return salary * muliplier;
}
}();
}
let s2: Strategy = StrategyFactory(2);
let s3: Strat... |
640fa03ff6c9870682d04ba585daaa0de04d3d4b | TypeScript | jvandenaardweg/playpost-api | /src/database/entities/publication.ts | 2.75 | 3 | import { IsDate, IsUrl, IsUUID, Length } from 'class-validator';
import { Column, CreateDateColumn, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { Article } from './article';
import { Organization } from './organization';
import { User } from './... |
7ba795e598f60f697cf15afae79e7d6ba63cf81d | TypeScript | glennj/exercism.io | /typescript/pascals-triangle/iterable-range.ts | 3.53125 | 4 | /* eslint-disable space-in-parens, no-restricted-syntax */
/* Example usages:
*
* for (const even of from(2).upTo(100).by(2)) {...}
*
* from(100).downTo(1).forEach(n => fn(n));
*
* Throws an error if you try to iterate before calling `downTo` or `upTo`
*/
class IterableRange {
private current: numbe... |
2f1af4dae27f74c9c9b1a03a52f26ddeec6e88de | TypeScript | PirialMersus/todolist-incubator-ts | /src/state/todolists-reducer.ts | 2.6875 | 3 | import {v1} from "uuid";
import {todolistAPI, TodolistType} from "../api/todolist-api";
import {Dispatch} from "redux";
import {AppRootStateType} from "./store";
import {RequestStatusType, setAppStatusAC, setErrorAC} from "./app-reducer";
import {handleServerAppError, handleServerNetworkError} from "../utils/error-util... |
2958013f48bac9926899421da7b932620dd5797c | TypeScript | krishnaanaril/zettle | /src/app/shared/pipes/absolute-value.pipe.ts | 3.140625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
/*
* Returns absolute value of an integer
* Takes none as argument
* Usage:
* value | abs
* Example:
* {{ -2 | abs }}
* formats to: 2
*/
@Pipe({ name: 'abs' })
export class AbsoluteValuePipe implements PipeTransform {
transform(value: number): number... |
888218a6f4c894423de0cbec45ee8ce7941875f7 | TypeScript | amarismail522-zz/BootCamp-2021 | /class05/TypeScript/todo 1/src/Item.ts | 3.296875 | 3 | export class Item {
public constructor(public taskId: number, public task:string, public done:boolean=false) {
}
/**
* printTask
:void */
public printTask():void {
console.log(`id = ${this.taskId}, \tTask: ${this.task},\tCompleted: ${this.done}`)
}
} |
72361f2b724c58ae82d763c7569f7331cf979204 | TypeScript | machadolucasvp/design-patterns-ts | /abstract-factory/src/furniture/Sofa.ts | 3.109375 | 3 | export default interface Sofa {
hasLegs(): boolean;
sitOn(): void;
}
export class VictorianSofa implements Sofa{
hasLegs(): boolean{
return true;
}
sitOn(): void {
console.log('Resting in a victorian sofa')
}
}
export class ModernSofa implements Sofa{
hasLegs(): boolean{
return true;
}
... |
6b00c44be68b0e649ef8152293d15fcb5381ee85 | TypeScript | abolshakov/daria-khil-portfolio | /src/app/navigation/shared/navigation-item.ts | 2.71875 | 3 | import * as _ from 'lodash';
import { NavigationArea } from './navigation-area.enum';
export class NavigationItem {
public readonly id: number;
public readonly route: string;
public readonly area: NavigationArea;
public readonly title: string;
private _description: string;
private _selected: bo... |
ee353a6043954e4bcb792b0935f120163e5835f7 | TypeScript | serverlessfirst/serverless-testing-workshop | /services/rest-api/tests/unit/club-validator.spec.ts | 2.6875 | 3 | import { validateClub } from '@svc/lib/club-validator';
import { ClubVisibility } from '@svc/lib/types/sports-club-manager';
import { v4 as uuidv4 } from 'uuid';
describe('club-validator', () => {
it('rejects club names that are shorter than 3 characters', () => {
const club = {
id: uuidv4(),
name: '... |
2893d4c5931ee562ad9cb4a703509498fbe5b582 | TypeScript | DalavanCloud/NoSQLProvider | /src/WebSqlProvider.ts | 2.609375 | 3 | /**
* WebSqlProvider.ts
* Author: David de Regt
* Copyright: Microsoft 2015
*
* NoSqlProvider provider setup for WebSql, a browser storage backing.
*/
import _ = require('lodash');
import SyncTasks = require('synctasks');
import NoSqlProvider = require('./NoSqlProvider');
import SqlProviderBase = require('./Sql... |
e0eb7b7707ba09e3979bd5815d5ee4e3c81576e5 | TypeScript | productinfo/web | /packages/models/src/Domain/Abstract/Payload/Types/EmitSource.ts | 2.828125 | 3 | export enum PayloadEmitSource {
/** When an observer registers to stream items, the items are pushed immediately to the observer */
InitialObserverRegistrationPush = 1,
/**
* Payload when a client modifies item property then maps it to update UI.
* This also indicates that the item was dirtied
*/
Loca... |
2df48e4025536f434affe3c6bd126817c68fdc29 | TypeScript | Q1173419450/algorithm012 | /Week_01/作业/twoSum.ts | 3.5 | 4 | function twoSum(nums: number[], target: number): number[] {
if (nums.length == 0) return [];
let obj: any = {};
for (let i = 0; i < nums.length; i++) {
let ans = target - nums[i];
if (obj[ans] != undefined) {
return [obj[ans], i];
}
obj[nums[i]] = i;
}
return [];
}
let res = twoSum([2, ... |
f384b2bd3582bd6dc831071b4c449f898f261a5e | TypeScript | baoxin/Design-Pattern | /State/RaffleActivity.ts | 2.96875 | 3 | import { DispenseOverState } from "./DispenseOverState";
import { DispenseState } from "./DispenseState";
import { NoRaffleState } from "./NoRaffleState";
import { RaffleState } from "./RaffleState";
import { State } from "./State";
export class RaffleActivity {
private state: State;
private count: number; /... |
6890d7a1360764126c537c991547d7213e19b33f | TypeScript | botphus/botphus | /client/assets/reducers/connection.ts | 2.703125 | 3 | // Import action
import {IActionData, IConnectionContentData} from '../interfaces/redux';
import {ActionType} from '../types/redux';
import {pageSize} from '../lib/const';
const INIT_STATE: IConnectionContentData = {
content: [],
detail: {},
page: 1,
pageSize,
total: 0,
};
export default function... |
72d5cbcf3161449cbc7c02e49470ae119597dce3 | TypeScript | asklim/asklim | /spec/rsis/workDate-day.spec.ts | 2.65625 | 3 | // / <reference path="../../dist/index.d.ts" />
import {
rsisFactory,
WorkDateOption,
WorkDateFunction
} from '../../src';
// import { rsisFactory } from '../../src/';
const options12 = {
delta : 12*60*60*1000, // 12h*60m*60s*1000ms
};
const options08 = {
delta : 8*60*60*1000, // 8h*60m*60s*1... |
90bbd9944b9bde4789a81d696ad6af9230fb675b | TypeScript | greatice/LMS | /src/client/reducers/lecturers.ts | 2.703125 | 3 | import { FETCH_LECTURERS, FETCHED_LECTURERS } from "../actions";
const initialState = {
isFetching: false,
lecturers: [],
};
export default function reducer(state = initialState, action) {
switch (action.type) {
case FETCH_LECTURERS:
return { ...state, isFetching: true, lecturers: [] }... |
2d876ba98412d06ea6d6e4fb059365f77e7dd53e | TypeScript | EventRegistry/event-registry-node-js | /src/topicPage.ts | 2.828125 | 3 | import * as fs from "fs";
import * as _ from "lodash";
import { QueryParamsBase } from "./base";
import { EventRegistry } from "./eventRegistry";
import { ReturnInfo } from "./returnInfo";
import { EventRegistryStatic } from "./types";
export class TopicPage extends QueryParamsBase {
private topicPage: EventRegist... |
e6d0bdc038df826167e7b0348e813406fd9d63cf | TypeScript | codified-likeness-utility/hackernews-server | /src/index.ts | 2.53125 | 3 | const { ApolloServer } = require('apollo-server');
const typeDefs = `
type Query {
info: String!
feed: [Link!]!
}
type Mutation {
post(url: String!, description: String!): Link!
}
type Link {
id: ID!
description: String!
url: String!
}
`;
let l... |
eaaf4eccddf047614e1dcf1cad3482d77d817c66 | TypeScript | CommunitySolidServer/CommunitySolidServer | /src/server/notifications/ActivityEmitter.ts | 2.640625 | 3 | import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata';
import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier';
import type { GenericEventEmitter } from '../../util/GenericEventEmitter';
import { createGenericEventEmitterClass } from '../../util/Ge... |
c21c813ea06e7725228529be61fce4f878f4b450 | TypeScript | kchamp45/zoo-animal-tracker | /app/animal-list.component.ts | 2.65625 | 3 | import {Component, Input, Output, EventEmitter} from '@angular/core';
import { Animal } from './animal.model';
@Component({
selector: 'animal-list',
template: `
<div class="filter">
<label>View by maturity</label><br>
<select (change)="onFilterAgeChange($event.target.value)">
<option value="allAnim... |
4dd7b854678b63e56a204cd3ac6c5a7c4e8a80fb | TypeScript | MrSkinny/angular2-play | /app/components/favorite.component.ts | 2.515625 | 3 | import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'favorite',
template: `
<i
class="glyphicon"
[class.glyphicon-star]="isFavorited"
[class.glyphicon-star-empty]="!isFavorited"
(click)="toggleFavorite()"></i>
`,
styles: [`
... |
cf1e4e36ecc094b62c4f3ddef3cb1661502725e5 | TypeScript | jeromejeromejerome/onboarding | /src/employee-list/employee-list.component.ts | 2.71875 | 3 | module mainApp {
'use strict';
angular.
module('employeeList').
component('employeeList', {
templateUrl: 'employee-list/employee-list.template.html',
controller: ['EmployeeResource',
function PhoneListController(Employee: IEmployeeResource) {
... |
a717ba51a5f14421f279a1e49895f4facc40815a | TypeScript | cbowdon/TsMonad | /src/writer.ts | 3.828125 | 4 | import { Monad, Functor, Eq, eq } from './monad'
/**
* @name WriterPatterns
* @description Define a contract to unwrap Writer object using a
* callback.
* @see Writer#
*/
export interface WriterPatterns<S,T,U> {
/**
* @name writer
* @description Function to handle the Writer content.
* @typ... |
50310a61c5cc9bc3ed56329a41762b57ec6162a0 | TypeScript | mannrobo/scout | /functions/src/api/invite.ts | 2.890625 | 3 | /**
* Invite manager:
* 1) Generates new invites
* 2) Applies them to users
* 3)
*/
import * as Koa from "koa";
import * as Router from "koa-router";
import * as admin from "firebase-admin";
import error from "../util/error";
async function authenticateUser(jwt: string) {
return admin
.auth()
.veri... |
5c78f86e3f573c8c47b354c3d89d729df12ed707 | TypeScript | nguyer/aws-sdk-js-v3 | /clients/browser/client-cognito-identity-provider-browser/types/_NotifyConfigurationType.ts | 2.765625 | 3 | import {
_NotifyEmailType,
_UnmarshalledNotifyEmailType
} from "./_NotifyEmailType";
/**
* <p>The notify configuration type.</p>
*/
export interface _NotifyConfigurationType {
/**
* <p>The email address that is sending the email. It must be either individually verified with Amazon SES, or from a domain that... |
3de4f04d551658636385baff37dda55358372770 | TypeScript | SandeepSangvekar/MyProject | /src/app/app.component.ts | 2.5625 | 3 | import { Component } from '@angular/core';
import { CalculatorService } from './calculator.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
resultnew =0;
constructor(private mycalculator: CalculatorService){
... |
dfcf2435becdde778c54d4ecb7150911b5671015 | TypeScript | eternalconcert/suitescript-types-tools-and-frameworks | /src/file/glob.ts | 2.671875 | 3 | // glob(parentFolder, '**/*.js') will return a list of all files/folders matching the glob
// import { AbstractConfig, AbstractFile } from './types';
// interface Config extends AbstractConfig{
// glob: string
// }
// export function glob(config: Config): AbstractFile[] {
// throw 1
// } |
c90a0d7a79183ac66ab09a5641ea6427960999d1 | TypeScript | Sniffing/log-back | /src/utils/migration.ts | 2.96875 | 3 | import { ILogEntryDTO } from '../interfaces';
const Datastore = require('@google-cloud/datastore');
const datastore = Datastore({
projectId: process.env.APP_ID,
});
class GoogleCloudData {
key: any;
data: EntryData;
constructor(key: any, data: EntryData) {
this.key = key;
this.data = data;
}
}
cla... |
df2a012e83ebd400b6645bcc0c8ccf77e6515fe3 | TypeScript | hal-shin/strat-planner | /backend/src/AppServer.ts | 2.53125 | 3 | import { createServer, Server } from 'http'
import * as express from 'express'
import * as socketIO from 'socket.io'
import Room from './Room'
import { Message } from '../../client/src/utils/types'
import { TYPE_HOST_ROOM, TYPE_INVALID_ROOM, TYPE_JOIN_ROOM } from '../../client/src/utils/consts'
import { genId } from '.... |
b9e767037529c24864bf3a94cdb96cc2f9ea291b | TypeScript | JAspeling/udemy-ionic2 | /shopping_list/src/classes/recipe.ts | 2.625 | 3 | import { Ingredient } from './Ingredient';
export class Recipe {
public title: string;
public description: string;
public difficulty: string;
public ingredients: Ingredient[];
constructor(init? : Partial<Recipe>) {
Object.assign(this, init);
}
}
|
8163e94cdaf73c66c61b8468401e4f44c3e5f4dd | TypeScript | SafiUllahAshfaq/heyday-challenge-2 | /src/models/employee.ts | 2.65625 | 3 | import { Field, ID, ObjectType } from '@nestjs/graphql';
import { Order } from './order';
@ObjectType()
export class Employee {
@Field(() => ID)
id!: number;
@Field()
name!: string;
@Field()
budget!: number;
@Field()
companyId!: number;
}
@ObjectType()
export class TaxDistrubution {
@Field()
ta... |
1ca7b5918bdc7caab79fa1d1fe62d3e4bafd9a52 | TypeScript | rodrilopez/IonicApp | /src/providers/db/db.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
/*
Generated class for the DbProvider provider.
See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class DbProvider {
db : SQLiteObject;
... |
eb44fd11cc2d69b4e118a3d455efb510a84d6938 | TypeScript | nestjs/nest | /integration/injector/src/self-injection/self-injection-provider.module.ts | 2.546875 | 3 | import { Module, Injectable, Inject, forwardRef } from '@nestjs/common';
@Injectable()
class ServiceInjectingItself {
constructor(private readonly coreService: ServiceInjectingItself) {}
}
@Injectable()
class ServiceInjectingItselfForward {
constructor(
@Inject(forwardRef(() => ServiceInjectingItself))
pr... |
c71c5fd6565455aeed5cf8dcdc4dbe2140a3e626 | TypeScript | dmitrykarmazin/TaskManager | /src/app/task/services/task.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Task } from './../models/task.model';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class TaskService {
private taskList: Task[];
con... |
39f473177c5941a103e235a78404a34bb9f65a9a | TypeScript | kohli6010/tameOfThrones | /src/processor/fileprocessor.ts | 2.890625 | 3 | import { Controller } from '../controller/controller';
export default class FileProcessor {
file!: string;
controller: Controller;
constructor() {
this.controller = new Controller();
}
setFile(file: string) {
this.file = file;
}
contentProcessor(): Array<string> {
const contentByLine = this.file.spli... |
77498c32be1352f326968c443dbbe36e05d9db77 | TypeScript | juzzyo-ffm/tinkery | /apps/ts_test/src/union-aliases.ts | 4.28125 | 4 | enum ResultType {
AS_NUMBER,
AS_STRING
}
// enum example
function combine(
n1: number | string,
n2: number | string,
resultType: ResultType
): string | number {
// add or concatentate base on input types
let result;
if (
(typeof n1 === "number" && typeof n2 === "number") ||
resultType === Resul... |
b1219078d6e6f72283fa35ac0076ec8683d79863 | TypeScript | papasani-soft/TypeScript | /typescript/Customer6.ts | 2.828125 | 3 | interface IDal {
Add();
}
class Customer6 implements IDal {
protected name: string = "";
private _customerName: string = "";
public set CustomerName(value: string) {
if (value.length == 0) {
throw "Customer Name is required";
}
this._customerName = value;
}
p... |
0ac910197682b074232acb999580e185296ad600 | TypeScript | tyru/irairabar | /dsl.ts | 2.796875 | 3 | import * as glMatrix from 'gl-matrix';
import { plotter } from './svg-path-canvas';
interface Callable {
call(stage: Stage): void
}
export class Block implements Callable {
private width = 0;
private height = 0;
constructor(
private readonly context: CanvasRenderingContext2D,
private readonly col: nu... |
b3eb293c51758a9ba17c46093594b9651b151bde | TypeScript | scottohara/tvmanager | /src/controllers/program-controller.ts | 2.765625 | 3 | import type {
NavButtonEventHandler,
ProgramListItem
} from "~/controllers";
import Program from "~/models/program-model";
import ProgramView from "~/views/program-view.html";
import ViewController from "~/controllers/view-controller";
export default class ProgramController extends ViewController {
private readonly... |
b4214518c7a4fd5404207871cd125228b915f07e | TypeScript | Nikhil-Rawat/javascript-server | /extraTs/patterns/equilateral.ts | 2.78125 | 3 | export default function equilateral_triangle(rows: number): void {
console.log('Equilateral triangle:', rows );
let s: string = '';
let j: number = rows;
for (let i: number = 1; i <= rows; i++) {
s = ' '.repeat(j);
console.log(s, '* '.repeat(i));
s = '';
j--;
}
}
|
85ef7c0b861b3bb31f1b9b58f97eb8b00d7353a3 | TypeScript | jacktho/calculator | /src/app/solution-screen/solution-screen.component.ts | 2.625 | 3 | import { Component, OnInit } from '@angular/core';
import { StorageService } from '../storage.service';
@Component({
selector: 'app-solution-screen',
templateUrl: './solution-screen.component.html',
styleUrls: ['./solution-screen.component.css']
})
export class SolutionScreenComponent implements OnInit {
cons... |
4b66b18dbf7f7d9d35c35fc65e97b9430c03b914 | TypeScript | GeorgyMishin/marvel-app | /src/modules/characterInfo/duck.ts | 2.609375 | 3 | import {
createAsyncAction,
createReducer,
getType,
PayloadAction,
createAction,
} from 'typesafe-actions'
import { combineReducers } from 'redux'
import { CharacterPagination, Character } from '../characters'
export const fetchCharacterInfo = createAsyncAction(
'GET_CHARACTER_INFO_REQUEST',
'GET_CHARACT... |
eea512d80da3d7826bcc776319a05b5873779198 | TypeScript | Omsaaf/passcards | /lib/base/mem_key_value_store.ts | 2.9375 | 3 | import key_value_store = require('./key_value_store');
import stringutil = require('./stringutil');
export class Database implements key_value_store.Database {
stores: Map<string, ObjectStore>;
version: number;
constructor() {
this.reset();
}
open(
name: string,
version: n... |
2d48ed344755b42df31ebe3e69c5bed6d25208fe | TypeScript | kipprice/toolkip_module | /packages/errors/src/renderers/_stringRenderer.ts | 2.90625 | 3 | import { ErrorRenderer, ErrorType } from '../_interfaces';
export abstract class _StringRenderer implements ErrorRenderer {
public error(details: any): boolean {
const msg = this._generateMessage('error', details)
return this._innerWarn(msg);
}
public warn(details: any): boolean {
c... |
3942aa634807da681136b3da2eb81282d9233c8c | TypeScript | ulfalfa/rx-harmony | /src/harmony.types.ts | 2.84375 | 3 | /**
* Collection of types that are neither discovery nor hub stuf
*
* @module HarmonyTypes
*/
/**
*
*/
import { URL } from 'url';
import { EventEmitter } from 'events';
/**
* minimum info about a hub - it has a name and url
* and finally also the client interface (currently xmpp)
* e.g. xmpp://172.123.123.12... |
60f4501744a761208dbbb74a3717bfd35b41c35a | TypeScript | sergeibez/study | /angular/simple/src/app/shared/services/user.service.ts | 2.75 | 3 | import { Injectable } from "@angular/core";
import { User } from "../models/user";
import { Http, Response } from "@angular/http";
import { Observable } from "rxjs";
let usersPromise: Promise<User[]> = Promise.resolve([
{id: 25, first_name: 'John', last_name: 'Smith', avatar: ''},
{id: 26, first_name: 'Silvia'... |
fedfb1d1325ae32383c6040057c73ee63f7d7088 | TypeScript | ThabisoDii/travelangecy | /src/service/RegistrationService.ts | 2.515625 | 3 | var http = require('http');
import { response } from "express";
import {Request,Response} from "express"
import { User } from "../entity/User";
import { Credentials } from "../entity/Credentials";
var http = require('http');
const bcrypt = require("bcrypt")
import { getRepository } from 'typeorm';
export const regist... |
c320754e952a585d90dc4f8dabdac3cf7a90b6c1 | TypeScript | moonlight8978/practice | /react/test-mobx/src/domain/transaction.ts | 2.671875 | 3 | import { observable, computed, action, makeObservable, reaction, toJS } from 'mobx'
import faker from 'faker'
import { Transaction, TransactionForm } from '../types/local'
export class TransactionsState {
transactions: Transaction[] = []
transactionsMap: { [key: string]: Transaction } = {}
constructor(transacti... |
60c2b01ce2b4850869ae372d39c178e60b65b4e4 | TypeScript | MatiasOlivera/feedy | /server/src/app/validators/users/user.validator.ts | 3 | 3 | import BaseValidator from '../base.validator';
class UserValidator<T, U = undefined> extends BaseValidator<T, U> {
// eslint-disable-next-line class-methods-use-this
rules() {
return {
firstName: ['string', 'between:3,50'],
lastName: ['string', 'between:3,50'],
gender: ['in:Female,Male,Other'... |
4228699964eec223cf709d34a5b6edc58b9d52db | TypeScript | Hemesh-Unka/node-authentication | /src/tests/user.spec.ts | 2.65625 | 3 | import * as request from "supertest";
import { expect } from "chai";
let token;
before("login superadmin", async () => {
const response = await request("http://localhost:3000")
.post("/login")
.set("Accept", "application/json")
.send({
email: "superadmin@example.com",
password: "superadmin"
... |
5d1b165bca264f7ec772172b146f5bbe5256e479 | TypeScript | marianozunino/objection-workshop | /src/models/Client.ts | 2.53125 | 3 | import { Model } from "objection";
import { Animal } from "./Animal";
import { BaseEntity } from "./BaseEntity";
import { Vet } from "./Vet";
import path from "path";
export class Client extends BaseEntity {
name!: string;
age!: number;
pets?: Partial<Animal>[];
vets?: Partial<Vet>[];
static tableName = "c... |
e9fe52477ecc3f8521380ee65a3ce148aa64171e | TypeScript | green-fox-academy/nandras88 | /week-02/day-1/print-params.ts | 3.546875 | 4 | // - Create a function called `printParams`
// which logs to the console the input parameters
// (can have multiple number of arguments)
function printParams (...numbers:number[]){
numbers.forEach(elem =>
{console.log(elem);})
}
printParams(10,30,50,60,20); |
87dafac95bdd314cb788db4163439e455c37f527 | TypeScript | MarcosSpessatto/Rocket.Chat | /apps/meteor/app/otr/lib/functions.ts | 2.609375 | 3 | import type { IOTRAlgorithm } from './IOTR';
const { subtle } = global.crypto;
export const joinEncryptedData = ({ encryptedData, iv }: { encryptedData: ArrayBuffer; iv: Uint8Array }): Uint8Array => {
const cipherText = new Uint8Array(encryptedData);
const output = new Uint8Array(iv.length + cipherText.length);
ou... |
d4d2e4c97cbeccb91df81abbe015f18d16eb1976 | TypeScript | mudream4869/cablin-ui | /src/cablin/exprs.ts | 3.21875 | 3 | import { CommandCall } from './commands'
import { inputValue, outputValue, Value } from './value'
import { YamlObj } from './yamlobj'
const exprConstructMap = new Map<string, {(): Expr}>()
export function exprOutputFactory(expr: Expr): YamlObj {
const name = expr.exprName()
const ret: {
[key: string]: YamlObj... |
b923a653a2a42c3ad089138d57a46d1c38f02b83 | TypeScript | alextanhongpin/typescript-node-clean-architecture | /src/service/ops/service.ts | 2.71875 | 3 | import { sha256 } from '../../module/crypto';
import { Signer } from '../../module/signer';
import { HttpStatusUnauthorized } from '../../module/http';
import { RegisterRequest, RegisterResponse } from './interface';
// If the service is a class, it can extend the EventEmitter.
export function Service(credential: stri... |
702831f5ac1493164fc9782b8f925c67cb647e6e | TypeScript | spreadzp/new-main-server | /src/server/modules/db/exchange/exchange.service.ts | 2.53125 | 3 | import { ExchangeDto } from './dto/exchange.dto';
import { Model } from 'mongoose';
import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { EXCHANGE_MODEL_TOKEN} from './../../../server.constants';
import { Exchange } from '../../common/models/exchange';
@Injectable()
expo... |
e7da6499db4f1c27654a35620b6325bb383dea83 | TypeScript | narasimha-v/proshop | /backend/controllers/productController.ts | 2.765625 | 3 | import asyncHandler from 'express-async-handler';
import { Request, Response } from '../types';
import { Product } from '../models';
/**
* @description Fetch all products
* @route GET /api/products
* @access Public
*/
export const getProducts = asyncHandler(async (req: Request, res: Response) => {
const pageSize... |
992668811323755c3e45455cfb98434f5cf45b31 | TypeScript | Willihill/feeling-check | /src/store/reducer/AddPersonReducer/index.ts | 2.765625 | 3 | import {
SET_IMAGE,
SET_LOADING,
SET_NAME,
AddPersonState,
ActionType
} from './types'
const initialState: AddPersonState = {
loading: false,
name: '',
imageFace: ''
}
// eslint-disable-next-line @typescript-eslint/default-param-last
export default (state: AddPersonState = initialState, { type, payloa... |
afe75841e48acace55c6239ecfcb85b0b16f8d96 | TypeScript | dcousino/Walcart | /client/src/app/store/reducers/category.reducer.ts | 3.015625 | 3 | import {
CategoryAction,
LOAD_CATEGORIES,
LOAD_CATEGORIES_SUCCESS,
LOAD_CATEGORIES_FAIL,
SET_CURRENT_CATEGORY,
SET_CURRENT_SUB_CATEGORY
} from '../actions/category.action';
import { Category } from 'src/app/models/category';
export interface CategoryState {
categories: Category[];
loading: boolean;
c... |
3ac5050d907aab5a6b473e9d67ae5bdc06769864 | TypeScript | typed-ember/ember-cli-typescript | /ts/lib/typechecking/worker/index.ts | 2.609375 | 3 | import resolve from 'resolve';
import { defer } from 'rsvp';
import logger from 'debug';
import {
Diagnostic,
FileWatcherEventKind,
SemanticDiagnosticsBuilderProgram,
CompilerOptions,
WatchOfConfigFile,
WatchCompilerHostOfConfigFile,
} from 'typescript';
const debug = logger('ember-cli-typescript:typecheck... |
75c80c18fc5f1e8c09e264be89d1a7926160914d | TypeScript | Revolt-Influence/revolt-webapp | /src/utils/grid.ts | 2.828125 | 3 | import styled from 'styled-components'
const colPadding = '10px'
const colMargin = '10px'
const rowPadding = '25px'
const containerSize = '1250px'
interface IColProps {
size?: number
align?: 'left' | 'center' | 'right'
padding?: 'horizontal' | 'vertical' | 'all' | 'left' | 'right'
margin?: 'horizontal' | 'ver... |
cbbde75cedef26424bea5d8c67281d73b9a5c8da | TypeScript | edisim/outline | /shared/utils/getDataTransferFiles.ts | 2.75 | 3 | export default function getDataTransferFiles(
event:
| Event
| React.FormEvent<HTMLInputElement>
| React.DragEvent<HTMLElement>
): File[] {
let dataTransferItemsList!: FileList | DataTransferItemList;
if ("dataTransfer" in event) {
const dt = event.dataTransfer;
if (dt.files && dt.files.leng... |
f673c8f75cbed578dd82d71277aef80eaa56b5fc | TypeScript | vic10us/v10s-overlays | /src/components/drops/Drop.ts | 2.625 | 3 | const P5 = require('p5');
import { Image, Vector } from "p5";
import { config } from "./config";
import { IVelocity, IDrop } from "./types";
export default class Drop implements IDrop {
p5: typeof P5;
image: Image;
vector: Vector;
landed: boolean;
wobble: number;
position: Vector;
landTime: n... |
0ee61ac954f71baa2b664a828719599a9cb626ec | TypeScript | Nipatsku/tabz | /src/components/common/navigation.ts | 2.546875 | 3 | import { History } from "history"
export interface Navigatable<T extends {}> {
/**
* Navigation history reference that is passed from react-router-dom <BrowserRouter> component under the hood.
*/
history: History
match: {
/**
* URL params.
*/
params: T
}
}
|
efdf5683dec5307e78386b4dc54dc2b7bd8c402d | TypeScript | michchan/simply-utils | /src/dateTime/isDateBetween.ts | 3.296875 | 3 | import isDate from './isDate'
import isUndef from '../validators/isUndef'
/**
* Check if `date` is between `start` and `end`.
* `start` and `end` are count as datetime (in ms)
*
* @author Sandy Lau https://github.com/sandylau333
*
* @param date
* @param start (optional)
* @param end (optional)
* @param isInclu... |
162092d4869e49c34078e5db7e0f1de8f2aa2bcd | TypeScript | anwaro/tiny-png-client | /src/utils/object.ts | 3.203125 | 3 | export const objectEntries = <Keys extends string | number | symbol, Value>(obj: {
[K in Keys]?: Value;
}): Array<[Keys, Value]> => {
// Object.entries typings error
// @ts-ignore
return Object.entries(obj);
};
export const objectHas = (obj: Record<string, unknown>, key: string) =>
Object.prototype... |
e130e6af047927bdea19d0a775bebe1753f93fc9 | TypeScript | emddeveloper/Angular_CustomPipe | /src/app/convert.pipe.ts | 2.78125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'convert',
})
export class ConvertPipe implements PipeTransform {
transform(value: number, unitname: string): number {
if (isNaN(value)) return 0;
switch (unitname) {
case 'km':
return value * 1.604;
case 'm':
re... |
458f19fe0448ce5b6abe5ade62d5c587eccc6539 | TypeScript | mycase/react-gears | /src/components/CollapsableText.d.ts | 2.515625 | 3 | import * as React from 'react';
export interface CollapsableTextProps {
children?: string;
collapsed?: boolean;
lessLabel?: React.ReactNode;
maxLength?: number;
moreLabel?: React.ReactNode;
}
export default class CollapsableText extends React.Component<CollapsableTextProps, any> {
render(): JSX.Element;
}... |
7bae77f94b8bcd9c0d3f0ad9602973e5a0857ff0 | TypeScript | inrupt/solid-sdk-forms | /src/utils/validator.ts | 2.859375 | 3 | import moment from 'moment'
import { UI, NS } from '@constants'
const actionMethod = (condition: boolean, message: string) => {
return {
valid: condition,
errorMessage: message
}
}
export const validators = [
{
name: UI.REQUIRED,
action: (field: any) =>
actionMethod(!(field.value === '' |... |
b09ee3fcb5a47cae67757273863e711519dd0ed7 | TypeScript | 9db/node-server | /src/operation/load-node-from-url.ts | 2.8125 | 3 | import Node from 'type/node';
import Operation, { OperationInput } from 'operation';
import NotFoundError from 'http/error/not-found';
import getNodeParameters from 'utility/get-node-parameters';
interface Input extends OperationInput {
readonly url: string;
}
class LoadNodeFromUrlOperation extends Operation<Input, ... |
4b2f191bc0e9c804079d922d94e222b9cb4705a5 | TypeScript | k2yoon/hackathon2018 | /client/src/app/home/store/reducers/users.spec.ts | 2.53125 | 3 | import { LoadUsers, LoadUsersSuccess} from '../actions';
import { initialState, reducer } from './users';
describe('Home page', () => {
describe('user reducer', () => {
it('sets the flag for a progress indicator while loading users', () => {
const loadAction = new LoadUsers();
const loadSuccessAction... |
fe29169e03a82e2c45cb3e5b9ea01a8816fb6163 | TypeScript | AlexGodofsky/exalted-discord-mush | /src/discord-mock.ts | 2.828125 | 3 | import { Collection, Snowflake } from "discord.js";
// this file contains the type signature of all of the features of discord.js we actually use
// so that we can build a minimal mock for our tests
export interface Message {
author: User;
content: string;
channel: Channel;
}
export type Channel = TextChannel | D... |
b71eff4681427c4828e3a1bee5929acf050a9ae7 | TypeScript | bluelovers/ws-ts-type | /packages/ts-type/lib/helper.d.ts | 3.09375 | 3 | import { ITSArrayListMaybeReadonly } from './type/base';
import { ITSAwaitedReturnType } from './helper/promise';
/**
* copy current function with Parameters and return to new value
*
* not support overload
*
* @example
* declare function f(a: number): number
* declare let c: ITSOverwriteReturnType<typeof f, str... |
493b53c7ab1b97cb05a2908f1e7b39e45f68f086 | TypeScript | Camacaro/rxjs | /src/02-operadores/05-reduce.ts | 3.453125 | 3 | import { interval } from "rxjs";
import { take, reduce, tap } from "rxjs/operators";
/**
* REDUCE EN JS
*
* lo que hace es reducir mi arreglo teniendo en cuenta
* un valor actual posicion del arrglo donde vaya y un
* acumulador valor que se ira retornando y podemos tenerlo
*/
const numbers = [1,2,3,... |
727ce5e8317fcdcb6798e2af2f9dc84cdc5a834b | TypeScript | CG-Coaches/js-exercises | /src/02-rxjs/06-switchMap-vs-mergeMap/switchMap-vs-mergeMap.ts | 2.625 | 3 | import {Observable} from "rxjs";
import {mergeMap, switchMap} from "rxjs/operators";
export class BikeCarService {
constructor(private bike$: Observable<string>,
private car$: Observable<string>) {
}
bikeOrDriveCar(actions$: Observable<'bike' | 'car'>) {
return actions$.pipe(
switchMap(a... |
882fee9f2be0f7ce77a0e84c2bc27a449ee9f8a1 | TypeScript | jser/dataset | /packages/@jser/stat/src/unused_natural/NaturalSearcher.ts | 2.9375 | 3 | // LICENSE : MIT
"use strict";
import { JSerItem } from "../models/JSerItem";
// @ts-ignore
import { TfIdf } from "natural";
// merge sort
let mergeSort = (arr: any[]): any => {
if (arr.length < 2) {
return arr;
}
let middle = arr.length / 2,
left = arr.slice(0, middle),
right = ar... |
fce303907b52a3282559b603543bfc8dc86f731b | TypeScript | voodoocreation/react-redux-boilerplate | /src/models/response.models.test.ts | 2.734375 | 3 | import { ServerError } from "../services/configureHttpClient";
import { failure, success } from "./root.models";
describe("[models] Response", () => {
describe("failure", () => {
it("creates a valid object when a string was provided", () => {
expect(failure("Error")).toEqual({
message: "Error",
... |
09f3c008926d45c86a949c991ec2ab426e4ea667 | TypeScript | chienmy/myBlog | /docs/.vuepress/theme/components/Terminal.ts | 2.65625 | 3 | import { PageComputed, SiteData } from "vuepress-types";
import VueRouter from 'vue-router';
import { getCategoryMap } from "../util";
import CommandFactory from "./CommandFactory";
export class Terminal {
// 输入行显示的前缀
private _prefix: string = "<#c13646>user</#>@<#3cbbc6>chienmy.github.io</#>";
private _workPat... |