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 |
|---|---|---|---|---|---|---|
6e0cf66fc9100ebc830cc642e6bc23b4ed375c13 | TypeScript | WangHL0927/grafana | /packages/grafana-data/src/utils/labels.ts | 3.1875 | 3 | import { Labels } from '../types/data';
/**
* Regexp to extract Prometheus-style labels
*/
const labelRegexp = /\b(\w+)(!?=~?)"([^"\n]*?)"/g;
/**
* Returns a map of label keys to value from an input selector string.
*
* Example: `parseLabels('{job="foo", instance="bar"}) // {job: "foo", instance: "bar"}`
*/
exp... |
e595855b74733dd484e0bae5f19014c328d64013 | TypeScript | taosut/SourceBin | /backend/src/models/User.ts | 2.71875 | 3 | import mongoose from 'mongoose';
import * as uuid from 'uuid';
export interface User extends mongoose.Document {
_id: string;
email: string;
username: string;
about: {
avatarURL?: string;
bio?: string;
website?: string;
location?: string;
};
oauth: {
discord?: string;
github?: str... |
3cc64f45ce10ca171a073b11f8064f781be01c8d | TypeScript | MarkMatute/MarkMatute.github.io | /src/models/projects.ts | 2.65625 | 3 | export class Project {
title?: string;
subTitle?: string;
image?: string;
company?: string;
description?: string;
technologies?: string[];
tags?: string[];
liveLink?: string;
slug?: string;
}
export const PROJECTS: Project[] = [
{
title: 'Open Source Projects',
subTitle: 'REST API template... |
ec981d094e76b0758b4a28a063b0589807afef94 | TypeScript | sean-hammon/phogra-ui2 | /src/admin/store/admin.reducer.ts | 2.625 | 3 | import { AdminState, initialState } from './admin.state';
import { AdminActions, ReducerAction } from './admin.actions';
export function adminReducer(
state: AdminState = initialState,
action: ReducerAction
): AdminState {
switch (action.type) {
case AdminActions.LOGIN_SUCCESS:
consol... |
ceaf03adfe4196771388d711b192ac2f79bd3411 | TypeScript | OhioUniversityRevUC2020/APIServer | /src/routes/UserRoute.ts | 2.53125 | 3 | import { Body, Get, JsonController, Param, Post, QueryParam } from 'routing-controllers';
import { Inject } from 'typedi';
import { UserService } from '../services/UserService';
@JsonController('/user')
export class UserRoute {
@Inject()
private userService!: UserService;
@Post('/link')
async link(
@Body()... |
9aa032b753a58d0b06f8ea049e0b867a7ad69054 | TypeScript | soitun/tabris-js | /test/typescript/Widgets/Picker.test.ts | 2.71875 | 3 | import {ColorValue, Picker, PickerSelectEvent, Properties, PropertyChangedEvent, FontValue} from 'tabris';
let widget: Picker = new Picker();
// Properties
let borderColor: ColorValue;
let itemCount: number;
let itemText: (index: number) => string;
let selectionIndex: number;
let textColor: ColorValue;
let font: Font... |
2a7b31333e37c7ac19f699d19f7449ffc61ceb17 | TypeScript | green-fox-academy/gulyaasjaanos | /inheritance/garden-app/Tree.ts | 2.609375 | 3 | "use strict";
import {Plant} from "./Plant";
class Tree extends Plant {
public static absorb:number = 0.40;
private static type:string = "Tree";
constructor (color:string, wateramount:number) {
super(color, wateramount, Tree.absorb, Tree.type);
}
}
export {Tree}; |
04d99e4125cd13f487e41ac67febd03f465a65dd | TypeScript | composablesys/collabs | /crdts/src/base_collabs/abstract_maps.d.ts | 2.9375 | 3 | import { IMap, MapEventsRecord } from "@collabs/core";
import { PrimitiveCRDT } from "./primitive_crdt";
/**
* Skeletal implementation of the [[IMap]] interface, as a subclass of
* [[PrimitiveCRDT]].
*
* This class is a convenience for Collab implementers. It provides
* some default method implementations and lea... |
a4d4cbdd6018cf54c983933eb6c89d67014e4da9 | TypeScript | LinuCC/guren-tree | /src/use-count-to.ts | 2.84375 | 3 | import { useInterval } from "./use-interval";
import { useState, useEffect } from "react";
export const useCountTo = ({
max,
delay
}: {
max: number;
delay: number | null;
}): number => {
const [count, setCount] = useState(0);
const [delayStatus, setDelayStatus] = useState<number | null>(delay);... |
cc3d9e3fe026ba7ac4807decd6094c30c3ad38a4 | TypeScript | nargok/ts_playground | /src/constructor-parameters.ts | 3.8125 | 4 | export {};
class Person {
name: string;
age: number;
constructor(name: string, age: number) {
this.name = name;
this.age = age;
}
}
let taro = new Person("taro", 43);
console.log({ taro });
type PersonType = typeof Person;
type Profile = ConstructorParameters<PersonType>;
const profile: Profile = ... |
e290b63f0148d423ab0e8d6687b44d0cdc27e497 | TypeScript | frothywater/quick-sort-visualize | /api/generateRandomNumbers.ts | 2.921875 | 3 | export default function generateRandomNumbers(count: number): number[] {
const array = new Array<number>(count);
for (let i = 0; i < count; i++) array[i] = Math.random();
return array;
}
|
b65dd8c9de01d1753073782334f663df078b9b70 | TypeScript | Mahluza/Code-Checker | /server/tests/FileMatch.spec.ts | 2.6875 | 3 | import { expect } from 'chai'
import CodeMatch from '../src/models/comparision/CodeMatch'
import FileMatch from '../src/models/comparision/FileMatch'
import FileModel from '../src/models/content/FileModel'
import SyntaxTreeNode from '../src/models/content/SyntaxTreeNode'
describe('tests for FileMatch', () => {
let f... |
a8638da8d5762d9ba8155bd15b2d7afa941d5c91 | TypeScript | dbgeek/codewars | /typescriptKatas/JosephusSurvivor/index.ts | 3.671875 | 4 | export function josephusSurvivor(n: number, k: number) {
const d: number[] = [...Array(n +1).keys()];
d.shift();
let p = 0;
while (d.length > 1) {
p = (p + k-1) % d.length
d.splice(p ,1)
}
return d[0]
}
console.log(josephusSurvivor(7,3), 4)
console.log(josephusSurvivor(7,300), 7... |
4355dfc1d25c45b77b1f11183b3b59c4cce38fe8 | TypeScript | thiagozf/warthog | /src/torm/operators.ts | 2.984375 | 3 | import { SelectQueryBuilder } from 'typeorm';
export function addQueryBuilderWhereItem<E>(
qb: SelectQueryBuilder<E>,
dbColumn: string,
columnWithAlias: string,
operator: string,
value: any
): SelectQueryBuilder<E> {
switch (operator) {
case 'eq':
if (value === null) {
return qb.andWhere(... |
187ca01e6e4cd81d57aec42fcea0d85dbd8337b4 | TypeScript | werk85/matechs-effect | /packages/core/src/next/Schedule/addDelayM.ts | 2.921875 | 3 | import { chain_ } from "../Effect/chain_"
import { delay } from "../Effect/delay"
import { Effect } from "../Effect/effect"
import { succeedNow } from "../Effect/succeedNow"
import { Schedule } from "./schedule"
import { updated_ } from "./updated_"
/**
* Returns a new schedule with the effectfully calculated delay ... |
cf18c18bc7ba6bc22cabfb6cc0b5bc0df841e316 | TypeScript | codeapps/angularRestarunt | /src/app/shared/calculator/calculator.component.ts | 2.578125 | 3 | import { Component, OnInit, HostListener, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
@Component({
selector: 'app-calculator',
templateUrl: './calculator.component.html',
styleUrls: ['./calculator.component.scss']
})
export class CalculatorComponent im... |
66a85c7adca6464dbf7cb72e2b8c050c0a4525d8 | TypeScript | green-fox-academy/Hpeter1988 | /week-01/day-3/define-basic-info.ts | 3.078125 | 3 | 'use strict';
// Define several things as a variable, then print their values
let myName: string = "Harasztia Péter"
let myAge: number = 30
let myHight: number = 1.7
let married: boolean = false
console.log(myName)
console.log(myAge)
console.log(myHight)
console.log(married)
export {}; |
c3ff2290a7a0a7dd11182daae19990c615a2b87b | TypeScript | postcasio/isogame | /src/game/editor/Cursor.ts | 3.046875 | 3 | import { EditorObjectMesh } from ".";
export class Cursor {
mesh?: EditorObjectMesh;
x = 0;
y = 0;
z = 0;
grabbedMesh?: EditorObjectMesh;
grabbedWidth = 0;
grabbedHeight = 0;
grabbedDepth = 0;
constructor(x: number, y: number, z: number) {
this.x = x;
this.y = y;
this.z = z;
}
gra... |
011edd2a69139fe4f0405fcf73626d439ef7e458 | TypeScript | xBATx/text-annotation-tool | /src/actions/index.ts | 2.5625 | 3 | import { Action } from 'redux';
import {
SUBMIT_ARTICLE_MODAL,
ADD_ANNOTATION,
SELECT_TEXT,
REMOVE_SELECTED_ELEMENT,
RESET_SELECTION,
SELECT_ANNOTATION,
SET_ARTICLE_MODAL_OPENED,
SET_ARTICLE_MODAL_TEXT,
ADD_RELATION,
SELECT_RELATION,
SET_SHOW_RELATIONS,
PREPARE_RELATION,
} from 'src/constants';
... |
729f4737c78dc17a7ff26ceab6a73132cbfe817e | TypeScript | dghalbr/wheeler | /src/expression.ts | 3 | 3 | import {Add, And, Divide, Equals, GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo, Modulo, Multiply, NotEquals, Or, Subtract } from './filters';
import {Cast, Length, Contains, Trim, Now} from './methods';
import {IExpression} from './expressions/iexpression';
import {UnaryExpression, BinaryExpression, ... |
336a4bd13f6fcdc4f68b7a4eb0019d44690b074d | TypeScript | greenn-lab/egovframe-msa-edu | /frontend/admin/src/hooks/useLocalStorage.ts | 3.109375 | 3 | import { useState } from 'react'
export const useLocalStorage = (key: string, initialValue: unknown = '') => {
const [storeValue, setStoreValue] = useState(() => {
try {
const item = window.localStorage.getItem(key)
return item ? JSON.parse(item) : initialValue
} catch (error) {
return init... |
6f2b3042c72a019df14b9b9ad28c00e92be467b2 | TypeScript | angelospillos/nodejs-typeorm-typescript-tslint-expessjs-nodemon-boilerplate-example-template | /src/action/user.action.ts | 2.75 | 3 | import { Request, Response } from "express";
import { getManager } from "typeorm";
import { UserEntity } from "../entity/user.entity";
export namespace UserAction {
/**
* Loads all users from the database.
*/
export async function getAll(request: Request, response: Response) {
// get a user repository to ... |
bfd432d2d133bc28a593e68fe9abaa47a676ba48 | TypeScript | DNaunin/ComicVine | /src/utils/api.ts | 2.625 | 3 | export type APICharacter = {
gender: 1 | 2 | 3;
image: {
icon_url: string;
medium_url: string;
screen_url: string;
screen_large_url: string;
small_url: string;
super_url: string;
thumb_url: string;
tiny_url: string;
original_url: string;
image_tags: string;
};
name: strin... |
808894c33ddab19b0af1aedd64f6d41ae26ffd01 | TypeScript | Small-Basic-French/SmallBasic-Online | /src/compiler/syntax/command-parser.ts | 2.671875 | 3 | import { ErrorCode, Diagnostic } from "../diagnostics";
import { BaseCommandSyntax, IfCommandSyntax, ElseIfCommandSyntax, ElseCommandSyntax, EndIfCommandSyntax, ForCommandSyntax, ForStepClause, EndForCommandSyntax, WhileCommandSyntax, EndWhileCommandSyntax, LabelCommandSyntax, GoToCommandSyntax, SubCommandSyntax, EndSu... |
ec6784b118d2d97549249c63411fb5f960e7fe35 | TypeScript | pacifist24/tlFormatter | /lib/tlFormatter.ts | 2.90625 | 3 | export type TLData = {
mode: string
phase: number
bossName: string
damage: number
battleDate: string
characters: {
lv: number
name: string
star: number
rank: number
specialLv: number
remark: string
}[]
startTime: number
endTime: number
timeline: { time: number; name: string; ... |
8cc922b4343308a628bafa9952976b864a919d41 | TypeScript | 420Integrated/fourtwentyjs-client | /test/net/peer/peer.ts | 2.734375 | 3 | /* eslint-disable */
// TODO: re-enable linting. Disabled because much of test is commented out
// resulting in unused variable false positives
import tape from 'tape-catch'
const td = require('testdouble')
import { Peer } from '../../../lib/net/peer'
import * as events from 'events'
tape('[Peer]', (t) => {
const pe... |
f06e404f839c0454b8ba6cdb0e92e7f86de7fb8d | TypeScript | andre-potsdam/Proto_2019 | /proto-app/src/app/common/model/form-control-config.ts | 3.046875 | 3 | import { Subject } from 'rxjs';
export class FormControlConfig {
// Name for technical purposes. No whitespaces.
name: string;
// Label of form row.
rowLabel?: string;
// Explaining information for row.
// NOTE: This is rendered as inner HTML, so HTML tags can be used!
infoText?: string;
// Info te... |
83e1cdb2d386878cb5c0ff1d57c8fd6a6af721c2 | TypeScript | transclusion/vdom | /src/diff.ts | 2.5625 | 3 | import {callWillDiffHook} from './callWillDiffHook'
import {
DID_INSERT,
DID_REMOVE,
DID_UPDATE,
INSERT,
POP_NODE,
PUSH_NODE,
REMOVE,
REMOVE_ATTR,
REPLACE,
SET_ATTR,
SET_TEXT,
} from './constants'
import {extractVNode} from './extractVNode'
import {hasHook} from './hasHook'
import {isThunk} from '... |
928f02b0580ab2c94267be900c073c4fa42094f7 | TypeScript | denoland/deno_std | /log/handlers.ts | 2.953125 | 3 | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { getLevelByName, LevelName, LogLevels } from "./levels.ts";
import type { LogRecord } from "./logger.ts";
import { blue, bold, red, yellow } from "../fmt/colors.ts";
import { exists, existsSync } from "../fs/exists.ts";
import { BufWrite... |
38b640e7d2c5e845149ab4719b4cc90e41160850 | TypeScript | Sergiobi9/TFGdashboard | /src/app/pages/concerts/pipe/date-concert.pipe.ts | 3.234375 | 3 | import { Pipe, PipeTransform } from "@angular/core";
/*
* Raise the value exponentially
* Takes an exponent argument that defaults to 1.
* Usage:
* value | exponentialStrength:exponent
* Example:
* {{ 2 | exponentialStrength:10 }}
* formats to: 1024
*/
@Pipe({ name: "dateConcertPipe" })
export class DayC... |
bcc5478c75a7ba2f95025d2676f90d0aaf128fa9 | TypeScript | wjdgpwl1004/next-toyProject | /reducers/user.ts | 2.734375 | 3 | import { UserState } from "../types/reduxState";
import produce from 'immer';
//* 초기 상태
const initialState: UserState = {
id: 0,
email: "",
lastname: "",
firstname: "",
birthday: "",
isLogged: false,
profileImage: "",
signUpError: null,
logInError: null,
};
export const SIGN_UP_REQ... |
3ed570af92d91ea43a95bcc51e6bc8b5ea6afcb3 | TypeScript | mlaanderson/firebase-budget | /webapp/src/controllers/events.ts | 3.421875 | 3 | type Constructor<T> = new(...args: any[]) => T;
function EventMaker<T extends Constructor<{}>>(Base: T) {
return class Events extends Base {
private listeners: {[event: string]: Array<(...args : any[]) => void>};
constructor(...args: any[]) {
super(...args);
this.li... |
cbfe6cb2712d68763f55fea50f724ad37a886844 | TypeScript | ApPlamen/Restaurants | /FrontEnd/src/app/shared/components/simple-table/simple-table.component.ts | 2.75 | 3 | import { ChangeDetectionStrategy, Component, Injector, Input } from '@angular/core';
import { SimpleTableColumn } from '../../models/simple-table.model';
import { NOT_AVAILABLE } from './simple-table.constants';
@Component({
selector: 'tmc-simple-table',
templateUrl: './simple-table.component.html',
styleUrls: [... |
d1cd6a05e31341cec8dcf89225ae5f7004e31d05 | TypeScript | SimonAlling/telia-wifi-auto-login | /.userscripter/build/config.ts | 2.78125 | 3 | import { not } from "./utils";
import {
FILE_CONFIG,
FILE_CONFIG_PROPERTIES_OPTIONAL,
FILE_CONFIG_PROPERTIES_REQUIRED,
format,
} from "./io";
// These keys must be present in the config file:
import CONFIG_KEYS_REQUIRED from "../../config/validation/userscript-required";
// These keys are recognized but... |
0524e03e481ebeee3ddb011b979885f0b57c4c9f | TypeScript | roybcr/Algorithms | /source/Unions/makeUnique.ts | 4.0625 | 4 | /**
* makeUnique Takes a Set or an Array of elements, and if it’s given an Array,
* it’ll sort that Array remove duplicates according to some comparison function.
* After all that, it will return the original collection. {@link makeUnique}.
*/
export function makeUnique<T, C extends Set<T> | T[]>(
collection: C,
... |
eae0ccacc0bde36fe4d45af1e4a732d824737670 | TypeScript | cancerberoSgx/suitecommerce-types | /tests/ts-any-issue/src/valueOfTypeTest.ts | 4.15625 | 4 |
/** returns the type of the value with key K in the Mapped type T.
*
* Example1: `type _string = ValueOf<A, 'a'>`
*
* Example 2 :
*
```
// the following is model-like class which attributes object are described with a type param and which
// getAttributes() and setAttributes methods are automatically type ... |
727c7601f597cabf641cf867f67f69639f606c05 | TypeScript | remuspoienar/apigen-admin | /src/app/helpers/api-request.helper.ts | 2.71875 | 3 | export function formatBody(body: Object) {
for (let key in body) {
let value = body[key];
if (!(value instanceof Array)) continue;
let newKey = formatKey(key);
delete body[key];
body[newKey] = value.map(obj => formatBody(obj));
}
}
function formatKey(key: string) {
l... |
46bcaa5b51ab36a590ca6949776280b8ef255bda | TypeScript | garaev-salavat/angular-hw6-tsk6 | /src/app/mock-lessons.ts | 2.6875 | 3 | import { Lesson } from './lesson';
import { Student } from './student';
import { StudentGrade } from './student-grade';
export const LESSONS: Lesson[] = [
{
id: 1,
date: new Date(2021, 1, 16),
theme: 'Привязка данных',
homework: 'Домашнее задание на тему привязки данных',
note: 'Примечания к урок... |
a55746f8d8e7aae7568e5b1399f824d6ae748747 | TypeScript | ststeiger/AnySqlWebAdmin | /AnySqlWebAdmin/TypeScript/Tools/urlModifier.ts | 2.921875 | 3 |
namespace Tools
{
interface Dictionary<T>
{
[key: string]: T;
}
export class UrlModifier
{
public url: string;
public hash: string;
public keys: string[];
public values: Dictionary<string>;
protected m_caseSensitive:boolean;
... |
b16cdbcb1afecc4ae3ab4258ba7890392b0e474d | TypeScript | kpwags/digital-family-cookbook | /frontend/src/utils/UserFunctions.ts | 2.578125 | 3 | import { UserAccount } from '@models/UserAccount';
export const hasRole = (user: UserAccount | null, roleName: string): boolean => {
if (user) {
return user.roles.filter((u) => u.normalizedName === roleName).length > 0;
}
return false;
};
|
f42f82eb2502f7c8e03724dd3cf84a16771974b8 | TypeScript | lexytail/games-letter | /index.ts | 3.28125 | 3 | const random = (max: number) => (Math.random() * (max + 1)) | 0
class Square {
public $element: HTMLDivElement = document.createElement('div')
constructor(
public $root: HTMLElement,
public letter: string,
public size: number = 100
) {
this.init()
}
protected init... |
081b2b05ccc92f75ca9cdbd820f73be7e0f5608c | TypeScript | th4t-gi/apcsa-lotr-game | /ts-version/src/warrior.ts | 2.984375 | 3 | class Warrior {
static readonly ANSI_RESET = "\u001B[0m";
static readonly ANSI_BLACK = "\u001B[30m";
static readonly ANSI_RED = "\u001B[31m";
static readonly ANSI_GREEN = "\u001B[32m";
static readonly ANSI_YELLOW = "\u001B[33m";
static readonly ANSI_BLUE = "\u001B[34m";
static readonly ANSI_PURPLE = "\u0... |
afc7936d3a14025152b2f4db927d6193acd28436 | TypeScript | downplay/create-rogue-app | /packages/herotext/test/parse.programs.speak.test.ts | 3.34375 | 3 | import { text, commonFunctions } from "../index";
import { mockRng } from "./testUtils";
import { render } from "../src/execute";
// TODO: Early version was simpler, like this:
// {<20}$speak($slice($number,1))teen
// {<100}$speak($slice($number,0,1)0)-$speak($slice($number,1))
// {<1000}$speak($slice($number,0,1)0) h... |
bcde311cf6dbb40a8d1eed26b0773388f6b10f2a | TypeScript | wessberg/fovea-wordpress-landing-test | /src/Service/WaitOperations/WaitOperations.ts | 2.734375 | 3 | import {IWaitOperations} from "./Interface/IWaitOperations";
export class WaitOperations implements IWaitOperations {
public async wait (time: number = 0): Promise<void> {
return new Promise<void>(resolve => setTimeout(resolve, time));
}
} |
f98c9b5bf6110d0ab5b0872d793774655d3e9b02 | TypeScript | josephluck/pion | /examples/simple.ts | 2.765625 | 3 | import { View, h } from '../src'
export type MyState = {
title: string
}
const defaultState: MyState = { title: 'Hello' }
const view: View<MyState> = (state = defaultState, update) => {
const updateTitle = () => {
update({ title: Date.now().toString() })
}
return h('div', {
id: 'my-div',
onclick:... |
90fbfc1c9ae3464a562a867a5d8cc618e44b081f | TypeScript | SrMatheus2000/Senac_TI | /Tipos/Exercício 1/tipos.ts | 3.03125 | 3 | // let OlaMundo = (teste: string) => {
// console.log(teste);
// };
// OlaMundo("Olá Mundo");
let mensagem: string = "ola mundo"
let numero: number = 2
let boleano: boolean = false
let listadepalavras: Array<string> = ['1', '2']
let listadenumeros: Array<number> = [1, 2]
|
4dcf8b0728f168734e5993330701a38ec4fbb91d | TypeScript | jpbberry/typed-emitter | /src/utils/Decorators.ts | 3.09375 | 3 | import { EventEmitter } from '../emitters/EventEmitter'
import { ExtendedEmitter } from '../emitters/ExtendedEmitter'
export const eventMapper = Symbol('__event_map')
// export enum EventMapperType {
// }
export interface EventMapperOptions {
event: string
method: string | Function
type: 'on' | 'once'
}
ty... |
65113416d550224e68adfa3190b83174ffcf9a23 | TypeScript | bketelsen/react-strapi-img | /src/imageLoader.ts | 2.890625 | 3 | export default class ImageLoader {
private img: HTMLImageElement | null = null;
load(src: string, srcSet: string, onDecode: () => void): void {
this.img = new Image();
if (srcSet) this.img.srcset = srcSet;
this.img.src = src;
this.img
.decode()
.then(() => {
onDecode();
}... |
47f3a89dc5e4e16cc91f8b5379cf246b02d9afec | TypeScript | dj-death/SimProX | /kernel/Engine/ComputeEngine/Finance/Finance.ts | 2.5625 | 3 |
import * as Fin from './';
import ENUMS = require('../ENUMS');
import console = require('../../../utils/logger');
import Utils = require('../../../utils/Utils');
import Q = require('q');
export default class Finance {
departmentName = "Finance";
get Proto(): Finance {
return Finance.prototype;
... |
3b18bda8339f598992010296c617af5c9cbc9533 | TypeScript | kjlevitz/neon-js | /packages/neon-core/__tests__/wallet/nep2.ts | 2.765625 | 3 | import * as NEP2 from "../../src/wallet/nep2";
import { isNEP2, isWIF } from "../../src/wallet/verify";
const simpleScrypt = {
n: 256,
r: 1,
p: 1,
};
const simpleKeys = {
a: {
wif: "L1QqQJnpBwbsPGAuutuzPTac8piqvbR1HRjrY5qHup48TBCBFe4g",
passphrase: "city of zion",
encryptedWif: "6PYLH... |
21962d4d842b6315082b9462b529c49e94914a01 | TypeScript | Mathieu94110/Meteo-App | /src/types.ts | 2.625 | 3 | export const GET_METEO_DATA = "GET_METEO_DATA";
export const SET_LOADING = "SET_LOADING";
export const SET_ERROR = "SET_ERROR";
export const SET_ALERT = "SET_ALERT";
export interface Meteo {
description: string;
icon: string;
id: number;
main: string;
}
export interface MeteoData {
base: string;
clouds: {... |
13d247cbe80217547fd44b4ca12bcacdeba2cfe0 | TypeScript | NominaUN/frontendAngular2 | /src/app/Services/fonds/fonds.service.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Fond } from '../../Models/fond'
import { Observable } from 'rxjs/Observable';
@Injectable()
export class FondsService {
private urlget : string = "http://localhost:3000/api/v1/fonds.json";
... |
da1f1ea293e6bcadce4c9780aaf4dd108a4049d2 | TypeScript | OyvindSabo/truss-simulation | /front-end/src/models/strut/Strut.ts | 3 | 3 | import Name from '../name/Name';
import Node from '../node/Node';
export interface StrutProps {
id?: string;
name?: string;
source: Node;
target: Node;
radius?: number;
}
class Strut {
id: string;
name: Name;
source: Node;
target: Node;
radius: number;
_changeListeners: (() => void)[];
constru... |
67848f6ed8009c61a432e64a969636451bbac747 | TypeScript | gtgalone/studya | /frontend/src/redux/services/api.ts | 2.5625 | 3 | import { schema, normalize, Schema } from 'normalizr'
import getConfig from 'next/config'
import 'isomorphic-fetch'
import { AxiosInstance } from 'axios'
import { processLogout } from '../../shared/helper/auth-helper'
// Extracts the next page URL from Github API response.
function getNextPageUrl(response: any) {
co... |
94000bae767185d1c8c387458ce27c0b70d8001b | TypeScript | ilanddev/javascript-sdk | /src/sdk/model/advanced-backups/backup-group/protection-source.ts | 2.546875 | 3 | import { VCloudProtectionSourceType } from './__json__/vcloud-protection-source-type';
import { ProtectionSourceJson } from './__json__/protection-source-json';
/**
* Backup Group Disk Unit.
*/
/* istanbul ignore next: autogenerated */
export class ProtectionSource {
constructor(private _json: ProtectionSourceJso... |
5087dfe73f60c43fd3a4afc27aa28c7417adebc5 | TypeScript | asterlibraryjs/aster-js-validation | /tests/asserts.test.ts | 3.09375 | 3 | import { assert } from "chai";
import { Validator, SucceedValidationResult, ValidationResult } from "../src";
describe("Validator", () => {
type MyModel = {
readonly id: number,
readonly name: string,
readonly value: any;
};
const myModelValidator = Validator.create<MyModel>(expec... |
e395d8997716f316e84bf87467fbb6b027bfe4df | TypeScript | hwahee/probability_one_nth | /src/ts/RandomGenerator.ts | 3.453125 | 3 | export class RandomGenerator {
constructor(private min: number=0, private max: number=0) {
if (max < min) {
this.min ^= this.max ^= this.min ^= this.max
}
}
set(min: number, max: number): void {
this.min = min, this.max = max
if (max < min) {
this.min ^= this.max ^= this.min ^= this.max
console.log(... |
8e7af7b248354755a64c30c0d2e2f5a21969bd8d | TypeScript | dominickudiabor/react-native-ecommerce | /src/common/redux/reducers/feature.ts | 2.703125 | 3 | import { FetchActions, FetchSuccessLoadOne } from 'common/redux/actions/feature'
import { FeatureState, LOAD_ONE_SUCCESS } from 'common/redux/types'
export function feature(state: FeatureState = {}, action: FetchActions): FeatureState {
switch (action.type) {
case LOAD_ONE_SUCCESS: {
if (!(action as FetchS... |
b91b9e777e9e1bb601784824ce439ad3d48c6e84 | TypeScript | JBoss925/MafiaBackend | /app/playerHandler.ts | 2.671875 | 3 | // This file contains the firebase implementations of the endpoints.
import { Request, Response } from "express-serve-static-core";
import { firestore } from "firebase";
import * as commonOps from "./util/commonOps";
import { v4 as uuid } from 'uuid';
import { CreatePlayerRequest, GetPlayerRequest, DeletePlayerReques... |
0cf4a32984dc7b05f7c10471d7f2914b4894b2b5 | TypeScript | honkit/honkit | /packages/honkit/src/plugins/listFilters.ts | 2.578125 | 3 | import Immutable from "immutable";
/**
List filters from a list of plugins
@param {OrderedMap<String:Plugin>}
@return {Map<String:Function>}
*/
function listFilters(plugins) {
return plugins.reverse().reduce((result, plugin) => {
return result.merge(plugin.getFilters());
}, Immutable.Map());
}
ex... |
00f3cd728ecb52086734cbbcd3aaf65244d223ac | TypeScript | abhiramps/BANKAPP-ANGULAR | /src/app/transaction-history/transaction-history.component.ts | 2.515625 | 3 | import { Component, OnInit } from '@angular/core';
import { BankServiceService } from "../services/bank-service.service";
@Component({
selector: 'app-transaction-history',
templateUrl: './transaction-history.component.html',
styleUrls: ['./transaction-history.component.css']
})
export class TransactionHistoryCo... |
1d392e3f38c88955abf87acbfff02f3433b12726 | TypeScript | polly-zou/test | /src/store/common/reducers.ts | 2.734375 | 3 | import { ChatState, SEND_MESSAGE, DELETE_MESSAGE, ChatActionTypes } from './models'
const initialState: ChatState = {
messages: [
{
user: "Alan",
message: "test1",
timestamp: 1
},
{
user: "Alan2",
message: "test2",
timestamp: 2
},
{
user: "Alan3",
me... |
d892aef96cf90530c17bc2a616f9a06f17a823e5 | TypeScript | Arthur3DLHC/Mini3DEngine | /src/math/plane.ts | 3.078125 | 3 | import vec3 from "../../lib/tsm/vec3.js";
import { BoundingSphere } from "./boundingSphere.js";
import mat4 from "../../lib/tsm/mat4.js";
export class Plane {
public constructor(a: number = 0, b: number = 0, c: number = 0, d: number = 0) {
this.normal = new vec3([a, b, c]);
this.constant = d;
}... |
c0077f6b9b5bc2226b0ec6f803b8440180862341 | TypeScript | somesocks/vet | /src/isAllOf.ts | 3.15625 | 3 |
import Assertion from './types/Assertion';
import Validator from './types/Validator';
import ExtendedValidator from './types/ExtendedValidator';
import ValidatorType from './types/ValidatorType';
import assert from './utils/assert';
import schema from './utils/schema';
function isFunction(val) { return typeof val =... |
af888e94b723136744afbe4797e6ac863443ae99 | TypeScript | Musasthl/Seb4Vision.SportView | /Seb4Vision.CSportView.Web/ClientApp/app/pipe/PipeLoopNumber.ts | 2.53125 | 3 | import { PipeTransform, Pipe } from "../../../node_modules/@angular/core";
@Pipe({name: "pipeLoopNumber"})
export class PipeLoopNumber implements PipeTransform{
transform(value: any, args: string[]) :any {
let res = []
for(let i = 0; i < value; i++)
{
res.push(i);
}
... |
3f9f41dff4d834f0a0b701af48102b390011a219 | TypeScript | markosinho/matf-kurs | /web-shop-mare/src/services/UserService.ts | 2.65625 | 3 | import { IUserEntity, UserEntity } from '../entities/UserEntity';
import { UserRepo } from '../repositories/UserRepo';
export class UserService {
private userRepo: UserRepo;
constructor(userRepo: UserRepo) {
this.userRepo = userRepo;
}
public async save(user: UserEntity) {
return this... |
8303a044c26fb271f8aed88b47292e1a3ac94bfc | TypeScript | green-fox-academy/somakanyasi | /Week01/Day-04/define-basic-info.ts | 2.9375 | 3 | 'use strict';
// Define several things as a variable, then print their values
let myName: string = "Soma";
let myAge: number = 27;
let myHeight: number = 1.88;
let amMarried: boolean = false;
|
6a58d65467f3b5360292069bee8c2c9a3079b5ee | TypeScript | ngochuy2902/AnyPicsClient | /src/shared/utils/index.ts | 2.625 | 3 | import { isNil, omitBy } from 'lodash';
import queryString from 'query-string';
function handlePayload(payload: any) {
const newPayload: any = {};
payload &&
Object.keys(payload).forEach((key) => {
newPayload[key] = payload[key] === '' ? null : payload[key];
});
return omitBy(newPayload, is... |
5ae4316f1d43e0e85d43370186d07f59003cf0d0 | TypeScript | umeshrapolu29/hrms-admin | /src/app/employees/employee-filter.pipe.ts | 2.75 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(items: any[], searchText: string): any[] {
if(!items) return [];
if(!searchText) return items;
return this.searchItems(items, searchText.toLowerCase());
}
... |
c892b750d8ed85678f4a59956e9e532553d01d8e | TypeScript | acferM/api-covid | /src/modules/vacines/infra/typeorm/repositories/VacinesRepository.ts | 2.890625 | 3 | import { getRepository, Repository } from "typeorm"
import Vacine from "../entities/Vacine"
interface CreateVacineDTO {
name: string
manufacturer: string
time_between_applications: string
applications_amount: number
}
class VacinesRepository {
private ormRepository: Repository<Vacine>
constructor() {
... |
78e4a9b2c8c429b5a81919056dadc8cc4e1c3d5b | TypeScript | andrenanninga/ludum-dare-45 | /src/entities/Player.ts | 2.734375 | 3 | import * as THREE from "three";
import Matter from "matter-js";
import { Game } from "../Game";
import { createTile, updateTile } from "../utils/createTile";
class Player extends THREE.Group {
game: Game;
mesh: THREE.Mesh;
frame: 0;
state: "walking" | "idle";
direction: "left" | "right";
static FRAMERATE... |
65ee9f154779edeb333328b0cffb36bff0482846 | TypeScript | end5/CoC-UEE-Web | /classes/coc/view/charview/KeyColor.ts | 2.84375 | 3 | /**
* Coded by aimozg on 28.07.2017.
*/
export class KeyColor {
private _src:uint;
private _base: string;
private tfs:/*String*/Array;
public KeyColor(src:uint, base: string, tf: string) {
this._src = src;
this._base = base;
if (tf) this.tfs = tf.split(";");
else this.tfs = [];
}
public transfor... |
49c3e8fa6d0e4714884c4a323f50e2c960a85784 | TypeScript | rabee198/ctoken-swap | /helpers/flatten.ts | 2.515625 | 3 | // import { Contract } from 'ethers/lib/ethers';
import { writeFileSync } from "fs";
// import { HardhatRuntimeEnvironment } from 'hardhat/types';
const hre = require('hardhat')
// require('hardhat-log-remover');
const TASK_FLATTEN_GET_FLATTENED_SOURCE = 'flatten:get-flattened-sources';
const TASK_COMPILE_SOLIDITY_GE... |
dd6cc363981b8d81f36cbbe2aab9606297b6146f | TypeScript | linuxcarl/tsc-solid | /src/srp/class/useCase.ts | 2.609375 | 3 | export class UseCase {
#repository: any;
#notifier: any;
public constructor(repo: any, notifier: any) {
this.#repository = repo;
this.#notifier = notifier;
}
public doSomethingWithTaxes(): string {
return 'Do somethings realted with taxes';
}
public saveChanges(): string {
try {
cons... |
496de44e0a687bb3eb529bb00eef020e304d0b8b | TypeScript | desssad/tr_u_ng_courses | /src/app/lesson43/courses.service.ts | 2.671875 | 3 | import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';
export interface Course {
id: string;
title: string;
price: number;
description: string;
lecturer: string;
}
const url = 'http://localhost:3000/cour... |
e2df70da09c398be27c02c9bb26d83e781c82b51 | TypeScript | Harley-Davidson-Inc/HDI-Chatbot-Cognigy-Extension | /extensions/google-sheets/src/nodes/getSpreadsheet.ts | 2.515625 | 3 | import { createNodeDescriptor, INodeFunctionBaseParams } from "@cognigy/extension-tools";
import axios from 'axios';
export interface IGetSpreadsheetParams extends INodeFunctionBaseParams {
config: {
connection: {
key: string;
};
spreadsheetId: string;
sheetName: string;
filter: string;
storeLocation: ... |
9f787994e2133b513f03836da84ca0a5efe1dfcb | TypeScript | AidaHerreravilar/ejercicionumerodemes | /src/index.ts | 2.671875 | 3 | let mes:number=document.getElementById("numerodemes");
let btn=document.getElementById("btn");
btn?.addEventListener("click", ()=>{
let mes2=Number(mes.value);
let diasve:= 2;
let diast:= 4,6,9,11;
let diastr:= 1,3,5,7,8,10,12;
switch (true) {
case (mes2===diasve):
console.log("tiene 28 dias");
... |
192b0a9b144b0233b98750aae8d2e956ba669166 | TypeScript | gavar/mvcs | /packages/logger/src/core/logger-factory.ts | 3.5625 | 4 | import { Logger } from "./logger";
/**
* Manufactures logger instances.
*/
export interface LoggerFactory {
/**
* Get an appropriate {@link Logger} instance as specified by the {@param name} parameter.
* @param name - the name of the Logger to return.
* @returns a logger instance.
*/
getLogger(name: ... |
c81a4b16d01f7cbb3bc5655ec9ffc00ede61f0af | TypeScript | kristingorge/backgroundfetch_playground | /src/background_fetch.ts | 2.515625 | 3 | export interface BackgroundFetchManager {
fetch(id: string, toFetch: RequestInfo | RequestInfo[], options: BackgroundFetchOptions): Promise<BackgroundFetchRegistration>;
get(id: string): Promise<BackgroundFetchRegistration|null>;
getIds(): Promise<string[]>;
}
export interface ImageResource {
src: stri... |
24c24e04f4c81f6596af60e332e01bf8079405cf | TypeScript | nkgrnkgr/styled-toolkit-todo | /simple-todo-app/src/Todo/modules/inputBox/slice.ts | 2.671875 | 3 | import { createSlice, PayloadAction } from "@reduxjs/toolkit";
export interface InputBoxState {
text: string;
}
const initialState: InputBoxState = {
text: "",
};
export const { actions, reducer, name } = createSlice({
name: "inputBox",
initialState,
reducers: {
changeText: (state, action: PayloadActio... |
36328f083825b9f4a02bda8aa363afb29799e3df | TypeScript | 0zcl/utils-library | /types/browser.ts | 2.609375 | 3 | export interface BrowserInfo {
/** 浏览器类型 */
type: 'ios' | 'android' | 'windowsPhone' | 'MacOSX' | 'windows' | 'linux' | undefined
isWeiXin: boolean
}
|
a7a72d6638a27a30fe0647a75261fe17f8c69f13 | TypeScript | Kaciaryna/google-map-area-editor | /src/models/UnboundState.ts | 2.546875 | 3 | import {PolygonInstanceMap, PolygonMap} from "@/models/Polygon";
import {Region} from "@/models/Region";
export interface UnboundState {
map: google.maps.Map | null;
polygonData: PolygonMap;
polygonInstances: PolygonInstanceMap;
regions: Region[];
}
const unboundState: UnboundState = {
map: null,
polygonD... |
be6b7fc304894915f7f496c81364c9112916bce1 | TypeScript | Braden1996/solana-nft-sentiment-finder | /src/twitter/TwitterApi.ts | 2.53125 | 3 | import axios, { AxiosInstance } from 'axios';
import { chunk } from 'lodash';
import { TwitterResponse } from './twitterTypes';
export class TwitterApi {
private readonly api: AxiosInstance;
constructor(bearerToken: string) {
this.api = axios.create({
baseURL: 'https://api.twitter.com/2',
timeout:... |
5414d307e7bcbe52696df87951977b5962fd58c4 | TypeScript | smitray/test-fastlane | /src/database/models/user.ts | 2.578125 | 3 | import Realm from 'realm'
export type IUser = {
_id: string,
email: string,
type: string,
avatar: string,
name: string,
isTermAccepted: boolean,
isVerified: boolean,
stripeCustomerId: string,
profile: {
bio: string,
callDuration: number,
callPrice: number,
charityDonationPercentage: n... |
1ce2f1e5b05a43e4cc2f3ec605c6308da8a06303 | TypeScript | semencov/typograf | /src/rules/ru/nbsp/abbr.ts | 2.921875 | 3 | import type { TypografRule } from '../../../main';
import { privateLabel } from '../../../consts';
function abbr($0: string, $1: string, $2: string, $3: string) {
// дд.мм.гггг
if ($2 === 'дд' && $3 === 'мм') {
return $0;
}
// Являются ли сокращения ссылкой
if (['рф', 'ру', 'рус', 'орг', '... |
3fba71114d6275d7f5cd123f582caa38867edca2 | TypeScript | faiscacriativa/ngx-sparkler | /src/lib/core/concerns/data-provider.ts | 2.578125 | 3 | import { Observable } from "rxjs";
import { map, tap } from "rxjs/operators";
// import { DialogService, LoadingService } from "@sparkler/ngx-ui";
import { ApiResponse } from "../interfaces/api-response";
import { HttpService } from "../services/http.service";
export abstract class DataProvider<T> {
protected end... |
5861152d8cbce4413ecda4335a39b990880ef3e7 | TypeScript | ringteki/ringteki | /server/game/GameActions/TriggerAbilityAction.ts | 2.703125 | 3 | import TriggeredAbilityContext = require('../TriggeredAbilityContext');
import TriggeredAbility = require('../triggeredability');
import AbilityResolver = require('../gamesteps/abilityresolver');
import CardAbility = require('../CardAbility');
import Event = require('../Events/Event');
import DrawCard = require('../dra... |
86b892151354794a69bca684383d91857cb22baa | TypeScript | degiorgioo/PowerCoders-TypeScript-WorkShop | /TypeScript/printSum.ts | 4.25 | 4 | /**
* TypeScript checks at compiletime the types of the given value. This means that when the compiler
* checks the code, an error occurs when the type of the value is not correct.
*
* @param summand1 - Number one.
* @param summand2 - Number two.
*/
function printSumTypeScript(summand1: number, summand2: numbe... |
688c399a018738e79077a6245d4948f88b8cc666 | TypeScript | maciejtutak/tslox | /src/Scanner.ts | 3.21875 | 3 | import { Literal, Token } from "./Token";
import { Result } from "./Result";
import TokenType from "./TokenType";
// export class ScannerError extends Error {
// line: number;
// message: string;
// constructor(line: number, message: string) {
// super('ScannerError');
// this.line = line... |
f3dc91d471a2ed023649fbf6c2ca12453ef257e1 | TypeScript | technologiestiftung/culturematch-client | /src/app/user/shared/user.model.ts | 3.015625 | 3 | export interface UserSource {
id: string,
displayName: string,
email: string,
}
export class UserModel {
public id: string;
public displayName: string;
public email: string;
constructor(source: UserSource) {
this.id = source.id;
this.displayName = source.displayName;
this.email = source.emai... |
12253b75629d0ce96c76514107c4309b6c051e57 | TypeScript | t-codill/automl-excel | /src/automl/common/utils/loggerGetKey.ts | 2.671875 | 3 | import { Region } from "./getRegion";
enum Geographies {
Asia = "asia",
Australia = "australia",
Euap = "euap",
Europe = "europe",
UnitedStates = "unitedstates",
Development = "development"
}
const instrumentationKeys: {
[key: string]: string | undefined;
} = {
[Geographies.Asia]: "6d8... |
69e7928774f4d83002fed9957b6a3f615994c84b | TypeScript | seanwallawalla-forks/brs | /src/parser/AstNode.ts | 2.984375 | 3 | import { Location } from "../lexer";
/**
* ABC (that's minimally compliant with ESLint/ESTree) for all nodes within
* the AST generated by our parser.
*/
export abstract class AstNode {
readonly type!: string;
/** @param type should match the name of the derived class */
constructor(type: string) {
... |
935930c50ebac734f64c5fa2aee10a2363e71da4 | TypeScript | VictorBalbo/functional-analyser | /src/models/Repository.ts | 2.6875 | 3 | import { Metrics } from './Metrics'
export interface Repository extends Metrics {
default_branch?: string
full_name?: string
language?: string
name?: string
pushed_at?: Date
clone_url: string
// Computed properties
lamdasPerFiles: number[]
totalFiles: number
}
export const getFolderPath = (repo: Repository) ... |
fdeeca7d32415ef8fa1f5fc0ed9760ed634758b3 | TypeScript | l11180730/umi-plugin-apimerge | /src/utils/index.ts | 2.5625 | 3 | import path from 'path';
import { EOL } from 'os';
import { readFileSync } from 'fs';
import { utils } from 'umi';
const { t, parser, traverse, winPath } = utils;
export const getPath = (absPath: string) => {
const info = path.parse(absPath);
return winPath(path.join(info.dir, info.name).replace(/'/, "'"));
};
e... |
690b154c373c76336858a32c7692e5f8b5746f04 | TypeScript | qjliang/algorithm-design | /src/Linked-List/06-Linked-list-queue/LoopQueue.ts | 3.484375 | 3 | import { InitArray } from './array'
interface ILoopQueue<E> {
getSize: () => number
isEmpty: () => boolean
enqueue: (e: E) => void
dequeue: () => E | null
getFront: () => E | null
}
export class LoopQueue<E> implements ILoopQueue<E> {
private array: Array<E | null>
private front: number = 0
tail: n... |
c111d0f98068137d675599c9b1a30742b65dd3a4 | TypeScript | techery/janet-ts | /src/__tests__/ClassHelpers.ts | 2.765625 | 3 | import {BaseAction} from "janet-ts/Action";
import "jest";
import {getActionName, getClassName, getFullClassNameComponentsFromClass} from "../ClassHelpers";
describe("ClassHelpers", () => {
describe("#getClassName", () => {
it("should return class name", () => {
class TestClass {
}
expect(ge... |
51d3fcbda85b69ec8651b055e6bcd2306536847d | TypeScript | zazzel/get-caller-file | /index.ts | 3.015625 | 3 | // Call this function in a another function to find out the file from
// which that function was called from. (Inspects the v8 stack trace)
//
// Inspired by http://stackoverflow.com/questions/13227489
export = function getCallerFile(position = 2) {
if (position >= Error.stackTraceLimit) {
throw new TypeError('g... |
f8e99ef7650a18de50743e4719332f2e20b28b7c | TypeScript | kanzaki923/jsdialog | /src/input-box.ts | 2.921875 | 3 | import WindowBase from "./window-base.js";
export default class InputBox extends WindowBase<string>{
protected textBox:HTMLInputElement;
protected _isHintShow:boolean;
public set maxLength(val:number){
if (!this.textBox) return;
this.textBox.maxLength = Math.max(val, this.textBox.minLength... |
3e38a5a02f6ab2102a305d44c8bf35be71153132 | TypeScript | JohannesLauinger/angular_frontend | /src/app/kunde/update-kunde/interessen/update-interessen.component.ts | 2.734375 | 3 | // eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/consistent-type-imports */
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
import { ActivatedRoute, Router } from '@angular/router';
impor... |
25c49009203867f4ed94d3b6957ee7e7c4a5d6e1 | TypeScript | stencila/dockta | /src/Parser.ts | 2.890625 | 3 | import Doer from './Doer'
import { SoftwarePackage } from '@stencila/schema'
/**
* A base class for language parsers
*
* A language `Parser` generates a JSON-LD `SoftwarePackage` instance based on the
* contents of a directory. It is responsible for determining which packages the application
* needs, resolving th... |