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 |
|---|---|---|---|---|---|---|
afa140d252408bf2d217c608c438e5a90da5e4f5 | TypeScript | da-peng/common-manager | /server/src/utils/string_utils.ts | 2.890625 | 3 | import * as uuid from 'uuid';
import * as crypto from 'crypto';
import {config} from '../config/config'
export class StringUtil{
private static md5(str: string): string {
return crypto.createHash('md5').update(str).digest('hex');
}
static md5Password(password: string): string {
return con... |
a29b6f71f5fdd35d31d82d505375504c0114d685 | TypeScript | SAP/ui5-webcomponents | /packages/main/src/MultiComboBoxGroupItem.ts | 2.59375 | 3 | import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import type { IMultiComboBoxItem } from "./MultiComboBox.js";
/**
* @class
* The <code... |
210db4934fb6fa3d40d5f493d7b0f8fc4c3e9421 | TypeScript | FernandoCuevasFeliz/api-login-role | /src/utils/JWT.ts | 2.671875 | 3 | import jwt from 'jsonwebtoken';
class JWT {
private static secretKey = process.env.SECRET_KEY || 'secretkey';
static generateToken(payload: IPayload, expiresIn: number | string = '24h') {
const token = jwt.sign(payload, this.secretKey, {
expiresIn
});
return token;
}
static verifyToken(toke... |
29dc6826d1fe4eaadbbcf10611b0a2d823e31745 | TypeScript | TiStrong/types | /types/titanium/Titanium/UI/Font.d.ts | 3.421875 | 3 | /**
* An abstract datatype for specifying a text font.
*/
interface Font {
/**
* Specifies the font family or specific font to use.
*/
fontFamily?: string;
/**
* Font size, in platform-dependent units.
*/
fontSize?: number | string;
/**
* Font style. Valid values are "italic" or "normal".
*/
fontS... |
5a2a3ef35e52d2818d94dedfbb8b828a82cbbbaa | TypeScript | mjshoemake/StoreGuideUI | /angular/src/app/users/users.service.ts | 2.703125 | 3 | import { Injectable } from '@angular/core';
import { User } from './user';
import { LogService } from '../log.service';
import {BehaviorSubject} from "rxjs/BehaviorSubject";
import {Observable} from "rxjs/Observable";
@Injectable()
// NOTE: For now, there is no DB so data is stored in memory only.
export class UsersSe... |
4a1c1ac15148fb9ff76ded5c63c75ab02591238f | TypeScript | MFvandenBos/angularbd2020 | /src/app/pipes/dutch-euro.pipe.ts | 2.578125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import {CurrencyPipe} from '@angular/common';
@Pipe({
name: 'dutchEuro'
})
export class DutchEuroPipe implements PipeTransform {
transform(value: any, ...args: any[]): any {
const currencyPipe = new CurrencyPipe('nl');
// Een geheel getal wordt default ... |
1d1347fa4ec94144895634faef4285b33f949f26 | TypeScript | johncomposed/remote-faces | /web/src/hooks/useSpatialArea.ts | 2.6875 | 3 | import { useCallback, useState, useRef, useEffect } from "react";
import { isObject } from "../utils/types";
import { useRoomData, useBroadcastData } from "./useRoom";
export type AvatarData = {
position: [number, number, number];
};
const isAvatarData = (x: unknown): x is AvatarData => {
try {
const obj = x... |
3d90d4c741639463602627aa9383f0dbe8dfb795 | TypeScript | shifucun/website | /static/js/tools/map/condition_hooks.ts | 2.546875 | 3 | /**
* Copyright 2022 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 copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
1cc0458676778889ab8e333cc18bd967f11a012d | TypeScript | jcamden/merninator | /packages/client/src/context/projects/projectsReducer.ts | 2.75 | 3 | import { IProjectsState, ProjectsActions } from '@merninator/types';
export const projectsReducer = (draft: IProjectsState, action: ProjectsActions): void => {
switch (action.type) {
// Set projects is called when the projects page loads
// If there are no projects matching the User._id, the state.projects e... |
ce1cd328713a07c4caddb21bb4a809ed0dbfd032 | TypeScript | villagestyle/note | /js && ts/leetcode/867.转置矩阵.ts | 3.140625 | 3 | /*
* @lc app=leetcode.cn id=867 lang=typescript
*
* [867] 转置矩阵
*/
// @lc code=start
function transpose(A: number[][]): number[][] {
const row = A.length;
const col = A[0].length;
const newArr = Array.from(new Array(col), () => new Array(row));
for (let i = 0; i < col; i ++) {
for (let j ... |
b39443bac21bdc56dbc490ee0f28758dad8723cc | TypeScript | DjihadBengati/daily-coding-problem | /google_12_06_2020/solution_google_12_06_2020.ts | 3.5 | 4 | function solutionGoogle12062020(values: Array<number>, k: number): Boolean {
return values.length == 0 ? false : doCkecks(k, values[0], values.slice(1, values.length));
}
function doCkecks(k: number, value: number, values: Array<number>): Boolean {
for (let index = 0; index < values.length; index++) {
... |
888f0e745fb65a2bf8bf7541802cd68c99156b52 | TypeScript | ralphcasipe1/pet-gram | /src/models/Pet.ts | 2.578125 | 3 | import * as mongoose from 'mongoose'
const Schema = mongoose.Schema
const Pet = new Schema({
petType: {
type: 'ObjectId',
ref: 'PetType',
required: 'Enter the type of the pet'
},
name: {
type: String,
required: 'Enter a name'
},
createdAt: {
type: Date,
default: Date.now()
}
}... |
0b6ebb40442cfb404dab02565d6b057953d4ac88 | TypeScript | redmagebr/redpgBeta | /app/Kinds/Classes/Sheet/SheetStyle.ts | 2.6875 | 3 | class SheetStyle {
private css : HTMLStyleElement = <HTMLStyleElement> document.createElement("style")
private visible : HTMLElement = document.createElement("div");
private $visible : JQuery = $(this.visible);
protected styleInstance : StyleInstance;
protected sheet : Sheet;
protected sheetInst... |
33935eaee63a6e0b473b033b32b6d6344cb7d7aa | TypeScript | einari/JavaScript.Fundamentals | /Source/rules/IRuleContext.ts | 2.984375 | 3 | // Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import { IRule } from './IRule';
import { BrokenRule } from './BrokenRule';
import { Cause } from './Cause';
/**
* Defines the context in which a rule is evaluated in.... |
4804e4d3a845efb41b2a823b3457913f3993b5ca | TypeScript | tisuela/popyt | /test/playlist.spec.ts | 2.5625 | 3 | import 'mocha'
import { expect } from 'chai'
import { Playlist, Video } from '../src'
import { youtube } from './setup-instance'
const apiKey = process.env.YOUTUBE_API_KEY
if (!apiKey) {
throw new Error('No API key')
}
describe('Playlists', () => {
it('should reject if the playlist isn\'t found', asy... |
096459210104b3e3efb5a15c74815d908eaacd5f | TypeScript | mickys/account-manager | /src/modules/binance/account.ts | 2.5625 | 3 | import { GenericAccount, IaccountOptions } from "../../core/account";
import { BigNumber } from "bignumber.js";
import binance from "node-binance-api";
export class BinanceAccount extends GenericAccount {
public client;
public defaultGasPriceInGwei: number = 30;
private isLoggedIn: boolean = false;
c... |
4ed18b82a5e3bc0e8048969835c4736d39616e73 | TypeScript | JOLee83/coding-challenges | /code-wars/TS/6kyu/ConseccutiveStrings.ts | 3.3125 | 3 | export function longestConsec(strarr: string[], k: number): string {
let str: string = '';
if (k <= 0) {
return str;
}
for (let i: number = 0; i + k <= strarr.length; i++) {
const string = strarr.slice(i, i + k).join('');
if (string.length > str.length) {
str = string;
}
}
return s... |
c470c409a5ffb82d9b897c7546963f3756a1729c | TypeScript | haimkastner/unitsnet-js | /src/angle.g.ts | 3.578125 | 4 | /** AngleUnits enumeration */
export enum AngleUnits {
/** */
Radians,
/** */
Degrees,
/** */
Arcminutes,
/** */
Arcseconds,
/** */
Gradians,
/** */
NatoMils,
/** */
Revolutions,
/** */
Tilt,
/** */
Nanoradians,
/** */
Microradians,
/**... |
350b64f38cfe12251256deb91b92b39899865755 | TypeScript | forkkit/state | /local-store/index.test.ts | 3 | 3 | import { delay } from 'nanodelay'
import { LocalStore, subscribe, change, destroy } from '../index.js'
it('loads store only once', () => {
class StoreA extends LocalStore {}
class StoreB extends LocalStore {}
let storeA1 = StoreA.load()
let storeA2 = StoreA.load()
let storeB = StoreB.load()
expect(storeA1... |
0dfc0e79927402e57273dfb5e955dade4494a48a | TypeScript | jvdm1988/Hello-Angular | /src/app/my-pipes/capitalize.pipe.ts | 3.53125 | 4 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
// In a template, you use the pipe like this
// {{ userName | capitalize}}, because name here is capitalize
name: 'capitalize'
// The "name" setting specifies how to use it
})
export class CapitalizePipe implements PipeTransform {
// The logic of o... |
700e9c050d06b063cbdef7bc70b494b9305e23a7 | TypeScript | Ciatek-Angular/Components-Templates | /ToDoApp/src/app/to-do/to-do.component.ts | 2.5625 | 3 | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-to-do',
templateUrl: './to-do.component.html',
styleUrls: ['./to-do.component.css']
})
export class ToDoComponent implements OnInit {
constructor() { }
animal_input: string
animals: any[]
ngOnInit() {
this.animals = ['d... |
e8d0115d27c64f1f5198e9175e2ace7650237dae | TypeScript | roelvanlisdonk/dev | /apps/sportersonline/www/libraries/am/virtual.dom/attribute.ts | 2.6875 | 3 | import { IObservableField, IObservableFn } from "../common/observable";
export interface IAttribute {
name: string;
// When null attribute will not be rendered, when empty string only, attribute name will be rendered.
value?: string | IObservableField<string> | IObservableFn<any, string>;
}
|
9b00604a6ac35feca4a85cfc9964b6ed4ad10b5b | TypeScript | matejikj/dataset-similarity | /client/evaluation/dataset-api.ts | 2.6875 | 3 | import axios from "axios";
export interface Dataset {
iri: string;
title: string;
description: string;
keywords: string[];
}
export function getDataset(datasetIri: string): Promise<Dataset> {
const url = "./api/v1/dataset?dataset=" + encodeURIComponent(datasetIri);
return axios.get(url).then((response) =>... |
785ee532493e6eddf1fc2362e39c66a3d86e6e8a | TypeScript | noelia96-96/BookLife-Back | /controladores/usuario.controlador.ts | 2.65625 | 3 | import {Request, Response} from "express";
import Token from "../clases/token";
import { Usuario } from '../modelos/usuario.modelo';
class usuarioController{
getSaludo (req:Request, res:Response){
const nombre = req.query.nombre || 'desconocid@';
res.status(200).send({
status: 'ok',
mensa... |
e6d7c66925d7d13210db9145eb05bb5078594f10 | TypeScript | LoicROY/Projet_diginamic_2_front_angular | /src/app/shared/formulaireComponents/input/input.component.ts | 2.703125 | 3 | import { GeneriqueComponent } from './../../../generique/generique.component';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
@Component({
selector: 'app-input[inputModel][id][label][type]',
templateUrl: './input.component.html',
styleUrls: ['./input.component.scss']
})
exp... |
073387c69d991c940b6f2b171a0eca23bebca0dd | TypeScript | Roeefl/andals-server | /src/schemas/GameCard.ts | 3.28125 | 3 | import { type, Schema } from '@colyseus/schema';
interface cardManifest {
title: string
description: string
};
const manifest: { [type: string] : cardManifest } = {
// A "Knight" card allows a player to move the robber to any spot on the board
// and then gets to take a card from any player that has a settle... |
00db76d5839a60c2536d488c6377ef613867a150 | TypeScript | AlanMauricioCastillo/wks-typescript | /clases/demos/funciones.ts | 3.609375 | 4 |
//function nombreMiFuncion(parametroUno: TIPADO_PARAMETRO_UNO, ...): tipadoReturn
// function suma(a: number, b: number): number {
// return a + b
// }
// function suma(a: number | string, b: number | string): number | string | void {
// if(typeof a === "number" && typeof b === "number") return a + b
// i... |
8cbf8ef659b7ca353c74a152e94fb03d8e227ae5 | TypeScript | c6o/ui | /packages/web/src/tabs/tabs.ts | 2.6875 | 3 | import { TabsElement } from '@vaadin/vaadin-tabs/src/vaadin-tabs'
import { mix } from 'mixwith'
import { EntityListStoreMixin } from '../mixins'
/**
* `<c6o-tabs>` is a Web Component for easy switching between different views.
*
* ```
* <c6o-tabs>
* <c6o-tab>Page 1</c6o-tab>
* <c6o-tab>Page 2</c6o-tab>... |
a62d93bbcabb51bbda9c85fbc5ff107b8d2ec41f | TypeScript | Himaja1606/IMSProjectAngular | /src/app/SupplierDetails.ts | 2.5625 | 3 | export interface SupplierDetails{
supplierId: number,
supplierName: string,
suppliedQuantity: number
} |
36003a9431432e97dc1c8ec60467ee36cabcc3ad | TypeScript | asimyildiz/market | /src/middleware/api/index.ts | 2.5625 | 3 | import axios from "axios";
import config from "../../config";
import { TagList } from "../interfaces/tag.interface";
import { CompanyList } from "../interfaces/company.interface";
import { ProductList } from "../interfaces/product.interface";
import { ItemTypeList } from "../interfaces/itemtype.interface";
import { Que... |
881f0e24b03428efe40c942968a01d9b31313541 | TypeScript | tomelam/mayhem | /tests/unit/core/Promise.ts | 2.53125 | 3 | import assert = require('intern/chai!assert');
import Deferred = require('dojo/Deferred');
import Promise = require('mayhem/Promise');
import registerSuite = require('intern!object');
registerSuite({
name: 'mayhem/Promise',
'resolve and progress'() {
var progressTriggered = false;
var promise = new Promise(func... |
6cd2e7dc823cb330b958ad88c7b08cad136b793a | TypeScript | dannycalleri/ture | /dist/trees/rect.d.ts | 2.8125 | 3 | import { Point2D } from "./point2d";
declare class Rect {
private _xMin;
private _yMin;
private _xMax;
private _yMax;
constructor(xMin: number, yMin: number, xMax: number, yMax: number);
readonly xMin: number;
readonly yMin: number;
readonly xMax: number;
readonly yMax: number;
w... |
e4d44c5eae01b536ad643d23f23da7ba79110b08 | TypeScript | ibrahimkarayel/TypeScriptDemo | /09_functions/03_driver.ts | 3.15625 | 3 | interface DCallback {
(dName: string): void
}
class DbLoader {
loadDriverName(callback: DCallback) {
callback("Mongo");
}
}
class DbController {
private _dName: string;
constructor(private dbLoader: DbLoader) {
}
get dName(): string {
return this._dName;
}
loadDri... |
8ae23a33091d5dd7fb829411b4dc73d8ff3dd50a | TypeScript | irkanu/temtem-api | /scripts/util/write.ts | 2.84375 | 3 | import { promises as fs } from "fs";
import path from "path";
import * as log from "./log";
import traverse, {
cleanStrings,
capitalizeType,
removeWikiReferences,
} from "./objectCleaner";
export function getDataPath(name: string) {
return path.join(__dirname, "..", "..", "data", `${name}.json`);
}
export def... |
ae8479ab5f84efcf6fb7d8d7dcc39aa666bf4f6f | TypeScript | alexeden/dotstar-node | /app/browser/src/app/leap-paint/lib/leap/finger.ts | 3.0625 | 3 | import { vec3 } from 'gl-matrix';
import { Pointable } from './pointable';
import { Bone } from './bone';
import { Triple, FingerType, FingerData, BoneType } from './types';
/**
* Constructs a Finger object.
*
* An uninitialized finger is considered invalid.
* Get valid Finger objects from a Frame or a Hand objec... |
82b30cd11a5dfbd912bee346317449c2c7c25397 | TypeScript | huaweicloud/huaweicloud-sdk-nodejs-v3 | /services/cloudpipeline/v2/CloudPipelineRegion.ts | 2.578125 | 3 | import { Region } from "@huaweicloud/huaweicloud-sdk-core/region/region";
interface RegionMap {
[key: string]: Region;
}
export class CloudPipelineRegion {
public static CN_NORTH_1 = new Region("cn-north-1", ["https://cloudpipeline-ext.cn-north-1.myhuaweicloud.com"]);
public static CN_NORTH_4 = new Regio... |
d8304c48e0f1be82790b4f516c0b63fe2e3ef524 | TypeScript | abelce/blogfrontend | /src/service/http.ts | 2.8125 | 3 | import Constants from "./constant"
const url = "http://127.0.0.1:9010"
let xhr: any;
class Deferred {
promise: any
resolve: any
reject: any
constructor() {
this.promise = new Promise((resolve: any, reject: any) => {
this.resolve = resolve;
this.reject = reject;
... |
64243b74eb62c8505a414a2ec90872e0d0b525e7 | TypeScript | comparIt/comparit-front | /src/app/shared/models/modelProperty.ts | 2.890625 | 3 | export class ModelProperty {
id: number;
name: string;
technicalName: string;
activated: boolean;
type: string;
filtrable: boolean;
filtrableAdvanced: boolean;
mandatory: boolean;
min: number;
max: number;
range: number[];
values: string[];
selectedValues: string[] = [];
isSaved = true;
... |
2d4ec7ac3fce2a62ac00d902863913b75f0866f9 | TypeScript | bgruening/ngl | /dist/declarations/trajectory/trajectory.d.ts | 2.75 | 3 | /**
* @file Trajectory
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @private
*/
import { Signal } from 'signals';
import { NumberArray } from '../types';
import Selection from '../selection/selection';
import Structure from '../structure/structure';
import TrajectoryPlayer, { TrajectoryPlayerInterpolate... |
c383a57034de817fb1eba7bc9031f46512ab098a | TypeScript | jiangshanmeta/meta | /src/0343.integer-break.343/solution.ts | 3.265625 | 3 | function integerBreak (n: number): number {
const dp:number[] = new Array(n + 1).fill(0);
dp[1] = 1;
for (let i = 2; i < dp.length; i++) {
for (let j = 1; j < i; j++) {
dp[i] = Math.max(dp[i], j * dp[i - j], j * (i - j));
}
}
return dp[n];
}
|
4e7b17cb5f93d3dfa9c2ce8e0c3bada1bd31b28c | TypeScript | alexfoxgill/biselect | /src/Debug.ts | 3.140625 | 3 | import { Extension } from "./Extension";
export function Debug() {
return Debug.create()
}
export namespace Debug {
const wrap = (name: string, f: Function) => (...args: any[]) => {
console.group()
console.log(`Calling ${name} with arguments:`, ...args)
const result = f(...args)
console.log("Resu... |
1e71814e4863a3574b0892af44429354f69f6cab | TypeScript | dtarvin/new-angular-2-components | /chapter_3/chapter_3.ts | 4.09375 | 4 | // valid ES6 or TypeScript
class User {
constructor(id) {
this.id = id;
}
getUserInfo() {
return this.getUserInfo;
}
}
//----------------------------------------------------------------
// simple TypeScript class
class Product {
private id: number;
private color: string;
con... |
df6437b25b98128f78e8709e07d2b550547b75ce | TypeScript | awanjila/angular-guessing-game | /app/guess-the-number.component.ts | 2.890625 | 3 | import { Component }from '@angular/core';
@Component({
selector: 'my-app',
template:
<div class="cointainer">
<h2> Guess the Number ! </h2>
<p class="well lead">Guess the computer generated random
number between 1 and 1000.</p>
<label>Your Guess:</label>
<input type="number" [value]="guess" (input)="gues... |
9f1c6f099c5f4aea43f2a5f832c84ccd50d263d7 | TypeScript | osamaalaa/aot-inventory | /frontend/src/app/pages/inventory/master-setup/stores-setup/stores-item-group-no/stores-items-group-no-model.services.ts | 2.734375 | 3 | /**
*
* * Model service for Stores Item Group No Components .
*
* *Features
* * Searching data
* * Storing data
* * Sorting data
*/
import { Injectable } from '@angular/core'
import { TableBase } from 'src/app/common/Table-base';
@Injectable()
export class StoresItemsGroupNoModelService extends TableBase{
... |
3377d7b58b8e82d4ae37d5d4b5a382f58e5c5384 | TypeScript | EyeSeeTea/Bulk-Load | /src/webapp/utils/colors.ts | 2.5625 | 3 | import _ from "lodash";
import { PaletteCollection } from "../../domain/entities/Palette";
// Returns a color brewer scale for a number of classes
export const getColorPalette = (palettes: PaletteCollection, scale: string, classes: number): string[] => {
const palette = palettes[scale] ?? {};
return palette[cl... |
131371d260fbc5ccef0c272b9137a699b7b0650e | TypeScript | BlackWolfBY/dreamcar_api | /src/mapper/abstract.mapper.ts | 2.9375 | 3 | export interface AbstractMapper<E, D> {
toDto(entity: E): D;
toEntity(dto: D): E;
}
|
e181a05aaf55515f037871654b4cbb1974e270fb | TypeScript | nrjackson/social-framework | /social-framework-backend/src/utils/utils.ts | 2.59375 | 3 | import { hashSync, genSaltSync, compareSync } from 'bcrypt-nodejs';
import * as jwt from 'jsonwebtoken';
import { Config } from '../constant/config';
import { IUser } from '../model/user';
export class Utils {
// generating a hash
public static generateHash = function(password) {
return hashSync(password, genS... |
f6d1d20161c41271f03832f2f84fd483b138726e | TypeScript | ryrocks/ng-arithmetic-operations | /src/lib/ng-arithmetic-operations.service.ts | 2.9375 | 3 | import { Injectable } from '@angular/core';
import { ErrorCode, Sign, ConvertOperator, ConvertSign, Operator } from './const';
import { BehaviorSubject, Observable } from 'rxjs';
export interface ErrorMsg {
code: string;
msg: string;
}
@Injectable({
providedIn: 'root'
})
export class NgArithmeticOperationsServ... |
820a8a585ed285542c57840ca400515eda5b66ab | TypeScript | LucasGomes9/training_project | /src/app/controllers/EmployeeController.ts | 2.765625 | 3 | import { getRepository } from 'typeorm';
import Employees from '../models/Employees';
interface Request {
name: string;
email: string;
}
class FuncionariosController {
public async store({ name, email }: Request): Promise<Employees> {
const employeesRepository = getRepository(Employees);
... |
73c12b27a62ccd987918427a2bae3364d11bc786 | TypeScript | oflynned/Mongoize-ORM | /src/example/credential-validation.example.ts | 2.703125 | 3 | import User from "./models/user";
import {
Repository,
InMemoryClient,
bindGlobalDatabaseClient
} from "../../src";
const main = async (): Promise<void> => {
await Repository.with(User).hardDeleteMany({});
const user: User = await new User().build({
name: "John Smith",
email: "email@test.com",
p... |
b404c38fc5f56ff4993d5755a58bb0788d2430b7 | TypeScript | Marianabnn/practica_examen | /main.ts | 2.546875 | 3 | let conteo = 0
let A = 0
let B = 0
let SUMA = 0
input.onButtonPressed(Button.A, function () {
conteo = 2
while (conteo <= 10) {
basic.showNumber(conteo)
basic.showIcon(IconNames.Ghost)
conteo += 2
}
basic.showString("BOO!!!")
})
input.onButtonPressed(Button.AB, function () {
... |
12ef765ae08047d4616c8f96c41cbb16a9784226 | TypeScript | littleTigerRunRunRun/PaperWing | /src/configure/color.ts | 3.65625 | 4 | // 颜色类型
// rgba颜色字符串
// example1: 'rgba(255, 255, 255, 1)
// example2: 'rgba(100,100,200,0.5)
export type RGBAColor = string
export function isRGBAColor() {
}
// rgb颜色字符串
// example1: 'rgb(255, 255, 255)
// example2: 'rgb(100,100,200)
export type RGBColor = string
export function isRGBColor() {
}
// 归一化颜色数组
// e... |
156b5d52232b0a1dd8b66e162abc44799cb72d85 | TypeScript | cnhuzi/Espider | /src/ts/spider/blur.ts | 2.9375 | 3 | //this is for vuejs.cn
function blur(finder:string):string[]{
let newfinder=finder.split('.').map((it)=>{
return '.'+it;
});
newfinder.splice(0,1);
// console.log($);
return combination(newfinder,[],[]);
}
function combination(arr:string[],newarr:string[][],ans:any):string[]{
... |
bc135cca2df15bb61602c3319a6aadb96a50bf51 | TypeScript | oricalvo/input-mask | /base.ts | 2.75 | 3 | import {
cloneBuf, cloneFieldsByPos, copyArray, Fields, FieldsOptions, findFieldByPos, isValidDate, KEY_BACKSPACE, KEY_DELETE,
KEY_DOWN,
KEY_LEFT,
KEY_RIGHT, KEY_UP,
parsePattern
} from "./common";
export abstract class InputMaskBase {
input: HTMLInputElement;
pos: number;
pattern: stri... |
09b3f08882cf3c3f014db494b29b3e9c60ea22cc | TypeScript | YuNode/omicron | /src/example/example.ts | 3.171875 | 3 | import * as omicron from "../index";
import { IO } from "fp-ts/lib/IO";
import { RouteResponse } from "../core/src/http/router/router.interface";
import * as E from "fp-ts/lib/Either";
import { HttpRequest } from "../core/src/http.interface";
const wait = (timeout: number) => new Promise((resolve) => setTimeout(resolve... |
d5bae1c5435c3d56d48bcb47c3d059eeb6090189 | TypeScript | rugglcon/twitch-bot | /src/bot/lib/readFileAsDataUrl.ts | 3.140625 | 3 | import fs from 'fs'
import path from 'path'
const mimeType = (filePath: string): string => {
const ext = path.extname(filePath)
const mainType =
ext === 'mp3'
? 'audio'
: 'image'
const subType =
ext === 'mp3'
? 'mpeg'
: ext
return `${mainType}/${subType}`
}
/**
* read a file a... |
c6d7a08be923e10bd802d86caa611e577bc656a0 | TypeScript | jweissman/eve | /src/eve/vm/data-types/EveInteger.ts | 2.671875 | 3 | import { EveDataType } from './EveDataType'
export class EveInteger implements EveDataType {
private internalValue: number;
constructor(value: number) { this.internalValue = Number(value) }
get js(): number { return Number(this.internalValue) }
}
|
32b55801948ced307a71c3789f451238507f5d15 | TypeScript | ThiagoBussola/teste-gazin | /developers/services/developers.service.ts | 2.578125 | 3 | import DevelopersDao from '../daos/developers.dao'
import { CRUD } from '../../common/interfaces/crud.interface'
import { CreateDeveloperDto } from '../dto/create.developer.dto'
import { PutDeveloperDto } from '../dto/put.developer.dto'
class DevelopersService implements CRUD {
async create (resource: CreateDevelope... |
07365a4a8a7920b1aec62d92ceeab6157448c39c | TypeScript | krushna-sharma/weather-forecast | /src/sagas.ts | 2.53125 | 3 | import { call, put, takeEvery } from "redux-saga/effects"
import { actionTypes } from './actions/actionTypes';
import { Api, Method } from "helpers/apiHelper/webcall2";
import { apiList } from 'helpers/apiHelper/apiList';
import { IReducerActionType } from "interfaces";
import { showLoader, hideLoader } from "actions";... |
7174dacd8ed316154cb18718c843524ad5c12463 | TypeScript | gitter-badger/xrm-mock | /src/page/enumattribute/enumattribute.mock.ts | 2.671875 | 3 | /// <reference path="../../../node_modules/@types/xrm/index.d.ts" />
class EnumAttributeMock implements Xrm.Page.EnumAttribute {
controls: Xrm.Collection.ItemCollection<Xrm.Page.Control>;
initialValue: number | boolean;
attribute: Xrm.Page.Attribute;
constructor(attribute: Xrm.Page.Attribute, controls... |
57b36896a66fed67e74720dc139dc50568271e61 | TypeScript | thluiz/jarvis-whitefox | /domain/services/templates/funnyMessages.ts | 3.171875 | 3 | export class FunnyMessages {
public static randomKeyValueMessage(): string {
const messages = this.keyValueMessages();
return this.getRandomString(messages);
}
public static greetingsResponse(): string {
const messages = [
"saudações!",
"Oooiii!",... |
1a2200fda795bdddbbe9b2d9e4d58a8b7c3ce234 | TypeScript | GDoval/Programacion-III | /typescript/.vscode/persona.ts | 3 | 3 | namespace Gente {
export abstract class Persona {
private _nombre : string;
private _apellido : string;
private _dni : number;
private _sexo : string;
constructor(nombre :string, apellido: string, dni : number, sexo : string)
{
this._apellido = apellido;
th... |
703a0fd79088e7ecd0fcc9d8875c3a619af5bbc5 | TypeScript | jigglypop/deal-14 | /backend/src/middlewares/error.middleware.ts | 2.734375 | 3 | import HTTPError from '../errors/http-error';
import { Request, Response, NextFunction } from 'express';
import { ValidationError } from 'class-validator';
const createErrorResponse = (status: number, message: string) => {
return {
status,
message,
};
}
const errorMiddleware = (error: Error | Error[], re... |
5822061132a78d960ecfbc524098f355fcb473bf | TypeScript | Becklyn/mojave | /polyfill/svg-use.ts | 2.75 | 3 | import fetch from "./fetch";
import {find} from "../dom/traverse";
type SvgUsages = {
[key: string]: {
hash: string,
element: HTMLElement,
}[],
};
/**
* Adds support for <svg><use xlink:href="url#id"/></svg> for older IE and Edge
*/
export default () =>
{
if (
// IE 10+
... |
27ef12b7d9621a004538994cc89ffeae3e2e221f | TypeScript | shrikbiz/Snakes | /src/helper/Colors.ts | 3.046875 | 3 | export type ColorName = "pink" | "green" | "orange" | "blue" | "yellow" | "red";
export type RGB =
| "cb6bff"
| "cffa41"
| "ffb36b"
| "41faf4"
| "fffa6b"
| "ff8269";
export interface ColorList {
name: ColorName;
hex: number[];
rgb: RGB;
}
export const GetRGBList: RGB[] = [
"cb6bff",
"cffa41",
... |
fa52343eb2c6973a2baca5836a5becd4c5d45f72 | TypeScript | cribe78/devctrl | /Communicators/ClearOne/AP400Communicator.ts | 2.578125 | 3 | import { TCPCommunicator } from "../TCPCommunicator";
import { commands } from "./AP400Controls";
import {TCPCommand} from "../TCPCommand";
import {IClearOneCommandConfig, ClearOneCommand} from "./ClearOneCommand";
import * as debugMod from "debug";
let debug = debugMod("comms");
export interface IAP400CommandConfig... |
6fa7e1056b08d56b2036e2a46b8c954a2d741727 | TypeScript | RafaelBadykov/Demip | /src/app/internal-rate-of-return/approximate-method/approximate-method.component.ts | 2.5625 | 3 | import {Component, OnInit} from '@angular/core';
import {FormControl, FormGroup, Validators} from '@angular/forms';
@Component({
selector: 'app-approximate-method',
templateUrl: './approximate-method.component.html',
styles: []
})
export class ApproximateMethodComponent implements OnInit {
values: FormGroup =... |
b31f38b02e4cefd85116d2b3f3936535eb5fdd31 | TypeScript | dreymaior/sg-treinamento-angular | /app/type.d.ts | 2.515625 | 3 | /*
Declaration files are how the Typescript compiler knows about the type information(or shape) of an object.
They're what make intellisense work and make Typescript know all about your code.
A wildcard module is declared below to allow third party libraries to be used in an app even if they don't
provide their... |
c7891ebe736bafd063929177a476f11794f4bee5 | TypeScript | BackHomeAction/backhome-miniapp-volunteer | /src/store/modules/common.ts | 2.5625 | 3 | import { Module } from "vuex";
import { CommonState, RootState } from "../types";
import { MutationTypes } from "@/enums/mutationTypes";
import { ActionTypes } from "@/enums/actionTypes";
import {
requestGetOnlineVolunteerNumber,
requestGetVolunteerNumber,
} from "@/api/volunteer";
import { requestGetOpenCaseNumber... |
31b1c1834a697396802d9aa2b3907f620409ec63 | TypeScript | iamvena/freeswitchcall | /project/client/src/types/types.ts | 3.859375 | 4 |
// Defining type to a variable
let stageName: string = "A Beautiful Vue";
let roomSize: number = 100;
let isCOmplete: boolean = false;
const shoppingList: string[] = ['apple', 'bananas', 'cherries'];
let generateFullName = (firstName: string, lastName: string):string => {
return `${firstName} ${lastName}`;
}
t... |
7b805baaa41e3be35248469c55c37c51679def3c | TypeScript | retyui/pandadoc-restql | /src/verdor/comments/serializer.ts | 2.640625 | 3 | import { castDateFields } from "../../utils/castDateFields";
export const parseComment = (comment: any) => {
if (Array.isArray(comment.replies)) {
comment.replies = comment.replies.map((
// @ts-ignore
reply
) => castDateFields(reply, ["date_created", "date_updated"]));
}
return castDateField... |
38f58458a86ceba792da6565b2df79c6a442e179 | TypeScript | peturv/sushi | /src/fshtypes/common.ts | 3.234375 | 3 | import { OnlyRuleType } from './rules/OnlyRule';
export function typeString(types: OnlyRuleType[]): string {
const references: OnlyRuleType[] = [];
const canonicals: OnlyRuleType[] = [];
const normals: OnlyRuleType[] = [];
types.forEach(t => {
if (t.isReference) {
references.push(t);
} else if (t... |
f2dd2475f9a7d3abfed2e9dc15b6a7ee05383a64 | TypeScript | quanlinc/ixa-helper | /src/pages/village.ts | 2.609375 | 3 | import { ALL_UNITS, Facility, TRAINING_MODE, UNIT_CATEGORY,
YARI,
YUMI,
KIBA,
KAJI,
} from '@/components/facility'
import { currentVillage } from '@/utils/data'
import { createElement, query, queryAll } from '@/utils/dom'
import { compose, equals, forEach, forEachObjIndexed, h... |
0e560b769dcc03653c11f6f9d505bf712970e34c | TypeScript | yakovenkodenis/requestum-test | /src/core/redux/reducers/__tests__/searchReducer.test.ts | 2.578125 | 3 | import {
setCurrentPage,
setCurrentSearchTerm,
setSearchCriteria,
setSearchHistory,
} from '../../actions/search/search.actions';
import { searchReducer } from '../searchReducer';
describe('searchReducer', () => {
const initialState = {
criteria: 'Repositories',
currentPage: 1,
historyItems: ['hi... |
67acaa6589310dcf02f1f1a4525fafdeb77735fe | TypeScript | Brusalk/react-wow-addon | /src/reconciler.ts | 2.65625 | 3 | import { Component } from './component';
import { InternalElement, TEXT_ELEMENT } from './element';
import { cleanupFrame, createFrame, updateFrameProperties } from './wow-utils';
export interface Instance {
publicInstance?: Component;
childInstance: Instance | null;
childInstances: Array<Instance | null>;
hos... |
9011da1553500e1da4d67809d060ace8f4d90777 | TypeScript | ember-cli/ember-ajax | /addon/raw.ts | 2.65625 | 3 | import AjaxRequest from './ajax-request';
import AJAXPromise from 'ember-ajax/-private/promise';
import { Response, RawResponse, AJAXOptions } from './-private/types';
/**
* Same as `request` except it resolves an object with
*
* {response, textStatus, jqXHR}
*
* Useful if you need access to the jqXHR object fo... |
10e7e29da6b5b30ffb00595f02e9155986dd9b16 | TypeScript | thnt/HistoryCleaner | /src/options.ts | 2.75 | 3 | import { browser } from "webextension-polyfill-ts";
import { ToggleButton, ToggleButtonState } from "./ToggleButton";
import { Message, MessageState } from "./MessageInterface";
import { i18n } from "./i18n";
import { Options, OptionsInterface } from "./OptionsInterface";
// Input elements
// type casting because the ... |
acbef4e9e5fb5c903a020bdd3c0c73baba90e472 | TypeScript | wenj91/pixel-skeletal-animation-editor | /src/editor/workspace-paint/tools/Tool.ts | 2.671875 | 3 | import Vue from 'vue'
import Class from '../../../utils/Class'
import WorkspacePaint from '../WorkspacePaint'
export default interface Tool {
/**
* Unique ID for each tool type.
*/
id: string;
/**
* Tool's display name.
*/
name: string;
/**
* Icon image url.
*/
ic... |
6143de2c65ae71b8da6e812988fef21f4e3fd06f | TypeScript | SpeedCurve-Metrics/speedcurve-cli | /src/util/resolve-site-ids.ts | 2.96875 | 3 | import * as SpeedCurve from "../index";
import log from "../log";
import Site from "../model/site";
type SiteIdOrName = string | number;
const sitesCache: { [key: string]: Site[] } = {};
async function populateSitesCacheForAccount(key: string): Promise<void> {
await SpeedCurve.sites.getAll(key).then((sites) => {
... |
281e6740fefc2f0966263b8531a97ee6f94aa05f | TypeScript | tnrich/ve-range-utils-ts | /test/flipContainedRange.test.ts | 2.546875 | 3 | /* eslint-disable no-var*/
import { flipContainedRange } from "../src";
import * as chai from "chai";
chai.should();
describe('flipContainedRange', function () {
it('non origin spanning, fully contained inner', function () {
var innerRange = {
start: 5,
end: 13
}
var outerRange = {
start: 0,
end: 20... |
bab4c11738f5d965fc23d1c4a60d3ba593e34cc8 | TypeScript | Dorkt/Teste | /Downloads/ead-back-master/ead-back-master/src/models/schemas/forum.model.ts | 2.71875 | 3 | import Mongoose, { Document } from 'mongoose'
/**
* Modelo de Fórum:
* O fórum será onde o tutores ou alunos poderão abrir uma
* conversa para um contato dentro do sistema.
**/
interface IMessage extends Document {
userId: string,
text: string,
date: Date
}
export interface IForum extends Document {
... |
85eb1bf3c5a96fa0b136d6a6dc3f7767e7c8f29d | TypeScript | nagasu/jest-sample | /src/array.test.ts | 2.53125 | 3 | test('array indexOf test', () => {
const values = ['banana', 'apple', 'orange', 'apple'];
expect(values.indexOf('apple')).toBe(1);
expect(values.lastIndexOf('apple')).toBe(3);
});
|
7c703b6388af6c6b6062673a0f18f5c5de0375aa | TypeScript | crazytoucan/math2d | /src/vecFunctions/vecTransformBy.ts | 3.453125 | 3 | import { Mat2d, Vec } from "../types";
import { vecAlloc } from "./vecAlloc";
import { vecReset } from "./vecReset";
/**
* Multiplies the vector by an affine matrix.
*
* This computes a left multiplication of the vector by a matrix, i.e. _M_ × _v_.
*
* Per usual linear algebra rules, multiplying the vector `(x, y... |
56413110baf6369e8c851d705c1d32dd8571b56c | TypeScript | warrenhodg/lib-mealie-crypt | /ts/users.ts | 3.09375 | 3 | import * as keys from './keys';
export interface IUsers {
[name: string]: User;
}
export class Users {
public static fromO(o: any): IUsers {
let result: IUsers = {};
for (let name in o) {
result[name] = new User(o[name]);
}
return result;
}
public static toO(value: IUsers): any {
... |
bed1db9a0ee1d0b1b3152c09eeb56a13c27eb3d8 | TypeScript | jappe999/terrain-generator | /src/entity/Tile.ts | 2.546875 | 3 | import { container } from "../app";
import { Sprite, Texture } from "pixi.js";
import World from "../world/World";
export default class Tile extends Sprite {
constructor(public id: number) {
super(Texture.WHITE);
this.x =
World.tileSize * Math.floor(id % World.width) +
cont... |
9e721012409aed4f1ba031b54e29fa1d7d1d1e4b | TypeScript | Stilgar84/MyScreepsAI | /src/components/creeps/roles/claim_room2.ts | 2.75 | 3 |
import * as move2room2 from'../actions/move2room2'
export function run(creep: Creep): void {
if(move2room2.move(creep)) {
let targets = creep.room.find<Structure>(FIND_STRUCTURES, {
filter: (s: Structure)=>s.structureType==STRUCTURE_CONTROLLER
})
if(targets.length>0) {
... |
3e476b7cb05464b90a0fe8d060c688aaa4f5f7f9 | TypeScript | NG-ZORRO/schematics | /scrtips/copy-resources.ts | 2.5625 | 3 | import * as fs from 'fs-extra';
import * as path from 'path';
const srcPath = path.join(process.cwd(), 'src');
const targetPath = path.join(process.cwd(), 'dist/schematics');
const copyFilter = (p: string) => !p.endsWith('.ts');
export function copyResources(): void {
fs.copySync(srcPath, targetPath, { filter: copy... |
85d0dd7c20ddb0ed56930f87dbc85f171cf0882f | TypeScript | artsy/eigen | /src/app/Components/ArtworkGrids/utils/sections.ts | 3.21875 | 3 | export function getSectionedItems<T extends { image: { aspectRatio: number } | null }>(
items: T[],
columnCount: number
) {
const sectionRatioSums: number[] = []
const sectionedArtworksArray: T[][] = []
for (let i = 0; i < columnCount; i++) {
sectionedArtworksArray.push([])
sectionRatioSums.push(0)
... |
63416e7d18f50606e42d9186ebabc94c7a7a85fe | TypeScript | Mennu-zz/rubix_be | /src/db/models/productType.ts | 2.546875 | 3 | import { Table, Column, Model, AutoIncrement, PrimaryKey, ForeignKey, AllowNull, Default } from 'sequelize-typescript';
import { Product } from "./product";
import { v4 as uuidv4 } from 'uuid';
@Table
export class ProductType extends Model<Partial<ProductType>> {
@Default(uuidv4)
@PrimaryKey
@Column
id... |
3236d4fbc49b2c30c14a8c1b109c4926b300089c | TypeScript | areangonzalez/frontend-rnnutre | /src/app/core/services/authentication.service.ts | 2.625 | 3 | import { Injectable } from '@angular/core';
import { ApiService } from './api.service';
import { map } from 'rxjs/operators';
import { JwtService } from './jwt.service';
@Injectable()
export class AuthenticationService {
constructor(private _apiService: ApiService, private _jwtService: JwtService) { }
/**
* L... |
a37ee6829419a948cfa15f128d16c810d8c3a8af | TypeScript | moreati/wallet-site | /src/explorer_api.ts | 2.53125 | 3 | import axios, { AxiosInstance } from 'axios'
import { ITransactionData } from './store/modules/history/types'
// Doesn't really matter what we set, it will change
const api_url: string = 'localhost'
const explorer_api: AxiosInstance = axios.create({
baseURL: api_url,
withCredentials: false,
headers: {
... |
4c344e3563595f2ce00677cd0c0cd8cfeeeb0fae | TypeScript | ChenxuJWang/notion-avatar | /src/types.ts | 2.671875 | 3 | // export enum AvatarStyle {
// Accessories,
// Beard,
// Details,
// Eyebrows,
// Eyes,
// Face,
// Glasses,
// Hairstyle,
// Mouth,
// Nose
// }
export type AvatarConfig = {
accessories: number;
beard: number;
details: number;
eyebrows: number;
eyes: number;
face: number;
glasses: n... |
0977ab985ba8eb6e168b9005ae8e58970091f88e | TypeScript | PhaserEditor2D/PhaserEditor2D-v3 | /source/editor/plugins/phasereditor2d.scene/src/ui/sceneobjects/nineslice/NineSliceExtension.ts | 2.671875 | 3 | namespace phasereditor2d.scene.ui.sceneobjects {
export class NineSliceExtension extends BaseImageExtension {
private static _instance = new NineSliceExtension();
static getInstance() {
return this._instance;
}
constructor() {
super({
phas... |
74063993dc88a47fad532d1e8491f69d15573c61 | TypeScript | ahyaemon/musikui | /src/domain/Contest.ts | 2.90625 | 3 | import Musikui from "./Musikui"
import MusikuiDate from "../value_object/MusikuiDate"
import Respondent from "@/domain/Respondent"
export default class Contest {
public static default() {
return new Contest(
0,
MusikuiDate.from_string("2000/01/01"),
"default c... |
12c31d2e199cbec737894a8a765b6e7634339f74 | TypeScript | angular/angular | /packages/core/src/util/closure.ts | 2.890625 | 3 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Convince closure compiler that the wrapped function has no side-effects.
*
* Closure compiler always assumes... |
1118f6107fc47f935c711c3bc99305100b65076e | TypeScript | sebreceveur/DrinkVendingMachine | /ClientApp/app/components/coinstore/coinstore.component.ts | 2.8125 | 3 | import { Component, Input, OnChanges, OnInit, SimpleChange } from '@angular/core';
import { CoinService } from '../../service/coin.service';
import { Coin } from '../../model/coin';
@Component({
selector: 'app-coinstore',
templateUrl: './coinstore.component.html',
styleUrls: ['./coinstore.component.cs... |
3ca86b473a8278532873804ae7983d2ae0002024 | TypeScript | doniseferi/salahtimes | /src/salah/__tests__/dhuhr.test.ts | 2.703125 | 3 | import { iterativeTest, generateRandomDate, randomLongitude } from '../../testUtils'
import { Longitude } from '../../geoCoordinates'
import { dhuhr } from '..'
import { success } from '../../either'
import { getNoonDateTimeUtc } from 'suntimes'
describe('Dhuhr', () => {
test('returns the midday date time value', ()... |
f86515ab9720b5646cccc0bf066678bc8d709641 | TypeScript | alucardstrikes/cuke-protractor | /features/step_definitions/search_steps.ts | 2.640625 | 3 | import { Given, When, Then } from "cucumber";
import { expect } from "chai";
Given('I Log into google', { timeout: 100 * 1000 }, async function () {
await this.google_search.waitForPageUrlToLoad();
});
When('I search for {string}', { timeout: 100 * 1000 }, async function (searchString) {
await this.google_search... |
73453e6ccd2f0e25de7af52115019e0028a19725 | TypeScript | hongji85/TPPChatBot | /angular-src/src/app/Services/socket.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { Observable, Observer, BehaviorSubject, Operator } from 'rxjs';
import * as socketIo from 'socket.io-client';
export class Message {
constructor(public content: string, public sentBy: string) {}
}
export class MessageObject {
constructor(public cust... |
a5c80b605a32daecdbc082b664bda390dbff114d | TypeScript | john-sonz/warships | /src/ts/Board.ts | 3.0625 | 3 | import ShipSetter from './ShipSetter';
import { comment } from './decorators';
interface shipSetting {
x: number;
y: number;
direction: boolean;
size: number;
}
enum State {
Empty,
Taken,
Hit,
Miss
};
export enum Win {
Player,
Machine
}
export enum PlayerMoves {
AlreadyShot... |