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 |
|---|---|---|---|---|---|---|
57d0c403568eeff9e97d9d5b6ff99f7f8b5bbeab | TypeScript | francisauwerda/simple-gym-app | /src/wrappers/dateWrapper.ts | 2.609375 | 3 | /**
* A utility function for easier testability of "now".
* Thank you Varun Jayaraman for teaching me this.
*/
class DateWrapper {
public static createDate = (): Date => new Date();
}
export default DateWrapper;
|
752afd9ca4ff230ae1295e318c28b96a0beaddf7 | TypeScript | beele/homebridge-unifi-protect-camera-motion | /src/utils/mqtt.ts | 2.65625 | 3 | import {MqttClient} from "mqtt/types/lib/client";
import {Logging} from "homebridge";
const mqtt = require('mqtt');
export class Mqtt {
private readonly log: Logging;
private readonly config: MqttConfig;
private readonly client: MqttClient;
constructor(config: MqttConfig, log: Logging) {
thi... |
3f8b576c3af9f642c6c7d5758c76f904aaf3c3d6 | TypeScript | craydent/Node-Library | /tests/methods/mapReduce.test.ts | 2.515625 | 3 | import mapReduce from '../../compiled/transformedMinor/craydent.mapreduce';
import emit from '../../compiled/transformedMinor/craydent.emit';
describe('mapReduce', () => {
const arr: any[] = [{ a: 1 }, { a: 1 }, { a: 1 }];
it('should do a map reduce', () => {
expect(mapReduce(arr,
() => { (t... |
470effbb069982501cc6aa1f9cda70a8168775ec | TypeScript | destinmoulton/rssenal | /src/client/lib/__tests__/sort.spec.ts | 3.21875 | 3 | import { propertyComparator } from "../sort";
const OBJECT_LESS = { name: "a", number: 1 }; // a is lower case on purpose to test string comp
const OBJECT_MORE = { name: "B", number: 2 };
describe("lib/sort.ts", () => {
describe("propertyComparator()", () => {
describe("asc non-string", () => {
... |
965b0b923a006aa1d3af17d2ddf5856153eaf3af | TypeScript | francorafael/tcw-angular | /src/app/core/services/tcw-api/tcw-api.config.ts | 2.546875 | 3 | import { Injectable } from "@angular/core";
/**
* Configurações de endpoint de API de acordo com o ambiente.
*/
const config =
{
'localhost' : {
address: 'https://twc-api.herokuapp.com/api/'
}
};
/**
* Arquivo de configuração de URL da API.
* TcwApiConfigService
* @author Rafael Franco <rafael@j... |
64f4334450cf7afef59177c6f8c5470e0efa07fa | TypeScript | twilio-labs/twilio-style-cli | /src/commands/migrate.ts | 2.6875 | 3 | import * as fs from 'fs';
import { OutputFlags } from '@oclif/parser/lib/parse';
import { flags } from '@oclif/command';
import { ESLint, Linter } from 'eslint';
import { CLIError } from '@oclif/errors';
import { TwilioStyleCommand } from '../core';
export default class Migrate extends TwilioStyleCommand {
static ... |
adb02f8acf13587f79e1395821667c6a6496d377 | TypeScript | green-fox-academy/FMirjam | /foundation/week-03/day-3/Data_Structures/Personal_finance.ts | 3.84375 | 4 | // We are going to represent our expenses in a list containing integers.
// Create a list with the following items.
// 500, 1000, 1250, 175, 800 and 120
// Create an application which solves the following problems.
// How much did we spend?
// Which was our greatest expense?
// Which was our cheapest spending?
// What... |
dea3e5415268999b1095927f36d68d971c32a5ff | TypeScript | przemyslawjanpietrzak/courses | /jest/code/spieces.ts | 3.015625 | 3 | // 4.1
export const someStorage = {
setItem: (key: string, value: string) => {
return `${key}--${value}`;
}
}
export class Class1 {
public method() {
someStorage.setItem('key', '42');
}
}
// 4.2
|
fceceee68c0414801de3a9cec7f1d1284353bb9c | TypeScript | haochangdi123/TypeScript-learn | /1.数据类型/2.number.ts | 3.234375 | 3 | //数字类型(number)
let s:Number = 12
// s = 'ppp' //Type 'string' is not assignable to type 'Number'.
s = 10 |
b58ba5442313c6e811c18a2075963bdf0bf4c710 | TypeScript | maxgaurav/nestjs-todo-app | /src/auth/services/hash-encrypt/hash-encrypt.service.ts | 2.734375 | 3 | import { Injectable, OnApplicationBootstrap } from '@nestjs/common';
import { hash, compare } from 'bcrypt';
import { createCipheriv, randomBytes, scrypt, createDecipheriv } from 'crypto';
import { ConfigService } from '@nestjs/config';
import { promisify } from 'util';
@Injectable()
export class HashEncryptService im... |
bd76d3801775d83ad834c3fcdab632fc49500127 | TypeScript | hey24sheep/vsts-flutter-tasks | /tasks/analyze/index.ts | 2.734375 | 3 | import * as task from "azure-pipelines-task-lib/task";
import * as path from "path";
const FLUTTER_TOOL_PATH_ENV_VAR: string = 'FlutterToolPath';
async function main(): Promise<void> {
// 1. Check flutter environment
var flutterPath = task.getVariable(FLUTTER_TOOL_PATH_ENV_VAR) || process.env[FLUTTER_TOOL_PATH_ENV_... |
82b32064021fd9995f9883d9d54c2fdb453846d0 | TypeScript | harshitsengar/arwes | /packages/design/src/createTheme/getThemeSetup.ts | 2.6875 | 3 | import {
THEME_BREAKPOINTS_DEFAULT,
THEME_PALETTE_TONAL_OFFSET_DEFAULT,
THEME_PALETTE_CONTRAST_OFFSET_DEFAULT,
THEME_PALETTE_ELEVATION_OFFSET_DEFAULT,
THEME_SPACE_DEFAULT,
THEME_SHADOW_BLUR_DEFAULT,
THEME_SHADOW_SPREAD_DEFAULT,
ThemeSettings,
ThemeSetup,
Theme
} from '../constants';
const extractEx... |
054a742c03e47dd17c9e2586401e60a677b74ca4 | TypeScript | yamirminaya/angular-adv-adminpro | /src/app/components/incrementador/incrementador.component.ts | 2.53125 | 3 | /* eslint-disable comma-dangle */
/* eslint-disable implicit-arrow-linebreak */
/* eslint-disable function-paren-newline */
/* eslint-disable lines-between-class-members */
/* eslint-disable object-curly-newline */
/* eslint-disable consistent-return */
/* eslint-disable no-return-assign */
import { Component, Input, O... |
a29be09b35b215a720023a276052902a7d2c6227 | TypeScript | adrianoneres/files-api-nodejs | /src/modules/files/repositories/fakes/FakeFilesRepository.ts | 2.890625 | 3 | import { IFilesRepository } from '@modules/files/repositories/IFilesRepository';
import { File } from '@modules/files/infra/typeorm/entities/File';
import { ICreateFileDTO } from '@modules/files/dtos/ICreateFileDTO';
class FakeFilesRepository implements IFilesRepository {
private files: File[] = [];
public async ... |
8edc38a2e843134c857e838920c515d46d5d91d9 | TypeScript | pchessah/calculator-ang | /src/app/app.component.ts | 2.6875 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
keys = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
operators = ["+", "-", "*", "/"];
valsArr: any[] = [];
vals: number = 0;
operator... |
5997c451f3303d06910ad710e7d0b3a8a6836d74 | TypeScript | guardian/frontend | /static/src/javascripts/projects/common/modules/avatar/api.ts | 2.609375 | 3 | import config from 'lib/config';
import {
getAuthStatus,
getOptionsHeadersWithOkta,
} from '../../modules/identity/api';
const apiUrl = `${config.get<string>(
'page.avatarApiUrl',
'/AVATAR_API_URL_NOT_FOUND',
)}/v1`;
const staticUrl = `${config.get<string>(
'page.avatarImagesUrl',
'/AVATAR_IMAGES_URL_NOT_FOUND',... |
a9630a6e637126dc89567de36734db7b7360acc1 | TypeScript | gagnemartin/cacestdrole-api | /controllers/PostController.ts | 2.796875 | 3 | import { Request, Response } from 'express'
import { Op } from 'sequelize'
import Post from '../models/Post'
import User from '../models/User'
import Category from '../models/Category'
import Tag from '../models/Tag'
import { SendErrorStatus } from "../utils/errors"
class PostController
{
constructor()
{
... |
50d8fbc557f47647bba63b92504d89465049b3d8 | TypeScript | serenadeai/code | /src/settings.ts | 2.703125 | 3 | import * as fs from "fs";
import * as mkdirp from "mkdirp";
import * as os from "os";
export default class Settings {
private systemData: any = {};
private systemDefaults: any = {};
private userData: any = {};
private userDefaults: any = {};
private createIfNotExists(file: string) {
mkdirp.sync(this.pat... |
4dd55e49416dc54eb148d7e71daf112cd414b66b | TypeScript | empyrosx/types | /Types/_entity/format/UniversalField.ts | 2.546875 | 3 | import {IHashMap} from '../../_declarations';
import {register} from '../../di';
type Dictionary = string[] | IHashMap<string>;
export interface IDateTimeMeta {
withoutTimeZone: boolean;
}
export interface IDictionaryMeta {
dictionary: Dictionary;
localeDictionary?: Dictionary;
}
export interface IRealM... |
a89faf75397c84bb2a4dfb0be036580ae2a629e7 | TypeScript | hra4h03/word-dictionary-front | /src/hooks/useUserAddWord.ts | 2.515625 | 3 | import { useUserNampespace } from '../store/main';
import { useCallback, useState } from "react";
import { IWord } from "../store/types";
import APIService from '../services/ApiService';
export const useUserAddWord = () => {
const { setUserWords, setUserLearningWords } = useUserNampespace()!
const [condition, setC... |
1349f5a1256655aa5056b7fb586178dd4047a87b | TypeScript | fiuba-laboral-v2/back-end | /src/models/EmailSenderFactory/Errors/UnknownEmailSenderError.ts | 2.84375 | 3 | export class UnknownEmailSenderError extends Error {
public static buildMessage(className: string) {
return `No emailSender found for ${className}`;
}
constructor(className: string) {
super(UnknownEmailSenderError.buildMessage(className));
}
}
|
8f3db7e2872fab018fd747c9f3fcd27deeeace09 | TypeScript | BlueGhostAlt/open20api | /src/handlers/close/deleteClassroom.ts | 2.78125 | 3 | import WebSocket from "ws"
import { State, Code, ID } from "../../State"
interface freeCodeOptions {
code: Code
state: State
}
interface deleteClassroomOptions {
ws: WebSocket
state: State
id: ID
}
const freeCode = ({ code, state }: freeCodeOptions): void => {
delete state.codes[code]
st... |
43604d0683d19e0a57889a26a052d5bc415ddf7e | TypeScript | mhasselbusch/TypeScriptGameStudioBuild | /library/Renderable.ts | 3.640625 | 4 | /**
* Renderable is the base of all objects that can be displayed on the screen. At its most simple
* level, a Renderable is simply a function (<code>onRender</code>), and a flag to indicate whether
* the object is currently active and enabled, or disabled.
*/
abstract class Renderable {
/// Track if the object is ... |
6055cd5f123d959ffd9c26eac3753986af4fb727 | TypeScript | DerrickDaKing/gowon | /src/commands/Lastfm/Jumble/Quit.ts | 2.796875 | 3 | import { JumbleChildCommand } from "./JumbleChildCommand";
import { Message } from "discord.js";
import { jumbleRedisKey, JumbledArtist } from "./JumbleParentCommand";
import { LogicError } from "../../../errors";
export class Quit extends JumbleChildCommand {
idSeed = "clc sorn";
description = "Giveup on the cur... |
81c9b51d2f5998a2a2a792804a8b141ad1dd3c00 | TypeScript | crystoll/kontitpomppimaan | /kontitpomppimaan/src/main/resources/static/app/beers/beer.service.ts | 2.609375 | 3 | import {Injectable} from '@angular/core';
import {Http, Response, Headers, RequestOptions} from '@angular/http';
import {Beer} from '../models/beer';
import {Observable} from 'rxjs/Rx';
// Import RxJs required methods
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
@Injectable()
export... |
2f122acbb4da1906a5a9dcdc1f532e2c1e708a73 | TypeScript | ocy1011/react-page-template-without-scroll | /src/page-template/reducer/index.ts | 2.6875 | 3 | import { IState, IAction } from "../types";
import {
UPDATE_CONTENTS,
UPDATE_INDEX,
FINISH_MOVE,
UPDATE_TOUCH_Y,
} from "../constants/actionTypes";
import {
updateContents,
updateIndex,
finishMove,
updateTouchY,
} from "../actions/reducer";
export const initialState: IState = {
contents: [],
curren... |
cc5d962bdde30294be6e66453686aea35cfa82ed | TypeScript | alpateam/oldschooljs | /test/Polls.ts | 2.734375 | 3 | import test from 'tape';
import { Polls } from '../dist';
test('Generic checks', async t => {
t.plan(3);
t.equal(Polls.size > 163, true, 'Expected atleast 163 polls');
const raidsPoll = Polls.find(poll => poll.title === 'More Raids Rewards');
if (!raidsPoll) return t.fail('Expected raids poll.');
t.equal(raids... |
a43a59a28f5ee2574cd9eeb4b08ab86e93c20812 | TypeScript | zeeshanhanif/chatting-Image-sharing-system | /src/app/store/reducers/counter.reducer.ts | 2.921875 | 3 | import { CounterAction } from '../actions/counter.actions';
import {ICounter} from '../models/ICounter';
const INITIAL_STATE: number = 0;
interface IInitialState {
counter: ICounter;
}
const InitialState: IInitialState = {
counter: {counter:0}
}
export function counterReducer(state: IInitialState = InitialS... |
4dc88045bc28d62f071a3a93542d98d0bb450f45 | TypeScript | dleclercpro/Samurai | /Apps/ClientApp/src/reducers/UserReducer.ts | 2.96875 | 3 | import { UserState } from '../types/StateTypes';
import { UserAction } from '../actions';
import { SET_USER, RESET_USER } from '../types/ActionTypes';
const initState: UserState = {
username: '',
email: '',
isAuthenticated: false,
isAdmin: false,
};
const UserReducer = (state: UserState = initState, a... |
96a74db57998ec71adca810435f36bf701919aa0 | TypeScript | Adept-Space/StaticScript | /src/backend/llvm/code-generation/function-declaration.ts | 2.546875 | 3 |
import * as ts from "typescript";
import * as llvm from 'llvm-node';
import {NodeGenerateInterface} from "../node-generate.interface";
import {Context} from "../context";
import {FunctionReference, Primitive} from "../value";
import {NativeTypeResolver} from "../native-type-resolver";
import UnsupportedError from "../... |
12321ba4941209436e8a6866d1ec1bd51fd9b0c0 | TypeScript | jacobenget/as3-to-ts | /src/custom-visitors/e4x/lib.ts | 2.984375 | 3 | import Node from '../../syntax/node';
import NodeKind from '../../syntax/nodeKind';
import Emitter, {identifierHasDefinition, visitNode} from '../../emit/emitter';
import * as assert from 'assert';
import * as Keywords from '../../syntax/keywords';
function isInsideE4xFilterBody(node: Node) {
let isE4xFilterBody ... |
6c9254a030da5a40ae619dc66e18dc070dd3fb12 | TypeScript | ringcentral/ringcentral-js-widgets | /packages/ringcentral-mock/src/platform/interfaces/ListA2PBatchesParameters.ts | 2.71875 | 3 | // Query parameters for operation listA2PBatches
export interface ListA2PBatchesParameters {
/**
* The default is 24 hours before `dateTo`
* Format: date-time
*/
dateFrom: string;
/**
* The default is current time
* Format: date-time
*/
dateTo: string;
/**
* Current status of a message ba... |
731315ad0118b331b9a66b870768364b348a9f5a | TypeScript | DzmitryPS/BelCab | /src/WebServer.ts | 2.71875 | 3 | import express from "express";
import {Express} from "express";
import bodyParser from "body-parser";
import {ExpressRequest, Handler} from "./Handler";
import cors from "cors";
export class WebServer {
private readonly webServer: Express;
private defaultHandler?: Handler<ExpressRequest, void>;
constructor... |
c8c2865763316f75db520d112ba3f319d32ed2d9 | TypeScript | soganhei/teste-api-veiculo | /src/services/veiculos/index.ts | 2.578125 | 3 | import { IDatabaseServices } from '../db'
import { IVeiculos, IVeiculosServices } from '../../schemas'
import { KEY as SaidasKey } from '../saidas'
import errors from './errors'
import { FormatUrlParams } from '../../util'
interface IParams {
placa?: string
marca?: string
cor?: string
}
export const KEY = 'v... |
49ccbea8621e87f3f4653727517edb92d55228db | TypeScript | JackyHOz/TrackDetection | /cdk/lib/securitygroup.ts | 2.578125 | 3 | import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
interface SecurityGroupStackprops extends cdk.StackProps {
mainvpc: ec2.IVpc;
}
export class SecurityGroupStack extends cdk.Stack {
public readonly ecssg:ec2.SecurityGroup;
public readonly vpcesg:ec2.SecurityGroup;
public... |
32dd994693f88cfdc86de698b2d9b30e31cc467a | TypeScript | ralphcrutzen/nachtlampje-relais | /main.ts | 2.515625 | 3 | input.onButtonPressed(Button.A, function () {
tijd += -5
if (tijd < 0) {
tijd = 0
}
basic.showNumber(tijd)
basic.clearScreen()
})
input.onButtonPressed(Button.AB, function () {
basic.showNumber(tijd)
basic.clearScreen()
})
input.onButtonPressed(Button.B, function () {
tijd += 1
... |
a168d7236d8566d2713fdac8e177cc73cd6896e4 | TypeScript | cxtao666/Design-model | /src/TYPES.ts | 3.65625 | 4 | class People {
name:string
constructor (name){
this.name = name
}
saySome(){
}
}
class A extends People{
constructor(name){
super(name)
}
saySome(){
console.log('A')
}
}
class B extends People {
constructor (name){
super(name);
}
sa... |
f4dc170f02e32b780e0e275c558a3ded7dbc3e6a | TypeScript | fearthecowboy/scratchpad | /network/complete/enums/ConnectionMonitorSourceStatus.ts | 2.609375 | 3 |
/**
* @extensible
* @description Status of connection monitor source.
* @since 2019-07-01
*/
export enum ConnectionMonitorSourceStatus {
/**
*
*/
Unknown = 'Unknown',
/**
*
*/
Active = 'Active',
/**
*
*/
Inactive = 'Inactive'
}
|
90a64ea860685f5ecca74a213109c028addf6e78 | TypeScript | dmeelker/SpaceShooter | /src/game/PlayerScore.ts | 3.125 | 3 | export class PlayerScore {
private _points = 0;
public reset() {
this._points = 0;
}
public get points(): number {
return this._points;
}
public add(points: number) {
this._points += points;
}
} |
8d740f5fb68a10458a17f25252a440e7c16fd392 | TypeScript | avonbied/gameoff2020 | /app/src/utils/Position.ts | 3.21875 | 3 | import { Velocity } from "./Velocity";
export class Position2D implements Position {
x: number;
y: number;
constructor(x?: number, y?: number) {
this.x = x ?? 0;
this.y = y ?? 0;
}
public set(args: Position): this {
this.x = args.x;
this.y = args.y;
return th... |
083fd638f934bfe66e30ec0453c1c19140f39627 | TypeScript | dino-absoluto/flex-progress-js | /src/components/bar.ts | 2.96875 | 3 | /**
* @author Dino <dinoabsoluto+dev@gmail.com>
* @license
* Copyright 2019 Dino <dinoabsoluto+dev@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apach... |
ee06af96ffa0e5a0ada6a34c4b4c27a2347b9c79 | TypeScript | saulide/typescript | /exercise6.ts | 2.515625 | 3 | // Task: Create a subset of State
interface State {
userId: string;
title: string;
filesLoaded: string;
content: string;
}
interface HeaderState {
userId: string;
title: string;
}
// Picking/Subsetting
|
9c725ef70d4202f051df8c279c8d19f5c75655ae | TypeScript | IngridCBarbosa/gym-consulting | /src/data/TraineData.ts | 2.84375 | 3 | import { firestore } from "../firebase";
import { Training } from "../interfaces/training";
import { UserRole, User } from "../interfaces/User";
import { TRAINING } from "./collections";
export default class trainingData {
createOrUpdate = async (training: Training) => {
const trainingRef = firestore.coll... |
1ccad9d978438436cd95679754a309aa66bd5921 | TypeScript | dorawyy/15_microservice-demo | /blog-client/src/app/authentication/registration.ts | 2.953125 | 3 | export class Registration {
id: number;
email: string;
username: string;
created: Date;
constructor(id: number, email: string, username: string, created: Date) {
this.id = id;
this.email = email;
this.username = username;
this.created = created;
}
static fromResponse(response): Registra... |
a4d4cbf5dd4ff3cd87ec69a582992e44cb7c9039 | TypeScript | sebasgavi/shopmate | /src/utils/api.ts | 2.640625 | 3 | import request from 'superagent';
import { getEnabledCategories } from 'trace_events';
/**
* helper to call API
*
* All functions should return a promise with the body of the response, or reject on error.
* Images should have the complete URL, to avoid extra logic in the components.
*/
const api = function(){
... |
0baeda24d3f5e8c50a3442aba5d7579f2e720601 | TypeScript | firebotQL/Competitive-Programming | /Codewars/7 kyu/Ping Pong/main.ts | 3.203125 | 3 | export function pingPong(startNumber: number, endNumber: number): string {
return [...Array(endNumber - startNumber + 1).keys()].map((num) => {
var result = num + startNumber;
if (result % 3 === 0 && result % 5 === 0) return 'PingPong';
else if (result % 3 === 0) return 'Ping';
else if (result % 5 ==... |
b14ddd9c68569e1a73eb3699691587c0183d795e | TypeScript | jay4q/blitz-web | /src/utils/request.ts | 2.5625 | 3 | import { extend, ResponseError } from 'umi-request'
import { toast } from 'react-toastify'
const CODE_MAP: { [key in string]: string } = {
"400": "请求内容有误",
"401": "您尚未登录",
"403": "抱歉,您没有访问权限",
"404": "无法处理的请求",
"406": "请求的格式有误",
"408": "请求超时,请稍后再试",
"410": "资源已被删除",
"422": "发生验证错误",
"500": "服务器出错",
... |
ca89f423de4be19b7d088c672df1dcd7f3341794 | TypeScript | czewail/react-implement | /src/elements.ts | 3.1875 | 3 | import { Component } from './component';
export interface VNode {
type: string;
props: Record<string, any>;
events?: Record<string, EventListenerOrEventListenerObject>;
children?: VNode[];
}
function prepareVNodeProps(vnode: VNode) {
const { props } = vnode;
// 处理 className
if (props && props?.classNa... |
8e42860c6d62d8eb404654f9fd1f0e436419613e | TypeScript | 0x50Fc/golang | /features/app/ts/ver/rm.less.ts | 2.515625 | 3 |
import { BaseResponse, ErrCode } from "../lib/BaseResponse"
import { int64, int32 } from "../lib/less";
import { Ver } from "../Ver";
/**
* 删除版本
* @method POST
*/
interface Request {
/**
* appid
*/
appid: int64
/**
* 版本号
*/
ver:int32
}
interface Response extends BaseResponse ... |
73704ef86cc124dbdbb6c31050c3249323babf98 | TypeScript | OliFabio/OFM_EIA2_2020 | /L10_Aufgabe_Canvas/ClassSnowflake.ts | 2.59375 | 3 | namespace L10 {
export class SnowflakeInfo extends MovingObjects {
constructor(_x: number, _y: number) {
super(_x, _y);
}
move(): void {
if (this.y > 600) {
this.y = 0;
}
this.x += Math.random() * 2 - 1;
this.y +... |
2007e8365b435b8ee0ed06d00de7d505f5caabfe | TypeScript | alexli1973/realcom-movie-test | /src/app/shared/pipes/search-text.pipe.ts | 2.703125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import {Movie} from '../interfaces/movie';
@Pipe({
name: 'searchText'
})
export class SearchTextPipe implements PipeTransform {
transform(items: Movie[], keys: {'isNumber', 'isString'}, value: string) {
if (!value) { return items; }
if (!items) { return ... |
00bdf1efac0ee584efc7ca3df109219b105a59d0 | TypeScript | MohammedALREAI/e-comarce | /src/redux/User/UserRrducer.ts | 2.640625 | 3 | import { ActionUser, EnumUserAction } from './userType'
import IUserState, { User } from './shapeState.interface'
const temp = localStorage.getItem('user')
const user = temp ? JSON.parse(temp) : {}
console.log('useris', user)
const initialState: IUserState = {
userProfile: {
user: {},
isLoa... |
9dcce2ab50bdec3eb5a12b9d59b3d0390244a990 | TypeScript | liuyics15/auto-ts-doc | /src/interface/Interface.ts | 3.359375 | 3 | /**
* 视图枚举
* */
export enum EViewType {
VALUE, /*值*/
TYPE, /*类型*/
STATEMENT, /*类型声明*/
MODULE, /*模块*/
INTERFACE, /*接口*/
ENUM, /*枚举*/
CLASS, /*类*/
VARIABLE, /*变量*/
PROPERTY, /*成员*/
METHOD, /*方法*/
FUNC... |
96dbd3956b0f833e984e8b87cb13e7a534a1a60d | TypeScript | leoteixeiraa/fepex_app | /src/app/pipes/filtro.pipe.ts | 2.6875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { DiaSemana } from '../interfaces/dia_semana';
import { SextaService } from '../services/sexta.service';
@Pipe({
name: 'filtro'
})
export class FiltroPipe implements PipeTransform {
transform(sextas: DiaSemana[], texto: string): DiaSemana[] {
if (... |
9db6c530bd6185a0e3b4b981d2978214d82bc425 | TypeScript | jonborchardt/moo | /src/store/cards.ts | 2.53125 | 3 | import { Indexable } from "./util";
import { AdvisorType, onAllAdvisors } from "./advisors";
export interface SimpleCard {
// play valuables
scienceCost?: number;
industryCost?: number;
goldCost?: number;
foodCost?: number;
populationCost?: number;
defenseCost?: number;
cultureCost?: number;
happines... |
fe56a8cdce9bcebb1e915c06bd85ee21f0c2367f | TypeScript | ehsanul/opctl | /sdks/js/src/data/coerce/toBoolean/isStringTruthy.ts | 3.71875 | 4 | /**
* ensures value isn't:
* - all "0"'s
* - ""
* - "FALSE" (case insensitive)
* - "F" (case insensitive)
* @param {string} value
*/
export default function isStringTruthy(
value: string
) {
const normalizedValue = value ? value.toUpperCase().replace(/0/g, '') : ''
switch (normalizedValue) {
case '':
... |
88df5548d6eff9c1ce2a92a44fe633bc477ca182 | TypeScript | dlopes7/muhcore-backend | /src/routes/index.ts | 2.515625 | 3 | import * as express from 'express';
import {Api} from './api'
export class Router{
public logger: any;
public router: express.Router
public api: Api;
constructor(app){
this.logger = app.logger
this.api = new Api(app);
this.router = express.Router();
this.setRoutes();
... |
5f2d00e84a4b61f5705f6a6451fb7faec67c76e2 | TypeScript | ovrmrw/ngrx-store-simplr | /src/adapters/adapter-testing.ts | 2.71875 | 3 | import { Observable } from 'rxjs/Observable'
import 'rxjs/add/observable/of'
import { Action } from '../common'
import { Adapter } from './adapter'
import { Wrapper } from '../wrapper'
export class AdapterForTesting<T> extends Adapter<T> {
testing = true
private wrapper: Wrapper<T> = new Wrapper<T>()
private f... |
d0e88b6b05b1b6760f80cdf50eb4f654c40f68f0 | TypeScript | LostBoyNZ/vr | /src/app/shared/tools/dateTools.ts | 2.625 | 3 | import * as moment from "moment";
import * as _ from "lodash";
export class DateTools {
constructor() {}
private handlingTimeDays = 1;
private publicHolidayDates = [
"2019-12-25",
"2019-12-26",
"2020-01-01",
"2020-01-02",
"2020-02-06",
"2020-04-10",
"2020-04-13",
"2020-04-25",
... |
42f10db4fa9302760fd1734fcd802d80b3c85db2 | TypeScript | Pierre-Demessence/Cornibot | /src/Commands/moderation/Clear.ts | 2.90625 | 3 | import { CommandoMessage } from "discord.js-commando";
import { Message, TextChannel } from "discord.js";
import CorniCommand from "../../Engine/CorniCommand";
import Cornibot from "../../Engine/CorniBot";
export default class ClearCommand extends CorniCommand {
constructor(client: Cornibot) {
super(clien... |
90a79c3a90c068954109c93b73f817c151f17944 | TypeScript | Yalovich/Angular-Netcraft-Examples | /session_005/example/pipes.ts | 2.578125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'addTax'
})
export class AddTaxPipe implements PipeTransform
{
/**
* Required method - will be executed during runtime
* @param value
* @param exponent
*/
transform(value: number): number {
return (value * 0.1... |
24cda7f5aa217c4f66983ebd03f92f334605031f | TypeScript | loquaz/appointmentrules | /src/common/application-error.ts | 3.078125 | 3 | import BaseError from "./base-error";
class ApplicationError extends BaseError {
private _status : number;
constructor(status: number, type: ErrorTypes, code: number, message: string){
super(type, code, message);
this._status = status;
}
getError(){
return {
... |
1d25b3fe63ac28bab8627565b7e9ca3339d58db4 | TypeScript | royswale/celo-web-wallet | /src/features/storage/storageProvider-electron.ts | 2.9375 | 3 | import { ipcRenderer } from 'electron'
import * as fs from 'fs'
import * as path from 'path'
import { StorageProvider } from 'src/features/storage/types'
let defaultCwd: string
function getAppCwdPath(filePath: string) {
if (!filePath) throw new Error('Invalid storage path')
if (!defaultCwd) {
const metadata ... |
2cf66e635a8a7873dab15ba314082ec318322d9b | TypeScript | concord-consortium/lara | /lara-typescript/src/shared/convert-keys.ts | 3.09375 | 3 | export const camelToSnakeCaseKeys = (object: any) => {
const translatedObject: any = {};
Object.keys(object).forEach((key: string) => {
const newKey = key.replace(/[A-Z]/g, (l: string) => `_${l.toLowerCase()}`);
translatedObject[newKey] = object[key];
});
return translatedObject;
};
export const snakeT... |
49ba75f26e1be46a3e994d5bb8f13ce0b5e2c2a1 | TypeScript | Pawel095/lectures | /biu/projects/Paweł-Pankiewicz-17839/Server/src/Utils/GameState.ts | 2.609375 | 3 | import { Player } from './Player';
import { TurtlePiece } from './TurtlePiece';
export class GameState {
players: Array<Player>;
turtles: Array<TurtlePiece>;
constructor(players: Array<Player>, turtles: Array<TurtlePiece>) {
this.players = players;
this.turtles = turtles;
}
}
|
9c25557af9482594bb40d21bee7209b11899c324 | TypeScript | ElderSantana/timer2u-app | /src/app/services/storage.service.ts | 2.734375 | 3 | import { Injectable } from '@angular/core';
@Injectable()
export class StorageService {
store(key:string, value:any):void {
localStorage.setItem(key, JSON.stringify(value));
}
retrieve(key: string): any {
return JSON.parse(localStorage.getItem(key));
}
has(key: string): b... |
6873ad8257fe60f3fb8b8dadd2175014777dce71 | TypeScript | kefniark/Jil | /dist/declarations/src/library/helpers/vector2extend.d.ts | 2.84375 | 3 | /**
* Variant of Vector2
* This is used by the layout system to overwrite user settings (position, size)
*
* @export
* @class Vector2Extend
*/
export declare class Vector2Extend {
private origin;
private overwrite;
x: number;
y: number;
constructor(x?: number, y?: number);
set(x: number, y... |
21784ba45799397919798a5fa91a109c49f28b89 | TypeScript | ThijsZijdel/Saver | /App/saver/src/app/data/service/pipes/CustomPipes.ts | 2.84375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'maxChar'
})
export class MaxCharsPipe implements PipeTransform {
maxChars: number = 25;
suffix: string = "...";
transform(value: string): string {
if (value === null || value.length <= this.maxChars) {
return value;
}
retu... |
46521c56353af91e9caad162ec650ca8cc0ec1b1 | TypeScript | Basaingeal/Razor.PageVisibility | /src/pagevisibility.ts | 2.71875 | 3 | declare let DotNet: any;
const domWindow = window as any;
const namespace = "CurrieTechnologies.Razor.PageVisibility";
const visibilityCallbacks = new Map<string, () => Promise<void>>();
function dispatchVisibiliyChange(
id: string,
hidden: boolean,
visibilityState: string
): Promise<void> {
return DotNet.... |
83eda5f9e530c57ebd66083222a66dbfe2c1a815 | TypeScript | Fraasi/random-quote-api | /src/routes/search.route.ts | 2.671875 | 3 | import { Router, Request, Response, NextFunction } from "express";
import { Routes } from "@interfaces/routes.interface";
import { searchQuotes } from "../databases/mockDB";
class SearchRoute implements Routes {
public path = "/search";
public router = Router();
constructor() {
this.initializeRoutes();
}
... |
033b32b24fad11d7dc6f74232f7eab06accc240c | TypeScript | wu-jingtao/-deprecated-remote-invoke-router | /bin/RemoteInvokeRouter.d.ts | 2.578125 | 3 | /// <reference types="node" />
import * as http from 'http';
import * as https from 'https';
import { Server, ServerSocket } from 'binary-ws';
import { BaseSocketConfig } from 'binary-ws/bin/BaseSocket/interfaces/BaseSocketConfig';
import EventSpace from 'eventspace';
import { ConnectedModule } from './ConnectedModule'... |
f6288321657ec4043d34d0cf14ff0bff39317c97 | TypeScript | viktortat/Portfolio | /src/app/admin/admin.validators.ts | 2.578125 | 3 | import { AbstractControl } from '@angular/forms';
export class AdminValidators {
static checkImage(control: AbstractControl) {
const valid =control.value ? control.value.endsWith('.png') : true;
return valid ? null : { invalidImage: true };
}
static versionRequired(control: AbstractControl) {
const... |
b835e258adb70b473ea2a5dff07bd5fecbb48801 | TypeScript | mmart1n/Recipe-Book | /src/app/shared/ingredient.model.ts | 3.125 | 3 | export class Ingredient {
constructor(public name: string, public amount: number) {}
clone(): Ingredient {
const clone = new Ingredient(this.name.trim(), this.amount);
return clone;
}
}
|
16cd2d1f454ebb1ba736303a8b9640a5d7ca947a | TypeScript | dnamenon/denoblog | /db_execs.ts | 2.65625 | 3 | import { Client, Pool } from "https://deno.land/x/postgres/mod.ts";
import { Post } from "./post.ts";
const pool = new Pool( // creates a pool of asynchronous connections to the postgres database
{
user: "denouser",
database: "creative_project",
hostname: "localhost",
password: "absx34",
port: 54... |
a95b2c00232fadb47dd2787f555258dadb49439b | TypeScript | Indexical-Metrics-Measure-Advisory/watchmen-web-client | /src/data-quality/command/types.ts | 2.921875 | 3 | /**
* behaviour of command sender when command published to executor
*/
import {ReactNode} from 'react';
export enum CommandPublishedBehaviorType {
CLEAR_ALL = 'clear-all',
BACKWARD = 'backward',
KEEP = 'keep'
}
export interface CommandPublishedBehavior {
type: CommandPublishedBehaviorType;
}
export interface ... |
e988ea7366424ba9ec13aced307af2743e2d34c2 | TypeScript | JeDaVard/ts-decorator-express | /src/controllers/decorators/controller.ts | 2.640625 | 3 | import 'reflect-metadata'
import { AppRouter } from '../../AppRouter'
import { MetadataKeys, Methods } from '../../types'
import { RequestHandler, Response, Request, NextFunction } from 'express'
function bodyValidators(keys: string): RequestHandler {
return (req: Request, res: Response, next: NextFunction) => {
... |
77c26ab90bf8fc5436b7f010d615284f3565135a | TypeScript | maxonchil/ultraton-front | /src/helpers/calcElementsPositionHelper.ts | 2.578125 | 3 | import { IBlock } from '../interfaces/i-block';
const calcElementsPositions = (elements: string[]): IBlock[] => {
return elements.reduce((acc, value, i) => {
const element = {
name: value,
posLeft: window.innerWidth / elements.length + 150 *(i+1),
};
acc.push(element);
return acc;
}, [... |
a4d4125a1f5c318df96dab94c73c316d8c357779 | TypeScript | kellystrauch0/control | /cmd/ui/assets/src/app/features/apps/actions/app-detail.actions.ts | 2.65625 | 3 | import { Action } from '@ngrx/store';
export enum AppDetailActionTypes {
LoadAppDetails = '[AppDetail] Load AppDetails',
SetAppDetails = '[AppDetail] Load AppDetails Success'
}
export class LoadAppDetails implements Action {
readonly type = AppDetailActionTypes.LoadAppDetails;
constructor(public payload: any... |
124e70450c8ac0655fa5d4acfa48991784161ac0 | TypeScript | Kim1am/near-admin-vue | /src/store/modules/global.ts | 2.703125 | 3 | interface State {
defaultExpandKeys?: string[]
}
interface Getter {
[key: string]: any
}
const state: State = {
defaultExpandKeys: []
}
const getters: Getter = {
defaultExpandKeys: (getterState: State) => {
return getterState.defaultExpandKeys
}
}
const mutations = {
}
const actions = {... |
1d7074a2a71fd5ea167687402ff758ca5e91c76b | TypeScript | andersonsts/access-control-nodejs | /src/controllers/UserController.ts | 2.59375 | 3 | import { Request, Response } from 'express';
import { getCustomRepository } from 'typeorm';
import { hash } from 'bcryptjs';
import fs from 'fs';
import path from 'path';
import uploadConfig from '../config/upload';
import UserRepository from '../repositories/UserRepository';
import RoleRepository from '../repositori... |
96510bec5386118fb6ae1200bf8bf0dfa48ab12e | TypeScript | evgomes/seguradora | /src/Seguradora.Apresentacao.Web.Angular/ClientApp/src/app/models/seguro.ts | 2.96875 | 3 | export class Seguro {
id: number = 0;
cpfCnpj: string = '';
tipo: string = '';
placa?: string = null;
cpfSegurado?: string = null;
rua?: string = null;
numero?: string = null;
bairro?: string = null;
cidade?: string = null;
constructor(init?: Partial<Seguro>) {
Ob... |
2c47db485b86722dc94030938eed42fa1c3e3b56 | TypeScript | zheeeng/the-big-bang-crawler | /src/crawler/guessProcessor.ts | 2.65625 | 3 | import { ProcessorConfigName, ProcessorName } from "./singleton";
const translateList: Array<[key: ProcessorConfigName, ...fussKeys: string[]]> =
[
["ruanYifengBlog", "ruanyifeng", "阮一峰"],
["aliMaMaFe", "alimama", "快爆", "阿里妈妈"],
["juejinHot", "juejin", "掘金", "掘金热门", "掘金前端"],
["infoQFE", "infoQ", "inf... |
4a44eb8a3d319df33747c1ab4beb46ed2b5fbf8c | TypeScript | macolby14/leetcode | /may21/find-and-replace-pattern.ts | 3.46875 | 3 | function findAndReplacePattern(words: string[], pattern: string): string[] {
const matches: string[] = [];
for (const word of words) {
if (isPatternMatch(word, pattern)) {
matches.push(word);
}
}
return matches;
}
function isPatternMatch(s: string, p: string): boolean {
if (s.length !== p.lengt... |
264dc4c2136e01e7bbbcb5ce20ad88e0f1285533 | TypeScript | pip-admin/pip-admin-system | /src/statistics/StatisticsService.ts | 2.5625 | 3 | 'use strict'
declare let moment;
import { StatCounterValue, StatCounterSet } from '../data/StatCounters';
import { IStatisticsDataService } from '../data/IStatisticsDataService';
export class StatisticsFilter {
static Yearly: string = 'Yearly';
static Monthly: string = 'Monthly';
static Daily: string = 'Da... |
9eac021622f387e3f83961b1654c989f9095d2ce | TypeScript | EnsyFane/mpp-rest-api | /angular-client/src/app/testing/page-objects/error-info.pageobject.ts | 2.59375 | 3 | export class ErrorInfoPageObject {
private element: HTMLElement;
constructor(element: HTMLElement) {
this.element = element;
}
getMainMessageText(): string {
const message: HTMLElement = this.element.querySelector('.main-message');
return message.textContent;
}
getDesc... |
ccda2e9a8fedbd10d50576cbe5085ed0928316bd | TypeScript | KeesCBakker/slack-ext | /packages/slack-ext-command-mapper/test/scenarios/scenarios.spec.ts | 2.546875 | 3 | import { getDefaultMockedBot } from "../mocks/MockedBot";
const pretend = getDefaultMockedBot();
import { mapper, Options, NumberParameter, RegExStringParameter, TokenParameter, IPv4Parameter } from "../../src";
import { expect } from "chai";
import "mocha";
describe("scenarios.spec.ts > wehkamp glitch", () => {
bef... |
bff574358de3e67340f7f063eacad90038410d3e | TypeScript | Ecoexlab-Dev/express-app | /src/decorators/app.decorator.ts | 2.703125 | 3 | import { Constructor } from '.';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as cors from 'cors';
type expressAppOption = {
routers?: any[];
statics?: any[];
useCors?: boolean;
baseUrl?: string;
port?: string | number;
}
export function ExpressApp(option... |
4475632d2a88254744a15d61cfe36755ece87e1a | TypeScript | georgwittberger/jamstack-ecommerce-example | /store/user.ts | 2.65625 | 3 | import { Action, Module, Mutation, VuexModule } from 'vuex-module-decorators'
import { $axios } from '@/plugins/global-axios'
import { ApiError } from '@/types/api-error'
import { ContactInfo } from '@/types/user/contact-info'
@Module({
name: 'user',
stateFactory: true,
namespaced: true,
})
export default class ... |
e6169df9de64693ce3d4f8b2d236707ec38cb28d | TypeScript | 1806Java-Trevin/janus-webapp | /client-side/src/app/portals/Track-Force/pipes/associate-search-by-text-filter/associate-search-by-text-filter.pipes.spec.ts | 2.796875 | 3 | import { AssociateSearchByTextFilter } from './associate-search-by-text-filter.pipes';
import { Associate } from '../../models/associate.model';
import { Client } from '../../models/client.model';
describe( 'TestPipe: AssociateSearchByTextFilterPipe', () => {
let pipe: AssociateSearchByTextFilter;
// creatin... |
a727cfb6db2d812472a1e33b8d9bfbe2ae4d5cb6 | TypeScript | kicumkicum/stupid-player | /src/routes/file.ts | 2.703125 | 3 | import * as fs from 'fs';
import {ReadStream} from 'fs';
export default {
test: (uri: string): boolean => {
if (process.platform === 'win32') {
return /^[a-zA-Z]:\\[\\\S|*\S]?.*$/g.test(uri);
}
return /^\.|^\//.test(uri)
},
read: (path: string): Promise<ReadStream> => {
return new Promise((resolve, rej... |
2c4301c4196306e42beef00d0e4360015bbc9982 | TypeScript | mattacosta/php-parser | /src/text/SegmentedText.ts | 3 | 3 | /**
* Copyright 2017 Matt Acosta
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
9c3917d27180de05a16b18045403bb234fea2c7a | TypeScript | JakovGudelj10/GiS-WiSe20-21 | /Endabgabe/Betreiberseite/script.ts | 2.53125 | 3 | namespace Betreiberseite {
interface Product {
_id: number;
_name: string;
_preis: number;
_bild: string;
_bildAlt: string;
_beschreibung: string;
_status: string;
_fname: string;
_lname: string;
}
async function init(): Promise<void... |
247464ef2c71d34d5f8f9269b595d246e0e9a4aa | TypeScript | green-fox-academy/nagyorsolya | /week-02/day-2/calculator.ts | 3.875 | 4 | 'use strict';
let readlineSync = require('readline-sync');
export{}
// Create a simple calculator application which does read the parameters from the standard input
// and prints the result to the console.
// It should support the following operations, create function called "calculate()" :
// +, -, *, /, % and it sh... |
5a9ccd9930878372a819287b85b2ee220fc53860 | TypeScript | CdSy/Ionic-Audio-Player | /src/services/convertAtTime.pipe.ts | 2.84375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'timeformat'})
export class ConvertAtTime implements PipeTransform {
transform(millseconds: number) {
const seconds = Math.floor(millseconds / 1000);
const h = 3600;
const m = 60;
let hours = Math.floor(seconds / h).toString();
let... |
653abf9dbd090fd86123bb4425dd21fddb3b9e8b | TypeScript | YeomJaeSeon/freeboard-crud | /src/board/dto/board_response.dto.ts | 3.03125 | 3 | import { Member } from "../../member/member.entity";
// 타입 정의
type DataType = {
id : number,
title: string,
content: string,
createdData: number,
updatedData: number,
member: Member
}
export class BoardResponseDto{
constructor(id: number, title: string, content: string, createdTime: number... |
b83d04a4597ced459aa4f6b7d2971eb6c8ee84ff | TypeScript | spirinvladimir/Excalibur | /src/engine/BoundingBox.ts | 3.421875 | 3 | /// <reference path="Algebra.ts" />
module ex {
export enum CollisionStrategy {
AxisAligned,
SeparatingAxis
}
/**
* Interface all collidable objects must implement
* @class ICollidable
*/
export interface ICollidable {
/**
* Test wether this collidable with another r... |
c2fd80e08fc4aa7bdb660d9279ebd3020b6b0101 | TypeScript | micebot/pubsub | /src/api/index.ts | 2.546875 | 3 | import { AxiosInstance } from 'axios';
import { config } from 'dotenv';
import querystring from 'querystring';
import OrderCreation, {
Order,
Product,
ProductResponse,
} from '../model/models';
import AxiosClient from './client';
config();
let client: AxiosInstance;
/**
* Realiza a autenticação do client.
*/... |
065cdc71872931efac899ded8fb6188397192253 | TypeScript | lucasvmiguel/coding-challenge-newsfeed | /graphql/resolvers/Query/feed.ts | 2.5625 | 3 | import db, { UserRow, AnnouncementRow, ProjectRow, Fellowship, ExtraFellowship } from '../../db'
import { limitQueryParam, offsetQueryParam } from '../../utils/pagination'
const ANNOUNCEMENTS_QUERY = `
SELECT a.id, a.title, NULL as name, a.body, NULL as bio, NULL as description, a.created_ts, a.fellowship, NULL as a... |
3c7e0e9f1b6f6b6e89e08c6571cb76c32a1afbd0 | TypeScript | chanzo/script-launcher | /src/logger.ts | 3.234375 | 3 | type LogWriter = (message?: any, ...optionalParams: any[]) => void;
export class Logger {
public static level = 0;
public static get debug(): LogWriter {
return Logger.level > 2 ? console.debug : Logger.nullWriter;
}
public static get log(): LogWriter {
return Logger.level > 1 ? console.log : Logger.n... |
8b008e5c7aa7039914cc7eed1ea3f741b026e145 | TypeScript | sylwek2531/ts | /FormCreator/src/InputField.ts | 3.234375 | 3 | import { Field } from "./IField";
import { FieldLabel } from "./FieldLabel";
import { FieldType } from "./EFieldType";
export class InputField implements Field {
name: string;
label: FieldLabel;
type: FieldType.inputText;
value: string;
id: number = new Date().getTime();
events: string[] = ["fo... |