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 |
|---|---|---|---|---|---|---|
f8461716118cd40c40343e5930fd16ae2f15c7f6 | TypeScript | telega/mpxl | /src/components/MPXLTools.ts | 2.984375 | 3 | import { MPXLSketch } from './P5Sketch';
import { Store, ToolType } from '../stores/store';
const marchingAntsOffset = 0.5;
/** Class for displaying various plugin-accessible tools using store data */
export class MPXLTools {
public p: MPXLSketch;
public store: Store;
constructor(store: Store) {
this.store... |
66f2039e689f95b477bbfc940475c37ed97124dc | TypeScript | SethDavenport/webpack-angularjs-demo | /src/utils/inject.decorator.ts | 2.890625 | 3 | /**
* Convenience function for setting $inject on a class.
*/
export default function Inject(...injectableNames: string[]): ClassDecorator {
return function decorate(constructor: Function): void {
constructor.$inject = injectableNames;
}
}
|
42363d7332bb1e320caed83cc046d27254a7dc93 | TypeScript | kaisalmon/proceduralPuzzle | /main/orbPuzzleGenerator.ts | 2.953125 | 3 | import {OrbPuzzle, Orb, Tile, OrbMove} from './orbPuzzle'
import {tryUntilSuccess, localFetch} from './lib';
export interface puzzleConfig {
seed?:number,
size: number;
fragile: boolean;
orbs: number;
pits: boolean;
crystal: boolean;
bombs: boolean;
portals: boolean;
depth: number;
... |
01979d134c7da6b9948d539284cf6f6f9054f8eb | TypeScript | rociornav/dwec_2021 | /Unidad 8/u8t3-DelRealRocio/src/app/generic-table/generic-table.component.ts | 2.515625 | 3 | import { Component, OnInit, Input } from '@angular/core';
import Utils from '../utils.component';
import { Ciclo } from './../interfaces';
@Component({
selector: 'app-generic-table',
templateUrl: './generic-table.component.html',
styleUrls: ['./generic-table.component.sass']
})
export class GenericTableComponen... |
2a7f57e9231d5a36e9e1876114471fbd9e893065 | TypeScript | def-codes/the-better-thing | /packages/meld-demo/extend.ts | 2.734375 | 3 | import { datafy_protocol } from "@def.codes/datafy-nav";
datafy_protocol.extend("@imaginary", imaginary => {
console.log("My beloved", imaginary);
});
// Reify primitives
const PRIMITIVE: PropertyDescriptorMap = {
"@context": {
// Not sure if I want to see this
// enumerable: true,
value: {
rdf... |
7047bbf6e965e9ce14aff6d610114a6254f4e840 | TypeScript | AugustoDeveloper/maav | /src/maav.app/src/app/shared/models/user/role.model.ts | 2.71875 | 3 | export class Role {
private internalRoleName: string = '';
public teamId: string;
public get name(): string {
return this.internalRoleName;
}
constructor(roleName: string) {
this.internalRoleName = roleName;
}
public static user: Role = new Role("user... |
1e49dfd28e8fdb4c693f830aad08d3afcb84d594 | TypeScript | canalplus/rx-player | /src/parsers/manifest/utils/update_segment_timeline.ts | 2.59375 | 3 | /**
* Copyright 2015 CANAL+ Group
*
* 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 t... |
d6f8211e872c31b6c4786f2ea71dbe78ab44f15e | TypeScript | brehaut/arachne | /src/ts/common/chord.ts | 3.03125 | 3 | import { Note } from "./notes";
import { Scale, ScaleSeries } from "./scales";
import { cycleGet } from "./array";
export type Degree = 1 | 2 | 3 | 4 | 5 | 6 | 7;
export type Chord = {
root: Note,
tones: Note[]
}
function newChord(tones: Note[]):Chord {
return {
root: tones[0],
... |
a92fa4160fe2d830a454c29d401c9050989f0ecb | TypeScript | jovotech/jovo-framework | /common/src/Input.ts | 2.609375 | 3 | import { EnumLike, UnknownObject } from '.';
export interface Intent {
name: string;
global?: boolean;
}
export interface Entity {
id?: string;
resolved?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
... |
95af2df30c2460b616136e703978361ca87016ab | TypeScript | adobe/react-spectrum | /packages/@react-stately/table/src/TableUtils.ts | 3.140625 | 3 | /*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you 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 appli... |
c5ac8e4076c00f4c95881c85dd77e6c04ccd38b9 | TypeScript | anmartin114/Gear.it | /src/app/services/packing-list.service.ts | 2.65625 | 3 | import { Injectable } from "@angular/core";
import { PackingList } from "../interfaces/packing-list";
import { Subject } from "rxjs";
@Injectable({
providedIn: "root"
})
export class PackingListService {
private subject = new Subject<any>();
listItems: PackingList[] = [
{ item: "Toiletries", complete: false ... |
96e44d86b737c9ddf35fe569c0edc172295632a1 | TypeScript | AlecAivazis/graphql-ws-client | /src/message.ts | 3.234375 | 3 | /**
*
* message
*
*/
import type { GraphQLError, ExecutionResult } from 'graphql';
import { ID } from './types';
import {
isObject,
areGraphQLErrors,
hasOwnProperty,
hasOwnObjectProperty,
hasOwnStringProperty,
} from './utils';
/** Types of messages allowed to be sent by the client/server over the WS pr... |
c4123a7c918647fad252bd1b699e6f0b0206a4cb | TypeScript | sneakwolf777/CS465pFall2019-InClassAssignments | /assignment#6/typescript-tutorial/app3.ts | 3.6875 | 4 | const numbers = [12,23,62,34,19,40,4,9];
console.log(numbers.filter(function(n: number){
return n > 30;
}));
// Or use shorthand function notation.
// (Also called arrow function)
console.log(
numbers.filter(n => n > 30)
); |
4f39fb142caa16dc8703ec0ac7839e0452926ddb | TypeScript | Flamdoodle/angular-2-twitter-challenge | /app/like.component.ts | 2.65625 | 3 | import { Component, Input } from "angular2/core";
@Component ({
selector: "like",
template: `<i class="glyphicon glyphicon-heart"
[class.grey]="!isLiked"
[class.pink]="isLiked"
(click)=onClick()>
</i> <span>{{ likes }}</span>`,
styles: [`
.glyphicon-heart {
cursor: point... |
b74858e32719dc8041c6d172cead18ecff4ff401 | TypeScript | Falieson/tsx-interview-prep | /src/modules/binary-tree-mode/binary-tree-mode.ts | 3.765625 | 4 | /*
Find the greatest mode in the binary tree.
or... find the largest most common number
4
/ \
/ \
2 7
/ \ / \
1 3 3 7
The answer is 7, not 3
*/
interface ILeaf {
left?: ILeaf,
right?: ILeaf,
value: number,
}
export default function findBinaryTr... |
6ad102b2ceb3b443d6a0f07ad43b7e054f39a910 | TypeScript | AssemblyScript/assemblyscript | /tests/compiler/infer-type.ts | 3.4375 | 3 | const i = 10; // infers i32 because it fits into i32 as the default
i;
const I = 0x100000000; // infers i64 because the value doesn't fit into 32 bits
I;
const F = 1.5; // infers f64 because of float notation
F;
function locals(): void {
var li = 10;
var lI = 0x100000000;
var lF = 1.5;
var ai = i;
var aI =... |
e6c9cd4a896ea4dd8c3032d3373878cf94286679 | TypeScript | Maxinth/Toyora-clone-with-react | /src/features/MobileDropDown/ownersSlice.ts | 2.71875 | 3 | import { createSlice } from "@reduxjs/toolkit";
export interface ownersViewState {
showOwners: boolean;
}
const initialState: ownersViewState = {
showOwners: false,
};
export const ownersSlice = createSlice({
name: "owners",
initialState,
reducers: {
//show all owners
goToAllOwners: (state) => {
... |
46d34662978bc1fe82f03a5030fd2c04b7eff5e1 | TypeScript | caroso1222/logo-quiz | /apps/logo-quiz/src/store/levels/types.ts | 2.53125 | 3 | import { Level } from '@logo-quiz/models';
import { AxiosError } from 'axios';
export const REQUEST_LEVELS = 'REQUEST_LEVELS';
export const REQUEST_LEVELS_SUCCESS = 'REQUEST_LEVELS_SUCCESS';
export const REQUEST_LEVELS_ERROR = 'REQUEST_LEVELS_ERROR';
export interface LevelsState {
levels: Partial<Level>[];
isLoad... |
15b59e4c074384339ef0902e4673753424d7189f | TypeScript | ansabor/Netron | /Source/IHoverable.ts | 2.59375 | 3 | module Netron
{
export interface IHoverable
{
hover: bool;
getCursor(point: Point): string;
}
} |
b635e65f3cf9936db334909a05383bac9d7cc644 | TypeScript | pidmad92/appAngular | /src/app/fruta/fruta.component.ts | 3.046875 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'fruta',
templateUrl: './fruta.component.html'
/* Template en Linea
template: `<h2>{{nombre_componente}}</h2><p>{{listado_frutas}}</p>`
*/
})
export class FrutaComponent{
public nombre_componente = 'Componente de fruta';
public listado_frutas =... |
52e5f89ec4eba64e04496aba58bbb978cd629945 | TypeScript | em2046/data-structure-0.1 | /src/shared/assert.ts | 3.09375 | 3 | /***
* Reference:
* https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions
*/
/**
* @public
* Assertion function.
*
* That throw an error if something unexpected happened.
*
* @param condition - Expected.
* @param msg - Error message.
*/
export function assert(con... |
58a2881847c1d8cdf9a6501026d61a022696e9ac | TypeScript | badjilounes/exo1 | /src/app/components/doctors/doctors.component.ts | 2.75 | 3 | import { Component, OnInit } from '@angular/core';
import { UserInterface } from 'src/model/user.interface';
import { PageEvent } from '@angular/material/paginator';
import { ListService } from 'src/app/services/list/list.service';
import { ApiService } from 'src/app/services/api/api.service';
@Component({
selector:... |
1f863c3ebc543a901a503c01aafbcad3f7f1521b | TypeScript | favourMusenga/weather-app | /src/reducers/settingReducer.ts | 3.28125 | 3 | export interface SetttingState {
timeFormat: string;
temperatureFormat: string;
}
const initialState: SetttingState = {
temperatureFormat: '',
timeFormat: '',
};
export type ActionsTypes = {
type: 'UPDATE';
payload: SetttingState;
};
export const settingReducer = (
state: SetttingState = initialState,
... |
05725029936a6368e721f9b5d8357537f2e0b90d | TypeScript | Alko-li/Aurora | /src/UI/worldScreen/WorldScreen.ts | 2.6875 | 3 | import UI from "../UI.js";
import MapUI from "./MapUI.js";
import TileSidebar from "./TileSidebar.js";
import GridCoordinates from "../../world/GridCoordinates.js";
import Game from "../../Game.js";
import InventorySidebar from "./InventorySidebar.js";
import WorldScreenHeader from "./WorldScreenHeader.js";
/* The cla... |
967d43aebe08809f525ffd3998edf4b56f8e8581 | TypeScript | XavierGerD/irregular.expert | /src/RhythmPractice/reducer/figuresUtils.ts | 2.5625 | 3 | import { tupletCodes, TupletValues } from "../../UnicodeAssignment";
import { RhythmicUnitKeys, RHYTHMIC_UNITS } from "../RhythmicUnits";
import {
CheckedRhythmicUnits,
CheckedTupletValues,
RhythmicEvent,
RhythmicUnit,
} from "./slice";
export const getFigure = (
rhythmicUnit: RhythmicUnit,
allowEmptyBars:... |
90cff6ac50795ec7ab906b3aa55f63cacdd4f796 | TypeScript | Ricardope3/digichips-backend | /src/utils/existsInArray.ts | 2.75 | 3 | export const existsInArray = (id: string, array: any[]) => {
return array.filter((e) => e._id === id)[0];
} |
3677aeec360b5d5facf60b9003fc54dba479c698 | TypeScript | NarHakobyan/awesome-nest-boilerplate | /src/decorators/validator.decorators.ts | 2.828125 | 3 | import type { ValidationOptions } from 'class-validator';
import {
IsPhoneNumber as isPhoneNumber,
registerDecorator,
ValidateIf,
} from 'class-validator';
import { isString } from 'lodash';
export function IsPassword(
validationOptions?: ValidationOptions,
): PropertyDecorator {
return (object, propertyName... |
e4a4a0aba50c86f7f927c655eff636d08e37f716 | TypeScript | hombredequeso/lift-kata | /src/lift.test.ts | 2.78125 | 3 | import { Option, None} from 'tsoption'
import {
LiftRequests, Lift,
processFloorRequestEventForLift, processLiftArrivedEventForLift, processLiftArrivedEventForLiftRequests,
processLiftRequestEvent, SystemState, getLiftMoveStrategy1,
applyLiftArrivedEvent, applyFloorRequestEvent, applyLiftRequestEvent} from './... |
1af4df2ed75f376496f06d1a70492849c92d1b8c | TypeScript | GaetanCesaro/echange.nc | /src/app/ad/ad.model.ts | 2.625 | 3 | export interface Ad {
id?: number;
title: string;
description: string;
price: number;
imageUrl: string;
category: string;
owner: User;
}
export interface Category {
value: string;
text: string;
}
export interface User {
id: number;
email: string;
firstName: string;
lastName: string;
}
expor... |
02345f1f7c2aec91b44eea301c8785145ee1ec41 | TypeScript | MaxwellHenderson/ILP-Capstone | /Frontend/GroceryStore/src/app/shared/cart-item.model.ts | 2.8125 | 3 | export interface CartItem {
productId: number;
productName: string;
productPrice: number;
productQuantity: number; //Represents the number of items in the cart
}
|
e0f444eb9be293d22c42c8787a7d7f3244bafbdd | TypeScript | muxy/extensions-js | /dist/types/src/messenger.d.ts | 2.546875 | 3 | import { DebugOptions } from './debug';
export declare enum MessengerType {
Pusher = 0,
Twitch = 1,
Server = 2,
Unknown = 3
}
export declare class CallbackHandle {
target: string;
cb: (t: any, datatype: string, message: string) => void;
}
export interface Messenger {
channelID: s... |
eb2432a86b7bcebfdc7baea15c8b75da9e459dab | TypeScript | guidoeckelt/ge | /src/game/input/InputWatcher.ts | 2.90625 | 3 | import InputBinding from "./InputBinding";
// import HashMap from "../HashTable";
abstract class InputWatcher<EventType extends Object, Binding extends InputBinding<Event>>{
protected _element : Element;
protected _body : HTMLElement;
protected _bindingMap : Object;
// private _bindingMap : HashMap = new Hash... |
6647690977571b10bd5112611d10aa4c49effaa8 | TypeScript | cc-modules/util-action | /util-action.d.ts | 3.03125 | 3 | /**
* 保存node的属性,返回一个还原的action
*
* @export
* @param {cc.Node} node
* @param {string[]} props
* @returns {cc.ActionInstant}
*/
export function saveProps(node: cc.Node, props: string[]): cc.ActionInstant;
/**
* 震动的动画Promise版本
*
* @export
* @param {cc.Node} node
* @param {number} [amplitudeX=20]
* @param {numb... |
742f582535cdb48a43d743cbc0d99cbc2e3016ff | TypeScript | K0R0VA/portal-chat | /client/src/app/interfaces/message.ts | 2.703125 | 3 | import {Deserializer, Serialize} from './websocket';
import {ClientMessage, ServerMessage} from '../../../messages/message';
export enum MessageType {
CONTACT = 0,
GROUP = 1
}
export interface Message {
readonly senderName: string;
readonly senderAvatar: string;
readonly text: string;
}
export interface IC... |
9efacc65dff62ebbfa2d7090664402bc53432f80 | TypeScript | ABEgame/ABEgame.github.io | /GameController.ts | 2.71875 | 3 | /// <reference path="GameLoop.ts" />
/// <reference path="Model.ts" />
/// <reference path="GameOne.ts" />
/// <reference path="GameTwo.ts" />
module Game{
export class GameController{
gameloop;
canvas;
width;
height;
model;
gamma;
alpha;
beta;
gameShallStart;
game... |
ebf2c208cc3b413d8a123ca1ad2a2e1ef300f921 | TypeScript | ohmpzz/pre-order-food-frontend | /pre-order-food/src/app/core/store/actions/pre-order.action.ts | 2.546875 | 3 | import { Action } from '@ngrx/store';
import { PreOrders } from '../../models/pre-order.model';
export enum PreOrderActionTypes {
LoadPreOrders = '[Core] Load PreOrders',
LoadPreOrdersFail = '[Core] Load PreOrders Fail',
LoadPreOrdersSuccess = '[Core] Load PreOrders Success',
LoadPreOrderById = '[Core] Load P... |
ca214685c8649bc27d5d34612a0112968a75fb0e | TypeScript | yaritaft/algorithms | /quickSort.ts | 2.671875 | 3 | function quickSort(array2: number[]){
let pivot = Math.floor(array2.length/2);
} |
5614aabab180402fae1d5985eedc7def0b939109 | TypeScript | stormseed/tidy-config | /src/lib/ConfigFunctions.ts | 2.71875 | 3 | import * as path from 'path'
import { promises as fsPromises } from 'fs'
import { AbsolutePath, RelativePath, ListOfFileNames } from './SharedTypesAndVars'
import output from './OutputFunctions'
import { PathFunctions } from './PathFunctions'
import { PackageFileFunctions } from './PackageFileFunctions'
export class C... |
9536ec35bdf3b36056e4aadad198f58144cf1492 | TypeScript | AtelyPham/procon-server-dev | /src/v1/types/classes/TilePoint.ts | 2.953125 | 3 | import Point from "./Point"
export default class TilePoint extends Point {
_point: number = 0
TilePoint(point: number = 0) {
this._point = point
}
setPoint(point: number) {
this._point = point
return this
}
get point() {
return this._point
}
}
|
c7358ab20c7c5b3701ecdfd5243bc6fb4d5b3c10 | TypeScript | QScore/qscore-serverless | /src/util/encryption/encryptor.ts | 3.109375 | 3 | import crypto from 'crypto'
const secretKey = process.env.SECRET_KEY as string // Must be 256 bits (32 characters)
const ivLength = 16 // For AES, this is always 16
const bufferEncoding: BufferEncoding = "base64"
const algorithm = 'aes-256-cbc'
export function encrypt(text: string): string {
const iv = crypto.rand... |
33654eddfd71346e73a98323082a9b7662a6c7ec | TypeScript | aitheon-karma/ai-smart-infrastructure | /client/src/app/infrastructure-map/utils/get-area-bounding-rect.ts | 3 | 3 | import { Coordinates } from '../shared/interfaces/coordinates.interface';
import { BoundingRect } from '../shared/interfaces/bounding-rect.interface';
export const getAreaBoundingRect = (points: Coordinates[] = []): BoundingRect => {
const areaRect: BoundingRect = points.reduce((rect, { x, y }) => {
return {
... |
91e9a912987a190724e65489e9e755dda55de7a1 | TypeScript | citizenfx/fxcode | /src/vs/editor/browser/controller/textAreaState.ts | 2.546875 | 3 | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
57f70538676951e0d6a9c23d6f8dfacd65b8ec9c | TypeScript | microsoft/vscode-postgresql | /src/prompts/progressIndicator.ts | 2.625 | 3 | 'use strict';
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
import {window, StatusBarItem, StatusBarAlignment} from 'vscode';
export default class ProgressIndicator {
private _statusBarItem: StatusBarItem;
... |
4ab2a920675df7e6cf9a74d7c8c62e7626259000 | TypeScript | xyhdgh/algorithm022 | /Week_01/189.旋转数组.ts | 3.234375 | 3 | /**
Do not return anything, modify nums in-place instead.
*/
function rotate(nums: number[], k: number): void {
const len = nums.length;
if (len === 0 || !len) return;
let r = k % len;
while (r--) {
nums.unshift(nums.pop());
}
}
|
42212f164f207c3fd2cf9385d0fe3f09e1c79a30 | TypeScript | future4code/cruz-labenu-system19 | /src/endpoints/criarTurma.ts | 2.90625 | 3 | import {Request, Response} from 'express';
import connection from '../connection';
import {Class} from '../types'
export default async function criarTurma(
req: Request,
res: Response
): Promise<void> {
try {
const {nome, data_inicio, data_final, modulo} = req.body;
if(!nome || !data_inicio || !... |
b88383fcca063f67d96e92a32800408b41ad90cd | TypeScript | sheinsight/shineout | /src/Gap/Props.ts | 2.625 | 3 | import * as React from 'react'
import { ReactNode } from 'react'
import { StandardProps } from '../@types/common'
/**
* @title Gap
*/
export interface GapProps extends StandardProps {
/**
* @en column spacing in the horizontal direction
* @cn 水平方向的列间距
* @default 8
*/
column?: number | string
/**
... |
fcbddd2b546a72904c59c8028ee37511c5da62e7 | TypeScript | dkaluza/NeuralNetworkVisualization | /frontend/NNVisualization/src/app/build/layers/pool/pool.ts | 3.15625 | 3 | import { Layer } from '../layer/layer';
import { Padding, StrToPadding } from '../conv/conv';
export enum Pool {
Max,
Average
}
export function StrToPool(str: string): Pool {
switch (str) {
case 'Max':
return Pool.Max;
case 'Average':
return Pool.Average;
de... |
e19f5f007ff73cb3a7f93cc50d536e7f1f79bfc8 | TypeScript | havandenberg/react-fitness-club | /src/types/program.ts | 2.546875 | 3 | export interface Division {
id: string;
name: string;
}
export interface Instructor {
bio?: React.ReactNode;
name: string;
logoSrc?: string;
photoSrc?: string;
}
export interface Program {
aboutUrl: string;
divisions: Division[];
eventBackground: string;
eventColor: string;
id: string;
logoSrc... |
1b6b38e255b6b3bf3d47a76e01afe8a0d5afb387 | TypeScript | Byzanthelio/nem2-input-forms | /src/formElements/inputPassword.ts | 2.78125 | 3 | export class inputPassword{
public readonly type:string = "inputPassword";
public readonly options:undefined;
constructor(public readonly label : string,
public readonly description: string) {
};
public static create(label: string, description: string) : inputPassword{
return new inputPas... |
52397b8a40b732b2ea5e3e2d80bd4e57d41888aa | TypeScript | willy20040711/nextjs-grandstack-starter-typescript | /app/apollo/type-defs.ts | 2.78125 | 3 | // Describe our GraphQL schema with type definitions
export const typeDefs = `
type User {
userId: ID!
name: String
reviews: [Review] @relation(name: "WROTE", direction: "OUT")
avgStars: Float
@cypher(
statement: "MATCH (this)-[:WROTE]->(r:Review) RETURN toFloat(avg(r.stars))"
)
... |
600901e6a3782f93c40b66df316bedf078f69f7c | TypeScript | nickzinn/circles | /src/gamelib/sprites/TitleSprite.ts | 2.875 | 3 | import { Sprite } from "./Sprite";
import { Point } from "../types/Point";
import { Size } from "../types/Size";
export class TitleSprite implements Sprite{
name: string = 'Title';
position: Point = {x:0,y:0};
size: Size = {width:1, height:1};
speed =0;
angle =0;
isAlive: boolean = true;
zO... |
c3fde82cf6fe81800f4b20b48e585103fcf4e9a0 | TypeScript | leonel-aguirre/react-native-animations | /dvd-animation/withBouncing.ts | 2.796875 | 3 | import { AnimationState, defineAnimation } from "react-native-redash";
interface BouncingAnimationState extends AnimationState {
lastTimestamp: number;
direction: -1 | 1;
}
export const withBouncing = (
velocity: number,
lowerBound: number,
upperBound: number,
onBounce?: () => void
): number => {
"workl... |
7000d31d899b36c11e019832f888ef5d0ed1a1dd | TypeScript | espenja/radtools | /packages/bundle/src/configs/plugins/CleanTerminalPlugin.ts | 2.921875 | 3 | interface CleanTerminalPluginOptions {
/**
* Message to be printed
*/
message?: string
/**
* Only clear the screen if webpack is in watch mode
* @default true
*/
onlyInWatchMode?: boolean
/**
* Don't clear the screen on first webpack run
* @default true
*/
skipFirstRun?: boolean
/**
* Clear scr... |
c3596759c067fc41c298b87528914fc2964398cd | TypeScript | kravchis/just-dating | /frontend/projects/core/src/store/reducers/chat-message.reducer.ts | 2.546875 | 3 | import {EntityAdapter, createEntityAdapter} from '@ngrx/entity';
import * as Actions from '../actions/chat-message.action';
import {ChatMessageState, ChatMessageListState, defaultState} from '../states/chat-message.state';
export const adapter: EntityAdapter<ChatMessageState> = createEntityAdapter<ChatMessageState>()... |
7b24fc838b3cd4d3dbda76d4cf5aab2f977ba7b4 | TypeScript | Innovic-io/typescript-learning | /src/company.class.ts | 2.8125 | 3 | import { IUser } from "./user.interface";
import { ICompany } from "./company.interface";
import { resolve } from "url";
export class Company{
private company: ICompany[] = [] ;
/**
*
*/
constructor(){ }
addCompany(comp: ICompany) {
this.company.push(comp);
return this;
... |
9e6f724ba6432b811bcbc6d73a2854caca10f92f | TypeScript | matheuscasavechia/music-player-app-test | /music-player/src/app/services/Auth/auth.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { query } from '@angular/animations';
@Injectable({
providedIn: 'root'
})
export class AuthService {
private spotifyUri: string = 'https://accounts.spotify.com';
private clientId: string = '21e20fe... |
53544d60ff3bfd368e4ee209c1ff03236fecdc8e | TypeScript | MasterJoe2ez/bncb-master | /src/app/setup/set-price/set-price.ts | 2.578125 | 3 |
export class SetPrice {
code?: string = 'N/A';
type?: string | null | undefined;
price?: string | null | undefined;
constructor(params: SetPrice) {
Object.assign(this, params);
}
}
|
abf84113e1f35334ec92dfe0e38ccfcd56b99154 | TypeScript | delasteve/cling | /src/commands/admin/grant-permissions.command.ts | 2.71875 | 3 | import { IUserRepository } from '../../repositories/user.respository';
import { IMessenger } from '../../messengers/messenger.interface';
import { AbstractCommand } from '../abstract.command';
export class GrantPermissionsCommand extends AbstractCommand {
private readonly userRepository: IUserRepository;
private r... |
b67d36024fd75e61cc8a3894bf9d94827dd31866 | TypeScript | OrfeasZ/tua | /src/parser/constructs/expressions/boolExpression.ts | 2.703125 | 3 | import {BoolExprContext} from "../../../grammar/TuaParser";
import {Type} from "../../types/type";
import {Construct} from "../construct";
import {Expression} from "../expression";
export class BoolExpression extends Expression {
public readonly boolValue: boolean;
constructor(ctx: BoolExprContext, pa... |
7a4fdee04280dd85952d4fc2c334a4895683f65c | TypeScript | m93enbah/AngularToutarial | /Angular2021/Section16 NGRX Introduction/Youtube/my-app/src/app/Store/Effects/movie.effects.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { createEffect, Actions, ofType } from '@ngrx/effects';
import { EmptyError } from 'rxjs';
import { catchError, concatMap, exhaustMap, map, tap } from 'rxjs/operators';
import { Movie } from 'src/app/Models/movie';
import { DataService } from 'src/app/Service/data.serv... |
6890698ceb7c62df8e2340e72afe1d51e975982f | TypeScript | emeraldwalk/slate-playground | /packages/0.5x/src/util/command.ts | 2.5625 | 3 | import { Editor } from 'slate'
import { Method } from '../data/editor'
export function buildArg(
methods: Method[],
arg: Method['args'][0],
value: string,
) {
if (arg.type === 'string') {
return value
}
let parsed
try {
parsed = JSON.parse(value)
}
catch (e) {
parsed = value
}
retur... |
dff87b0a36e7648c7fefba4ef517ea0a9cafaecd | TypeScript | NatalieNunez/CodeSignal | /reverse-in-parentheses.ts | 3.390625 | 3 | function reverseInParentheses(inputString: string): string {
while (inputString.includes('(')) {
inputString = inputString.replace(/\(([^()]*)\)/, (_, str) => [...str].reverse().join(''));
}
return inputString;
}
|
83a48a023ceb461fad9b9ec0e6b89cbea7c9d85c | TypeScript | Nevoss/server-up | /src/utils/log.ts | 2.84375 | 3 | const chalk = require('chalk')
/**
* run an error message and close the program
*
* @param message
*/
export const error = (message: string) => {
console.error(chalk.bold.red(message))
process.exit()
}
/**
* Print a success message.
*
* @param message
*/
export const success = (message: string) => {
co... |
8ee686fe10657b02ef2e6b9cfd03f67e2a5e3ea9 | TypeScript | ethan-qin/leetcode | /240.ts | 4.0625 | 4 |
// 编写一个高效的算法来搜索 m x n 矩阵 matrix 中的一个目标值 target 。该矩阵具有以下特性:
// 每行的元素从左到右升序排列。
// 每列的元素从上到下升序排列。
// 示例 1:
// 输入:matrix = [[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24],[18,21,23,26,30]], target = 5
// 输出:true
// 输入:matrix = [[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24],[18,21,23,26,30]]... |
68be4f1379fe83157835fe642ddfd650d620f66e | TypeScript | green-fox-academy/BalazsSipos | /week-02/day-03/03Diagonals.ts | 2.96875 | 3 | 'use strict';
const canvas = document.querySelector('.main-canvas') as HTMLCanvasElement;
const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
// DO NOT TOUCH THE CODE ABOVE THIS LINE
// Draw the canvas' diagonals.
// If it starts from the upper-left corner it should be green, otherwise it should be red.... |
7e84fb8b1d1342843cb30fcf6b4f17a223ecebd1 | TypeScript | HathorNetwork/hathor-wallet-lib | /src/utils/utxo.ts | 3.09375 | 3 | /**
* Copyright (c) Hathor Labs and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { IStorage, IUtxo, IUtxoFilterOptions, UtxoSelectionAlgorithm } from '../types';
export enum UtxoSelection {
FAST = 'fast',... |
7f1f105965c8ba59714d9cebfb01a5aaf341de7e | TypeScript | immyidubor/qa_playground | /src/practice/creatingFunctions.ts | 3.40625 | 3 | function fancyPrint(firstString: string, secondString: string): string {
//code goes here
var stringA = firstString;
var stringB = secondString;
var result = stringA + "\n" + stringB;
return result;
}
console.log(fancyPrint("*****Hello*****", "*****World*****")); |
02a87f188b6b53d032b5ee57f2739f6af3e1b8e5 | TypeScript | damianpokorski/adventofcode | /2021/day2.ts | 3.359375 | 3 | import { data } from "./data/day2.data";
interface Vector2 {
depth: number;
horizontal: number;
};
const Vector2Zero = {
depth: 0,
horizontal: 0
} as Vector2;
const addVector2 = (a: Vector2, b: Vector2) => ({
depth: a.depth + b.depth,
horizontal: a.horizontal + b.horizontal,
}) as Vector2;
const multipl... |
dd364fd5f7a5fb51003ca4eb76c56fac2d374e03 | TypeScript | Juexro/react-components | /components/utils/index.ts | 3.140625 | 3 | export function className(name: any): string {
if (Array.isArray(name)) {
return name.reduce((total, current) => {
const result = className(current);
if (result) {
total += `${total ? ' ' : ''}${result}`;
}
return total;
}, '')
}
if (Object.prototype.toString.call(name) ==... |
2b5c131f11aa9a3be3346ab5684b0759cb8aa14b | TypeScript | luckyxts/leetcodeTs | /medium/61_70/63_Unique_Paths_II.ts | 3.171875 | 3 | /**
* Created by Administrator on 2020/6/11.
*/
function uniquePathsWithObstacles(obstacleGrid: number[][]): number {
for(let i: number = 0; i < obstacleGrid.length; i++){
for(let j: number = 0; j < obstacleGrid[i].length; j++){
if( obstacleGrid[i][j] === 1){
obstacleGrid[i][j]... |
3e80dd54d4ae909b7353863c8c4628772a4232f1 | TypeScript | eazey-e/WagerrCom | /src/app/utils/addressValidator.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import * as baseX from 'base-x';
import sha from 'sha.js';
import { environment } from '../../environments/environment';
@Injectable()
export class AddressValidatorService {
private addressTypes = {
0x49: {
type: ... |
cae3aaf1a9246af75b122955c7a37b46bdaaddcf | TypeScript | untoldwind/t-rust-less-ui | /attic/action-creator.ts | 3.65625 | 4 | /**
* @type EmptyAction - Empty Action Type
* @template T - Generic Type
*/
export type EmptyAction<T> = {
readonly type: T;
};
/**
* @type PayloadAction - Flux Standard Action Type
* @template T - Generic Type
* @template P - Generic Type
*/
export type PayloadAction<T, P> = {
readonly type: T;
readonly ... |
77f5d496089b462416f53acb6e23e3b88dcdfea1 | TypeScript | kelseyyoung/office-ui-fabric-react | /scripts/tasks/api-extractor.ts | 2.609375 | 3 | import fs from 'fs';
import * as glob from 'glob';
import * as path from 'path';
import jju from 'jju';
import { apiExtractorVerifyTask, task, series, resolveCwd, logger, TaskFunction, TscTaskOptions } from 'just-scripts';
const apiExtractorConfigs: Array<
[
configPath: string,
/**
* config name is crea... |
118a79c6eccb120f6809a86d31ad08b2e8f51274 | TypeScript | Lorick23/breizhcamp-2018-console | /ihm.ts | 2.796875 | 3 | import readline from 'readline';
import {Service} from './service';
export class Ihm{
public rl:readline.Interface;
public service:Service;
constructor(){
this.rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
this.service = n... |
7d8261fd6329b36a59548b9e608e2c3d3632be52 | TypeScript | ACRoark/wismoui | /app/components/Stepper/getActiveProduct.ts | 2.5625 | 3 | import { IProduct } from 'types';
const getActiveProduct = (productType: string, products: IProduct[]): IProduct | undefined => {
const activeProduct = products.find(
(product: IProduct): boolean | undefined => product.productType === productType && product.isCanceled === false,
);
return activeProduct;
};
... |
98fb2ca162adfc62c5302162150001bfe41a961d | TypeScript | gnoesiboe/personal-goal-based-todos | /context/todos/stateModifiers/filterModifiers.ts | 2.59375 | 3 | import { countAppliedFilters } from './../utility/todoFilterUtilities';
import { AppliedFilters, State } from '../reducers/todoReducer';
import { applyFilters } from '../utility/todoFilterUtilities';
import produce from 'immer';
export const applyFilterToggleModifier = (
currentState: State,
filter: keyof Appl... |
e0706b1f9404564d5607f71f67ec3d073b918270 | TypeScript | gitter-badger/CarbonLDP-JS-SDK | /src/Agents.ts | 2.65625 | 3 | import Context from "./Context";
import * as Agent from "./Agent";
import * as Pointer from "./Pointer";
import * as Response from "./HTTP/Response";
import * as Utils from "./Utils";
import * as Errors from "./Errors";
export class Class {
private context:Context;
constructor( context:Context ) {
this.context = ... |
cf409cc719b33fa0a71157cea9ef0801b9cdabab | TypeScript | joonhocho/ts-jutil | /src/string/formatName.ts | 2.890625 | 3 | const formatNamePart = (s: string): string => {
if (s) {
return s[0].toUpperCase() + s.substring(1).toLowerCase();
}
return '';
};
const allWS = /\s+/g;
export const formatName = (s: string): string => {
if (s) {
return s.trim().split(allWS).map(formatNamePart).join(' ');
}
return '';
};
|
991e5598381d4e1f2fea8f097a07cde9af1ec0cf | TypeScript | codebysandip/nralcm | /src/exceptions/handler-not-found.exception.ts | 2.625 | 3 | import { HttpResponseMessage } from "../lifecycle";
import { Exception } from "../core";
import { StatusCode } from "../common/enums";
/**
* Expection class to throw handler not found 400
*/
export class HandlerNotFoundException<T> extends Exception<T> {
httpResponseMessage: HttpResponseMessage<T>;
construct... |
5f256dfd122403fa4b6e49ee950d3c2972314141 | TypeScript | Timba82/heroes | /src/app/helpers/pipes/filter.pipe.ts | 2.78125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { Hero } from 'src/app/interfaces/heroe/hero';
@Pipe({
name: 'filter',
pure: false
})
export class FilterPipe implements PipeTransform {
transform(value: Hero[], filteringString: string, ...arg: string[]): Hero[] {
if (value.length === 0 || !filteri... |
6ad875c153b3e52c0e8cf768e2d1ff41db1beade | TypeScript | yetsen/surveychartapp | /src/main/webapp/app/shared/model/answer.model.ts | 2.84375 | 3 | export interface IAnswer {
userId?: string;
questionName?: string;
choiceValue?: string | number;
}
export class Answer implements IAnswer {
constructor(public userId?: string, public questionName?: string, public choiceValue?: string | number) {}
}
|
bf2600bc4d90b6d09adbb7222e9093750164eec9 | TypeScript | karolis-arbaciauskas/node-ibus-mediacenter | /src/ibus/IbusProtocol.ts | 2.5625 | 3 | import { Transform, TransformCallback, TransformOptions } from 'stream';
import autoBind from 'auto-bind';
import { Encoding } from '../constants';
import loggerSystem from '../logger';
import { IncommingMessage } from './types';
const logger = loggerSystem.child({ service: 'IbusProtocol' });
class IbusProtocol ext... |
050a6a149fab959810ae2ce173ce9fda2ec0e2de | TypeScript | lijugeorge/reach4 | /src/app/shared/list-errors.component.ts | 2.546875 | 3 | import { Component, Input } from '@angular/core';
import { Errors } from './models';
@Component({
selector: 'list-errors',
templateUrl: './list-errors.component.html'
})
export class ListErrorsComponent {
formattedErrors: Array<string> = [];
@Input()
set errors(errorList: any) {
this.forma... |
03b053a6e3ad13ba80693e79eaffc7c1f342e464 | TypeScript | bandyg/politicodds | /server/src/services/OddsService.ts | 2.796875 | 3 | import BettingClient from '../domain/BettingClient'
import { RunnerOdds, Runner } from '../domain/types'
import Odds from '../domain/Odds'
class OddsService {
constructor (
private bettingClient: BettingClient
) {}
async getByMarket (marketId: string, limit?: number): Promise<RunnerOdds[]> {
c... |
191a909702b0b4b0e1b1e89dd818cf7259857c38 | TypeScript | forCrowd/GlobalGoalsFund | /ng2Client/app/modules/logger/logger.service.ts | 2.53125 | 3 | import { Injectable } from "@angular/core";
import { BodyOutputType, ToasterConfig, ToasterService } from "angular2-toaster";
import { pad } from "../../utils";
//export { ToasterConfig, ToasterModule }
@Injectable()
export class Logger {
toasterConfigured = false;
constructor(private toasterService: Toast... |
5e7ba707286e9bfb2f1e008d0f060089b3a8c942 | TypeScript | jsxc/jsxc | /src/Avatar.ts | 2.921875 | 3 | import Hash from '@util/Hash';
import { IAvatar } from './Avatar.interface';
import Client from './Client';
import PersistentMap from './util/PersistentMap';
export default class implements IAvatar {
private properties: PersistentMap;
constructor(private sha1Hash: string, type?: string, data?: string) {
l... |
d080189ecee7a3bc4ccfb7ee307e46d0cd5e0488 | TypeScript | S4elkyn4eGGG/project | /src/store/main/index.ts | 2.703125 | 3 | import { BehaviorSubject } from 'rxjs';
import { useEffect, useState } from 'react';
import { IMainState } from './model';
export const initialState: IMainState = {
isLoading: false,
userName: null,
};
export let _state: IMainState = initialState;
const store$ = new BehaviorSubject<IMainState>(_state);
export ... |
142f6e9b6d45dbbd7c252deccf9f210101844454 | TypeScript | sshubhamk1/social_site | /src/RoleUser/Controllers/authController.ts | 2.546875 | 3 | import { Request, Response, RequestHandler } from "express";
import bcrpyt from "bcryptjs";
import { Users } from "../../Engine/Models/users";
import { User_auth } from "../../Engine/Models/user_auth";
export const postChangePassword: RequestHandler = async (
req: Request,
res: Response
) => {
try {
const { ... |
9a5607766800aeeebc95d4cf2f3c7b7a154b0b81 | TypeScript | Luobata/L3 | /src/UI/layout/position.ts | 3.25 | 3 | /**
* @desc 计算位置
*/
import Chart from 'UI/chart/chart';
type verticalType = 'top' | 'bottom' | 'middle';
type horizonType = 'left' | 'center' | 'right';
/**
* default class
*/
export default class Position {
private chart: Chart;
private vType: verticalType;
constructor(chart: Chart) {
this... |
40612965f6505efb6e7fcedc07ca12feb813d667 | TypeScript | bagbag/tstdl | /base/source/utils/periodic-reporter.ts | 2.625 | 3 | import type { Observable } from 'rxjs';
import { Subject } from 'rxjs';
import { DeferredPromise } from '../promise/deferred-promise.js';
import { CancellationToken } from './cancellation-token.js';
import { cancelableTimeout } from './timing.js';
export class PeriodicReporter {
private readonly reportSubject: Subje... |
220fc8ddbef7ccd583e9c81bc3ef232a894f1116 | TypeScript | ctmm/biotope-resource-loader | /src/fp/difference.ts | 2.9375 | 3 | import curry from './curry';
import _Set from './Set';
const difference = (first: ReadonlyArray<any>, second: ReadonlyArray<any>) => {
const out = [];
let idx = 0;
const firstLen = first.length;
const secondLen = second.length;
const toFilterOut = new _Set();
for (let i = 0; i < secondLen; i+... |
2222296a163da82f1a37a4ff292595e9cccd0e12 | TypeScript | green-fox-academy/Eszkis | /JavaScript/Week-03/Day-2/Double.ts | 3.015625 | 3 | 'use strict';
// Create a method that decrypts duplicated-chars.txt
let fs = require('fs');
function double(fileName: string) {
let content: string[] = fs.readFileSync(fileName, 'utf-8').split('\r');
let array: string[][] = [];
let sentences: string = '';
content.forEach(function (value) {
array.push(valu... |
cd285932100c504ef760a5030990ed52fd1d350a | TypeScript | KhushalGoyal/ExpressGatewayMicroservicePattern | /employee-gateway/identity-service/src/controllers/auth.controller.ts | 2.515625 | 3 | import { Router, Request, Response, NextFunction } from 'express';
import { body } from 'express-validator';
import { ErrorResponse, SuccessResponse } from '../helper/reponse';
import { validate } from '../middleware/validateUserRequest';
import { AuthService } from '../service/employee.service';
const AuthController ... |
872d4847834f66cd90dff8620a289dc6e6a5fd06 | TypeScript | HUANGRuirui1/ng-counter-group-2020-11-30-1-19-19-990 | /src/app/service/counter-group.service.spec.ts | 2.671875 | 3 | import { TestBed } from '@angular/core/testing';
import { CounterGroupService } from './counter-group.service';
describe('CounterGroupService', () => {
let service: CounterGroupService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CounterGroupService);
});
it('shou... |
b43e4a38d4a52073ef1a63841a023c89ba09ab66 | TypeScript | paloukari/shine | /app/dynamic/control/dynamic-dropdown-model.ts | 2.546875 | 3 | import { DynamicControlModel } from './dynamic-control-model';
import { NodeWrapper } from '../../parser/transaction/node-wrapper';
export class DynamicDropdownModel extends DynamicControlModel<any[]> {
controlType = 'dropdown';
isListBox = false;
private _children: { key: string, value: string }[];
cons... |
f87d364d6e25f05d3f7a094b22ca1188bcef824a | TypeScript | kuoluo1995/lineupjs | /src/model/CompositeNumberColumn.ts | 2.671875 | 3 | import { format } from 'd3-format';
import CompositeColumn from './CompositeColumn';
import type { IDataRow, IGroup, IColumnDesc } from './interfaces';
import { isMissingValue } from './missing';
import NumberColumn from './NumberColumn';
import { SortByDefault, toolbar } from './annotations';
import type { ISequence }... |
fe2f34c9e495a5d7bfcaf048658542d87ccbfe30 | TypeScript | huaweicloud/huaweicloud-sdk-nodejs-v3 | /services/sms/v3/model/UpdateTemplateRequest.ts | 2.515625 | 3 | import { UpdateTemplateReq } from './UpdateTemplateReq';
export class UpdateTemplateRequest {
public id?: string;
public body?: UpdateTemplateReq;
public constructor(id?: string) {
this['id'] = id;
}
public withId(id: string): UpdateTemplateRequest {
this['id'] = id;
retur... |
a6302b2c064b94f977b649be3f9faacb552bbddf | TypeScript | Laisheung/codewars | /primorialofanumber/primorialofanumber.spec.ts | 2.71875 | 3 | import { numPrimorial } from "./primorialofanumber";
describe("Basic tests", () => {
it("Testing for 3", () => expect(numPrimorial(3)).toStrictEqual(30));
it("Testing for 4", () => expect(numPrimorial(4)).toStrictEqual(210));
it("Testing for 5", () => expect(numPrimorial(5)).toStrictEqual(2310));
it("Testing f... |
745dba1c457918afae6741b5c9592e215bb22ea2 | TypeScript | Erik3003/myCalendar24 | /src/app/components/login/login.component.ts | 2.65625 | 3 | /*
* This component displays the login form. It consists functions for validating
* the users input and sends valid input to the authentification service.
*/
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { AuthService } from '../../se... |
8c6a6270f8ec24a26558e0eb7d6a3ae4693be311 | TypeScript | Gretten/gba | /src/api/GoogleApiHandler.ts | 2.921875 | 3 | const MAIN_LINK = 'https://www.googleapis.com/books/v1/volumes'
const API_KEY = 'AIzaSyCBVroRsJ0yUbiLU8r2pT4dzRdt6oFbUOw'; // перенести
interface GoogleApiInt {
retrieve: (params: any) => Promise<any>
}
class GoogleApiHandler implements GoogleApiInt {
private mainLink: string;
private apiKey: string;
... |