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 |
|---|---|---|---|---|---|---|
cf2433a3525846e7bc03dd4315bf630977376a20 | TypeScript | aaronm-2112/JS_Data-Algs | /arrays/easy.ts | 3.890625 | 4 | // Question #1
// // Given an array of integers, return the indices of the two numbers that add up to a given target.
var twoSum = function (nums: Array<number>, target: number) {
if (nums.length < 2) {
return null;
}
let difference = 0;
let differencesIdx: { [difference: number]: number } = {};
for (l... |
79f8ed179f57b53c40f06ce2ec80633b09a97d95 | TypeScript | nazar-maslianka/HealthCheck | /HealthCheck/ClientApp/src/app/models/healthCheckResult.ts | 2.625 | 3 | interface Result {
checks: Check[];
totalStatus: string;
totalResponseTime: number;
}
interface Check {
name: string;
status: string;
responseTime: number;
}
|
b8bb5fa8c04f38cede6907cf27dc4d31298bfb6a | TypeScript | dainnovation722/test | /main.ts | 3.3125 | 3 | let b: number[];
function collision_judgement(X: number, Y: number): boolean {
if (Y < 0) {
// collision in upper side
return false
} else if (Y > 4) {
// collision in lower side
return false
} else if (X - 1 < 0) {
// collision in left side
return false
... |
3c65bd9791d00ac49add12f7bb707ff17d6d8091 | TypeScript | PiNengShaoNian/learn-algo-systematically | /src/stage2/unique-morse-code-words.ts | 3.484375 | 3 | /*
国际摩尔斯密码定义一种标准编码方式,将每个字母对应于一个由一系列点和短线组成的字符串, 比如: "a" 对应 ".-", "b" 对应 "-...", "c" 对应 "-.-.", 等等。
为了方便,所有26个英文字母对应摩尔斯密码表如下:
[".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]
给定一个单词列表,每个单词可以写成每个字母对应摩尔斯密码的组合。... |
07b8df36c8ce4cb8e169d96edb68fe98ac923dc1 | TypeScript | esgf-compute/webapp | /webapp/src/app/core/notification.service.ts | 2.796875 | 3 | import { Injectable } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subject } from 'rxjs/Subject';
import { switchMap } from 'rxjs/operators';
import { NEVER } from 'rxjs';
export en... |
a36b46cc1adf0e1591d009f6489f150059b770f0 | TypeScript | messageformat/messageformat | /packages/number-skeleton/src/pattern-parser/number-tokens.ts | 3.71875 | 4 | export type NumberToken =
| { char: '.'; width: number }
| { char: '#'; width: number }
| { char: ','; width: number }
| { char: '0'; width: number; digits: string }
| { char: '@'; width: number; min: number }
| { char: 'E'; width: number; expDigits: number; plus: boolean };
const isDigit = (char: string) ... |
fc3812f581b9872de065318d8c77d928a22ae8ee | TypeScript | MuraliNunna/count-loc | /lib/index.ts | 2.578125 | 3 | import { FileTotals } from "./interfaces";
import JSLanguageUtils from "./languages/js";
const processCountsForFile = (
extension: string,
data: string,
fileName: string
): FileTotals | undefined => {
switch (extension) {
case ".js":
return JSLanguageUtils.processJSFile(data, fileName);
default:... |
273811f616550f30564b05ed905ae49efcce09f9 | TypeScript | zunderscore/azure-boards-estimate | /src/services/cardSets.ts | 2.546875 | 3 | import { defaultCardSets, ICardSet } from "../model/cards";
import { IService } from "./services";
export interface ICardSetService extends IService {
getSets(): Promise<ICardSet[]>;
getSet(cardSetId: string): Promise<ICardSet>;
}
export const CardSetServiceId = "CardSetService";
export class MockCardSetSer... |
daed3bebdd1671ac1ce2c59c353570ba6920cc08 | TypeScript | tarcCar/teste-viasoft | /client/src/store/actions/feedback/feedbackActions.ts | 2.765625 | 3 | import { FeedbackActionsTypes } from "./feedbackActionsTypes";
import {
getAllFeedback,
getFeedbackById,
saveFeedback,
updateFeedback,
} from "../../../services/feedbackService";
import { Feedback } from "../../../types/feedback";
const setGetFeedbacks = (
feedbacksDoUsuario: Feedback[],
feedbacksParaUsuar... |
6adb56b9d9f016397fd1319894f8969f6f016b11 | TypeScript | nirbhay41/Amazon-Clone | /src/pages/api/db/addToCart.ts | 2.625 | 3 | import { NextApiRequest, NextApiResponse } from "next";
import { connectToDatabase } from "../../../utils/db";
export default async (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'POST') {
const { db } = await connectToDatabase();
const { product: productDetails, userEmail }: {... |
104eb2771a76ce364830d45cf7e719030ac4a92c | TypeScript | starspot/starspot | /packages/starspot-json-api/test/update-resource-test.ts | 2.828125 | 3 | import { expect } from "chai";
import ResourceController, { after } from "../src/resource-controller";
import Resource, { attribute, updatable, readOnly, writableAttributes, updatableAttributes, creatableAttributes } from "../src/resource";
import JSONAPI from "../src/json-api";
import { createApplication, createRespo... |
9db1a5a537df55c4f78bdd85bcb90de7feb818ee | TypeScript | ovac/graphql-code-generator | /dev-test/star-wars/types.ts | 3.25 | 3 | /* tslint:disable */
// ====================================================
// START: Typescript template
// ====================================================
// ====================================================
// Interfaces
// ====================================================
/** A character from the Sta... |
9c39d877b7b1b4717849177bcc4df188671db3da | TypeScript | Myna65/tdd-template | /src/use-cases/book-flight.test.ts | 3.015625 | 3 | import {Customer} from "../domain/customer";
import {Flight} from "../domain/flight";
import {InMemoryPaymentGateway} from "../gateways/in-memory-payment-gateway";
import {BookFlightUseCase} from "./book-flight";
let paymentGateway : InMemoryPaymentGateway;
function expectCustomerToBeCharged(customer: Customer, amoun... |
c8024b5301b9808cca5eb4e6e3af78c22efb0cfd | TypeScript | roma-lukashik/neural-network | /src/NeuralNetwork.ts | 2.890625 | 3 | import NeuronLayer from './NeuronLayer';
import { gradientDescent, Optimizer } from './optimizers';
import { ILossFunction, LossFunction, LossFunctions } from './loss-functions';
import * as array from './engine/ArrayOperators';
import * as vector from './engine/VectorsOperators';
import * as Distributions from './engi... |
2f2778581f4a8382fe3e323a9c67f082e91f1a01 | TypeScript | pfgalego/sdk-codegen | /packages/api-explorer/src/reducers/spec/utils.spec.ts | 2.53125 | 3 | import { ApiModel } from '@looker/sdk-codegen'
import { omit } from 'lodash'
import { specs } from '../../test-data'
import { SpecItems } from '../../App'
import {
getDefaultSpecKey,
parseSpec,
fetchSpec,
initDefaultSpecState,
} from './utils'
describe('Spec reducer utils', () => {
const spec = specs['3.1']... |
288469f29450f77152e9d33ef0245af4de7c2467 | TypeScript | bestlyg/bestlyg-data-structure-and-algorithm-typescript-2019 | /src/utils/model/Person.ts | 3.421875 | 3 | import { Comparable, Hash } from "../../types";
import { hashCode as hash, getClassName } from "../index";
export default class Person implements Comparable<Person>, Hash {
private _age: number;
private _name: string;
constructor(name: string, age: number) {
this._age = age;
this._name = name;
}
get a... |
134c0b58a0c558b62584beec6ac2f505858979a4 | TypeScript | joseywoermann/spotify-monthly-playlist | /src/util/helpers.ts | 2.96875 | 3 | import chalk from "chalk";
export const debugLog = <T>(message: T): void => {
console.log(chalk.hex("#9DD1BA")(`${getUTCTime()} [DEBUG] ${message}`));
};
export const infoLog = <T>(message: T): void => {
console.log(chalk.hex("#BAD755")(`${getUTCTime()} [INFO] ${message}`));
};
export const warnLog = <T>(me... |
44148b19cf4a3020b3d18bfb13b34c3bbb88d7f0 | TypeScript | Softcaze/GroupProject | /Group.Client/src/components/apps/home-feed/Feed.service.ts | 2.515625 | 3 | import { IGroup } from "../../../model/IGroup";
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
import { Constants } from "../../../common/Constants";
import { IFeedEvent } from "../../../model/IFeedEvent";
const GET_MY_GROUPS_API: string = "/getGroups";
const GET_SUGGESTED_GROUPS: string = "/getGrou... |
6d41a4e378e2215ecc4cbd7343223293a92f8811 | TypeScript | Azure/Hyperledger-Fabric-on-Azure-Kubernetes-Service | /azhlfTool/commandDefs/msp/import/fromAzureStorage.ts | 2.75 | 3 | import { Argv } from "yargs";
import { MspCommandHandler } from "../../../commandHandlers/msp";
interface Arguments {
organization: string;
fileshare: string;
}
export const command = "fromAzureStorage";
export const desc = "Import MSP from Azure storage.";
export const builder = (yargs: Argv): Arguments =>
... |
f4d8aaf68f036bd16e2ee28856cf9c4b1290b061 | TypeScript | niebieska/TicketsBooking | /src/client/src/app/model/MovieHour.ts | 2.75 | 3 | import {MovieType} from "./MovieType";
export class MovieHour {
id: number;
hour: string;
movieType: MovieType;
constructor(id?:number, hour?:string, movieType?: MovieType){
this.id = id;
this.hour = hour;
this.movieType = movieType;
}
}
|
72ec0aa7813bfe9a3fb30aede9113928537a2746 | TypeScript | muzzatech/Andreani-Api | /src/api/AndrianiURL.ts | 2.734375 | 3 | type AndreaniEntity =
| 'dispatch'
| 'orders'
| 'authorize'
| 'provinces'
| 'offices'
| 'tariff';
type AndreaniMethod = 'findBy' | 'find' | 'create' | 'login';
interface AndreaniEntityURL {
findByPK(): string;
find(): string;
create(): string;
login(): string;
}
const EntityParser = new Map<Andrea... |
cef30d8452d63f435ca566af63570995f0489b58 | TypeScript | TeamBerry/muscadine | /src/models/message.model.ts | 3.15625 | 3 | export class Message {
public author: {
_id: string
name?: string
color?: string
role?: string
badge?: string
}
public contents: string
public source: string
public scope: string
public time: Date
// eslint-disable-next-line @typescript-eslint/explici... |
e6f8ddc02d64682b624dfe7d3f7f1628a1ebfb07 | TypeScript | MKleinSB/pxt-envirobit-meowbit | /envirobit.ts | 2.515625 | 3 | //% weight=100 color=#000000 icon="\uf043" block="Enviro:Bit"
namespace envirobit {
class bme280 {
is_setup: boolean
addr: number
dig_t1: uint16
dig_t2: int16
dig_t3: int16
dig_p1: uint16
dig_p2: int16
dig_p3: int16
dig_p4: int16
dig_p5... |
3de03121a55a80318a4117a2513a3ef3518b9f5e | TypeScript | RequestNetwork/requestNetwork | /packages/toolbox/src/commands/request/calculateReference.ts | 2.703125 | 3 | import { PaymentReferenceCalculator } from '@requestnetwork/payment-detection';
import * as yargs from 'yargs';
import { utils } from 'ethers';
interface IReqOptions {
requestId: string;
salt: string;
address: string;
}
const calculateReferenceForRequest = (options: IReqOptions): void => {
try {
const paym... |
c0dc737138ec74ebca33df700f7f384a3ea73af3 | TypeScript | heifade/happywork-test-web | /src/pageBase/pageBaseService.ts | 2.6875 | 3 | import { ListItemModule } from "./list/listModule";
import { wait } from "../util/util";
let dataList: ListItemModule[];
function initDataList() {
let list = new Array<ListItemModule>();
for (let i = 0; i < 20; i++) {
list.push({ id: `${i}`, name: `name${i}` });
}
dataList = list;
}
initDataList();
expor... |
55e4896efd29daff972a73938446aa74988abb43 | TypeScript | GregTCLTK/WebGen | /src/components/cards/searchCard.ts | 2.53125 | 3 | import { createElement, draw, img, span } from "../Components";
import { CommonCard } from "../../types/card";
import '../../css/search.webgen.static.css';
import { CommonIcon, CommonIconType, Icon } from "../generic/Icon";
export type SearchEntry = {
name: string;
icon?: string;
tags?: string[];
categ... |
556f80ec0a1c891f5c9e95a658d8ff58e6d10601 | TypeScript | IamRaduB/sync-i18n | /src/commands/validate.command.ts | 2.5625 | 3 | import { Command } from 'commander';
import { join } from 'path';
import { readdir } from 'fs';
import { promisify } from 'util';
import { Logger } from '../services/logger.service';
import { FileService } from '../services/file.service';
import { UtilService } from '../services/util.service';
import { Invalid } from '... |
a0eae5e2672a3577b20ede5074c272c09c7bdb0b | TypeScript | mmajkafmp/typescript-sandbox | /src/design-patterns/behavioral-observer/mall.ts | 2.59375 | 3 | import Observer from './observer';
import Sale from './sale';
export default class Mall implements Observer {
sales: Sale[];
constructor() {
this.sales = [];
}
notify(storeName: string, discount: number) {
this.sales.push({ storeName, discount });
}
}
|
d11088fc8fda3e06843495aa05495117017d7be3 | TypeScript | vambil/COMP-426-Final | /scripts/Parent.ts | 2.65625 | 3 | class Parent {
private children: Child[];
private requests: Requests[];
constructor() {
this.children = [];
this.requests = [];
}
getChildren() {
return this.children;
}
getRequests() {
return this.requests;
}
addChild(child: Child) {
this... |
a6843a8f64cdee421587a0fb450c6b74bd8295f0 | TypeScript | akurilov/platform | /ui/src/dashboards/actions/v2/hoverTime.ts | 2.859375 | 3 | export type Action = SetHoverTimeAction
interface SetHoverTimeAction {
type: 'SET_HOVER_TIME'
payload: {
hoverTime: string
}
}
export const setHoverTime = (hoverTime: string): SetHoverTimeAction => ({
type: 'SET_HOVER_TIME',
payload: {hoverTime},
})
|
e609b112f0ae102b7e6a872f21104ff05c077d4b | TypeScript | omochi/angular2-quickstart | /app/main.ts | 3.09375 | 3 | import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
class Cat {
name: string;
age: number;
constructor(name: string) {
this.name = name;
}
greet(): void {
console.log("I am " + this.name);
}
}
var cat1 = new Cat("tama");
cat1.greet();
var cat2 = {
name: ... |
dbfeff1ca45720298a1a2b2d7d205c4e25f1b9f0 | TypeScript | gxh1996/jumpAdventure | /jumpAdventure/assets/scripts/indexScene/selectPanel/horizelScrollView.ts | 2.625 | 3 |
const { ccclass, property, disallowMultiple, menu, requireComponent } = cc._decorator;
/* ---------------------水平滚动页面----------------------- */
@ccclass
@disallowMultiple()
@menu('自定义组件/HorizelScrollView')
@requireComponent(cc.ScrollView)
export default class HorizelScrollPage extends cc.Component {
@property(... |
6db15f952af75d043c31bc364d74bd3f70e3f5e8 | TypeScript | Jameskmonger/adventofcode | /src/2019/Day 1/part1.ts | 3.140625 | 3 | import {modules} from "./modules"
class FuelCalculator {
/**
* Calculates the fuel needed for a given mass
* @param modules list of modules' masses
*/
public fuelForMass(modules: number[]) {
return modules
.map(m => Math.floor(m / 3) - 2)
.reduce((acc, val) => acc + val);
}
}
const fuel... |
219b4c7d29e902290d4b65eeefa3347c898257ab | TypeScript | redarrowlabs/modeljx | /src/modeljx.ts | 3.015625 | 3 | import * as Immutable from 'immutable';
import * as _ from 'lodash';
export interface ProjectionStage<TFromType, TResultType> {
override(props: {
fromProperty: (from: TFromType) => any,
toProperty: (to: TResultType) => any,
use: (from: any) => any,
when?: (from: any) => boolean
... |
a1093abc9db6eb1e7fcb74f6b932756e1f720d48 | TypeScript | vuepress-theme-hope/vuepress-theme-hope | /packages/theme/src/shared/options/feature/options.ts | 2.578125 | 3 | import type {
BlogLocaleConfig,
BlogLocaleData,
BlogLocaleOptions,
PaginationLocaleData,
} from "./blog.js";
import type {
EncryptConfig,
EncryptLocaleData,
EncryptOptions,
} from "./encrypt.js";
export interface FeatureLocaleData {
/**
* Blog related i18n config
*
* 博客相关多语言配置
*/
blogLoca... |
27decb40020949662612ef132a17f5160d08240a | TypeScript | zengyujiao/react | /day-4/weui-app/src/stores/index.ts | 3.421875 | 3 | import { createStore } from 'redux'
interface stateType{
// 如果在这里定义了类型,那么必须传入什么类型进来,在这里规定了类型,是比较严谨的一种写法
name: string
age: Number | boolean
searchText: string
}
interface actionType{
type: string
searchText: string
}
const store:object = createStore((state: stateType = {
name: 'react',
... |
518b2bf836a31e3f1d3ef60483697bd4ba9f36ab | TypeScript | DmitriyMenshayev/TestProject1 | /src/index.ts | 2.859375 | 3 | //for questions and suggestions you can contact me:
// dmitry.menshaev@gmail.com
import * as PIXI from 'pixi.js';
//Importing PIXI in global scope with PIXI is OK.
//For this simpile project pollutting global scope is OK too,
//but for large or giant AAA projects it's usually a bad idea to
//pollute the global scope, ... |
bb60aeafad67f3feb9a73ccca13b34c5960fe2e4 | TypeScript | ushpar71/ticketing | /auth/src/astro/nakshatra.ts | 2.671875 | 3 | const nakshatra = require('./json/nakshatra.json');
const division = 27;
const duration = 360 / division;
//-----
export const getNakshatras = () => {
return nakshatra;
};
//-----
export const getNNakshatra = (id: number) => {
id === 0 ? (id = 1) : id;
return getNNNakshatra(id);
};
//-----
export const getNNN... |
a4fb256662a68b2d86eddf82eaa356bc8d4874ac | TypeScript | alexandresantosm/typescript | /src/aula_07/aula07.ts | 3.640625 | 4 | /*Type assertions
- É um recurso de casting, ou seja, de conversão de tipo
*/
const teste1: any = "Isso é uma string";
alert((<string>teste1).length); //sintaxe utilizando o operador diamante
/*
Sintaxe utilizando o operador 'as'.
Obs.: quando utilizar TypeScript com JSX, muito comum no React, a única sintaxe aceit... |
ee24bfcf1968c322fb8230e3d376cdfefef1f5f7 | TypeScript | nadipalli-swetha/news-application | /newsApplicationF/src/app/home/home.component.ts | 2.640625 | 3 | import { Component, OnInit } from '@angular/core';
import { NewsService} from "../services/news.service";
import { News} from "../models/News";
import { NewsProvider} from "../interfaces/news-provider";
import { HttpResponse} from "@angular/common/http";
@Component({
selector: 'app-home',
templateUrl: './home.comp... |
e791f6897f213a7d46057df7ba9dd836a52b94cc | TypeScript | cesar07hoyos03/digistore | /src/app/store/reducers/ui.reducer.ts | 3.109375 | 3 | import { START_PLAYING, STOP_PLAYING, UiActions } from '../actions/ui.actions';
import { TIME_OUT_GAME } from '../actions';
export interface UiState {
isPlaying: boolean;
timeOutGame: boolean;
}
export const initialState: UiState = {
isPlaying: false,
timeOutGame: false,
};
/**
* Reducer to handle the UI st... |
75be8a683974a2b8c36c4e6bcf8c51f292f0af34 | TypeScript | DkReactNative/TheBox | /utils/functions.ts | 2.5625 | 3 | import AsyncStorage from '@react-native-community/async-storage';
import CameraRoll, {PhotoIdentifier} from '@react-native-community/cameraroll';
import {NativeTouchEvent} from 'react-native';
import {useDispatch} from 'react-redux';
import {
changeSortConditionAndNumColumns,
photoChunk,
sortCondition,
sortedPh... |
2e5f3e45f0f9f8585a385ed9a0a92574d845de97 | TypeScript | TobiObeck/xstate | /packages/xstate-react/src/utils.ts | 3 | 3 | import {
AnyInterpreter,
AnyState,
Interpreter,
InterpreterStatus
} from 'xstate';
export function partition<T, A extends T, B extends T>(
items: T[],
predicate: (item: T) => item is A
): [A[], B[]] {
const [truthy, falsy] = [[], []] as [A[], B[]];
for (const item of items) {
if (predicate(item)) ... |
9e9e776b49ea6fd108b6e9c7c9c2c29c8aa06d09 | TypeScript | rxdi/deploy | /src/app/services/time/time.service.ts | 2.703125 | 3 | import { Service } from '@rxdi/core';
@Service()
export class TimeService {
calculateTime(time: string) {
const date = new Date(time);
return {
day: this.getDay(date),
month: this.getDay(date),
year: this.getDay(date),
};
}
getDay(date: Date): number {
return date.getUTCDate();... |
0945e4d53e454cdf74a18e26c1016e6784d9e1c8 | TypeScript | nhat-phan/najs-eloquent | /dist/lib/definitions/model/IModel.d.ts | 2.578125 | 3 | /// <reference path="../../contracts/Driver.d.ts" />
/// <reference path="../utils/IClassSetting.d.ts" />
/// <reference path="IModelRecord.d.ts" />
/// <reference path="IModelFillable.d.ts" />
/// <reference path="IModelSerialization.d.ts" />
/// <reference path="IModelTimestamps.d.ts" />
/// <reference path="IModelSo... |
1da2a5006e9933d82941da6cf209c32c7f96a337 | TypeScript | alu0101235516/ull-esit-inf-dsi-20-21-prct03-static-types-functions-Espinette | /src/ejercicio-7.ts | 3.609375 | 4 | // Ejercicio 7 - El siguiente número
function nextNumber(numero: number) {
let numString: string = numero.toFixed();
let aux: string = "";
const tam: number = numString.length;
for (let i: number = tam-1; i > -1; i--) {
for (let j: number = 0; j < tam; j++) {
if (i-j > 0) {
if (parseInt(numSt... |
1b823ec3d9298fef474b10060edced75dbf9f28e | TypeScript | byglimps/boomerang | /src/main.ts | 3.03125 | 3 | import * as fs from "fs";
import * as path from "path";
import * as crypto from "crypto";
import * as gm from "gm";
type ImagePath = {
location: string;
name: string;
};
export class Boomerang {
constructor(images: Array<string>) {
this.mkdir();
this.create(images);
}
public async create(images: Ar... |
a6e880def86fb98373a2801a5fbe6fa6d67ba806 | TypeScript | YoshiyukiKato/nightharbor | /src/reporter/simple-reporter.ts | 2.9375 | 3 | import {IReporter} from "../interface";
export default class SimpleReporter implements IReporter {
private results: any[];
public constructor() {
this.results = [];
}
public write(result: any): void {
this.results.push(result);
}
public close(): Promise<any> {
this.results.forEach((result) =>... |
4b63cd39f871811f872f66c47012126d226934a1 | TypeScript | benjaminParisel/Formation_JavaScript_Bonitasoft_2017_11 | /BuildWebpack/src/js/random.ts | 3.203125 | 3 | export const getRandomInt = (min: number, max: number) : number => {
console.log('getRandomInt');
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
};
export const getRandomIntInclusive = (min: number, max:... |
be79cd8d2ab1eb91472db7e07bcba6dd164e13ef | TypeScript | minhdpt/tetris_game | /src/menu/GameOver.ts | 2.5625 | 3 |
import {Text} from 'pixi.js';
import SoundManager from '../manager/SoundManager';
import BaseMenu from './BaseMenu';
/**
* Display Game Over screen
*/
export default class GameOver extends BaseMenu {
scoreInfo: Text;
constructor(game) {
super(game, 'GAME\nOVER', 'Touch to restart');
... |
70651c274f06b61fea892bf4115cb5c2d3ac4805 | TypeScript | RenatoBrito81/EncurtadorDeURL | /src/Controller/URLController.ts | 2.953125 | 3 | import { URLmodel } from "../database/model/URLmodel";
import { Request, Response } from "express";
import shortId from 'shortid'
import "dotenv/config";
export class URLController {
public async EncurtarURL(req: Request, res: Response): Promise<void>{
const { urlOrigem } = req.body;
//Ver se a UR... |
a63fa9ad96f09d5f6c36ba585574137645c1c9a4 | TypeScript | IngridGdesigns/typescript-playground | /course-notes/ex4_functions.ts | 4.78125 | 5 | // ex 1: Functions and void versus undefined
function subtract(n1: number, n2: number): number {
return n1 - n2;
}
function printResult(num: number) {
console.log(`Result: ${num}`);
}
printResult(subtract(10, 4)); // function printResult(num: number): void
/* return type of void - The function doesn't return anty... |
bb18fb527488e239f6b2f8939938e8780f3abbc8 | TypeScript | cypeng001/h5game | /client/project/src/particle/affector/PSAffectorLinearForce.ts | 2.84375 | 3 | class PSAffectorLinearForce extends PSAffector {
protected static DEF_ATTR = {
FORCE: 100,
};
protected static ForceApp = {
AVERAGE: 0,
ADD: 1
};
protected _forceVector: PSVec3 = [0, -1, 0];
protected _forceApp: number = PSAffectorLinearForce.ForceApp.ADD;
protected _dynForce: PSD... |
b9cb87e70ab2757e9fb5720dfb4fa87a60a59e0d | TypeScript | martendV/mei-long | /router/route-validator.ts | 2.953125 | 3 | import { Route, UrlParameterObject } from "../interfaces/router-interface.ts";
import { ServerRequest } from "../deps.ts";
export class RouteValidator {
public request: ServerRequest;
constructor(request: ServerRequest) {
this.request = request;
}
public naturallyMatches(route: Route): boolean {
retu... |
31b44c7ab2072579c42677656cd48012a2e6af79 | TypeScript | r00t-101-LoL/replikit | /packages/messages/src/messageBuilder.ts | 2.703125 | 3 | import { OutMessage, Attachment, TextToken, MessageHeader, Button } from "@replikit/core/typings";
import { AttachmentType, TextTokenKind, TextTokenProp, Builder, assert } from "@replikit/core";
import { hashString, MetadataLike, extractMetadata } from "@replikit/messages";
export class MessageBuilder extends Builder ... |
1e4bfa80e15201626e688095762cf7f5faa5f5a4 | TypeScript | Nax/screepy | /src/tasks/index.ts | 2.84375 | 3 | import buildRoads from './build/roads';
import buildExtensions from './build/extensions';
import creepReap from './creep/reap';
interface ITask {
task:() => void,
period:number;
};
interface IComputedTask extends ITask {
skew:number;
};
const combineTasks = (tasks:ITask[]) => {
const taskTable:IComputedTask[... |
63975537bd43f52dd4f8f5097fa29c2708da06b5 | TypeScript | lutterotti/angular-budget-calendar | /src/app/directives/numerical-pipe.directive.ts | 2.53125 | 3 | import { Directive, ElementRef, forwardRef, HostListener, Input, Renderer2 } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { formatNumber } from '@angular/common';
import { isNull } from 'lodash';
export const AV_NUMERIC_VALUE_ACCESSOR: any = {
provide: NG_VAL... |
e8c4958d1695e198eaaa992c2796084650a4ff16 | TypeScript | zstefanovska/algo-comparer | /src/comparer/comparer.ts | 2.953125 | 3 | import { ProblemOptions, Algorithm, InputFunction, AlgorithmResults, MetricValuesMap, IAnalyzer } from "./models";
import * as Performance from "performance-node";
export class AlgorithmComparer {
private algorithms: Algorithm[] = [];
private problemName: string;
private metrics: string[];
private inp... |
7457c3d44b15a3c5ce77cdecbf8fa10d55afacad | TypeScript | munishase/ExistingAPIs | /src/Services/Authentication.ts | 2.703125 | 3 | import { BaseLayer } from "./BaseLayer";
import jwt from 'jsonwebtoken';
import AuthenticationToken from "../types/AuthenticationToken";
export class Authentication extends BaseLayer {
public Authorize(username: string, password: string): string {
if (username == "munish" && password == "singla") {
... |
2c75905d77d145126200c55e575132bb985431b1 | TypeScript | enriko-riba/PixiTest | /Web/app/_engine/KeyboardMapper.ts | 3.109375 | 3 | import { State } from "./SceneManager";
/**
* Simple keyboard mapper.
*/
export class KeyboardMapper {
/**
* Stores keyboard pressed state.
*/
private keyboard: boolean[];
/**
* Stores an array of KeyboardAction instances per Global.State. The 'state' indexer is a numeric value from ... |
b19e1968031527a880cb58a0551b3abf722a5619 | TypeScript | LancerComet/simple-phy-canvas | /src/splash-ball/index.ts | 3.015625 | 3 | const canvas = document.querySelector('#app-canvas') as HTMLCanvasElement
const context = canvas.getContext('2d') as CanvasRenderingContext2D
window.addEventListener('resize', setCanvasSize)
setCanvasSize()
function setCanvasSize () {
const width = document.body.clientWidth
const height = document.body.clientHeig... |
281b2ac6cbdeebcb124b34c0f3205f4096c9242f | TypeScript | marcobiedermann/codewars | /kata/6 kyu/replace-with-alphabet-position/index.test.ts | 2.734375 | 3 | import alphabetPosition from '.';
describe('alphabetPosition', () => {
it('should replace every letter with its position in the alphabet', () => {
expect.assertions(2);
expect(alphabetPosition("The sunset sets at twelve o' clock.")).toBe(
'20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 1... |
c6a842cc927f4d38444ce48653c2cea7365fe7ab | TypeScript | nhcarter123/ocs | /src/state/types/tournament.ts | 3.078125 | 3 | export type Tournament = {
id: string;
name: string;
description?: string;
pools: Pool[];
date: Date;
playerCount?: number;
maxRating?: number;
avgRating?: number;
};
export type Pool = {
players: string[];
};
export type CreateTournamentPayload = {
name: string;
date: Date;
description?: stri... |
8f28ed2d11ac562b22ba9364e6fbc5bf80095ab8 | TypeScript | synergy2411/ng-tcs | /demo/users-app/src/app/components/observable-demo/observable-demo.component.ts | 2.671875 | 3 | import {
Component,
ElementRef,
OnDestroy,
OnInit,
ViewChild,
} from '@angular/core';
import {
concat,
forkJoin,
from,
fromEvent,
interval,
Observable,
ReplaySubject,
Subject,
Subscription,
} from 'rxjs';
import {
debounceTime,
map,
mergeAll,
mergeMap,
switchAll,
switchMap,
tak... |
c9f7246d8aa768e8ae262695bf69eeb86c59b83c | TypeScript | jenskuhrjorgensen/HelloBank | /App/Api/Api.ts | 2.90625 | 3 | import {AccountById} from "../Model/Account"
import {AccountBuilder} from "../Model/AccountBuilder"
import {OwnerById} from "../Model/Owner"
import {OwnerBuilder} from "../Model/OwnerBuilder"
const DELAY = 2000
interface AccountsNormalized {
result: Array<string>,
entities: {
accounts: AccountById,
... |
b0723ab6ce683fdcde54313b58f8f0ea14ab04b8 | TypeScript | codexetreme/DinoGame | /DinoGame/Engine/GameLoopComponents.ts | 2.625 | 3 | class GameLoopComponents {
fps: number = 60;
protected now: number;
protected then: number = Date.now();
protected interval: number = 1000 / this.fps;
delta: number = 0.0;
startGame() {
this.Start();
this.drawGame();
this.fixedUpdate();
//this.garbageCollec... |
4c506e93cf395b12dc8a3ce57cdc15a0c097c51a | TypeScript | zalman778/ct-constructor | /src/app/model/response.model.ts | 2.53125 | 3 | /*
Модель json ответа сервера.
*/
export interface IResponse {
status: string;
message: string;
code: string;
payload: object;
}
|
3ff9a3f7aab0c7743a459b8ecf5b4184a5b3b805 | TypeScript | green-fox-academy/zsomborvermes | /week-04/typescript/day-2/sharpie-set/SharpieSet.ts | 3.375 | 3 | import { Sharpie } from "./Sharpie";
export class SharpieSet {
private sharpieList: Sharpie[] = [];
add(sharpie: Sharpie) {
this.sharpieList.push(sharpie);
}
getSharpieList() {
return this.sharpieList;
}
countUsable() {
let usable: number = 0;
this.sharpieList.forEach(e => {
if (e.... |
6d2712767042cf633c7d4cbbe46e1aed522673e6 | TypeScript | josecullen/calendar | /src/app/lib/calendar-view/config/calendar-view-config.class.ts | 2.65625 | 3 | import { CalendarHeaderConfig, ICalendarHeaderConfig } from './header-config.class';
import { CalendarConfig } from '../../calendar/config/calendar-config.class';
import { MonthViewConfig } from './month-view-config.class';
import { IMonthViewConfig } from './month-view-config.interface';
export class CalendarViewConf... |
4d58a52b977a5998336b7ecc5cf954edb52032f0 | TypeScript | SanderRonde/CustomRightClickMenu | /tools/definitions/types/node-stream-zip.d.ts | 2.578125 | 3 | import { Stream } from "stream";
export = NodeStreamZip;
interface FileEntry {
}
declare class NodeStreamZip {
constructor(config: {
file?: string;
storeEntries?: boolean;
skipEntryNameValidation?: boolean;
});
entries(): {[key: string]: FileEntry};
entry(name: string): FileEntry;
stream(entry: FileEntr... |
5e467db24c5cd000772db4d7fe67e4c09409fd9a | TypeScript | Angular-RU/angular-ru-sdk | /libs/cdk/object/src/is-object.ts | 2.765625 | 3 | export function isObject<T>(object: T): boolean {
return object === Object(object);
}
|
1c17fc3c17813716dcb96be3ff95097e92a77367 | TypeScript | KRISACHAN/ying-datastructures-algorithms | /src/core/utils.ts | 3.6875 | 4 | export type DefalutListType = number[]
export type ICompareFunction<T> = (a: T, b: T) => number
export type IEqualsFunction<T> = (a: T, b: T) => boolean
export type IDiffFunction<T> = (a: T, b: T) => number
// 红黑色色值枚举
export enum Colors {
RED = 0,
BLACK = 1,
}
// 红黑树色值文本枚举
export enum ColorTexts {
RED = 'RE... |
2223c0d1ab41314df451c048344371578e8031eb | TypeScript | NIV54/url-shortener-client | /src/common/types/ShortURL.type.ts | 2.53125 | 3 | export interface ShortURLInput {
url: string;
alias: string;
}
export interface ShortURL extends ShortURLInput {
id: number;
lastUpdated: string;
}
|
63bbfa4500c70d5601ab88cec3e4e9e623be8783 | TypeScript | rokkerdoktor/prok | /src/common/core/utils/get-query-params.ts | 2.625 | 3 | export function getQueryParams(url: string) {
const parts = url.split('?');
if (!parts[1] || parts.length > 2) return null;
const hashes = parts[1].split('&');
const params = {};
hashes.map(hash => {
const [key, val] = hash.split('=');
params[key] = decodeURIComponent(val);
});
... |
5326a0753eeae4f2e826cd8bf9f31ef4be9aac1a | TypeScript | MichaelDuo/react-mindmap | /src/store/editor/reducers.ts | 2.53125 | 3 | import { EditorState, ActionTypes, INCREASE } from './types';
import fakeData from '../_fakeStates/editor';
const initialState: EditorState = fakeData;
export function editorReducer(
state = initialState,
action: ActionTypes
): EditorState {
switch (action.type) {
case INCREASE:
return... |
f274276f5fb75013840b2c16402abab344a9fa19 | TypeScript | driquelme/edge-currency-plugins | /src/common/utxobased/keymanager/bitcoincashUtils/base32.ts | 2.875 | 3 | // @flow
/***
* https://github.com/bitcoincashjs/cashaddr
* Copyright (c) 2018 Matias Alejo Garcia
* Copyright (c) 2017 Emilio Almansi
* Distributed under the MIT software license, see the accompanying
* file LICENSE or http://www.opensource.org/licenses/mit-license.php.
*/
/***
* Charset containing the 32 symb... |
f566cfc8366874d74779bfc87a38958d93a135cc | TypeScript | eventfarm/javascript-sdk | /src/Api/UseCase/UserIdentifier.ts | 2.515625 | 3 | /**
* This file was auto generated, please do not edit it directly.
**/
import { RestClientInterface } from '../../Interfaces';
export class UserIdentifier {
constructor(private restClient: RestClientInterface) {}
// Queries
// Commands
/**
* @param string - userIdentifierId
* @param string - ident... |
22d7dc4bafef99fa1cec06f8dd52625d4a113777 | TypeScript | SystangoTechnologies/uk-loan-apr-calculator | /src/APRCalculator.ts | 3.171875 | 3 | import Instalment from './Instalment'
import InstalmentFrequency from './InstalmentFrequency'
import InstalmentType from './InstalmentType'
export default class APRCalculator {
private _advances
private _payments
public constructor(firstAdvance: number) {
this.constructorMthod(firstAdvance, [], [... |
2514f264b20a972fc5c48fefe35cd6119f933a9c | TypeScript | Avi-Meshulam/events.ts | /src/publisher.ts | 3.0625 | 3 | import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { INotifyPropertyChanged } from './INotifyPropertyChanged';
import { PropertyChangedEventArgs } from './propertyChangedEventArgs';
export class Publisher implements INotifyPropertyChanged {
// Singleton
private st... |
4a94b08c27aef6ff0a6713d762fb803c3116a36c | TypeScript | chenyuantao/estr | /src/ustring.ts | 3.125 | 3 | /**
* File: src/ustring.ts
* Project: estr
* Created Date: Thursday, December 13 2018, 2:09:32 PM
* Author: billbai <billbai42@gmail.com>
* -----
* Copyright (c) 2018 billbai
*/
import {
toCodePoints,
fromCodePoints,
isHighSurrogate,
isLowSurrogate
} from './util';
import { nextBreak as nextGraphemeBr... |
2c6d14a48be2875a018e84e40fef0bfb4b4147d3 | TypeScript | loumisha96/tytusx | /20211SVAC/G16/app/Clases/Hijos/If.ts | 2.671875 | 3 | import Entorno from '../AST/Entorno';
import { Instruccion } from './../Interfaces/Instruccion';
export class If implements Instruccion{
condicicion:any;
sentencias:any;
sino:any;
fila:number;
columna:number;
t:string;
constructor(condicion:any,sentencias:any,sino:any,fila:number,columna:number){
thi... |
409d6bb638f610a12d1775c94bff82097c2e9e1d | TypeScript | AndreGeng/practice-algorithm | /add-two-large-num/index.ts | 3.46875 | 3 | function paddingWithZero(str: string, targetLen: number, left: boolean) {
const strArr = str.split("")
while (strArr.length < targetLen) {
if (left) {
strArr.unshift("0")
} else {
strArr.push("0")
}
}
return strArr.join("")
}
function integerAdd(str1: string, str2: string) {
let highV ... |
3e479a946b88b7b1ffd27a330813dc5f13181045 | TypeScript | naspinall/studs | /src/builder/limitQueryBuilder.ts | 2.8125 | 3 | import { ParameterManager } from "../common/ParameterManager";
import { OperatorConfiguration } from "../operators/Operator";
import { Primitive } from "../utility/types";
export class LimitQueryBuilder {
private limit: number = 0;
private parameterManager = new ParameterManager();
getParameterManager(): Parame... |
815aa2e95531d67d9d7ac38f01b4754cbea7d84c | TypeScript | bhavya0598/PracticeProject | /src/app/store/user.reducer.ts | 2.765625 | 3 | import { IUserForm } from '../../assets/model/IUserForm'
import { UserActionTypes, UserFormActions } from './user.actions';
export interface IAppState {
user: IUserForm[],
isLoading: boolean;
}
const INITIAL_STATE: IAppState = {
user: [],
isLoading: false
}
export function rootReducer(state = INITIAL... |
20a81f9c3b675bf9ca23d64603f81f37120e0fc0 | TypeScript | koole/tailwind-component-code-action | /src/util/generateStyledComponent.ts | 2.703125 | 3 | import { IClassAttribute } from "./parseDocument";
import generate from "@babel/generator";
import {
variableDeclaration,
variableDeclarator,
identifier,
taggedTemplateExpression,
memberExpression,
callExpression,
templateLiteral,
templateElement,
StringLiteral,
} from "@babel/types";
const generateS... |
cb88258a2903ec6d2b88f9e3fe776c6b61504163 | TypeScript | EdduSoft/resuelve-test | /src/validation/player.team.ts | 2.6875 | 3 |
import { Allow, IsInt, IsNotEmpty, IsNumber, IsPositive } from 'class-validator'
/**
* Class ValidatePlayerTeam
*
* Model and request validation
*
* @author Eduardo Díaz <eddusoft@gmail.com>
*/
export class ValidatePlayerTeam {
/**
* nombre property
*/
@IsNotEmpty()
nombre: string
/**
* nivel... |
b03139d7af86a3e6f396ba1554922da3e595dfea | TypeScript | markjdvs/angular | /s03l34-35_services-depencyInject/src/app/courses.service.ts | 3.21875 | 3 | // 02 we wanto to export a plain typescipt Class.
// Normally we add a decorator (@Component) to a Class. But we don't have one for Service!
export class CoursesService {
getCourses() {
// for now we don't do the http service.
return ['course1', 'course2', 'course3'];
}
}
// Ok now we have a service but... |
4a338c6c006bb918fc3062619f1c3e12c19b87d7 | TypeScript | murdisto/ng5 | /src/app/home/home.component.ts | 2.515625 | 3 | import { Component, OnInit } from '@angular/core';
import { DataService } from '../data.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
itemCount: number; //interpolation
btnText: str... |
d67faa7bd4683f8a4b331249355f40a5c29aad7a | TypeScript | kazuhito-m/line-bot-sandbox | /typescript/src/app.ts | 2.546875 | 3 | import Provider from './quiz/Provider';
import Quiz from './quiz/Quiz';
import Kani from './quiz/Kani';
import { Command } from './cmd/Command';
import Express, { Request, Response } from 'express';
import CheckListInterlocutor from './checklist/CheckListInterlocutor';
import {
Client, middleware, ClientConfig, Mid... |
d4a50a98119760e534537f36dbce184e5c5db0d3 | TypeScript | gfpeltier/ts-tanks | /src/models/tank.ts | 2.859375 | 3 | import * as PIXI from 'pixi.js'
import * as sprites from '../sprites'
import { Terrain } from './terrain';
import { Projectile, ProjectileType } from './projectile';
export enum TankColor {
Black,
Blue,
Yellow,
Green,
Red
}
export class Tank {
tank: PIXI.Container;
tbody: PIXI.Sprite;
... |
39139bc27d48d78a1f5584743c980f74d79e456a | TypeScript | Majdi-Zlitni/Madara | /src/types/index.ts | 2.71875 | 3 | export type ColumnType = 'Todo' | 'In progress' | 'Done'
export type TrimmedColumnType = 'Todo' | 'Inprogress' | 'Done'
export type Task = {
text: string
createdAt: string
id: string
columnType: ColumnType
}
export type TaskFirestoreResult = {
tasks: Task[]
}
export type Status = 'idle' | 'loading' | 'suc... |
990c626bf71b7b00d36af9be0d6d60124d9cdfcd | TypeScript | dzebleckis/aoc | /2021/4/index.ts | 2.9375 | 3 | export {};
const text = await Deno.readTextFile("./4/input");
const input = text.split("\n").filter((n) => n != "");
const numbersLine = input[0];
input.shift();
const boardSize = 5;
type Digit = {
number: number;
matched: boolean;
};
type B2 = Digit[][];
type Board = Digit[][];
const boards: Board[] = [];
l... |
8a280a28d7856f1a3784e2037ab6792a9add5ef9 | TypeScript | Kryndex/AssemblyScript | /tests/kitchensink.ts | 3.3125 | 3 | /// <reference path="../assembly.d.ts" />
// TODO: binaryen's optimizer seems to keep / eliminate random things here
class MyClass {
instanceFunctionVoid(): void {
}
static staticFunctionVoid(): void {
}
instanceFunctionInt(v: int): int {
return v;
}
static staticFunctionInt(v: int): int {
re... |
92479f01de39d6de3bc71271929cda217eca28a7 | TypeScript | frontarm/demoboard | /packages/demoboard-core/src/types/DemoboardLayout.ts | 2.703125 | 3 | /*
* Copyright 2019 Seven Stripes Kabushiki Kaisha
*
* This source code is licensed under the Apache License, Version 2.0, found
* in the LICENSE file in the root directory of this source tree.
*/
import { DemoboardPanelType } from './DemoboardPanelType'
export type DemoboardLayoutMode = 'mobile' | 'single' | 'd... |
ef25819a562bbba738757e5ce720f7ee0f59abd0 | TypeScript | samchon/tgrid.examples | /src/projects/simple-calculator/client.ts | 3.0625 | 3 | import { WebConnector } from "tgrid/protocols/web";
import { Driver } from "tgrid/components";
import { ISimpleCalculator } from "../../controllers/ICalculator";
async function main(): Promise<void>
{
//----
// CONNECTION
//----
let connector: WebConnector<{}, null> = new WebConnector(null);
await ... |
31df4fec8a5749a1206d6432b56eb244892002be | TypeScript | andonary/cart-tdd | /src/domain/services/vaultService.ts | 2.703125 | 3 | import {Product} from "../models/business/product";
import {Vault} from "../models/business/vault";
export class VaultService {
private vault: Vault = new Vault();
private listProduct: Product[] = [];
createProduct(product: {name: string, price: number}): Product {
const _newProduct = new Product(... |
b9e63e348c971e54acc3862733a240d3916b4ac3 | TypeScript | mrrs878/blog | /src/hooks/useRequest.ts | 2.625 | 3 | /*
* @Author: your name
* @Date: 2020-10-09 09:57:25
* @LastEditTime: 2020-10-20 17:19:18
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \blog\src\hooks\useRequest.ts
*/
import { useEffect, useState, useCallback } from 'react';
function useRequest<P, T>(api: (params: P... |
482f47737218351b4db922e18d72b573f28c979e | TypeScript | fernandozanutto/apresentacao-teste-unitario | /src/libs/core/src/cookie.ts | 2.84375 | 3 | /**********************************************************
* Criador: Thiago Feijó *
* Data: 21/12/2017 *
* Descrição: Classe responsavel por gerenciar cookies. *
* *******************************************************/
import { Injectable... |
602d89937661ce212886f7f9860689b17b8ed022 | TypeScript | Kruimeldief/trilogy | /tests/find-or-create.ts | 2.875 | 3 | import test from 'ava'
import { connect } from '../src'
import { Game } from './helpers/types'
const db = connect(':memory:')
test.after.always(() => db.close())
test('creates missing objects or returns an existing one', async t => {
const games = await db.model<Game>('games', {
name: { type: String, primary:... |
c42416fdb82d87402d0a6afc79bf89bc7f46f22a | TypeScript | tunyanghevond/typescript-with-redux | /src/state/reducers/repositoriesReducer.ts | 2.984375 | 3 | import {ActionType} from '../action-type';
import {Action} from '../actions';
const initialState = {
loading:false,
error: null,
data: []
};
interface RepositoriesState {
loading:boolean;
error: string | null;
data: string[];
};
const reducer = (state:RepositoriesState = initialState, actoin... |