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 |
|---|---|---|---|---|---|---|
a33e0acb9140175f57f4b964bdae0795e7a28d0f | TypeScript | whiterook6/webgl | /src/cameras/PerspectiveLens.ts | 2.578125 | 3 | import {Lens} from "./Lens";
import {mat4} from "gl-matrix";
export class PerspectiveLens extends Lens {
public fieldOfView: number = (45 * Math.PI) / 180;
public aspect: number = 1;
public zNear: number = 0.1;
public zFar: number = 100.0;
public getProjection() {
const matrix = mat4.create();
mat4.... |
020fd896f76e8606cf12a57462008a237c8afef3 | TypeScript | mrwhale-io/mrwhale | /packages/mrwhale-commands/src/commands/fun/ascii.ts | 2.796875 | 3 | import { codeBlock, CommandOptions } from "@mrwhale-io/core";
import * as figlet from "figlet";
import * as util from "util";
const figletAsync = util.promisify(figlet);
export const data: CommandOptions = {
name: "ascii",
description: "Generate ascii.",
type: "fun",
usage: "<prefix>ascii <text>",
examples:... |
da8ef040d2842a41e426dd2418b0e2bb7119730c | TypeScript | arturdedela/cryptography-lab-1 | /src/components/Encryption/Encrypt/types.ts | 2.59375 | 3 | import { AlgorithmNames } from "../algorithms";
import { Mode } from "../Encryption";
export interface IEventData {
action: string;
}
export interface IEncryptData extends IEventData {
file: ArrayBuffer;
mode: Mode;
algorithmName: AlgorithmNames;
encryptionKey: string;
options: any;
}
export... |
84009f77d38c66fdd1e7d49f7a30062a8c94df79 | TypeScript | Arsenalist/twitter-video-uploader | /src/fileDetectedHandler.ts | 2.625 | 3 | import {getVideoDurationInSeconds} from 'get-video-duration'
import {SocketServerWrapper} from "./socketServerWrapper";
import {createThumbnailPath, createThumbnailPathFromWebRoot} from "./videoFilePaths";
import {videoInfoRequest} from "./socketMessage";
const fs = require('fs');
function isFileNewEnough(newDetectedF... |
08343ea2b5b6a1f59c7509bb9c6b6fe3ed80f9ba | TypeScript | Bingsta/Angular-async-routes-loading-test | /src/app/services/page.service.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { PageType } from '../types/PageType.type';
import { delay, map } from 'rxjs/operators';
import { GenericHTMLComponent } from '../generic-html/generic-html.component';
import { ModuleItem } from './module-item';
import { PropertyM... |
ceaeb24ad84f205996dd7c6ee76b66bdeb76e190 | TypeScript | Perseus101/lonely-journey | /src/stars.ts | 2.859375 | 3 | import * as PIXI from 'pixi.js';
import Camera from './camera';
function wrap(val: number, by: number): number {
val = val % by;
if (val < 0) {
return val + by;
} else {
return val;
}
}
function randomGauss(): number {
let randA = Math.random();
let randB = Math.random();
return Math.sqrt(-2 * ... |
65735323df0631b3d9ebb9132e7f76a0eb59e65c | TypeScript | loglife-dev/transporte-biologico_v3 | /src/modules/city/useCases/create/CityUseCase.ts | 2.5625 | 3 | import { inject, injectable } from "tsyringe";
import { AppError } from "../../../../shared/errors/AppError";
import { ICityDTO } from "../../dtos/ICityDTO";
import { City } from "../../infra/entities/City";
import { ICityRepository } from "../../repositories/ICityRepository";
@injectable()
class CreateCityUseCase {... |
0e8f4a36deb1c89e04fca167e30678a077153ce7 | TypeScript | mothepro/signaling-lobby | /util/stringSantizer.ts | 2.9375 | 3 | const zeroWidthCharCodes = new Set<number>()
.add(0x200B) // Zero Width Space
.add(0x200C) // Zero Width non - joiner Unicode code point
.add(0x200D) // Zero Width joiner Unicode code point
.add(0xFEFF) // Zero Width no -break space Unicode code point
.add(0) // Null
.add(7) // Bell
.add(8) // Backspace
... |
cf2a7e8acc79e54a10892a48bc44ae82f45aeb03 | TypeScript | cordeno/cordeno | /src/client/constructors/RESUMED.ts | 2.546875 | 3 | import { Client } from "../Client.ts";
export class RESUMED {
public reconnectRequested: boolean = false;
public resumeTime: Date | null = null;
constructor(private client: Client, private payload: any) {
if (this.payload.reconnectRequested) {
this.reconnectRequested = this.payload.reconnectRequested;... |
3532fd9a5eef0dac052ca4c8ac86911d513e0656 | TypeScript | BryanWilhite/songhay-ng-workspace | /songhay/projects/songhay/core/src/lib/services/app-tabular-data.store.ts | 2.609375 | 3 | import { Observable, Subscription, BehaviorSubject } from 'rxjs';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClientOptions } from '../models/http-client-options';
import { SendMethods } from '../models/send-methods.type';
import { AppDataStore } from '.... |
ff8d0a80e13722a2c494eec5f21d25a4bbc9b15f | TypeScript | russell-mason/clocks | /src/app/game/game.component.ts | 2.75 | 3 | import { Component, OnDestroy, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { GameStage } from '../shared/game/game-stage.enum';
import { GameService } from '../shared/game/game.service';
/**
* Component that coordinates what's shown to the user at any given time.
* Responds to changes in the game ... |
4a3817df8fb3cd7c94d83e018f6e6d1c9e76a868 | TypeScript | SnowHeight/App | /src/services/bridge.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import * as _ from 'lodash';
import { BluetoothSerial } from '@ionic-native/bluetooth-serial';
import { GeneralDataEntry } from './model';
import moment from 'moment';
import Chance from 'chance';
export enum Commands {
SETTINGS = 'settings',
SAVE_SETTINGS = 'savesetting... |
44ddcca2b68f8f83a5ac993237a9d5115515c090 | TypeScript | DmitryDorofeev/vk-bridge | /src/applyMiddleware.ts | 3.15625 | 3 | import { VKBridge, VKBridgeSend } from './types/bridge';
import { Middleware, MiddlewareAPI } from './types/middleware';
/**
* Creates the VK Bridge enhancer that applies middleware to the `send`
* method. This is handy for a variety of task such as logging every sent
* event.
*
* @param middlewares The middlewar... |
cb934d9d4795b221288e36fbfc565bd9f966e5b3 | TypeScript | brudil/timothy | /src/parser.ts | 2.734375 | 3 | export enum Token {
Character = 'character',
TitlePage = 'titlePage',
SceneHeading = 'sceneHeading',
SceneNumber = 'sceneNumber',
Transition = 'transition',
Dialogue = 'dialogue',
Parenthetical = 'parenthetical',
Action = 'action',
Centered = 'centered',
Section = 'section',
Synopsis = 'synopsis',... |
29e44a7d67d9dcff20736538ca2b14d169060065 | TypeScript | grimace/ngx-form-builder | /src/app/utils/formatTime.ts | 3.203125 | 3 | /**
* format time to string
* @param time
*/
export function formatTime(time) {
var digits = [time.getHours(), time.getMinutes(), time.getSeconds()];
var timeStr = '';
for (var i = 0, len = digits.length; i < len; ++i) {
timeStr += (digits[i] < 10 ? '0' : '') + digits[i];
if (i < len - ... |
f6100b61658d162e1c8b94a98d0d9f44fc6bc0c7 | TypeScript | future4code/Yan-Sabino | /semana19/backend-template-ts/src/business/entities/post.ts | 3.34375 | 3 | export class Post {
constructor(
private postId: string,
private picture: string,
private description: string,
private creationDate: Date,
private postType: PostType,
private userId: string
) {}
public getPostId(): string {
return this.postId;
}
public getPicture(): string {
... |
6f97d18ba6b38a36a5b4994a5a6167c763fe4306 | TypeScript | ruslanguns/rusgunx-blog | /src/shared/dto/response-error.dto.ts | 2.8125 | 3 | // success: false => errorMessage, error
import { IResponse } from '../interfaces/response.interface';
export class ResponseError implements IResponse {
constructor(infoMessage: string, data?: any) {
this.success = false;
this.message = infoMessage;
this.data = data;
console.warn(ne... |
f27b9a589356554ffbbda65cc08801001d608cc0 | TypeScript | abdulmoiz2245/angular_laravel | /common/shared/charts/chartist/chartist-line.ts | 2.546875 | 3 | import * as Chartist from 'chartist';
import {IChartistLineChart, ILineChartOptions} from 'chartist';
import {BaseChart} from '@common/shared/charts/base-chart';
export class ChartistLine extends BaseChart {
protected lineConfig: ILineChartOptions = {
showArea: true,
lineSmooth: true,
low: ... |
ca8fe3a8706285f9ff222482ee375444583ce877 | TypeScript | FynnGrandke/interview-preparation | /src/index.ts | 2.8125 | 3 | // You can write your code here.
// Add console.log(`${myVariable}`) to see your output.
// Don't forget to run 'npm start' in the console!
const myVariable = 'World'
console.log(`Hello ${myVariable}`)
|
511ae6ce77466793261a8de4b52098fef2a187db | TypeScript | peterhchen/800_Angular | /21_22/ch21-http-fetch-data-src/src/app/employee.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { IEmployee } from './employee';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class EmployeeService {
//private _url: string ="src/assets/data/employees.json"
private _url: string ="/assets/... |
07f8c385f39034da7f383628e401aa0c1ceac0f9 | TypeScript | TeamBerry/cranberry | /src/redux/reducers/user.reducer.ts | 2.625 | 3 | /* eslint-disable import/prefer-default-export */
import AsyncStorage from '@react-native-community/async-storage';
import axios from 'axios';
import { AuthSubject } from '../../models/session.model';
import {
RESTORE_TOKEN, SIGN_IN, SIGN_OUT, UPDATE_USER,
} from '../actionTypes';
export type StoreType = {
userT... |
3fb5ed53d2bf68b5fd82e6ac43196e94c447f933 | TypeScript | armmroorm/vending-machine-backednd | /src/machine/dto/create-machine.dto.ts | 2.515625 | 3 | import { IsNotEmpty, Length } from 'class-validator';
export class CreateMachineDto {
@IsNotEmpty()
@Length(0)
machineName: string;
@IsNotEmpty()
@Length(0)
location: string;
@IsNotEmpty()
@Length(0)
address: string;
}
|
ecfdb10ccb8a446b2ee73725fe5258e0b21465f9 | TypeScript | GennadySX/race-scheduler-app | /src/store/reducers/Race.ts | 2.734375 | 3 | import {
RACE_GET_START,
RACE_SET,
RACE_GET_END,
RACE_GET_ERR,
} from '../actions/Races';
const initialState = {
races: [],
max: 0,
current: 1,
loading: false,
err: false,
};
const reducer = (state: any = initialState, action: any) => {
switch (action.type) {
case RACE_SET:
//console.log... |
772fed559fbd5b42597bb2e1385f1a6e60d0aef4 | TypeScript | duki994/nrwl-nx-workshop | /tools/generators/util-lib/index.ts | 2.53125 | 3 | import { Tree, formatFiles, installPackagesTask } from '@nrwl/devkit';
import { libraryGenerator } from '@nrwl/workspace/generators';
interface Schema {
name: string;
tags?: string;
directory: 'api' | 'store' | 'shared';
}
const checkNameHasUtil = (name: string) => name?.includes('util') ?? false;
const mergeT... |
069b2a421dd1fc6bd48bf0251c40fa8e569ba739 | TypeScript | cnbrkkaya/typescript-basics | /src/index.ts | 4.25 | 4 | //Basic Types
let id: number = 5
let company: string = "CK"
let isValid: boolean = true
let x: any = "Hello"
let ids: number[] = [1, 2, 3, 4, 5]
let arr: any[] = [1, 2, "ck", false]
//Tuple
let person: [number, string, boolean] = [1, "ck", true]
//Tuple Array
let employee: [number, string][]
employee = [
[1, "CK"]... |
2346cc358ab7a1819df537ecd3b48661626ac09b | TypeScript | johancc/Apollo | /packages/server/src/models/Numbers.ts | 2.84375 | 3 | import {
getModelForClass,
post,
pre,
prop,
ReturnModelType,
} from "@typegoose/typegoose";
export interface INum {
value: number;
}
@pre<Num>("save", function () {
console.log(`Saving ${this.value}`);
})
@post<Num>("save", function (num) {
console.log(`Created Document ${num.id}`);
})
export class Nu... |
0ea27d773f65b6a107b56b43d974c0f8f0eab683 | TypeScript | glimmerjs/glimmer-vm | /packages/@glimmer/reference/test/utils/platform.ts | 2.859375 | 3 | export default function objectValues(obj: any) {
if (typeof Object.values === 'function') {
return Object.values(obj);
} else {
return Object.keys(obj).map((k) => obj[k]);
}
}
|
206e88f3d647b43590bb391b438187a4f7107943 | TypeScript | jthogsett/fam-element | /test/observe-property.test.ts | 3.015625 | 3 | import { observeProperty } from '../src/observe-property'
describe('observeProperty', () => {
it('calls the callback when the observed property is updated', () => {
const callback = jest.fn()
class Foo {
@observeProperty(callback)
bar?: string
}
const instance = new Foo()
instance.bar... |
83b030f3cfb2f1c61b5587e5518287d8a2207c3d | TypeScript | Pfoerd/advent_of_code_2018 | /src/day_12/day_12_1.ts | 3.109375 | 3 | import * as os from 'os';
export function day12_part1(rawFileData: string) {
const inputData: string[] = rawFileData.split(os.EOL);
let pots: string = inputData.splice(0, 2)[0].substr(15);
// we only need to know one side of the rules
const spreadRules = inputData.filter(v => v.indexOf('=> #') !== -1).... |
7b0f39139e7795fce926cb9f334bda771b6330cf | TypeScript | DevSeto/awesome-typescript-loader | /issues/product-designer/src/stores/UIStore-spec.ts | 2.515625 | 3 | import { iocContainer } from '../utils/ioc/index';
import { UIStore } from './UIStore';
const wnd = window as any;
describe('UI Store', function () {
let store: UIStore;
beforeEach(() => store = iocContainer.get(UIStore));
afterEach(() => {
wnd.innerWidth = 1024;
wnd.innerHeight = 768;
});
it('sh... |
ed622d4261ad035e07c87481c74b34bbb0b1b471 | TypeScript | Esri/hub.js | /packages/search/test/ago/helpers/aggs/collection.test.ts | 2.546875 | 3 | import { collectionAgg } from "../../../../src/ago/helpers/aggs/collection";
describe("collection aggs test", () => {
it("calculates collection raw aggs correctly", () => {
const agoAggs = {
counts: [
{
fieldName: "type",
fieldValues: [
{
value: "Featur... |
97a568854bb4549f69b098e3ead2f0a9da1d7625 | TypeScript | Egg4/crop-app | /src/app/lib/array.prototype.ts | 3.375 | 3 | import './object.prototype';
interface Array<T> {
deepEqual(array1: T[], array2: T[]): boolean;
}
Array.deepEqual = function (array1: [], array2: []): boolean {
if (!array1 || !array2) return false;
if (array1.length !== array2.length) return false;
for (var i = 0, l=this.length; i < l; i++) {
const val1 =... |
c5af1f851cfd31bb2350489416112c037ae4d4b5 | TypeScript | qcjxberin/backgroundSystem | /src/filters/index.ts | 2.78125 | 3 | import Vue from 'vue'
function sex ( str: string ) {
if (str === 'MALE') {
return '男'
} else if (str === 'FEMALE') {
return '女'
} else if (str === 'UNKNOW') {
return '未知'
}
}
Vue.filter('sex', sex)
|
4870e072b8ade314ad8a9e5c2ff47328bdddbe8f | TypeScript | MonchiLin/modern-magic | /projects/Data-Structure-and-Algorithms/DataStructure/Queue/__tests__/回文检查.spec.ts | 3.78125 | 4 | /**
*
回文是正反都能读通的单词、词组、数或一系列字符的序列,例如 madam或 racecar。
*
*/
import {DQueue} from "../Queue";
/**
* 计算过程 "madam"
* 1. m
* 2. ma
* 3. mad
* 4. mada
* 5. madam
*
*
* @param word
*/
function palindromeChecker(word: string): boolean {
const queue = new DQueue();
word.split("")
... |
e781cf735e1af4151434c88dedb8ad0c7f61184b | TypeScript | cynt4k/prepaid-list | /backend/src/core/express/response.ts | 2.609375 | 3 | import { HttpCodes } from './codes';
import { IResponse } from '../../types/express';
import { Response, NextFunction } from 'express';
export let response = (res: Response, code: HttpCodes, msg?: string, data?: any) => {
let responseMessage: IResponse<any> = <IResponse<any>>{};
if (code >= 400) {
res... |
00799fde8995a60b3ab8b897f6109626378d47d9 | TypeScript | ytechie/SimpleTrackingV3 | /src/providers/fedex/FedexTracker.ts | 2.59375 | 3 | import * as fs from 'fs';
import * as path from 'path';
import * as request from 'request-promise';
import * as xml2js from 'xml2js-es6-promise';
import { TrackingData } from '../TrackingData';
import { ITracker } from '../ITracker';
import { ActivityData } from '../ActivityData';
export class FedexTracker implements ... |
8b0f6dc99ca737f8460ab7f69f375dd09b7fdda1 | TypeScript | yubowenok/coda | /server/src/util/integrity.ts | 2.515625 | 3 | import * as paths from '../constants/path';
import {
JudgeMode,
ProblemsetConfig
} from '../constants';
const checkProblemsetIntegrity = (problemset: ProblemsetConfig): void => {
if (problemset.judgeMode === JudgeMode.BLIND && problemset.freebies) {
console.error(`problemset ${problemset.id} has blind judge ... |
171887270c2c4c8513544f67e105df3099f0e9ba | TypeScript | a1967629423/d_language | /executor.ts | 2.8125 | 3 | import type { AST } from "./d_language_lib";
import { createInterface } from "readline";
export class Context {
/** 流程控制状态,在return时此值会被设置为return值 */
exit: Value | undefined = undefined;
break: Value | undefined = undefined;
continue: Value | undefined = undefined;
get NormalExit() {
if (this.exit !== und... |
cd44d3205c6ec1d828aceffdb9a59488825a6943 | TypeScript | RizwanMurtaza/MultiTenant | /src/app/forms/Login/LoginForm.ts | 2.609375 | 3 | import { required, minLength, email } from "@rxweb/reactive-form-validators";
export class LoginForm {
@required({ message: "email is required field" })
@email({ message: "user name must be a email" })
username: string;
@required({ message: "password is required" })
@minLength({ value: 6, message: ... |
673cf17c8c9a3304111cd5c5de8738dc290021ad | TypeScript | ygorkayan/estruturas-de-dados | /src/estruturas-de-dados/deque.ts | 3.546875 | 4 | export default class Deque<T> {
private count: number;
private lowestCount: number;
private items: Record<number, T>;
constructor() {
this.count = 0;
this.lowestCount = 0;
this.items = {};
}
private moveForRight() {
const itemsTemp: Record<number, T> = {};
for (let i = 0; i < this.cou... |
f428bcdfd2505b2d52ca3dd2c2b7319b9c164b9c | TypeScript | andruxacomm/nakukopTest | /store/modules/BaseStore.ts | 2.6875 | 3 | import { types } from 'mobx-state-tree';
export const BaseStore = types
.model({
isFetching: false,
error: types.maybeNull(types.string),
})
.actions(self => {
const setFetching = (value: boolean): void => {
self.isFetching = value;
};
const setError = (e... |
e27a99f1657570144c82877a24fd5025cd2d2020 | TypeScript | bantyK/Payment-Billing-System | /Frontend/frontend/src/app/model/admin.ts | 2.8125 | 3 | export class Admin {
private id: number;
private username: string;
private password: string;
private dateOfJoining: Date;
private salary: number;
constructor(id: number, username: string, password: string, dateofJoining: Date, salary: number) {
this.id = id;
this.username = user... |
2dcd18f5b7f334c70eff30df179764873cebc69a | TypeScript | gurundoro/100AlgorithmChallenge | /100AlgorithmsChallenge/largestNumber/largestNumber.ts | 3.203125 | 3 | function largestNumber(n: number): number {
let str = ''
for(let i = 0; i < n; i++){
str += 9
}
return Number(str)
}
console.log(largestNumber(2)); |
7213bd1786eb13ef79f386cc28963c864293f1a9 | TypeScript | nerder/typescript-rest-api | /src/controllers/BalanceController.ts | 2.59375 | 3 | import { Inject } from "typescript-ioc";
import { FormParam, Path, PathParam, PUT } from "typescript-rest";
import { BalanceService } from "../services/BalanceService";
@Path("/balance/")
export class BalanceController {
@Inject
private balanceService!: BalanceService;
@Path(":userId/deposit")
@PUT
public ... |
1aa5c8b128ba7468376f687ae4d91485510329e3 | TypeScript | rocketseat-creators-program/angular-http-requests-2021-10-13 | /src/app/features/students/student.ts | 3.03125 | 3 | export interface Student {
id: number;
name: string;
email: string;
birthday: string;
createdAt: Date;
}
export class Student {
name: string;
email: string;
birthday: string;
constructor(name?: string, email?: string, birthday?: string) {
this.name = name || '';
thi... |
9a45726f2892ba411c25aadb59e5ce41f3401e56 | TypeScript | hkfd/hkfd | /packages/angular/src/app/shared/pipes/helpers.ts | 2.78125 | 3 | import { ApiPipeInput } from './api.pipe';
import { PrismicPipeInput } from './prismic.pipe';
import {
Image as GenericImage,
Video as GenericVideo,
Audio as GenericAudio
} from 'generic';
import {
ImageBlockData as ApiImageBlockData,
VideoBlockData as ApiVideoBlockData,
AudioBlockData as ApiAudioBlockData
... |
3f733b9fd92f8c9303a6b50acb897ee311c081bb | TypeScript | jobjava00/typescript | /basic/ch3/src/enum.ts | 3.640625 | 4 | enum WeekDay { Mon, Tue, Wed, Thu }
enum WeekDay2 { Mon = 10, Tue, Wed = 10 << 2, Thu = 13 } // 초기값 지정
enum WeekDay3 { Mon = "Monday", Tue = "Tuesday" } // 문자열 지정
let day: WeekDay = WeekDay.Mon;
console.log(day);
console.log(WeekDay2.Wed);
console.log(WeekDay3.Mon); |
d76e033f4d6e121ce98543c2731222b6c08e7382 | TypeScript | manooog/noreact | /src/react.ts | 2.671875 | 3 | import { VNode } from './VNode';
import { MVVM } from './MVVM';
const isInBrowser = new Function(
'try {return this===window;}catch(e){ return false;}'
);
class NoReact {
private mode: 'deep' | 'shallow' = 'deep';
public target: MVVM;
createElement(
Elem: string | (typeof MVVM) | (typeof Fragme... |
4e46510d78fe62a18cfb293f9f75d99aa15e2117 | TypeScript | phongluudn1997/react-piano | /src/utils/useMount.ts | 2.53125 | 3 | import * as React from "react";
const useEffectOnce = (effect: React.EffectCallback) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
React.useEffect(effect, []);
};
type Effect = (...args: unknown[]) => void;
export const useMount = (fn: Effect) => {
useEffectOnce(() => {
fn();
});
};
|
7ad348edeac8d316565fded08379975b46246103 | TypeScript | brycejech/socket-server | /src/index.ts | 2.546875 | 3 |
import * as http from 'http';
import { SocketServer } from './socket-server';
import { ISocketMessage } from './socket-server/interfaces';
const httpServer = http.createServer(requestHandler),
socketServer = new SocketServer(httpServer);
function requestHandler(req: http.IncomingMessage, res: http.Ser... |
633bbce61423b4f9231a126fe42f82210195f516 | TypeScript | upgundecha/cucumber | /gherkin/javascript/src/types.ts | 2.515625 | 3 | export interface IGherkinOptions {
defaultDialect?: string
includeSource?: boolean
includeGherkinDocument?: boolean
includePickles?: boolean
}
const defaultOptions: IGherkinOptions = {
defaultDialect: 'en',
includeSource: true,
includeGherkinDocument: true,
includePickles: true,
}
export function gher... |
cde7744dacca16b4ed3da613cb5e2cb2c54c226a | TypeScript | 1241962119/superV-node-end | /model/enums/activity.ts | 2.796875 | 3 | /**
* @description
* 活动状态
* @export
* @enum {number}
*/
export enum ActivityStatus {
/**
* 待发布
*/
PENDING = 0,
/**
* 上架
*/
SHOW = 1,
/**
* 下架
*/
HIDE = 2,
/**
* 删除
*/
DELETE = 3
}
|
21e85d997aab734545eea193036f7b94d995b3bd | TypeScript | gurhann/typescript-samples | /js/looping.ts | 3.15625 | 3 | var randArray = [3,4,5,6];
for(var i in randArray) {
document.write(i + "<br />");
}
var strArray = randArray.map(String);
for(var i of strArray) {
document.write(i + "<br />");
}
document.write("type of randArray:" + typeof randArray + "<br />");
document.write("type of strArray:" + typeof strAr... |
308eb04147a3bc2534a3c81b9208b0914dfde2fa | TypeScript | firebase/firebase-tools | /src/fsutils.ts | 2.953125 | 3 | import { readFileSync, statSync } from "fs";
import { FirebaseError } from "./error";
export function fileExistsSync(path: string): boolean {
try {
return statSync(path).isFile();
} catch (e: any) {
return false;
}
}
export function dirExistsSync(path: string): boolean {
try {
return statSync(path... |
5d1d955288e6999bf51c3b64621c01d4f5718101 | TypeScript | Isur/isomorphic-react-app | /src/Client/Services/Base/request.service.ts | 2.828125 | 3 | import axios from "axios";
import { Cookies } from "react-cookie";
import { RequestService } from "./request.interface";
import config from "@client/config";
type methods = "GET" | "POST" | "PATCH" | "DELETE";
export class Request implements RequestService {
private _basePath: string;
public constructor(basePath:... |
c2cbede132cbfe9edf31d872a3e58f0fc0f4c096 | TypeScript | NCElegacy/WebGLStudyNote | /ThreeJsStudyNote/material/texture/texture3/src/main.ts | 2.703125 | 3 | import * as THREE from "three"
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap";
import "./main.css";
import { Mesh } from "three";
window.addEventListener("DOMContentLoaded", () => {
// レンダラーの設定。
const RENDER = new THREE.WebGLRenderer();
/// レンダラーのサイズを決める(画面の大きさ)
/// 必ずしも画面いっぱいである必要はない。
... |
ade8881a38eee8e0923e37119cddd0df3449e725 | TypeScript | gzuidhof/WebMetaverse | /src/ds/circularbuffer.ts | 3.40625 | 3 | /**
* Author Guido Zuidhof / http://guido.io
*/
module DS {
/**
* Circular buffer
* Data structure that uses a single, fixed-size buffer.
* A new entry overwrites the oldest entry when the buffer is full.
*/
export class CircularBuffer<T> {
buffer: T[];
/**
* Index of... |
6e63d9f277a5629c800c33529f67df4296a6f819 | TypeScript | maryb14/BusBoard | /workspace/busStop.ts | 2.71875 | 3 | import * as request from 'request'
import * as _ from "lodash"
import {Bus} from './bus'
export class BusStop {
constructor(public id: string, public name: string) { }
getBuses(): Promise <Bus[]> {
let promiseLatAndLong: Promise <string> = new Promise((resolve) => {
var requestString = "htt... |
567a16a31eff3d006762817584715a9cabc191a9 | TypeScript | eternalconcert/suitescript-types-tools-and-frameworks | /src/nstypes.ts | 2.578125 | 3 | export type NSBoolean = 'T'|'F'// perhaps the api support native boolean accorting to typings
export type NSDate = string // perhaps the api support native Dates accorting to typings
export type NSRecordType = string // but could be a enum or ored type
export interface NativeError { name?: string, message?: string, st... |
1a91819bf6e057e78630013f156d603ed0694eb0 | TypeScript | qdraw/starsky | /starsky/starsky/clientapp/src/shared/validate-login-form.ts | 3.171875 | 3 | /**
* Handle form validation for the login form
* false is no email or password
* null is non valid email adres
* true is continue
* @param email - user's auth email
* @param password - user's auth password
*/
export const validateLoginForm = (
email: string,
password: string
): boolean | null => {
// Chec... |
8ea022f0cd9d0f6a040522cb57bd6503d8a9e63f | TypeScript | rafaelgalle/rabbitmq-requeue | /consumer/server.ts | 2.75 | 3 | import * as amqplib from 'amqplib'
var exWork = 'e.work';
var queueWork = 'q.work';
var bindKeyWork = '';
var exWait = 'e.wait';
var queueWait = 'q.wait';
var bindKeyWait = '';
amqplib.connect('amqp://guest:guest@localhost')
.then(conn => {
conn.createChannel()
.then(ch => {
// Criando exchanges... |
f23c65d7b7349930a12f5c9e78d35aa4a6677f79 | TypeScript | tafm/PG-projeto2 | /projeto.ts | 2.75 | 3 | import * as $ from 'jquery'
import { Bezier } from './classes/bezier'
import { Camera } from './classes/camera'
import { FuncoesAux } from './classes/funcoesAux'
import { Iluminacao } from './classes/iluminacao'
let camera : Camera
let iluminacao : Iluminacao
let bezier : Bezier
let size = { width: 800, height: 600 }
... |
e734df90d317fcb48dbeb97ae0ee3cc781009d85 | TypeScript | jgretz/schwankie | /site/app/services/util/colorForTag.ts | 2.59375 | 3 | import * as R from 'ramda';
const FOOD_TAGS = [
'food',
'recipe',
'baking',
'coffee',
'chicken',
'cookies',
'bread',
'soup',
'instantpot',
'breakfast',
];
const TECH_TAGS = [
'tech',
'react',
'javascript',
'programming',
'ai',
'ml',
'software',
'technology',
'development',
];
cons... |
10444357a2b3721e2d9c78ad8e18fa4bbf1e937c | TypeScript | almcaffee/mock-repo | /src/app/pipes/sensitive-info.pipe.ts | 2.65625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'sensitiveInfo'
})
export class SensitiveInfoPipe implements PipeTransform {
transform(value: string, format?: string): any {
if(value) {
let hiddenInfo: string = '';
let valArr: any[] = [];
let mask: string = '*';
let ... |
9ece640a21c8101edb25882400f2579d27c16c2a | TypeScript | devank-hub/weirdtrex | /src/commands/music/radio.ts | 2.6875 | 3 | import * as Discord from "discord.js";
import * as path from "path";
import { IBotCommand } from "../../api";
const RadioBrowser = require('radio-browser');
const { Utils } = require("erela.js");
const ms = require("ms");
export default class radio implements IBotCommand {
public readonly _command = ... |
287ae408c03da986ffa48df8196069b397665e20 | TypeScript | sajadparacha/angularjs-learning | /favoriteusingngclass.component.ts | 2.875 | 3 | import {Component,Input,Output,EventEmitter} from 'angular2/core'
@Component({
selector : "favoriteusingngclass",
/*
Don't delete below lines , these are to be used to define inline templates
Inline templates are good if small.
However if the HTML code grows it's better to create a new HTML file lik... |
878d76070f3bd6a9314e907aea520ad0aec936c5 | TypeScript | future4code/Luan-Campos | /BackEnd/Semana 20/Logic Exercises/ex3b.ts | 3.34375 | 3 | function compare(text: string, text2: string): Boolean {
if (text.toLowerCase() === text2.toLowerCase()) {
return true;
}
return false;
}
console.log(compare("luan", "luAn"));
|
ba4451d88823304dc4987529f08b73692e87d1bf | TypeScript | hapijs/ammo | /test/index.ts | 2.875 | 3 | import * as Stream from 'stream';
import * as Ammo from '..';
import * as Code from '@hapi/code';
import * as Lab from '@hapi/lab';
import * as Wreck from '@hapi/wreck';
const { expect } = Lab.types;
const TestStream = class extends Stream.Readable {
_count: number;
constructor() {
super();
... |
6d8e7979572576c6298855826a890cd5b5afeb9a | TypeScript | alanshaw/it-pushable | /src/fifo.ts | 3.328125 | 3 | // ported from https://www.npmjs.com/package/fast-fifo
export interface Next<T> {
done?: boolean
error?: Error
value?: T
}
class FixedFIFO<T> {
public buffer: Array<Next<T> | undefined>
private readonly mask: number
private top: number
private btm: number
public next: FixedFIFO<T> | null
constructo... |
9ed5c05f4c238e4c520a0d73514ef67eaf904815 | TypeScript | chriskrycho/v5.chriskrycho.com | /eleventy/utils.ts | 2.71875 | 3 | import { env } from 'process';
interface ToString {
toString(): string;
}
export const toString = (a: ToString): string => a.toString();
export const logErr = (err: unknown): void => {
if (env['DEBUG']) {
console.error(err);
}
};
|
6a5276aa2465820cf0e425a6fef124c292a94500 | TypeScript | tokyosheep/ExportImages | /src/js/fileSystem/basicSystem.ts | 2.578125 | 3 | import * as fs from "fs";
import * as path from "path";
const readFile = (path:string):Promise<string|Error> =>{
return new Promise((resolve,reject)=>{
fs.readFile(path,"utf-8",(err,data)=>{
if(err)reject(err);
resolve(data);
});
})
};
const writeFile = (path:string,dat... |
eaf55c3d288f6d2ac55248087dee5d68e6ce2bdd | TypeScript | Mayness/multi-events | /types/event.d.ts | 2.78125 | 3 | interface EventSub {
id: symbol;
fnArray: Function[];
size: number;
constructor(id: symbol, fnArray: Function[], realSize?: number): void;
applyFunction(value: any[]): void;
}
interface _events {
[propName: string]: EventSub[];
}
interface EventCache {
[propName: string]: symbol;
}
declare class MultiE... |
35b0f7382047d0225b5977f075523a491de817be | TypeScript | Y-shu/ReCap-Angular | /myspace/class.ts | 3.375 | 3 | class Bakery{
name:string;
type:string;
color:string;
constructor(name:string,type:string,color:string){
this.name = name;
this.type = type;
this.color = color
}
display():void{
console.log("Welcome to " +this.name+ " we serve food... |
06f49c2d8864ae9c5719bb03d0857362f7e3a973 | TypeScript | sygic-travel/js-sdk | /src/Alerts/Mapper.ts | 2.5625 | 3 | import { Alert, DetailedAlert } from './Alert';
export const mapAlertApiResponseToAlert = (alert: any): Alert => ({
id: alert.id,
type: alert.type,
severity: alert.severity,
affectedArea: alert.affected_area as GeoJSON.GeoJsonObject,
perex: alert.perex,
name: alert.name,
state: alert.state,
origin: alert.origi... |
d900bd38376e988033ad26f42b110e2919ac290a | TypeScript | vikram-gsu/twitter-search | /src/api/format-data.ts | 2.734375 | 3 | import searchResult from "../types/search-result";
const getUTCSecondsSinceEpoch = (date: Date) =>
Math.round((date.getTime() + date.getTimezoneOffset() * 60 * 1000) / 1000);
function formatData(statuses: any): searchResult[] {
return statuses
.map((status: any) => ({
created_at: new Date(status.created_... |
8d417d8ad11d19f28f5297695b564cc921ec4053 | TypeScript | kiekk/study-typescript | /control/src/loop/while-loop.ts | 2.53125 | 3 | let count: number = 1
let sum: number = 0
while (count <= 100) {
sum += count
count++
}
console.log(sum) |
de1b986b8f6aace123c85d0f1765e73ef7d00198 | TypeScript | ischoolinc/coregadget | /c391ef32-f3b7-406a-8cd2-b8a1e4cfe77d/src/app/merge-helper.ts | 2.875 | 3 | import { CourseCodeInfo, FileInfo } from './form/model-subject';
export class MergeHelper {
constructor() {}
/**
* 歷程產生的大表
*/
tempCourseTable: Map<string, CourseCodeInfo> = new Map();
/**
* 每一份FileIno的暫存
*/
tempCourseMap: Map<string, CourseCodeInfo> = new Map();
/**
*
* @param fileIn... |
721d00638bea9277ec84b06b2fe2c1997aa1c418 | TypeScript | drunken-lemur/core2d | /src/game/rayCasting/entity/map.ts | 2.765625 | 3 | import {
Bounds,
Color,
Entity,
IBrush,
IBrushStyle,
IViews,
Size,
styledView,
translatedView
} from "core";
const mapData =
"#########......." +
"#..............." +
"#.......########" +
"#..............#" +
"#......##......#" +
"#......##......#" +
"#..............#" +
"###............ |
3e06e1a92d4dcd0b7b337c8706f22cec5e7574fa | TypeScript | backstagePro/playground-api | /src/model/base/IWrite.ts | 3.203125 | 3 | export interface IWrite<T> {
/**
* Create a new document and return its id
*
* @param item
*/
create(item: T): Promise<string>;
/**
* Update a single item.
*
* If the item is modified in result of this operation - true will be returned
* from this function
*
* @param id
* @... |
63c87eb7d4269665fd233f94e18b4f060baffbf3 | TypeScript | BYazdaani/Stacks-Editor | /src/rich-text/plugins/spoiler-toggle.ts | 2.828125 | 3 | import { EditorState, Plugin, Transaction } from "prosemirror-state";
import { docChanged } from "../../shared/utils";
/**
* Updates all spoiler nodes within the state's selection
* @param tr The transaction to modify
* @param state The state whose selection to check for spoiler nodes (does not have to be the curre... |
dab0c9cd26a7ef727bff6a687dfa026e3e236b39 | TypeScript | vraptor75011/ST_Risk | /graphqlServer/utils/scripts/createMigrationsIndex.ts | 2.546875 | 3 | import * as fg from 'fast-glob';
import * as fs from 'fs';
import * as path from 'path';
/**
* All paths relative to root dir
*
*/
interface migrationsParams {
migrationsSrc: string;
migrationsGlobPattern: string;
migrationsOut: string;
migrationsOutFileName: string;
}
export { migrationsParams };
functi... |
73fb6c95cbd261d216a5c973c522bbe2cd03ae1c | TypeScript | AWolan/febs | /client/services/assignment.service.ts | 2.609375 | 3 | import axios, { AxiosResponse } from 'axios';
import {
AssignmentTO,
Assignment,
} from '../interfaces/assignment/interfaces';
import { Status } from '../enums/common.enums';
import { parseDate } from '../utils/date.utils';
export const fetchAllAssignments = () =>
axios.get('/api/assignment')
.then((respons... |
4efe463b075c6bc99a7e06e1c6db77cc33a32630 | TypeScript | capturely/capturely-js | /src/structures/cookies.ts | 2.640625 | 3 | ///<reference path="abstractStructure.ts"/>
import AbstractStructure from "./abstractStructure";
class Cookies extends AbstractStructure {
protected cookies: object[] = [];
public make(
name: string,
value: string,
url: string | null = null,
domain: string | null = null,
path: string | null = null,
e... |
e24bef4251e3fdd10f1a47e8bd9a46faaf2f267f | TypeScript | hubol/pissant | /src/stopwatch.ts | 2.828125 | 3 | export class Stopwatch
{
public readonly startedMilliseconds = new Date().getTime();
public get elapsedMilliseconds()
{
return new Date().getTime() - this.startedMilliseconds;
}
public get elapsedMillisecondsText()
{
return `${this.elapsedMilliseconds}ms`;
}
} |
c6b122d228aa93d0bc7e209c9ab6caa90c8b44fd | TypeScript | reach2amitdeb/TypeScript | /Interfaces/FunctionalInterfaces.ts | 3.5625 | 4 | interface Add{
(x:number, y:number):void
}
interface Sub{
(x:number, y:number):number
}
var add:Add;
var sub:Sub;
add = function(x:number, y:number):void{
console.log(x+y);
}
sub = function(x:number, y:number):number{
return x-y;
} |
70ccfaf1ef040c145c56565aaab334471dbecdbf | TypeScript | Paxxi/Vim | /src/configuration/commandKeyMap.ts | 2.671875 | 3 | import * as vscode from 'vscode';
export enum Command {
// Enter insert mode
InsertAtCursor = 1,
InsertAtLineBegin,
InsertAfterCursor,
InsertAtLineEnd,
InsertNewLineBelow,
InsertNewLineAbove,
// Movement
MoveUp,
MoveDown,
MoveLeft,
MoveRight,
MoveLineBegin,
Mov... |
ce5d18735cd9feb86774e654549cae7bcfbecc51 | TypeScript | Platekun/bare-ui | /src/common/custom-breakpoints.ts | 3.0625 | 3 | import keys from './keys';
import isObject from './isObject';
import isNull from './isNull';
import EMPTY_STRING from './empty-string';
/**
* Stolen from Material UI.
*/
export const bps: Record<string, number> = {
xs: 0,
sm: 600,
md: 960,
lg: 1280,
xl: 1920,
};
type IBreakpoint = 'xs' | 'sm' | 'md' | 'lg... |
f1837ac6882c283fbf9079df44949a11c4cb7194 | TypeScript | baisheng/picker | /src/modules/jobs/number.service.ts | 2.6875 | 3 | import { Injectable } from '@nestjs/common';
@Injectable()
export class NumberService {
twice(x: number) {
return x * 2;
}
thrice(x: number) {
return x * 3;
}
}
|
aaf45ae8e8fe73c1360830a13a0d4a52e019f9dd | TypeScript | AkshayPilane/zeldaPlay | /apps/api/src/app/validators/isEmail.ts | 2.53125 | 3 | import { PropertyValidator, PropertyValidatorError } from '@deepkit/type';
import { emailError } from './messages';
export class IsEmail implements PropertyValidator {
validate(value: string): PropertyValidatorError | void {
if (!value.includes('@')) {
return new PropertyValidatorError('bad_email', emailEr... |
1e1c98652f4d3a48cbb02dc9f12fd687cd6e2a95 | TypeScript | gengjian1203/YikanBox | /client/src/redux/reducers/avatarShowInfo.ts | 2.75 | 3 | import { produce } from 'immer'
import { deepClone } from '@/utils/index'
import {
INIT_AVATAR_INFO,
SET_AVATAR_SHOW_LIST_POINT,
SET_AVATAR_IMAGE,
SET_SELECT_TYPE,
SET_SELECT_JEWELRY,
ADD_AVATAR_JEWELRY,
REMOVE_AVATAR_JEWELRY,
UPDATE_AVATAR_JEWELRY,
} from '@/redux/constants/avatarShowInfo'
const LIMIE_AVATAR_... |
9f6f0aba88ba9e60ec6b10aad2e8bf113e3cbcc3 | TypeScript | offlinehacker/justmodel | /test/justmodel.test.ts | 3.140625 | 3 | import Joi from "joi"
import { Model } from "../src/justmodel"
type User = {
username: string
password: string
meta?: {
abcd: string
metaObject: {
key: string
}
}
}
class UserModel extends Model<User> {
get schema() {
return super.schema.keys({
username: Joi.string()
.re... |
3cfa63c9da7fb06758ea9de1d66d37d31e3840bb | TypeScript | ibzakharov/angular_project_template | /Client/app/js/entities/operationResult.ts | 2.96875 | 3 | class OperationResult {
public Succeeded: boolean;
public Message: string;
constructor(succeeded: boolean, message?: string) {
this.Succeeded = succeeded;
this.Message = message;
}
} |
5de477bc1d9c4c06d10131b61357d5596b23aeb9 | TypeScript | l3043Y/nestjs-iot-server | /src/cluster.ts | 2.578125 | 3 | // cluster.ts
// import cluster from 'cluster';
const cluster = require('cluster')
import * as os from 'os';
export class Cluster {
static register(workers: Number | 'auto', callback: Function): void {
if (cluster.isMaster) {
console.log(`Master server started on ${process.pid}`);
... |
26269e7001ad36b7612dd0b93cb1377db28607c9 | TypeScript | MalpenZibo/wherewolf | /src/utils.ts | 2.578125 | 3 | import { useIntl } from "react-intl";
import { Faction, RoleId } from "./domain";
export function useFormatRole(): {
formatName: (roleId: RoleId) => string;
formatDescription: (roleId: RoleId) => string;
} {
const { formatMessage } = useIntl();
const formatName = (roleId: RoleId) => {
switch (roleId) {
... |
a2079468f1e71b03dc736a47ebbe93362f35d518 | TypeScript | matias96321/Next-Level-Week-Happy | /Web-Back-end/src/views/Orphanages-Views.ts | 2.53125 | 3 | import Orphanege from "../models/orphanages";
import imagesViews from './Images-Views'
export default {
Render(orphanages: Orphanege){
return({
id: orphanages.id,
name: orphanages.name,
latitude: orphanages.latitude,
longitude: orphanages.longitude,
... |
2bd2c2e0a33c0a063917aa3e61f17c65fd816c1b | TypeScript | romanzdarek/br | /server/src/loot/LootSnapshot.ts | 3 | 3 | import LootItem from './LootItem';
import { LootType } from './LootType';
export default class LootSnapshot {
//id
readonly i: number;
x: number;
y: number;
size: number;
type: number;
del?: number;
quantity?: number;
constructor(loot: LootItem) {
//1 = zero digit after the comma
//10 = one digit after t... |
222864a8dd34bf76056e60c79275a277ccfcc1f9 | TypeScript | srinathnms/Test | /src/app/onboarding/course-details/model/courseDetail.ts | 2.734375 | 3 | export interface ICourseDetail {
id:string,
title:string,
code: string,
url:string,
description:string,
courseType:string,
documentType:string
}
export class CourseDetail implements ICourseDetail {
constructor(
public id: string,
public title: string,
public cod... |
0cfc6b50cfe32eec73c9e3613c4c6a18a277de7f | TypeScript | DevExpress/testcafe | /src/client/core/barriers/emitters/client-request.ts | 2.6875 | 3 | import hammerhead from '../../deps/hammerhead';
import EventEmitter from '../../utils/event-emitter';
import { ClientRequestEmitter } from '../../../../shared/types';
interface XhrEvent { xhr: XMLHttpRequest }
type ClientRequestType = XMLHttpRequest | Promise<Response>;
type ClientRequestEventListener = (req: ClientR... |
8091d76af1c6f8cc786f2700e78e79ffe34033f7 | TypeScript | schwartzmj/advent-of-code | /2020/day5/index.ts | 3.140625 | 3 | import * as fs from 'fs'
const BOARDING_PASSES = fs.readFileSync('./day5/boarding-passes', 'utf-8')
.split('\n')
const getNextNumberRow = (min, max, input, idx = 0) => { // F or B (0 - 127)
if (idx > input.length - 1) throw new Error("Went over length of input")
const char = input[idx]
let newMin
... |
bdb3d666934804a50a96dc5244a187a67d67717c | TypeScript | piusprince/devkamet | /api/middlewares/validationChecklist.ts | 2.8125 | 3 | import { check, body } from "express-validator";
export const signIn = [
check("email", "Email is not valid")
.isEmail()
.normalizeEmail()
.trim()
.escape(),
check("password", "Password is not valid")
.not()
.isEmpty({ ignore_whitespace: true })
.isLength({ min: 7 }),
];
... |