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 |
|---|---|---|---|---|---|---|
2406742f13518efba198df3c7f7ad70b366ae2c3 | TypeScript | parkerproject/brain.js | /src/neural-network-types.ts | 3.046875 | 3 | /** TODO: The following should be moved to neural-network.ts once that is converted to typescript. Added here until neural-network.js is converted */
export interface INeuralNetworkOptions {
/**
* @default 0.5
*/
binaryThresh?: number;
/**
* array of int for the sizes of the hidden layers in the network... |
354e3f82d01dc84d332a2b1b6ea586722b746fb9 | TypeScript | Mike-Stupich/auto-type-abi | /index.ts | 3.125 | 3 | import { OptionDefinition, Options } from 'command-line-args';
import * as cmd from 'command-line-args';
import { appendFileSync } from 'fs';
interface Config {
interface: string;
inputMappings: {
[key: string]: string[];
};
outputMappings: {
[key: string]: string[];
};
abiDir: any;
fillInterface... |
fb2ee8e0f1a5f6d0425c24144920cbc1f5e8ce25 | TypeScript | J05HI/website | /store/menu.ts | 2.5625 | 3 | import { MutationTree } from 'vuex'
export const state = () => ({
open: false,
})
export type MenuModuleState = ReturnType<typeof state>
export const mutations: MutationTree<MenuModuleState> = {
toggle(state, open) {
state.open = open !== undefined ? open : !state.open
},
close(state) {
state.open =... |
2152b85361bb058819e6e196ff92e2ab23e5b89f | TypeScript | nemeCIS6/cadds-backend | /src/classes/common/awaitReadyBase.ts | 2.75 | 3 | class awaitReadyBase {
protected _ready:boolean = true;
private _runningPromise?:Promise<void>;
public ReadyAsync = async ():Promise<void> => {
if(this._ready){
return;
}
if(this._runningPromise === undefined || this._runningPromise.isPending){
await this._... |
9678e1cd76a835e1f282935d29e76c67f1fedd31 | TypeScript | ErickTamayo/react-native-breeze | /src/hooks/useMedia.ts | 2.71875 | 3 | import { useCallback } from "react";
import { useWindowDimensions } from "react-native";
import { PlatformStyle, MediaStyle } from "../helpers/styles";
import { mergeObjects } from "../helpers/objects";
const useMedia = (): ((style: PlatformStyle) => MediaStyle) => {
const { width } = useWindowDimensions();
retur... |
fd1dec769b20708140a445638268d7c676f07693 | TypeScript | dianalemen/homework | /second_task/src/Weapon.ts | 3.40625 | 3 | import { Item } from './Item'
export abstract class Weapon extends Item {
baseDamage: number;
damageModifier: number;
durabilityModifier: number;
baseDurability: number;
effectiveDamage: number;
effectiveDurability: number;
constructor(
name: string,
baseDamage: number,
baseDurability: number,
value: n... |
95814a70137953ee672efd8da046a9860d3484d6 | TypeScript | msciborski/packt-reminder | /Server/src/authentication/authentication.controller.ts | 2.671875 | 3 | import * as express from 'express';
import Controller from '../interfaces/controller.interface';
import validationMiddleware from '../middlewares/validation.middleware';
import RegisterUserDto from '../user/user.dto';
import userModel from '../user/user.model';
import LoginDto from './authentication.dto';
import Authen... |
444cfb1a41caeb9e32f657984cb77fc6e0cdd0ab | TypeScript | brunopaixao87/MyChatFirebase | /src/pipes/capitalize/capitalize.ts | 3.03125 | 3 | import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'capitalize',
})
export class CapitalizePipe implements PipeTransform {
transform(value: string, onlyFirst: boolean) {
if (!value) {
return value;
}
if (value.length <= 1) {
return value.toLocaleLowerCase();
}
if (... |
18246d7a461366e098afc9de4125b7026d2b4e92 | TypeScript | davsmithhpfc/AOC2020 | /utils.ts | 2.890625 | 3 | import fs from 'fs';
import readline from 'readline';
export const fileToStringArray = async (filePath: string) => {
const fileStream = fs.createReadStream(filePath);
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity,
});
let response = [];
for await (const line of rl) {
... |
79daa8819ff47e15128a61c43b9f996344989922 | TypeScript | jeroenhuinink/adventofcode2018 | /1/src/1b.ts | 2.8125 | 3 | import * as fs from "fs";
fs.readFile("input.txt", (err, data) => {
if (err) {
throw err;
}
const changes = data
.toString()
.split("\n")
.map(s => parseInt(s));
const seen: boolean[] = [];
let frequency = 0;
for (let i = 0; ; i++) {
const value = changes[i % changes.length];
if (... |
776ba61708751c38c736e63305d93c7c51c3038e | TypeScript | alecsandrobs/the-internet-testing-serenityjs | /features/step_definitions/file-upload.steps.ts | 2.5625 | 3 | import { DataTable, Given, Then, When } from '@cucumber/cucumber';
import { Ensure, equals, not } from '@serenity-js/assertions';
import { actorCalled, actorInTheSpotlight, Duration, Loop, Note, TakeNote } from '@serenity-js/core';
import { Click, Enter, isPresent, Navigate, Text, Wait } from '@serenity-js/protractor';... |
3bd2080f47b0e903af87d3fa0accba6d027e0e92 | TypeScript | NexisSis/lecture-1 | /src/blocks/sensor/sensor.ts | 2.71875 | 3 | document.addEventListener("DOMContentLoaded", function(event) {
const image = document.querySelector<HTMLScriptElement>('.image');
//stackoverflow fix
const parentNode = <HTMLScriptElement>image.parentNode;
// что б не таскалась картинка
image.addEventListener('dragstart', (event) => {
eve... |
891e79c108eee727939f8acac185803cb8fc2867 | TypeScript | mosmartin/ts-custom-package-demo | /src/Food.ts | 3.15625 | 3 | import { InvalidFoodAmountError } from "./errors/InvalidFoodAmountError";
import { EmptyFoodNameError } from "./errors/EmptyFoodNameError";
import { Nutrition } from "./types/Nutrition";
export class Food {
constructor(
private readonly name: string,
private readonly unit: string,
private readonly baseVa... |
126c77e21b25ba518891dd544a3e5db6ba695999 | TypeScript | JACrosman/jsplumb-test2 | /src/app/steps/step.model.ts | 2.953125 | 3 | export interface IStep {
id: number;
name: string;
type: string;
next: number;
previous: number;
}
export interface IPopover extends IStep {
target: string;
siblings: number[];
}
export interface IBranch extends IStep {
yes: number;
no: number;
converge: number;
}
export class Popover implements... |
747a37c0dc423513e8824babbd7316d54fc53f8a | TypeScript | TimV98/IKREFACT | /src/app/expense/expense.model.ts | 2.8125 | 3 | /**
* The Expense Model.
*
* @author Sergi Philipsen.
*/
export class ExpenseModel {
title: string;
description: string;
costItem: string;
amount: number;
date: Date;
company: string;
expenseID: number;
constructor(title: string = '',
description: string = '',
costItem:... |
7cf8f46efa6554fb90649fd6e3a3f82f7b5970d1 | TypeScript | ghiscoding/slickgrid-universal | /packages/common/src/interfaces/resizerOption.interface.ts | 3.234375 | 3 | export interface ResizerOption {
/** Defaults to false, do we want to apply the resized dimentions to the grid container as well? */
applyResizeToContainer?: boolean;
/** Defaults to 'window', which DOM element are we using to calculate the available size for the grid? */
calculateAvailableSizeBy?: 'container'... |
55639cb502aeb520fcec244009252ffda9d9bab1 | TypeScript | yehudacooper/nestjs-shop-app-server | /src/auth/auth-credentials.dto.ts | 2.578125 | 3 | import{IsString,MinLength,MaxLength} from 'class-validator'
export class AuthCredentialsDto{
@IsString()
@MinLength(4)
@MaxLength(20)
username:string;
@IsString()
@MinLength(4)
@MaxLength(20)
password:string;
} |
919a35823fa3fb615ad3b22c28ff273db984663f | TypeScript | gazmull/eros-bot | /src/commands/tag/leaderboard.ts | 2.921875 | 3 | import { GuildMember, Message, TextChannel } from 'discord.js';
import Command from '../../struct/command';
import { Tag } from '../../struct/models/Tag';
export default class extends Command {
constructor () {
super('tag-leaderboard', {
description: {
content: 'Displays a leaderboard of tags from ... |
9176df7989d41aac3f1b68572436cf664f2011da | TypeScript | clardizabal/options-portfolio-analysis | /app/core/Portfolio.ts | 2.796875 | 3 | import { addDecimal,
adjustmentTrade,
Trade,
Transaction,
TransactionDTO,
openingTrade, closingTrade, parseLegs, handleExerciesOrAssignment,
Strategies
} from '../index';
export const shouldBeOneTrade = (dateOne: string, dateTwo: string) => {
const tradeDateOne = new Date(dateOne);
cons... |
a99cd5b1c2e89c1817666db37db28cd649f2841e | TypeScript | david-mateogit/algorithms-practice | /arrayConversion.ts | 4.25 | 4 | function arrayConversion(inputArray: number[]): number {
let newArr: number[] = [...inputArray];
let isOdd: boolean = true;
function workPairs(arr: number[], flag: boolean): number[] {
const results: number[] = [];
for (let i = 0; i < arr.length; i += 2) {
if (arr[i + 1]) {
!flag && results... |
f9d4ca573685a4ecfe87119c632088e258f9ab23 | TypeScript | spatools/promizr | /lib/tapOn.ts | 3.046875 | 3 | import type { AsyncFunction } from "./_types";
import type { MethodNames } from "./_internal";
import execOn from "./execOn";
/**
* @public
*
* The sames as {@link tap} but apply the `task` with `owner` as this context.
*
* @param owner - The this context to apply when calling the task
* @param task - The ke... |
519374e1fcf2b113108662e8da04c8a1ad7f688a | TypeScript | kallaspriit/blockchain-express-middleware | /src/Invoice.test.ts | 2.546875 | 3 | import { Invoice, InvoiceAmountState, InvoicePaymentState } from "./";
import { processInvoiceForSnapshot } from "./Blockchain.test";
const RECEIVING_ADDRESS = "2FupTEd3PDF7HVxNrzNqQGGoWZA4rqiphq";
describe("Invoice", () => {
it("should enable serialization and de-serialization", async () => {
const invoice = n... |
54fea72fc4db78e0653e814df65e19d0b8d49e03 | TypeScript | aish1698/Online-Course-Portal-For-A-Campus-CS-891-Group-3 | /front-end/src/app/video-call/video-call.component.ts | 2.515625 | 3 | import { Component, OnInit,ViewChild } from '@angular/core';
declare var Peer:any;
@Component({
selector: 'app-video-call',
templateUrl: './video-call.component.html',
styleUrls: ['./video-call.component.css']
})
export class VideoCallComponent implements OnInit{
@ViewChild('myvideo',{static:true}) myVideo:any;
... |
838283670a6e832781df1ce4cfb843c1162c1b42 | TypeScript | calogar/geek-school | /src/school/services/students/students.service.ts | 3.109375 | 3 | import { Injectable } from '@nestjs/common';
import { Student } from 'src/school/models/student.model';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
@Injectable()
export class StudentsService {
constructor (
@InjectRepository(Student)
private _repos... |
edb2338f90098ebbd138a9db300b11b9f31b2ddc | TypeScript | literat/workshop_testing-react | /src/01_functions/e_mock-functions/forEach.ts | 2.9375 | 3 | export function forEach(items: Array, callback: any): void {
for (let index = 0; index < items.length; index++) {
callback(items[index]);
}
}
|
119c4b5ae371a5fb73d65962891c8a19d9529f9a | TypeScript | appy-one/acebase-core | /dist/types/subscription.d.ts | 2.796875 | 3 | type SubscriptionStop = () => void;
export declare class EventSubscription {
/**
* Stops the subscription from receiving future events
*/
stop: SubscriptionStop;
private _internal;
/**
* @param stop function that stops the subscription from receiving future events
*/
constructor(... |
a34fd3af68a99bc76003708d9d4be17c724392a9 | TypeScript | fabian-dev/fussbot | /src/natural-language.ts | 3.078125 | 3 | export class PartOfSpeech {
private nlPOS: any;
static wrap(nlPOS: any) {
return new PartOfSpeech(nlPOS)
}
constructor(nlPOS: any) {
this.nlPOS = nlPOS;
}
get tag(): string {
return this.nlPOS.tag;
}
get mood(): string {
return this.nlPOS.mood;
}
... |
8adebe0d6fde6f0faa83f1f4d045baf79d0b4417 | TypeScript | psnwd/Fire | /src/inhibitors/migration.ts | 2.59375 | 3 | import { FireMessage } from "@fire/lib/extensions/message";
import { Inhibitor } from "@fire/lib/util/inhibitor";
export default class MigrationInhibitor extends Inhibitor {
constructor() {
super("migration", {
reason: "migration",
priority: 11,
});
}
async exec(message: FireMessage) {
i... |
4eea1bb7fbf88671185e0b3b87663a98ddc8aae2 | TypeScript | vViktorPL/react-fetching-library | /examples/use-suspense-query-hook/src/newsList/NewsList.types.ts | 2.546875 | 3 | export type NewsListProps = {
error: boolean;
news: News[] | undefined;
};
export type News = {
uuid: string;
title: string;
description: string;
date: string;
image: string;
};
|
3e8462e7910ce67c65b60558f27305075cfc821c | TypeScript | kyriejoshua/leetcode | /leetcode/235.lowest-common-ancestor-of-a-binary-search-tree.ts | 3.625 | 4 | /*
* @lc app=leetcode id=235 lang=typescript
*
* [235] Lowest Common Ancestor of a Binary Search Tree
*/
// @lc code=start
/**
* Definition for a binary tree node.
* class TreeNode {
* val: number
* left: TreeNode | null
* right: TreeNode | null
* constructor(val?: number, left?: TreeNode | n... |
b14d11d20197917f6bb8f3a242518b21176c3879 | TypeScript | shaunluttin/algorithms | /books/Skiena-the-algorithm-design-manual/typescript-implementations/src/sections/section-5/section-5.2-data-structures-for-graphs.ts | 3.703125 | 4 | import os from "os";
import { Graph } from "./Graph";
/**
* Create a new graph with empty arrays and zero values.
*
* Since we are numbering our edges starting at `1`, the `edges` and `degree`
* arrays will always have `0` and `null` at index `0` respectively.
*/
const initializeGraph = (nvertices: number, direct... |
03f5445693d4cafc34068b07120045adb4472189 | TypeScript | monomax-bg/reali-angular-project | /reali/src/app/main-container/reali-store/reali-store.reducer.ts | 2.625 | 3 | import {realiStoreState, RealiStoreState} from './reali-store.state';
import { RealiStoreActions, RealiStoreActionTypes } from './reali-store.actions';
export function realiStoreReducer(state: RealiStoreState = realiStoreState, action: RealiStoreActions): RealiStoreState {
switch (action.type) {
case RealiS... |
9ce77f8ce69f7743952783ce34444f641c6a4698 | TypeScript | sviete/AIS-home-assistant-polymer | /src/common/config/is_service_loaded.ts | 2.671875 | 3 | import { HomeAssistant } from "../../types";
/** Return if a service is loaded. */
export const isServiceLoaded = (
hass: HomeAssistant,
domain: string,
service: string
): boolean =>
hass && domain in hass.services && service in hass.services[domain];
|
113e62cad83bcf945dfd4e06aec9caaf5731f9fb | TypeScript | Dyshay/DeepBot | /DeepBot/ClientApp/src/webModel/Enum/RessourcesMetier.ts | 2.515625 | 3 | export enum BucheronRessources{
"BUCHERON_RSS_1" = 303,
"BUCHERON_RSS_2" = 473,
"BUCHERON_RSS_3" = 476,
"BUCHERON_RSS_4" = 2358,
"BUCHERON_RSS_5" = 2357,
"BUCHERON_RSS_6" = 471,
"BUCHERON_RSS_7" = 461,
"BUCHERON_RSS_8" = 7013,
"BUCHERON_RSS_9" = 474,
"BUCHERON_RSS_10" = 449,
"BUCHERON_RSS_11" = 79... |
5b901b78c457bdb3cef973e31e25989e62e145a6 | TypeScript | conanjunn/linear-algebra | /src/ques1.ts | 2.859375 | 3 | import { Axis } from './axis';
import { World } from './world';
import { transform, inv } from 'loshu';
const world = new World();
const axis = new Axis(world, {
x: [-5, 6],
y: [-5, 6],
});
const target = [1, 1];
// 渲染标准空间坐标系,(设为A空间)
axis.render();
axis.renderV(target);
axis.setBasis([
[Math.cos((Math.PI / 18... |
897f69091cdbe9f8c6cabdfcdd8706233e33a27c | TypeScript | TrendingTechnology/vue-use-motion | /src/useMotionFeatures.ts | 2.59375 | 3 | import { MaybeRef } from '@vueuse/shared'
import { Ref, ref } from 'vue'
import { registerLifeCycleHooks } from './features/lifeCycleHooks'
import { registerVisibilityHooks } from './features/visibilityHooks'
import { TargetType } from './types/instance'
import { MotionVariants } from './types/variants'
import { UseMot... |
6188a6a15e4c14b5947c8ed903a87172bc88da4c | TypeScript | bigpig-was-taken/utilitiesbot | /commands/stats.ts | 2.546875 | 3 | import { MessageEmbed } from "discord.js";
module.exports = {
'name': 'stats',
'description': 'Gets bot stats',
'arguments': 'None',
'permissions': 'None',
async execute(message,args,client){
let days = Math.floor(client.uptime / 86400000);
let hours = Math.floor(client.uptime / 3600... |
e830cf0242f8a95c104af4c5ec8cdbabd2a9966c | TypeScript | skin93/proshop-typescript | /frontend/src/redux/reducers/userReducers.ts | 2.75 | 3 | import { Reducer } from 'redux'
import {
UserActions,
UserActionTypes,
IUserLoginState,
IUserRegisterState,
IUserListState,
IUserDeleteState,
IUserDetailsState,
IUserUpdateProfileState,
IUserUpdateState
} from '../types/userTypes'
const initialUserLoginState: IUserLoginState = {
error: '',
loadin... |
133bf7df4b522a1c2ce0fa98e73225f7090a562f | TypeScript | fritzy/7drl-2019 | /src/ecs/entity.ts | 2.921875 | 3 | import ECS from '.';
export default class Entity {
components: Map<string, any>;
id: string;
ecs: ECS;
constructor(ecs: ECS, definition?: { [index: string]: any}) {
this.ecs = ecs;
this.components = new Map();
if (definition) {
this.setComponents(definition);
}
}
setComponents(defi... |
9f928d8d83e5a2ccb172924347b6e40660e563fc | TypeScript | julianGonzalezV/angular | /03-pipes/src/app/pipes/capitalizado.pipe.ts | 2.875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: "capitalizado"
})
export class CapitalizadoPipe implements PipeTransform{
transform(value: string, allCapital: boolean = true): string {
value = value.toLowerCase();
let names = value.split(" ");
if(allCapital){
return names.map(... |
a5e9cec5d1d59c9ad6ca70970bfa3748d1506d75 | TypeScript | zealande2019/indkobsliste-Basicxd | /src/js/index.ts | 2.828125 | 3 | document.getElementById('submitBtnUsund').addEventListener("click", addVare);
document.getElementById('submitBtnSund').addEventListener("click", addVare2);
let elementInput = document.getElementById('nyvare');
function addVare()
{
let myText = (<HTMLInputElement>elementInput).value;
let usundListe = doc... |
df8f97df77780cfb520181891efd8941084ef907 | TypeScript | vladimirpetchenko/qualification | /src/authors/authors.controller.ts | 2.546875 | 3 | import {
Body,
Controller,
Get,
Logger,
Param,
Post,
Render,
Res,
} from '@nestjs/common';
import { AuthorsService } from './authors.service';
import { Author } from './entities/author.entity';
@Controller('authors')
export class AuthorsController {
constructor(private readonly authorsService: Author... |
f80755435ac066f14b3490bdbd1ab61d0b73d234 | TypeScript | m1sha/WebHitTest | /WebHitTest/app/tools/primitive/styles/LabelResolver.ts | 2.546875 | 3 | import Label from '../Label';
import { FontStyle } from './FontStyle';
export default class LabelResolver {
resolve(ctx: CanvasRenderingContext2D, fontStyle: FontStyle, label: Label) {
ctx.save()
ctx.fillStyle = fontStyle.fillStyle
ctx.font = fontStyle.font
const w = ctx.measureText("M").width
c... |
1da52205fc7e8552f39ffd5d3a1db66412ef707f | TypeScript | xarmar/conference-track-management | /src/dateManipulation/timeOperations.unit.test.ts | 3.40625 | 3 | import {
addMinutesToDate,
convertToAmPm,
createDate,
subtrackMinutesFromDate,
} from "./timeOperations";
// Initialize Date variables
var nineAm: Date;
var twelvePm: Date;
var twoPm: Date;
var elevenPm: Date;
// Before Each to Keep Code DRY
beforeEach(() => {
// Give Date specific hours to test timeOperati... |
42c9cba7035bc1e49b50d0076a04e95bb81d72d0 | TypeScript | ymoreiratiti/TestePraticoNode2 | /src/class/Boleto/validate/validateVerifyingDigit.ts | 3.15625 | 3 | import { Titulo } from "../Boleto"
import { ValidationError } from "../enum/ValidationError"
export function validateVerifyingDigit (this: Titulo): void {
const field1 = this.barCodeFields[1].slice(0, -1)
const field2 = this.barCodeFields[2].slice(0, -1)
const field3 = this.barCodeFields[3].slice(0, -1)
const ... |
34d2eb88539e313ff483ef122703e8fc7d143fce | TypeScript | jbberinger/message-board-back-end | /src/strategies/localStrategy.ts | 2.640625 | 3 | import LocalStrategy from 'passport-local';
import bcrypt from 'bcryptjs';
import {
signup,
login,
getPasswordHashFromEmail,
checkEmailAvailability,
} from '../database/database';
const localStrategy = new LocalStrategy.Strategy(
{
usernameField: 'email',
},
async (email: string, password: string, do... |
3773ffb74d01696fd50fe3ffefdc7fd2c44306a1 | TypeScript | mezdef/toyrobot | /src/exports/process.ts | 2.921875 | 3 | import {Position} from './interfaces'
import {validDir} from './variables'
import {Validator} from './validation'
export class Process {
public static placeCmd(inputCmds: Array<string>) {
return {position: {x: parseInt(inputCmds[1], 10), y: parseInt(inputCmds[2], 10)}, orientation: inputCmds[3]}
}
public st... |
dea58d3c636c0ab6c33bec03480259e1d87d3b65 | TypeScript | eguajardo/useDApp | /packages/core/src/hooks/useDebouncePair.ts | 3.125 | 3 | import { useEffect, useState } from 'react'
// modified from https://usehooks.com/useDebounce/
export function useDebouncePair<T, U>(first: T, second: U, delay: number): [T, U] {
const [debouncedValue, setDebouncedValue] = useState<[T, U]>([first, second])
useEffect(() => {
// Update debounced value after del... |
0063be962b6309527c094d50f4cd3929abed8673 | TypeScript | trobinson41/AngularJS-Collector | /Source code for tutorial/Chapter2/Example02-111717/BugCollector/BugCollector/Scripts/App/bugList.ts | 2.71875 | 3 | export class bugs {
bugs = [
{
CommonName: "Mosquito Pupa",
Class: "Insecta",
Order: "Diptera",
Family: "Culicidae",
Genus: "",
Species: "",
Description: "Mosquito larva are aquatic. After the larval stage, the mosquito becomes a pupa, which... |
a325a8581ff0198594740e955e0851c2bb6b0e01 | TypeScript | rencire/weeact | /src/weeact.ts | 3.203125 | 3 | import {
FunctionalComp,
IAttributes,
ICompNode,
IDOMNode,
IProps,
Node,
Tree
} from "./types.d";
import { Component, isComponentSubClass, render } from "./weeact-dom.js";
// Globals Vars
export let CURRENT_RENDERING_COMPONENT_ID = 0;
export let ROOT_TREE = null;
// Global Setters
export const increment... |
3e9dbdb4c3e38f48c9525b645d6636c9ea0a3e4d | TypeScript | dacodemaniak/oop | /src/models/recette.ts | 3.359375 | 3 | import { QuantityProduct } from "./quantity-product";
export class Recette {
private ingredients: Array<QuantityProduct> = new Array<QuantityProduct>();
private title: string;
/**
* @var number
*
* Total price for the receipe
*/
private receipePrice: number = 0;
/**
* @... |
083eed4c40965d451adbb4941b814fb87122957b | TypeScript | zhanbei/ts-utils | /DateUtil.ts | 3.40625 | 3 | //
type ParamDate = number | string | Date | undefined;
const newDate = (date: ParamDate): Date =>
date ? new Date(date) : new Date();
// Get the total minutes elapsed of a day according to local time.
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay
const getMinut... |
bd1f64b5cb730e924457160c70f33b4dbaaa2245 | TypeScript | ChloeCacola/Recipe-Master | /src/app/recipe/recipe-detail/recipe-detail.component.ts | 2.515625 | 3 | import { Component, OnInit } from '@angular/core';
import { Router, Params, ActivatedRoute } from '@angular/router';
import { RecipeModel } from '../recipe.model';
import { IngredientModel } from '../../shared/ingredient.model';
import { ShoppingListService } from '../../shopping-list/shopping-list.service';
import {... |
165d226625ccc46eb74f5c14cd3960cba1cafcfb | TypeScript | RizBizKits/kin | /app/models/UserModel.ts | 2.671875 | 3 | import { IsNotEmpty, Length } from 'class-validator';
import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, OneToMany, OneToOne, Generated} from "typeorm";
import { RankingsModel } from './RankingsModel';
import {AppointmentsModel} from "./AppointmentsModel";
import {CabinetModel} from "./CabinetModel";
co... |
7caa663c7809a47e1f708cae94661928dc9adfc4 | TypeScript | PhotoN0987/FriendListApp1 | /src/views/ListView.ts | 2.953125 | 3 | import axios from 'axios'
import { User } from "../models/User";
export class ListView {
//#region Components
userList: HTMLElement | null;
//#endregion
constructor() {
// HTMLElement取得
this.userList = document.getElementById('user-list')
}
//#region Events
// ロード時
public async loadView() ... |
7ae263f2895b088627cfd698fb7aa916a9ca5af6 | TypeScript | rahat664/Angular_practice | /angular-practice/src/app/courses.component.ts | 2.59375 | 3 | import { CourseService } from "./courses.service";
import { Component } from "@angular/core";
@Component({
selector: 'courses',
template: `
<!-- <h2>{{ title }}</h2>
<div (click) = "onDivClicked()">
<button (click) = "onSave($event)">Add</button>
</div> -->
<!-- <input [(ngModel)]="Email" (keyup.enter)="... |
407100b8c05dd075545ccb659a0f46cc5d54c52e | TypeScript | Hestia9/angular-7poc4p | /src/app/@shared/idee.service.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { Idee } from '../model/idee';
@Injectable()
export class IdeeService {
private idees : Idee[];
constructor() {
this.idees = [];
}
addIdee(log : string, lib : string, like : number, dislike : number, pseudo : string){ //
const idee : Id... |
a127eaf5e9b3486de7f18d292614aba2ec9f7a16 | TypeScript | rawcmd/framework | /packages/rawcmd-typewriters/src/typewriters/row.ts | 3.28125 | 3 | import { EOL, alignText, wrapText, trucateText, repairAnsi, TextAlign } from '@rawcmd/text';
import { toArray, toString } from '@rawcmd/utils';
/**
* Row typewriter configuration options.
*/
export interface RowTypewriterOptions {
separatorSymbol?: string;
truncationSymbol?: string;
}
/**
* Row column configur... |
27db3429b7d7e672604b647943b0fdaecafd702e | TypeScript | xpsdim/spd | /Spd3/ClientApp/src/app/shared/services/base.service.ts | 2.5625 | 3 | import { Observable } from 'rxjs/Rx';
import { Http, Headers } from '@angular/http';
const AUTH_HEADER_KEY = 'Authorization';
const AUTH_PREFIX = 'Bearer';
export abstract class BaseService {
constructor(private _http: Http) { }
createAuthorizationHeader(headers: Headers) {
headers.append('Content-Type... |
2f9ad81abfcf57616206175f28eb95197bf2158d | TypeScript | Dennis273/DB-project-2 | /src/util/utilities.ts | 2.828125 | 3 |
export enum ErrorMessages {
unknownError = '未知错误',
illegalOperation = '非法操作',
usernameExist = '用户名已存在',
emailExist = '电子邮箱已存在',
wrongPasswor = '密码错误',
userNotExist = '用户不存在',
unAuthenticated = '未授权访问',
workNotExist = '作品不存在',
workNameExist = '作品名称已存在',
invalidEmailFormat = '邮箱格式... |
2e4265a57606767ac04506380a346b15734fc5ba | TypeScript | rahulyhg/saas-taro | /src/models/common.ts | 2.515625 | 3 | import Taro from '@tarojs/taro'
import { uploadFile } from '../service/commonService';
interface IResult {
code: number,
data: Array<IImage>
}
interface IImage {
id: string,
path: string
}
export default {
namespace: 'common',
state: {},
effects: {
*uploadMultiFile({ payload, cal... |
9414e20842b490baa447e34c735729f38eccd91c | TypeScript | mvecerin/concert-finder | /src/models/performer.model.ts | 2.53125 | 3 | import {Entity, hasMany, model, property} from '@loopback/repository';
import {Concert} from './concert.model';
@model()
export class Performer extends Entity {
@property({
type: 'string',
id: true,
generated: true,
mongodb: {dataType: 'ObjectId'},
})
id?: string;
@property({
type: 'string... |
3104de1c78e8771c061433364f9c9c69508a2c74 | TypeScript | haydos404/quantum | /packages/quantum/src/definition.ts | 2.65625 | 3 | import { IDefinitionStep, IToken } from 'quantumlib';
// Views
/**
* Retrieves a definition step by a token step
*
* @param token - Token to find definition in
* @param id - Id of the token step
*/
export function getDefinitionByTokenStep(
token: IToken,
id: string,
): IDefinitionStep {
const definition = tok... |
90be15a1e84ac9406242499371718a773e2316a3 | TypeScript | alissonph/react-material-crud | /frontend/src/redux/actions/error.ts | 2.609375 | 3 | export const GET_ERRORS = "GET_ERRORS";
export const CLEAR_ERRORS = "CLEAR_ERRORS";
// RETURN ERRORS
export const returnErrors = (msg: string, status: number, id: any = null) => {
return {
type: GET_ERRORS,
payload: { msg, status, id }
};
};
// CLEAR ERRORS
export const clearErrors = () => {
return {
... |
b38f2456790aac0f24f74939d44c1f048000f02e | TypeScript | infinitered/reactotron-redux | /src/helpers/pathObject.test.ts | 3.203125 | 3 | import pathObject from "./pathObject"
describe("pathObject", () => {
it("should return the entire object if a null is passed", () => {
const obj = { isThis: { here: true } }
const path = null
const pathedObj = pathObject(path, obj)
expect(pathedObj).toEqual(obj)
})
it("should return the entire... |
6419a58e6ba53c826be99585424893a5221e7383 | TypeScript | acaria/vscode-elasticdeveloper | /src/models/graph.ts | 2.828125 | 3 | 'use strict'
import * as vscode from 'vscode';
export class Graph {
private _onNodeAddedEventEmitter: vscode.EventEmitter<Node>;
private _onNodeUpdatedEventEmitter: vscode.EventEmitter<Node>;
private _onEdgeAddedEventEmitter: vscode.EventEmitter<Edge>;
private _nodes:Node[] = [];
private _ed... |
5a68b27f2a04123f528e0c3214c94b7272f29a70 | TypeScript | Ivillysg/GoSnack | /src/store/modules/example/reducer.ts | 2.703125 | 3 | /* reducer.ts */
import { TodoState, TodoActionsTypes, CREATE_TODO_REQUEST } from './types'
const initialState: TodoState = {
data: []
}
export default function todoReducer (
state = initialState,
action: TodoActionsTypes
): TodoState {
switch (action.type) {
case CREATE_TODO_REQUEST:
return {
... |
14d40a150b36aa606ca6c759b2211a5cf026a34f | TypeScript | BYazdaani/Stacks-Editor | /src/rich-text/markdown-serializer.ts | 2.515625 | 3 | import {
defaultMarkdownSerializer,
MarkdownSerializer,
MarkdownSerializerState,
MarkSerializerConfig,
} from "prosemirror-markdown";
import { richTextSchema } from "../shared/schema";
import { Node as ProsemirrorNode, Mark } from "prosemirror-model";
import { error } from "../shared/logger";
import { E... |
d62d5af07efb675a6a64caa6acab64cbc1774c8a | TypeScript | ice-nine-as/hellox-client | /tests/Reducers/languageReducer.test.ts | 2.96875 | 3 | import {
AppActionTypes,
} from '../../src/Enums/AppActionTypes';
import {
languageReducer,
strings,
} from '../../src/Reducers/languageReducer';
import {
Languages,
} from '../../src/Enums/Languages';
/* Mocked */
import {
isLanguage,
} from '../../src/TypeGuards/isLanguage';
jest.mock('../../src/TypeGuards... |
16bdb812a64852e3e641327d1bae548c7ab0fd16 | TypeScript | kongallis/Quiz-Application | /quiz-app/src/app/quiz/quiz.component.ts | 2.53125 | 3 | import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { GetResponse } from 'src/models/GetResponse';
import { Question } from 'src/models/Question';
import { QuizService } from 'src/shared/quiz.service';
@Component({
selector: 'app-quiz... |
9cdf4cc33542680b21399002a8d992a667288602 | TypeScript | EmilienLeroy/vuefire | /packages/vuefire/__tests__/rtdb/merging.spec.ts | 2.53125 | 3 | import { rtdbPlugin } from '../../src'
import { MockFirebase, Vue } from '@posva/vuefire-test-helpers'
Vue.use(rtdbPlugin)
function createMixins() {
const db = new MockFirebase().child('data')
db.autoFlush()
const docs = [
db.child('1'),
db.child('2'),
db.child('3'),
db.child('4'),
db.child... |
7cedba4e6a23bc49f57dab504ca4d86666a4048e | TypeScript | shehio/Project-Nash | /src/economic-data/index.ts | 3.125 | 3 |
import request from 'sync-request'
const base = 'http://api.worldbank.org/';
const literals = ['countries/', 'indicators/', 'date=', '&format=json'];
const concatenate = function(array) {
let ret = '';
let i = 0;
for(; i < array.length - 1; i++){
ret = ret + array[i] + ';';
... |
8afbd33e6ff83d70716d4d5dc2370a2eaad7de23 | TypeScript | jerry1100/leetcode | /133. Clone Graph.ts | 3.75 | 4 | // N: number of nodes
// M: number of edges
// Time: O(N + M)
// Space: O(N)
/**
* Definition for Node.
* class Node {
* val: number
* neighbors: Node[]
* constructor(val?: number, neighbors?: Node[]) {
* this.val = (val===undefined ? 0 : val)
* this.neighbors = (neighbors===undefine... |
cb9d3329ea25fe3f010afce78a9f1fed68121875 | TypeScript | rkrausze/formula-editor | /src/Term/SimpleTerm.ts | 3.0625 | 3 | /// <reference path="Term.ts" />
namespace fe {
export class SimpleTerm extends Term {
s: string;
iFontIndex: number;
constructor (fp: IFormulaPanel, parent: Term, s: string, iFontIndex: number) {
super(fp, parent);
this.s = s;
this.iFontIndex ... |
b077011decf4a38348b6384139f5eb9634b95aa9 | TypeScript | xuping-huang/coding-accelerator | /src/ext/codeUtils/pasteUtils/convert/SwaggerModel2JsonDataConverter.ts | 2.71875 | 3 | import * as _ from 'lodash';
import * as faker from 'faker';
import * as fs from 'fs';
import * as yaml from 'js-yaml';
import { PasteNode } from '../PasteNode';
import { CodeConvertor } from '../Converter';
import { SwaggerModelDefine } from '../model/SwaggerModelDefine';
import { SwaggerModelPropertyDefine } from '..... |
2af0fe03ce2f76b70782a01327fa2c7d40dab958 | TypeScript | maticnetwork/matic.js | /src/pos/root_chain.ts | 2.515625 | 3 | import { BaseToken, utils, Web3SideChainClient } from "../utils";
import { TYPE_AMOUNT } from "../types";
import { IPOSClientConfig, ITransactionOption } from "../interfaces";
import { BaseBigNumber } from "..";
export class RootChain extends BaseToken<IPOSClientConfig> {
constructor(client_: Web3SideChainClient<... |
568dc35943bfd2b27f72b8a6ba170751edaf4f25 | TypeScript | delesseps/newdash | /src/isArrayBuffer.ts | 3.640625 | 4 | import getTag from './.internal/getTag';
import isObjectLike from './isObjectLike';
/**
* Checks if `value` is classified as an `ArrayBuffer` object.
*
* @since 5.5.0
* @category Lang
* @param value The value to check.
* @returns Returns `true` if `value` is an array buffer, else `false`.
* @example
*
* ```js... |
654373dc5cbb00b010edea75d9e803e8b1d01640 | TypeScript | mersocarlin/api-error | /src/method-not-allowed-error.ts | 2.546875 | 3 | import ApiError from './api-error'
export default class MethodNotAllowedError extends ApiError {
constructor(message?: string, error?: any) {
super(message || 'Method Not Allowed', 405, error)
}
}
|
76c2afb1bc4f12591817c9c9f11c5d9cc7c41745 | TypeScript | effector/effector | /src/types/src/runner/forIn.ts | 2.828125 | 3 | export function forIn<Obj extends Record<string, unknown>>(
value: Obj,
fn: <K extends keyof Obj>(value: Obj[K], key: K, obj: Obj) => any,
) {
for (const key in value) {
const fnResult = fn(value[key], key, value)
if (fnResult !== undefined) return fnResult
}
}
|
666d453e3415bc3399d7a1fb2ddb25c96a99fa16 | TypeScript | lucassimao/decorebator-app | /backend/crawler/src/entities/Pronunciation.ts | 2.578125 | 3 | import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import Lemma from "./lemma";
@Entity()
export default class Pronunciation {
@Column()
@PrimaryGeneratedColumn()
id?: number;
@Column({ nullable: true })
audioFile?: string;
@Column("text", { array: true, nullable: true })
dial... |
09214ca0d2ad68e480d6b1ebb5cf1da6c1f8649b | TypeScript | grantopher/ChraracterManager | /src/Interfaces/IRace.ts | 2.90625 | 3 | export interface IRace {
name: string;
id: string;
traits: string[];
abilityScore: IAbilityScore;
age: IAgeRange;
spells?: ISpell[];
size: INumberRange;
speed: number;
languages: string[];
}
interface INumberRange {
min: number;
max: number;
}
interface IAbilityScore {
... |
1c807c3b297c4cd44431b7eff04bf99967706a62 | TypeScript | Klemensas/seenit-server | /src/auth/auth.ts | 2.6875 | 3 | import * as passport from 'passport';
import * as jwt from 'jsonwebtoken';
import { Strategy as LocalStrategy } from 'passport-local';
import { Strategy as BearerStrategy } from 'passport-http-bearer';
import * as bcrypt from 'bcrypt';
import { getUserById, getFullUser } from '../models/user/queries';
import { User } ... |
c3b44f223b6fe08658d965b9c9298179528c24c4 | TypeScript | Sou-eu-Miguel/graphql-engine | /console/src/components/Common/utils/tsUtils.ts | 2.984375 | 3 | export const UNSAFE_keys = <T extends Record<string, unknown>>(source: T) =>
Object.keys(source) as Array<keyof T>;
export type Json =
| null
| boolean
| number
| string
| Json[]
| { [prop: string]: Json };
export type Nullable<T> = T | null | undefined;
|
f42d940fb0fa725446eb9eab6ceea981e90fa0d3 | TypeScript | bigdatasciencegroup/prancer | /static/src/components/Annotation/utils/colorUtils.ts | 2.796875 | 3 | export const hex2rgba = (hex: string, alpha = 1) => {
const [r, g, b] = hex.match(/\w\w/g).map(x => parseInt(x, 16));
return `rgba(${r},${g},${b},${alpha})`;
};
export const createBackground = (colors: string[]) => {
const sectionLength = Math.floor(100 / colors.length)
const sectionStrings = colors.map((c, i)... |
213a3008c6fa18145a8ae3be3c192e21635cd07e | TypeScript | nadershbib/hotelsFinderUI | /src/utils/functionsHelper.ts | 2.578125 | 3 | export function objBuilder (name:string,location:string,price_range:string|Number){
return {
name,
location,
price_range
}
}
export function objReviewBuilder (name:string,review:string,rating:string|number) {
return {
name,
review,
rating
}
} |
1b4ad43791f90e9e9e30dccf18fa870dedc4e8d9 | TypeScript | planttheidea/unchanged | /__tests__/utils.ts | 2.765625 | 3 | import { parse } from 'pathington';
import React from 'react';
import {
assignFallback,
callIfFunction,
cloneArray,
cloneIfPossible,
createWithProto,
getCoalescedValue,
getDeepClone,
getFullPath,
getOwnProperties,
getMergedObject,
getValueAtPath,
getCloneOrEmptyObject,
getNewEmptyChild,
get... |
fe01169a731220001a67e23f3e6bf05ee0b9847a | TypeScript | thevinaysingh/slots-booking-app | /src/services/di/Dependencies.ts | 2.84375 | 3 | import {IDependencies} from './IDependencies';
import {InjectionKey} from './InjectionKey';
import {InjectionKeyScope} from './InjectionKeyScope';
export class Dependencies implements IDependencies {
protected cache = new Map<string, any>();
provide<T>(injectionKey: InjectionKey<T>): T {
switch (injectionKey.... |
458e4f0c19414c6c54e13d54abd693adfc7f8d86 | TypeScript | mgechev/guess-runtime | /src/markov.ts | 2.953125 | 3 | import { Model, Prediction } from './model';
import { Hash, PrefixMap } from './prefix-map';
let c = 0;
let map: { [key: string]: string } = {};
export const hash: Hash<Prediction> = (value: Prediction) => {
if (map[value.path]) return map[value.path];
const key = (c++).toString();
map[value.path] = key;
retur... |
3a417bff748158f889461afbc051b5badf6efe2e | TypeScript | limaleandro1999/o-commerce-web-server | /src/components/users/users.controller.ts | 2.625 | 3 | import * as express from 'express'
import * as mongoose from 'mongoose'
import { User } from './users.model'
import { ControllerInterface } from "../../common/controller.interface"
export class UserController implements ControllerInterface{
async get(req: express.Request, res: express.Response, next: express.Next... |
71a30a36b97473e86c3687bfade25b53bb6a1a21 | TypeScript | VK-Media/family-hub-server | /src/validation/Auth.validation.ts | 2.609375 | 3 | import { NextFunction, Request, Response } from 'express'
import { check } from 'express-validator'
import { verify } from 'jsonwebtoken'
import { UserModel } from '../models'
export const loginRules = () => {
return [
check('email')
.exists()
.withMessage('Required')
.bail()
.isEmail()
.withMessage(... |
aa9909e95278c417a15e9ab7ef080fa7cf0fd5c7 | TypeScript | Frikki/matechs-effect | /packages/browser/tests/Browser.test.ts | 2.90625 | 3 | import { effect as T } from "@matechs/effect";
import * as B from "../src";
import * as assert from "assert";
import { some } from "fp-ts/lib/Option";
class MockStorage implements Storage {
[name: string]: any;
get length() {
return this.st.length;
}
// tslint:disable-next-line: no-empty
constructor(pr... |
262013ac6f87e6967ac8e299b890d0d890b7532e | TypeScript | karlhulme/mantella | /workspaces/mantella-interfaces/src/engine/ResumeOperationSendResponseProps.ts | 2.890625 | 3 | import { OperationStatus } from '../op'
/**
* Defines the properties that are provided by Mantella to the
* sendResponse delegate function of the ResumeOperationProps object.
*/
export interface ResumeOperationSendResponseProps {
/**
* The last status of the operation. If a resolveStep was specified
* then... |
be8d2ec06263daed07c72a2e6b0b58bda5482618 | TypeScript | gergokutu/substitution-TS | /src/substitution.ts | 3.5 | 4 | const usageInfo = `
!! Usage: node substitution.js <key> !!
***************************************
* Key should be 26 characters long! *
* Key should consist of only letters! *
* Key should have unique characters! *
* The key is case insensitive. *
***************************************
`;
const { argv, e... |
3065a111a99cbd44c64cf038adcc3ebd56d5aba0 | TypeScript | CarbonLDP/sparqler | /src/patterns/triplePatterns/RDFLiteral.ts | 3.0625 | 3 | import { Container } from "../../core/containers/Container";
import { cloneElement } from "../../core/containers/utils";
import { IRIToken } from "../../tokens/IRIToken";
import { LanguageToken } from "../../tokens/LanguageToken";
import { RDFLiteralToken } from "../../tokens/RDFLiteralToken";
import { XSD } from "..... |
3c7a9ba6944ea007db376aba17f1c203dcdcf2e5 | TypeScript | proglang/dts-generate-results | /results/7_generate-declaration-files/modules/gently/gently_1.js/typescript/gently/index.d.ts | 2.59375 | 3 | export = Gently;
declare class Gently {
constructor();
expect(obj: Dog | Gently.I__obj, method: string, count?: Function, stubFn?: undefined): Function;
expect(obj: Dog | Gently.I__obj, method: string, count?: undefined, stubFn?: undefined): void;
_name(obj: Dog | Gently.I__obj__1 | Gently.I__obj, metho... |
9c2e5dd4fb0456c7c1e3e8f87a13f41ac354788e | TypeScript | pokumars/ionicLostAndFound | /src/pipes/thumbnail/thumbnail.ts | 2.8125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
/**
* Generated class for the ThumbnailPipe pipe.
*
* See https://angular.io/api/core/Pipe for more info on Angular Pipes.
*/
@Pipe({
name: 'thumbnail',
})
export class ThumbnailPipe implements PipeTransform {
transform(value: string, sizeOption) {
// val... |
46d8af68bc3c8dba84c9a23121f798f36b5c3b7e | TypeScript | dmkav/creditCardForm | /src/app/validators/luhnAlgorithmValidator.ts | 2.96875 | 3 | import {AbstractControl} from '@angular/forms';
export function validateNumbers(control: AbstractControl): { [key: string]: any } {
const numsPattern = new RegExp(/^[\d\s]*$/);
const value = control.value;
/* Check if field contains only numbers */
if (!numsPattern.test(value)) {
return { 'number': true };... |
37fb3126246d2aa7baef247b23e1b7470b2a0681 | TypeScript | KozhevnikovaJulia/Building | /src/bll/Reducer.ts | 2.9375 | 3 | import { API } from '../dal/Api';
import { AppStateType } from './Store';
let initialState = {
building: null as number | null,
height: null as number | null,
material: null as number | null,
sizex: null as number | null,
sizey: null as number | null,
result: '',
message: '',
status: 'succeeded',
};
e... |
10a44e63cc3c94c9a7ac2500c51f9faa9d3e605e | TypeScript | graycoreio/daffodil | /libs/design/src/molecules/sidebar/sidebar-viewport/content-shift.ts | 2.765625 | 3 | import { QueryList } from '@angular/core';
import { DaffSidebarMode } from '../helper/sidebar-mode';
import { DaffSidebarComponent } from '../sidebar/sidebar.component';
export const isViewportContentShifted = (mode: DaffSidebarMode, open: boolean): boolean => (mode === 'under' && open);
/**
* Given a list of sideb... |
9609a43c642f2322fc1320282b4306e7c8a0ddca | TypeScript | sam17896/Crash-Courses | /Typescript crashcourse/functions.ts | 3.90625 | 4 | function getSum(num1:number, num2:number) : number{
return num1 + num2;
}
//console.log(getSum(1,4));
let mySum = function(num1 : any , num2 : any) : number{
if(typeof num1 == 'string'){
num1 = parseInt(num1);
}
if(typeof num2 == 'string'){
num2 = parseInt(num2);
}
return... |