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 |
|---|---|---|---|---|---|---|
0ac0d85aa7255afad782f9d95939293e8f80f34f | TypeScript | rosostolato/blackboard | /src/app/models/period.ts | 3.203125 | 3 | import { Materia, MateriaCollection } from './materia';
import * as _ from 'lodash';
export class PeriodDate {
year: number;
semester: number;
constructor (str: string) {
const [year, semester] = str.split('.');
this.year = parseInt(year, null);
this.semester = parseInt(semester, null) - 1;
}
i... |
f4929cff6f399a2247d28892f03eac82151999f9 | TypeScript | Abracawdabra/TheFurthDimension | /src/game/screens/BaseScreen.ts | 2.578125 | 3 | /**
* The Furth Dimension
* @author Cawdabra <cawdabra@null.net>
* @license MIT
*/
import { Game, DISPLAY_WIDTH, DISPLAY_HEIGHT } from "../Main";
import { IEventDispatcher } from "..";
export abstract class BaseScreen {
container: createjs.Container;
parent: BaseScreen;
gameInstance: Game;
const... |
238498ae886ebfa1450438a97fadd12c61175523 | TypeScript | rpanch1/angular-nodejs-project | /Frontend/src/app/components/profile/profile.component.ts | 2.53125 | 3 | import { Component, OnInit } from '@angular/core';
import { UserService } from 'src/app/services/user.service';
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.css']
})
export class ProfileComponent implements OnInit {
// Bool to show edit addres... |
f2c8d2d7ad7ab73615dddba4bad6eeb5a618d079 | TypeScript | mariocoski/rulr | /src/Object.ts | 2.78125 | 3 | import ValidationError from './ValidationError';
// tslint:disable-next-line:no-class
export class ObjectValidationError extends ValidationError {
constructor(data: unknown) {
super('expected object', data);
}
}
export default function<T>(data: T) {
if (data.constructor === Object) {
return [];
}
re... |
b6c70c080546809c1bc014061deb77489878fb89 | TypeScript | CodyBuilder-dev/my-item-stock-front | /src/reducers/index.ts | 2.65625 | 3 | import {ADD} from "../actions";
import {combineReducers} from "redux";
const initState = {
str: "react"
};
const data = (state = initState, action: any) => {
switch (action.type) {
case ADD:
return {
str: state.str + "200"
};
default:
return ... |
093aee0e7d270a42e14ee894b78eda5cbd5fbd5a | TypeScript | panuganti/ElectionDataAnalytics | /src/models/result.ts | 2.78125 | 3 | import * as Enumerable from 'linq';
import {CandidateVote} from './candidate-vote';
export class Result {
Id: number;
Name: string;
Votes: CandidateVote[];
constructor() { }
GetWinner(): string {
var en = Enumerable.from(this.Votes);
return en.first(t => t.Position == ... |
d9b58d5da1cae422e5ee5cef36ccf4e819533f9d | TypeScript | cancerberoSgx/cannabis | /typescript-member-signatures/test/assets/project1/src/test1.ts | 2.984375 | 3 | interface I {
/**
* @param m Non Lorem tempor culpa dolor ipsum cupidatat magna elit quis ea ut officia Lorem Lorem.
*/
m(a: Date): void
}
interface J extends I {
/**
* Velit ipsum dolor sit deserunt laborum tempor eu amet ipsum ullamco laborum.
*/
prop: Date[]
}
interface G extends J {
/**
... |
59d1fb607efb4d4d551b9352779072320472fe7b | TypeScript | sameralajooly/nativescript-mip-ble | /mip-device.ts | 2.71875 | 3 | declare var require: any;
var bluetooth = require("nativescript-bluetooth");
import { HeadLightState } from "./mip-types";
import { MipController } from "./mip-controller";
import { MipStatusReader } from "./mip-status-reader";
export class MipDevice {
public UUID: string;
public name: string;
public stat... |
34a529d277e88fab3d8b9681aa6f12e8e4874235 | TypeScript | davidrd81/firts-app | /src/app/models/bitacora.ts | 2.65625 | 3 | export class Bitacora {
// tslint:disable-next-line: variable-name
constructor( _id = '', name = '', usuario = '', turno = '', area = '', position = '' ) {
this._id = _id;
this.name = name;
this.usuario = usuario;
this.turno = turno;
this.area = area;
this.posi... |
a365ba6b445e3e8b4e83c83529d434a3b75c01ba | TypeScript | CodeURJC-DAW-2018-19/santatecla-tiempos-2 | /refactorAngular/ng/src/app/event-name-filter.pipe.ts | 2.515625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import {Event} from "./event.service";
@Pipe({
name: 'eventNameFilter'
})
export class EventNameFilterPipe implements PipeTransform {
transform(events:Event[], nameEvents: string): Event[] {
if(nameEvents==null || nameEvents ===""){
return events;
}... |
40d498e709a10cd755403947a7cc90d2cca761be | TypeScript | SheepTester/sgy-sgy | /archiving/updates.ts | 2.625 | 3 | // deno-lint-ignore-file camelcase
import { Element } from 'https://deno.land/x/deno_dom@v0.1.12-alpha/deno-dom-wasm.ts'
import { AnticipatedHttpError, cachePath } from './cache.ts'
import * as html from './html-maker.ts'
import { getUsers, User } from './user.ts'
import { expect, parseHtml, shouldBeElement } from './... |
e5bd826f1f6c002b105d17351871d7dddb6ce3e4 | TypeScript | dmnorc/async-conductor | /src/component.ts | 2.953125 | 3 | import { Constructor, IComponent, IEvent } from "./interfaces";
import { Event } from "./event";
export abstract class Component<C = unknown> implements IComponent<C> {
context: C;
dependencies: Constructor<IComponent<C>, C>[] = [];
protected requiredBy: Set<IComponent<C>>;
protected required: Set<IComponent<C... |
15638395394befff7d49ce37986ffa3c4240faa5 | TypeScript | KernelMrex/RainbowSlides | /src/core/objects/objects.test.ts | 2.5625 | 3 | import {
addObjectToSlide,
changeMediaSource,
changeObjectName,
changeObjectPosition,
changeObjectsPosition,
changeObjectSize,
changeTextContent,
changeTextFont,
removeObjectFromSlide
} from './objects'
import { MediaBlock, Presentation, RectangleBlock, Slide, TextBlock } from '../t... |
01f7a81365526aabbe4395f294c536bd03b249e9 | TypeScript | Darksidesfear/amphicyon | /src/classifiers/codeHiddenBySpaces.ts | 2.546875 | 3 | import {
AnalysisResult,
Classifier,
ContractInformation,
AnalysisResultOccurrence,
} from '../analyze/sourceCodeAnalyzer';
import { matchAll } from '../utils/regexp';
import { map } from 'lodash';
export const codeHiddenBySpaces: Classifier = {
category: 'UNDERHANDED SOLIDITY',
check: (contractInformation... |
155e4ccd406c977c6ec4dbd677d6b5a7fe85bb0e | TypeScript | stephenfrancis/cardindex | /src/__tests__/model/All.ts | 2.734375 | 3 | /**
* @jest-environment jsdom
*/
import All from "../../model/All";
test("initial state", () => {
expect(() => {
All.getBox("blah");
}).toThrowError("unrecognized box id: 'blah'");
expect(() => {
All.deleteBox("blah");
}).toThrowError("unrecognized box id: 'blah'");
let count = 0;
All.forEachB... |
34312c607c74c47e770e76cf7929ec02b1764d13 | TypeScript | peteryoon11/TSC_element | /traning/01days/04Scope/04ValiableScope.ts | 3.3125 | 3 | var global_num=10;
class Numbers{
num_val=20;
static s_val=30;
xxx():void{
var local_num=40;
console.log(global_num);
console.log(
this.num_val, Numbers.s_val);
}
}
console.log(global_num);
console.log(Numbers.s_val);
var n= new Numbers();
console.log(n.num_val);
n.xxx();
|
e6e205baf8ed0113b55fd566093cdaa1920c0ce8 | TypeScript | Ashishamar99/QuizQues | /QuizQuesAngular/quizques/src/app/services/testservice.ts | 2.75 | 3 | import { Injectable } from "@angular/core";
import { Test } from "src/models/test";
@Injectable()
export class TestService{
static arrTests: Test[] = [];
constructor() {
TestService.arrTests = [
new Test(1, 'Python', 20, 10),
new Test(2, 'JS', 10, 5),
new Test(3, 'C+... |
617898d32dd28beb74f3ac24c16ecc64f6646655 | TypeScript | MickNabewata/spfx-best-practice | /src/webparts/spfxBestPractice/loc/mystrings.d.ts | 2.75 | 3 | /** locフォルダ配下で定義したローカライズ用ファイルの型定義 */
declare interface ISpfxBestPracticeWebPartStrings {
/** データ種別プロパティラベル */
DataTypeLabel: string;
/** 描画形式プロパティラベル */
VariantLabel: string;
/** データ種別 選択肢 サイトのユーザー */
DataTypeSiteUser: string;
/** データ種別 選択肢 ドキュメント */
DataTypeDocument: string;
/** 描画形式 選択肢 カード */
Var... |
70bcf0db4b96f5c27606eb1f834514f4d85d521c | TypeScript | HiveWorkers/start-backend | /src/arc-hv/other/error/custom.error.ts | 2.8125 | 3 | export class CustomError extends Error {
code: string | number;
status: number = 500;
value: string | undefined = undefined;
true_value: string | undefined = undefined;
alert: 'warning' | 'danger' | 'success' | undefined = 'danger';
author: string | undefined = undefined;
constructor(
... |
3c33af3f0e7b17c257f5e617b6fb2b15cde4dc70 | TypeScript | AlansCodeLog/indexit | /src/index.ts | 2.71875 | 3 | /* eslint-disable @typescript-eslint/no-shadow */
import yargs from "yargs"
import { main } from "@/main"
import { Options, TEST_TYPE } from "@/types"
// careful, don't move, these must be defined before we call indexit and typescript doesn't seem to warn against it and errors at runtime
enum ALIASES {
IGNORE = "i... |
ce572b77158778047aca7a1b2916aa9ef6329c47 | TypeScript | atlassian/build-stats | /lib/utils/sanitize.ts | 2.640625 | 3 | import inquirer from 'inquirer';
const getHost = {
name: 'host',
type: 'list',
message: 'Select the CI host:',
choices: [
{
name: 'Bamboo',
value: 'bamboo',
},
{
name: 'Bitbucket pipelines',
value: 'bitbucket',
},
{
name: 'Travis CI',
value: 'travis',
... |
0599720278f4c61122f038aead7506351c4c9200 | TypeScript | BrandedNomad/Tickets | /auth/src/utils/logger.util.ts | 3.15625 | 3 | import fs from 'fs'
import path from "path/posix";
interface LogParams {
message: string;
ip?: string;
user?: string;
url?: string;
info?: string;
}
class Logger {
private config:{
logFilePath:string
}
constructor(config:{logFilePath:string}) {
this.config = config
... |
e4d5972f84cd99d544ee92ab9fa5de642b7b01ca | TypeScript | Kimakjun/Project09-A-Uber | /client/src/reducers/addUserInfo.ts | 2.546875 | 3 | export const ADD_USER_INFO = 'ADD_USER_INFO';
export interface AddUserInfo {
type: typeof ADD_USER_INFO;
test: string;
}
const addUserInfo = (test: string): AddUserInfo => ({ type: ADD_USER_INFO, test });
export default addUserInfo;
|
51fe653a1c56608bea9e5f344aebd14db885261a | TypeScript | akbulutserhat/Uss-Izleme | /src/app/store/reducers/auth.reducer.ts | 2.84375 | 3 | import { AuthActions, AuthActionTypes } from "../actions/auth.actions";
import { UserItem } from "../models/user-item-models";
export interface AuthState {
user:UserItem,
loading:boolean,
isLogin:boolean,
error:Error
}
const initialState = {
user:null,
loading:false,
isLogin:false,
er... |
db8168737855fa955bc35d976f435e3c7f0b392b | TypeScript | AlexRogalskiy/ng2 | /src/app/order/entity/ticket.entity.ts | 2.671875 | 3 | import { TariffEntity } from './tariff.entity';
export interface ITicketEntity {
tariff: TariffEntity;
quantity: number;
}
export class TicketEntity implements ITicketEntity {
tariff: TariffEntity = new TariffEntity();
quantity: number = 0;
constructor(tariff: TariffEntity, quantity: number)... |
a5c5201b457b214e1f46fe835d46d9d8e56bcf50 | TypeScript | msteve58/Fitness | /src/app/member.service.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
//we know that response will be in JSON format
const httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};
@Injectable()
export class MemberService {
constructor(private http:... |
6eb1f5fd2381f43f33a79262080a6e1a8f50afe4 | TypeScript | marcobiedermann/codewars | /kata/8 kyu/how-much-water-do-i-need/index.ts | 3.296875 | 3 | function howMuchWater(
water: number,
load: number,
clothes: number,
): number | 'Too much clothes' | 'Not enough clothes' {
if (clothes > load * 2) {
return 'Too much clothes';
}
if (clothes < load) {
return 'Not enough clothes';
}
const result = water * 1.1 ** (clothes - load);
return Mat... |
cd778a005b3e8b3651eef771e1d2fafd61baa204 | TypeScript | rosostolato/github-repository-summary | /src/github-scraper/github-scraper.ts | 2.734375 | 3 | import filesizeParser from 'filesize-parser';
import $ from 'cheerio';
import _ from 'lodash';
import LimitRequest from './limit-request';
import { FileSummary } from './summary.interface';
interface DirectoryStructure {
directories: string[];
files: string[];
}
export class GithubScraper {
private constructor... |
cd9f9a52f4f18a77da8ee7629aa95d7974373aa0 | TypeScript | cj19/Angular-Start | /src/app/recipes/recipe.service.ts | 2.609375 | 3 | import {Recipe} from '../shared/recipe.model';
import {Injectable} from '@angular/core';
import {Ingredient} from '../shared/ingredient.model';
import {ShoppingListService} from '../shopping-list/shopping-list.service';
import {Subject} from "rxjs/internal/Subject";
@Injectable(/*{providedIn: 'root'}*/)
export class R... |
28df80d60f9275e88989b6e377d01596860a81ab | TypeScript | newtonkiragu/goals | /src/app/goal/goal.component.ts | 2.71875 | 3 | import { Component, OnInit } from '@angular/core';
import { Goal } from '../goal';
@Component({
selector: 'app-goal',
templateUrl: './goal.component.html',
styleUrls: ['./goal.component.css']
})
export class GoalComponent implements OnInit {
goals = [
new Goal(1, 'I am a funky monkey', 'this is not really ... |
95774d1d29ba2f97446c0478aad98c018f5d3467 | TypeScript | motionpicture/kwskfs-factory | /src/factory/action/trade/order.ts | 2.53125 | 3 | /**
* 注文アクションファクトリー
*/
import * as ActionFactory from '../../action';
import ActionType from '../../actionType';
import { IOrder } from '../../order';
import { IAttributes as IPayActionAttributes } from '../trade/pay';
import { IAttributes as ISendOrderActionAttributes } from '../transfer/send/order';
export type I... |
b866df754c6d9b4302a9fdfd87dd6a00cb9b385f | TypeScript | Dibrian27/Programacion3 | /Practica3_1/Practica2_3.ts | 3.796875 | 4 | //3. Crear una clase Cuenta Bancaria a la cual le podemos asignar fondos y sacar fondos
class CuentaBancaria
{
fondos:number;
constructor (fondos)
{
this.fondos = fondos;
}
depositar(monto)
{
if (monto > 500000) // depositar mas de 500000 mil se dispara alarma
{
console.i... |
542906318ec260e52a9ea0ab434774a5db6e3bd4 | TypeScript | IDiamondDragon/nodejs-aws-shop-be | /product-service/dal/database.service.ts | 2.5625 | 3 | import { Client } from 'pg';
import { dbOptions } from '../config/dbOptions'
export abstract class DataBaseService {
protected client: Client;
constructor() {
this.client = new Client(dbOptions);
}
protected async query(queryText: string, parameters?: any[], connect = true): Promise<any[]> {
... |
64c34c5f655252f751aeafb965c339f8fc369cc7 | TypeScript | kevin51jiang/intern.plus | /src/theme/constants.ts | 2.515625 | 3 | export enum Size {
XSMALL = "xsmall",
SMALL = "small",
MEDIUM = "medium",
LARGE = "large",
XLARGE = "xlarge",
}
export interface VariantList<T> {
[variant: string]: Partial<T>;
}
const constants: { [style: string]: { [key: string]: string | number } } = {
color: {
black: "#000000",
greyDark: "#7... |
7cd90d89b1d35b04d1e85d187dd61d11e8e1fc31 | TypeScript | abhishek-chaurasia/employee-management-system | /app/employees/employee-filter.pipe.ts | 2.703125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import {Employee} from './employee';
@Pipe({
name: 'employeeFilter'
})
export class EmployeeFilterPipe implements PipeTransform {
transform(employees: Employee[], search: string) {
if(!employees ||!search){
return employees;
}
return employees.filter... |
03430933ca8a90fac5b9a6994888855eac4e94bf | TypeScript | Faroukymedia/covid | /src/app/_shared/store/loader.state.ts | 2.625 | 3 | import { Injectable } from '@angular/core';
import { Action, Selector, State, StateContext } from '@ngxs/store';
import { HideLoader, ShowLoader } from './loader.action';
const LOADER_DEFAULT_TEXT = 'Chargement...';
export interface LoaderStateModel {
isVisible: boolean;
text: string;
count: number;
}
@State<L... |
44e89908bc7cb4fc8f149ddee7c8a44161122044 | TypeScript | naveenkarthik88/Angular_Test_1 | /src/app/app.component.ts | 2.671875 | 3 | import { Component, OnInit } from "@angular/core";
import { Observable } from "rxjs/Observable";
import "rxjs/Rx";
import { Observer } from "rxjs/Observer";
import { Subscription } from "rxjs/Subscription";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]... |
48d232ad7defe9576275cdde05b24c5c402346a9 | TypeScript | jonatasprates/OrdemServico | /src/app/shared/utils/string-utils.ts | 2.703125 | 3 | export class StringUtils {
public static apenasNumeros(str: string): string {
return str.replace(/\D/g, '');
}
}
|
33257d271dd6965e82c0314eb7f96bfd46f206a0 | TypeScript | Dannschz/eis-demo | /src/utils/barcodegen.ts | 2.515625 | 3 | export default function barcodeGenerator(): string {
const left = 510;
const middle = Math.floor(Math.random() * (9999 - 1000) + 1000);
const rigth = Math.floor(Math.random() * (99999 - 10000) + 10000);
return `${left}${middle}${rigth}`;
// return '7591005994324';
}
|
31efcfd087736f9a0bb86de509dd688af87fe4b6 | TypeScript | d9beuD/makina | /src/lib/utils/onActionTypes.ts | 3.328125 | 3 | import { InferredAction } from '../types';
/**
* a middleware modifier that only run it's input middleware on specific action types
*
* ### Example
* ```js
* import { onActionTypes } from '@ezy/makina'
*
* ...
*
* factory.use(onActionTypes(['INCREMENT'], logActionType()))
*
* ...
*
* ```
*
* @param actio... |
0f3e9df1472ba8f2ae728a3ebaccdff451c722d0 | TypeScript | MickJasker/read-help-platform | /client/src/data/Api/TextSpeechApi.ts | 3.0625 | 3 | import NestApi from '@/data/Api/NestApi';
export type Base64 = string;
export interface TextToSpeechResponse {
audioContent: Base64;
languageCode: string;
name: string;
}
export default class TextSpeechApi extends NestApi {
constructor() {
super();
this.endpoint = `${this.endpoint}/text-to-speech`;
... |
aae4dc966363802191632baf12a788122c42ab3f | TypeScript | jetiny/tdash | /test/types.ts | 3.1875 | 3 | import test from 'ava'
const {expect} = require('chai')
import * as type from '../src/types'
test('type', (t) => {
interface Objects {
[key:string]: any;
}
const items : Objects = {
'Object': {},
'Array': [],
'Nan': NaN,
'Undefined': undefined,
'Boolean': true,
'Number':... |
510b505894f9bcff61718de6ac571d2a672fecd8 | TypeScript | KassandraA/film-directors-list-angular | /src/app/shared/yearValidate.directive.ts | 2.53125 | 3 | import { Directive } from '@angular/core';
import { ValidatorFn, ValidationErrors, Validator, FormGroup, NG_VALIDATORS, AbstractControl } from '@angular/forms';
export const identifyYearValidator: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
const dateOfBirth = control.get('dateOfBirth').value... |
b226a068888db7e3dd4bf00dddea79d26fa1d58d | TypeScript | ivanhuay/coin-cli | /src/Transaction.ts | 3.09375 | 3 | import Input from "./Input";
import Output from "./Output";
import { List } from "immutable";
import * as crypto from "crypto";
class Transaction {
public readonly type: "regular" | "fee" | "reward";
public readonly inputs: List<Input>;
public readonly outputs: List<Output>;
public static readonly reward: numb... |
24f2cbf3e292d95d6649ef3d0cd247c70770564f | TypeScript | blalasaadri/advent-of-code-2018 | /day-04/task-2/ShiftAnalyzer.ts | 2.921875 | 3 | import { LogLine } from './ReadLogs';
import { NightShiftLog, shiftLogs } from './GroupLogs';
import differenceInMinutes from 'date-fns/differenceInMinutes';
import isBefore from 'date-fns/isBefore';
import _ from 'underscore';
let calculateSleepiestMinute = (logs: NightShiftLog[], guard: string) => {
//console.lo... |
c212d31dfa41d12c5b9b55e928ba291c9c02d346 | TypeScript | zhouhoujun/tsioc | /packages/logs/src/manager.ts | 2.671875 | 3 | import { Inject, Injectable, INJECTOR, isClass, isString, Registration, Singleton, Token, Type } from '@tsdi/ioc';
import { ICoreInjector } from '@tsdi/core';
import { NonePointcut } from '@tsdi/aop';
import { LogConfigure } from './LogConfigure';
import { ILoggerManager, LoggerConfig, IConfigureLoggerManager } from '.... |
198cee0dcb19d5269ab2e194b45cfc8545c1edc6 | TypeScript | hzj-flowery/hello-world | /webgl/js/out/spine/CurveTimeline.ts | 2.828125 | 3 | export class CurveTimeline{
constructor(frameCount){
if (frameCount <= 0)
throw new Error("frameCount must be > 0: " + frameCount);
this.curves = spine.Utils.newFloatArray((frameCount - 1) * CurveTimeline.BEZIER_SIZE);
}
public getFrameCount() {
... |
03a8d12ef50bc12fa51611d0b8c0d32cb6669a76 | TypeScript | ireenna/fighters-game | /src/javascript/modals/fighterDetails.ts | 2.734375 | 3 | import { createElement } from '../helpers/domHelper';
import { IFighterDetails } from '../interfaces/IFighterDetails';
import { showModal } from './modal';
import { createImage } from '../fighterView';
export function showFighterDetailsModal(fighter:IFighterDetails) {
const title = 'Fighter info';
const bodyElemen... |
ca497a819c9ef8e3bf6f9344dde743683aaff086 | TypeScript | crazytoucan/math2d | /src/segmentFunctions/segmentGetEndpoint0.ts | 3.015625 | 3 | import { Segment } from "../types";
import { vecAlloc } from "../vecFunctions/vecAlloc";
import { vecReset } from "../vecFunctions/vecReset";
/**
* Retrieves the starting endpoint (_t_ = 0) of the segment, as a vector.
*
* @param segment segment to inspect
* @param out
*/
export function segmentGetEndpoint0(segme... |
370c17fe0aab60ab1f7748c270963e6ecc3c8642 | TypeScript | googleapis/cloud-trace-nodejs | /src/tracing-policy.ts | 2.890625 | 3 | import {RequestDetails, TracePolicy} from './config';
import {Constants} from './constants';
import {TraceContext} from './util';
// Copyright 2015 Google LLC
//
// 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 co... |
2460f7886a54939b8ce11adf2fc73d80448c5728 | TypeScript | graycoreio/daffodil | /libs/driver/magento/src/graphql/cacheable-operations/cacheable-operations-token.ts | 2.6875 | 3 | import { InjectionToken } from '@angular/core';
/**
* A multi-provider injection token of the operation names of magento queries that should
* be cached. This is needed because queries need to be converted into GET queries in order for Magento
* to cache them. This token should be used by daffodil driver platform m... |
1e17cd6a6045f9c48945732aad927dc122b7dee0 | TypeScript | bfoese/edible-garden-backend | /src/common/util/enum.utils.spec.ts | 3.125 | 3 | import { EnumUtils } from './enum.utils';
describe('EnumUtils', () => {
enum StringEnum {
Foo = '_foo',
Bar = '_bar',
Baz = '_baz',
}
enum NumberEnum {
Foo = 10,
Bar = 20,
Baz = 30,
}
describe('getKeys', () => {
it('should return keys of the StringEnum', () => {
expect(Enu... |
c5a88abff07978b484d80b1abaafea82d038eb38 | TypeScript | Hypercubed/dynamo | /tests/demo-complex.spec.ts | 3.578125 | 4 | import test from 'ava';
import { IsExact, assert } from 'conditional-type-checks';
import { signature, Dynamo, guard, conversion } from '../src';
// Create a new, isolated instance of Dynamo.
const dynamo = new Dynamo();
// This is a typical TypeScript class definition
class Complex {
// A guard is used to detrmi... |
027a8bb213eaa33f364c17bbccac3c60229947f1 | TypeScript | benwinding/react-admin-firebase | /tests/integration-tests/ApiUpdate.spec.ts | 2.5625 | 3 | import { doc, getDoc, setDoc } from 'firebase/firestore';
import { Update } from '../../src/providers/commands';
import { MakeMockClient } from './utils/test-helpers';
describe('api methods', () => {
test('FireClient update doc', async () => {
const client = await MakeMockClient({ disableMeta: true });
const... |
706891c7d40f32caa80e855244e583fcd8ddc538 | TypeScript | ColinTimBarndt/vue-audio-visualizer | /src/window-node.ts | 3.046875 | 3 | export enum WindowFunctionType {
/**
* A basic half cosine curve with its maximum in the middle.
*/
Hanning = "hanning",
/**
* Like `Hanning`, but with some scaling applied.
*/
Hamming = "hamming",
/**
* Similar to the `Hamming` window, but the width of the main
* lobe is 50% wider.
*/
... |
90ad52e039dae14f74ab263cef12c96c673d6c05 | TypeScript | zhangliminabc/zhangliminabc.github.io | /demo.js | 2.625 | 3 | #!/usr/bin/env ts-node
// Disposable Mixin
var Disposable = /** @class */ (function () {
function Disposable() {
}
Disposable.prototype.dispose = function () {
this.isDisposed = true;
};
return Disposable;
}());
// Activatable Mixin
var Activatable = /** @class */ (function () {
function... |
59a4e46d586256ef56ef70f328de87c99b227c90 | TypeScript | yogevizhak/BerryForms | /test/unit/mocks/queueServiceMock.ts | 2.734375 | 3 | /// <reference path="../../jasmine.d.ts" />
/// <reference path="../../../client/angular/interfaces/services/communication/IQueueService.ts" />
module Mocks {
'use strict';
export class QueueServiceMock implements Services.IQueueService {
constructor() {
this.Setup();
}
//... |
55310cbc4ab5c7763d611b90535484d1b4867345 | TypeScript | mhsunny/typescript | /basic.ts | 3.765625 | 4 | //compile the .ts file to .js file
//https://tutorialzine.com/2016/07/learn-typescript-in-30-minutes
// tsc main.ts
// We can also compile multiple files at once by listing all of them or by applying wildcards:
// # Will result in separate .js files: main.js worker.js.
// tsc main.ts worker.ts
// # Compiles all ... |
fe0c6564166f04e4449bd13813f2f30f4ea76448 | TypeScript | rickeyd1/jkr-project2 | /tasty-plan/src/reducers/recipe.reducer.ts | 2.671875 | 3 | import { IRecipeState } from ".";
import { recipeType } from "../actions/recipe.action";
const initialState: IRecipeState = {
recipeId: 0,
recipeName: '',
totalcalorie: 0,
category : 0,
user: undefined,
ingredient: undefined,
displayMessage: undefined,
recipeList: [],
recipeIngredie... |
db8fed9b7ffe5ed2cb8807e28c2967c6ad79e964 | TypeScript | DavidAlphaFox/taro | /packages/taro-rn/src/utils/callbackManager.ts | 3.421875 | 3 | interface CallbackManager {
add: (opt: any) => void;
remove: (opt: any) => void;
clear: () => void;
count: () => number;
trigger: (...args: any[]) => void;
}
export function createCallbackManager(): CallbackManager {
const _callbacks: Set<any> = new Set()
const add = (opt) => {
_callbacks.add(opt)
... |
88cd9894333feadd27cea3d38911a582681a9a2d | TypeScript | zcorky/zodash | /packages/emoji/src/index.ts | 2.640625 | 3 | const actions = require('../data/actions.json');
export type Type =
| 'feat'
| 'fix'
| 'chore'
| 'test'
| 'docs'
| 'refactor'
| 'perf'
| 'ci'
| 'revert';
export type Emoji = {
type: string;
description: string;
emoji: string;
code: string;
};
const _emojis = actions.reduce((all, one) => {
... |
76873774abe0618ed5bb5a02e90fae6ba623b508 | TypeScript | codingmaniac2138/amaze_web | /src/app/models/module.model.ts | 2.75 | 3 | /**
* Model class for module in the Amaze Portal (eg. AMAZE_TOUCH, AMAZE_USER_MANAGEMENT and etc.)
*/
import { ROLES } from "./roles.enum";
export class Module {
module_id: number;
name: string;
description: string;
roles: Array<ROLES>;
constructor(module_id, name = "", description = "", roles ... |
1147588715f513562ec1fe16f854dd4f2a228a49 | TypeScript | guedesviniciuss/proj-top-especiais | /src/middlewares/ensureLevelPermission.ts | 2.640625 | 3 | import { Request, Response, NextFunction } from 'express';
import AppError from '../errors/AppError';
export const ensureMinimumLevelPermission = (requiredPermissionLevel: number) => (
request: Request,
response: Response,
next: NextFunction,
) => {
try {
const userLevel = request.user.authorization;
... |
7ed1211b4965d8154f017b9249518d0c195e6ca9 | TypeScript | heikkima/takomo | /packages/cli-io/src/stacks/deploy-stacks/tags.ts | 2.859375 | 3 | import {
DetailedChangeSet,
DetailedCloudFormationStack,
Tag,
TagKey,
TagValue,
} from "@takomo/aws-model"
import { bold, green, red, yellow } from "@takomo/util"
import R from "ramda"
import { BaseIO } from "../../cli-io"
import { printValue } from "./common"
export type TagOperation = "update" | "create" |... |
3637e2499f5d549239795842d28f11ad15d532c3 | TypeScript | gfteix/exercism-typescript | /leap/leap.ts | 2.890625 | 3 | export function isLeap(year: number): boolean {
if(year%4===0){
if(year%100===0){
if(year % 400===0){
return true;
}else{
return false;
}
}
return true;
}
return false;
}
|
36b5954bd019ddb5319a0ce92815d788254c7e0b | TypeScript | Wedvich/stellaris-to-json | /src/tokenizer.ts | 3.484375 | 3 | const LINEBREAK = /\r?\n|\r/;
const WHITESPACE = /\s/;
const NUMBERS = /\d/;
const IDENTIFIERS = /[a-z0-9_\-@]/i;
export interface Token {
type: 'assignment' | 'bracket' | 'boolean' | 'comment' | 'comparison' | 'identifier' | 'number' | 'string';
value: string;
}
const makeIdentifier = (value: string): Token => {... |
3181293c272b20a449497d5bfe62f96703dd2a34 | TypeScript | KDAtkins/angular5-exercise | /src/app/dog-list/dog-list.component.ts | 2.703125 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'dog-list',
templateUrl: './dog-list.component.html',
styleUrls: ['./dog-list.component.css']
})
export class DogListComponent {
dog1 = {name: 'Odie', color: 'Gold'};
// dog2 = {name: 'Bane', color: 'Black'};
// dog3 = {name: 'Daisy', col... |
1c59412090dae2ce358e5cf9e341dffbd515dd91 | TypeScript | Winnie1024/Vue3_TS_study | /01_TypeScript/01_ts的第一次/src/03_类.ts | 3.859375 | 4 | //类 接口 只是一个语法糖,编译过去实际上还是一个函数
(function(){
class Person{
firstName:string
lastName:string
fullName:string
constructor(firstName:string,lastName:string){
this.firstName = firstName
this.lastName = lastName
this.fullName = firstName + '_' + lastName
... |
91ae78d6742712cd17667c243f90a792cdd79909 | TypeScript | sandstreamdev/std | /math/sign.test.ts | 2.5625 | 3 | /* eslint-env jest */
// @ts-ignore ambiguous import
import sign from "./sign.ts";
describe("sign", () => {
it("returns -1 for negative values", () => {
expect(sign(-5)).toBe(-1);
});
it("returns 1 for positive values", () => {
expect(sign(3)).toBe(1);
});
it("returns 0 for 0s", () => {
expect(... |
146d20bb5462a24f98a8159c37a65e13a0bb14b9 | TypeScript | wuhaohao1234/ts-algorithm | /src/unit/listNode.ts | 3.328125 | 3 | export class ListNode {
next: ListNode | any
key: number
constructor(key: number) {
this.next = null
this.key = key
}
}
export class List {
head: ListNode | null
length: number = 0
constructor() {
this.head = null
}
static createNode(key: number) {
return new ListNode(key)
}
insert... |
6326112fad0da7f8c684a33304e4ea2732c89a7b | TypeScript | jt-rose/sudokio | /tests/checkAndSolve.test.ts | 2.59375 | 3 | import { assert } from 'chai'
import { checkAndSolve, CheckAndSolveResult } from '../src/solver/checkAndSolve'
import { InvalidPuzzleError, ValidPuzzleCheck } from '../src/utils/checkValid'
import {
gridStringTooShort,
gridStringNotEnoughAnswers,
basicPuzzleGridString,
basicPuzzleAnswer,
xChainGridString,
} f... |
8b4b9c567d35215a7d4c067929692329c1c84063 | TypeScript | hapify/hapify | /packages/syntax/utils/convert-to-long.ts | 3.046875 | 3 | // This tools convert all *.hpf files from short syntax to long syntax. This operation is idempotent
// Usage: npm run convert-to-long -- /path/to/dir/to/convert
import * as Fs from 'fs';
import * as Path from 'path';
import { Die, GetFilesFromPath } from './class/Functions';
import { ShortToLongConverter } from './cl... |
e1371013301071420a402955a524d63c7cd6484b | TypeScript | olinic/livingwater-cornerstone-bible | /src/cornerstone/Logger.ts | 3.53125 | 4 | import { ILogger } from "../interfaces/ILogger";
import { LoggingLevel } from "./CommonEnums";
/**
* Provides logging capabilities.
*
* Logs based on the set logging level. Logging levels range from
* the most detailed (DEBUG) to the least detailed (ERROR).
* Possible values: DEBUG, INFO, WARN, ERROR.
* The logg... |
a5908c2de2ad7ee10d4855ebb17a9f27e658d7fc | TypeScript | Exoridus/ExoJS | /src/input/Gamepad.ts | 2.515625 | 3 | import type { GamepadMapping } from './GamepadMapping';
import { Signal } from 'core/Signal';
import { ChannelOffset, ChannelSize } from 'types/input';
type OriginalGamepad = ReturnType<Navigator['getGamepads']>[0];
export class Gamepad {
public readonly onConnect = new Signal();
public readonly onDisconnect... |
4288d60fdf105f140280608bc68d4a5fa39c621d | TypeScript | guoshaoshuai/myFirstRepo | /src/interfaces/extend.ts | 3.328125 | 3 | let shape: Shape = { color: "red" }
export interface Shape {
color: string
}
export interface Square extends Shape, PenStroke {
width: number
}
interface PenStroke {
penWidth: number
}
class Control {
// private state: any
}
export interface SelectableControl extends Control {
select(): void
}
export cl... |
0489723b8dc6408dc8bce4ea4c74c9c31a9543a3 | TypeScript | Valentyn-999/mySocialNetwork | /src/redux/auth-reducer.ts | 2.859375 | 3 | import {ActionsTypes} from "./store";
import {Dispatch} from "redux";
import {AxiosResponse} from "axios";
import {AuthDataType} from "../components/Header/HeaderContainer";
import {authAPI} from "../api/api";
import {stopSubmit} from "redux-form";
const SET_USER_DATA = 'SET-USER-DATA'
export type setAuthUserData = Re... |
5a5d530412fb7d7fb599557521168df37989d37e | TypeScript | awalte11/Assignment7Host | /server/src/app.ts | 2.578125 | 3 | // lib/app.ts
import { MongoClient } from "mongodb";
import { TasksDatastore } from "./datastore";
import * as express from 'express';
import * as morgan from 'morgan';
import * as cors from 'cors';
import { Request, Response } from 'express';
const bodyParser = require('body-parser');
TasksDatastore
.con... |
fe59a14e066f956be065dd3760fa0883baabb97e | TypeScript | genexuslabs/web-standard-functions | /src/datetime/test/second.spec.ts | 2.65625 | 3 | import { GxDatetime } from "../../types/gxdatetime";
import { second } from "../second";
export const testCases: Array<[GxDatetime, number]> = [
[new GxDatetime(1891, 8, 28, 1, 0, 0), 0],
[new GxDatetime(1891, 8, 28, 1, 0, 1), 1],
[new GxDatetime(1891, 8, 28, 1, 0, 15), 15],
[new GxDatetime(1891, 8, 28, 1, 0, ... |
8969fd0db49c0a42dd27e8d62651055cb979e4e8 | TypeScript | amir20/dozzle | /assets/types/Container.d.ts | 2.703125 | 3 | export interface ContainerStat {
readonly id: string;
readonly cpu: number;
readonly memory: number;
readonly memoryUsage: number;
}
export type ContainerJson = {
readonly id: string;
readonly created: number;
readonly image: string;
readonly name: string;
readonly command: string;
readonly status:... |
543c3ead791375132166f0d24b53295aa195509d | TypeScript | Boilerplate4u/skolplattformen | /libs/hooks/src/childlists.ts | 2.59375 | 3 | import {
Child,
EtjanstChild,
Skola24Child,
} from '@skolplattformen/api-skolplattformen'
export const merge = (
etjanstChildren: EtjanstChild[],
skola24Children: Skola24Child[]
): Child[] =>
etjanstChildren.map((etjanstChild) => {
const skola24Child: Skola24Child =
skola24Children.find(
... |
79aa91630194c9b78da0959e93fb79c4a304a7af | TypeScript | HYannick/ymp-v2 | /src/reducers/song.reducer.ts | 2.640625 | 3 | import {ActionTypes} from "../actions/app.actions.types";
import {createSelector} from "reselect";
import {HistoryListItemTypes} from "../app/App";
export interface SongProps {
id: string
thumbnail: string,
title: string,
link: string,
}
export interface IStateProps {
requestId: string | null,
loading: bo... |
38c0f0226e4be241b822826968b4774b986aa48c | TypeScript | martincarmonafrancisco/Almacencrud | /src/model/Producto.ts | 3.015625 | 3 | import {Schema, model } from 'mongoose'
export class Producto{
private _nombre: string
private _precio: number
private _tipo: string
private _cantidad: number
private _caducidad: Date
constructor(_nombre: string, _precio : number, _tipo : string, _cantidad: number, _caducidad : Date
){... |
e6876cf9cc93c6785c7e2ec79c657d716e7214a9 | TypeScript | OriShmila/todo-exercise | /todo-server/src/utils/extract-from-array.ts | 2.65625 | 3 | export const extractFromArray = (value: object) =>
Array.isArray(value) ? value[0] : value;
|
ab667956a8bad62614bbd4c02f8e2bd0a1bfba9b | TypeScript | atx-crypto-collective/acrobot | /src/db.ts | 2.625 | 3 | import { DeleteWriteOpResultObject, MongoClient } from 'mongodb';
import dotenv from 'dotenv';
dotenv.config();
export interface Definition {
term: string;
definition: string;
lookupCount: number;
}
const uri = process.env.MONGO_DB_URI as string;
const mongoDBClient = new MongoClient(uri, {
useNewUrlParser:... |
11fa466db748bf751e821b50f33cf31605c378b5 | TypeScript | prismicio/slice-machine | /packages/manager/src/lib/fetchNPMPackageVersions.ts | 2.59375 | 3 | import * as t from "io-ts";
import fetch from "./fetch";
import { decode } from "./decode";
/**
* The Accept header value used when only metadata required for package
* installation is needed. The response includes all versions and some of their
* metadata.
*
* @see https://github.com/npm/registry/blob/cfe04736f... |
04f2a29024a7fc9c1ef51abc7e861732db8465bc | TypeScript | sdileep/authpack | /packages/theme/old/stories/Forms.ts | 2.53125 | 3 | import { createElement as create, useState } from 'react'
import { storiesOf } from '@storybook/react'
import {
Modal,
Layout,
Iconbar,
Gadgets,
Inputs,
Overview,
Button,
useToaster,
Toaster,
} from '../index'
console.clear()
const stories = storiesOf('Forms', module).addDecorator(data => {
return... |
74abe2e6c516ba26137258b6bf204fc42945c7ce | TypeScript | shalevy1/flat-demo-covid-dashboard | /dashboard/interfaces/index.ts | 2.78125 | 3 | // You can include shared interfaces/types in a separate file
// and then use them in any component by importing them. For
// example, to import the interface below do:
//
// import { User } from 'path/to/interfaces';
export interface MobilityDataType {
date: string;
groceryAndPharmacyPercentChangeFromBaseline: nu... |
7a7573a070503efe8326a3ddc93d4c1247d497e3 | TypeScript | 185driver/vuetify | /packages/vuetify/src/util/__tests__/mergeData.spec.ts | 2.953125 | 3 | import { isObject } from '../helpers'
import { mergeClasses, mergeListeners, mergeStyles } from '../mergeData'
function simpleClone (value) {
if (Array.isArray(value)) {
return value.map(simpleClone)
}
if (isObject(value)) {
const dest = {}
for (const key in value) dest[key] = simpleClone(value[key])... |
20f80c06859b94027860896150202711b5ac3f5b | TypeScript | eashevchenko/js-rocks | /src/app/audio/effects/distortion-curves.ts | 3.40625 | 3 | export const curves = {
classic(amount: number, curve: Float32Array, n: number) {
const k = amount * 150 + 50;
for (let i = 0, x: number; i <= n; ++i) {
x = i * 2 / n - 1;
curve[i] = (Math.PI + k) * x / (Math.PI + k * Math.abs(x));
}
},
blues(amount: number, curve: Float32Array, n: numbe... |
56b271acc99e0308ead5958f13afb3b725575897 | TypeScript | SurendraShukla/Javascript | /change-detection/3_timer-ng2.ts | 2.578125 | 3 |
@Component()
class App {
firstname: string = 'Pascal';
lastname: string = 'Precht';
changeName() {
this.firstname = 'Brad';
this.lastname = 'Green';
}
} |
69e59317e65e40130b597f4a078453e4d75fd5bb | TypeScript | rickykiet83/tgl-app | /src/store/actions/auth.actions.ts | 2.578125 | 3 | import { Action } from "@ngrx/store";
import { IAuthenticatedUser } from './../../app/shared/interfaces/auth-user.interface';
export enum EAuthActions {
LoginWithToken = '[Login] Login With Token',
LoginWithTokenSuccess = '[Login] Login With Token Success',
}
export class LoginWithToken implements Action {
... |
ac65fa4d40667be5c1626eaeb3f47c52f5b86999 | TypeScript | exxcellent/swt2-bsa-frontend | /bogenliga/src/app/modules/shared/data-provider/services/rest-client.class.ts | 2.625 | 3 | import {Injectable} from '@angular/core';
import {HttpClient, HttpErrorResponse, HttpHeaders} from '@angular/common/http';
import {throwError} from 'rxjs';
import {catchError} from 'rxjs/operators';
import {TransferObject} from '../models/transfer-object.interface';
const httpOptions = {
headers: new HttpHeaders({
... |
706e1d6eebf5bd28ec88ca21b2d477122a10949c | TypeScript | mozumderTushar/typescript | /ArrObj/arrObj.ts | 3.609375 | 4 | // arrays
let names = ['luigi', 'mario', 'yoshi'];
names.push('toad');
// names.push(3);
// names[1] = 3;
let numbers = [10, 20, 12, 15];
numbers.push(25);
// numbers.push('shaun');
// numbers[0] = 'shaun';
let mixed = ['ken', 4, 'chun-li', 8, 9];
mixed.push('ryu');
mixed.push(10);
mixed[0] = 3;
// objects
let ni... |
d25db746511416152f7c07e04804122e428ecd2f | TypeScript | wand2016/study_gatsby | /src/utils/assertions.ts | 2.828125 | 3 | export function isJust<T>(target: T | undefined): target is T {
return target !== undefined
}
|
ee027d444de31d224edf77e718ff82d01b63bbcb | TypeScript | djok92/last-fm | /src/app/services/music.service.ts | 2.6875 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/operators';
import { Track } from '../classes/track';
import { BehaviorSubject, ReplaySubject, Observable } from 'rxjs';
const API_KEY = '7aca6ef86ceb095034f88fa36aa6e3f9';
const ENDPOINT_URL = 'htt... |
0a1b322c25445f302943635c18104fe4fd063847 | TypeScript | barnese/ConvexHull | /source/quickHull.ts | 3.546875 | 4 | /// <reference path="ConvexHullInterface.ts" />
/// <reference path="arrayHelpers.ts" />
/// <reference path="mathHelpers.ts" />
/// <reference path="point.ts" />
/// <reference path="line.ts" />
/// <reference path="rect.ts" />
/**
* Implements the QuickHull algorithm for finding a convex hull for points.
*/
class ... |
1ffb8a9b924c88932be1c0fd8a86dc249f149b09 | TypeScript | linux-china/kotlin-is-like-typescript | /code/protocol.ts | 3.296875 | 3 | interface Nameable {
name(): string;
}
function f(x: Nameable) {
console.log("Name is " + x.name());
}
|
ad72e7ed3cfe11995bd4c49a4cdf7e2f715e2710 | TypeScript | TalissonJunior/winuvo-cli | /src/winuvo-cli/schematics/templates/model/dateAttributes.template.ts | 2.546875 | 3 | export const dateAttributesTemplate = (projectName: string): string => {
return `using System;
namespace ${projectName}.Models.Attributes
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class UpdatedAt : Attribute{}
[AttributeUsage(AttributeTargets.Field | AttributeTarget... |
2d3343afc0584872c48d34b36b67e23f93c740cf | TypeScript | Steinantonio/NodeJsTransactions | /src/entity/Transactions.ts | 2.515625 | 3 | import { Entity, PrimaryColumn, Column, JoinColumn, ManyToOne} from "typeorm";
import {v4 as uuid} from "uuid";
import { User } from "./User";
@Entity("transactions")
class Transactions {
@PrimaryColumn()
readonly id: string;
@Column()
user_id: string;
@JoinColumn({name:"user_id"})
@ManyToOn... |
de934cad817a0b575a63b603be591148acad96bf | TypeScript | Nandakumar-Kadavannoore/Algorithms | /EgyptianFraction.ts | 3.71875 | 4 | /**
* Compute Egyptian Fraction
*/
class Compute {
printEgyptian(numerator : number, denominator : number) {
if (numerator == 0 || denominator == 0)
return;
if (denominator % numerator == 0) {
console.log("1/" + denominator / numerator);
return;
}
... |