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 |
|---|---|---|---|---|---|---|
ef99c48209826a06f94b165239a068c9ce90a6e0 | TypeScript | rhases/cep-as-promised | /test/unit/cep-as-promised.spec.ts | 2.625 | 3 | 'use strict'
import { expect } from 'chai';
import '../setup';
import * as nock from 'nock';
import * as path from 'path';
import cep from '../../src/cep-as-promised'
import CepPromiseError from '../../src/errors/cep-promise'
describe('cep-promise (unit)', () => {
describe('when imported', () => {
it('should... |
0147521de8c5d50237f5c9266962bc010eb3213d | TypeScript | Joshswooft/nestjs-interface-issue | /src/entities/address.embeded.ts | 2.578125 | 3 | import { Column } from 'typeorm';
export interface IAddress {
line1: string;
line2?: string;
city: string;
state: string;
countryCode: string;
postCode: string;
}
export class AddressEmbedded implements IAddress {
@Column()
line1: string;
@Column({ nullable: true })
line2?: string;
@Colum... |
18e082a3ea94936f372e4cf04005d7e80ea0e761 | TypeScript | bt/wepower-mvp | /web-frontend/src/app/shared/period.ts | 3.1875 | 3 | import * as moment from 'moment';
export class Period {
from : Date;
to: Date;
constructor(from?: Date, to?: Date) {
this.from = from;
this.to = to;
}
plusWeeks(weekCount : number) : Period {
const millisInWeek = 7 * 24 * 3600 * 1000;
return new Period(
moment(this.from).add(weekCo... |
0bf8ea099385c71043d41f24f74feeec7599c75b | TypeScript | SidStraw/leet-codes | /2021-08/2021-08-19 (day32)/AGO/solution.ts | 2.96875 | 3 | function missingNumber(nums: number[]): number {
let result: number = 0; // store answer
for (let i = 1; i <= nums.length; i++) {
result += i;
result -= nums[i - 1];
}
return result;
}; |
5bd42c3b626036df444eb794d29c5867de00d02f | TypeScript | reduxjs/redux-toolkit | /packages/toolkit/src/autoBatchEnhancer.ts | 3.015625 | 3 | import type { StoreEnhancer } from 'redux'
export const SHOULD_AUTOBATCH = 'RTK_autoBatch'
export const prepareAutoBatched =
<T>() =>
(payload: T): { payload: T; meta: unknown } => ({
payload,
meta: { [SHOULD_AUTOBATCH]: true },
})
// TODO Remove this in 2.0
// Copied from https://github.com/feross/que... |
37fe978f20d406db5497fe7f8bdaa840b3d0a7f6 | TypeScript | cdnjs/cdnjs | /ajax/libs/amcharts4/4.10.36/.internal/charts/elements/Candlestick.d.ts | 3 | 3 | /**
* Module that defines everything related to building Candlesticks.
*/
/**
* ============================================================================
* IMPORTS
* ============================================================================
* @hidden
*/
import { Column, IColumnProperties, IColumnAd... |
2df09b24f2bcd1505e98f8c6118c3df6ac572454 | TypeScript | lucidsoftware/aichallenge | /lobby/src/gamefactory.ts | 2.609375 | 3 | import {Game} from './game';
import {PaperIO} from './games/paperio';
export class GameFactory {
static create(
name: string,
usedNames: Set<string>,
requestedPlayers?: string[],
persistent?: boolean,
): Game {
console.log('Requesting to create game named ' + name + ' wi... |
84ac95103040a6121405e0f733cac804ad215fa1 | TypeScript | r2-studio/robotmon-scripts | /scripts/framework-v1/src/page/point.ts | 2.734375 | 3 | export interface XY {
x: number;
y: number;
}
export interface IXYRGB {
x: number;
y: number;
r: number;
g: number;
b: number;
}
export class XYRGB {
public x: number = 0;
public y: number = 0;
public r: number = 0;
public g: number = 0;
public b: number = 0;
}
|
9fa94d465362a69a2e83b6194b9537f2684fd7ee | TypeScript | murilomontino/PRATICAS.server | /data/models/User.ts | 2.703125 | 3 | import { DataTypes, Model, Optional } from 'sequelize'
import { database } from '.'
import { Permission } from './types'
// We recommend you declare an interface for the attributes, for stricter typechecking
interface UsersAttributes {
id?: number
nome?: string
sobrenome?: string
telefone?: string
img_perfil?: s... |
18dc2b4a93c7f452f88b1120e62320bc9805b755 | TypeScript | Mavricus/flex-cache-in-memory | /spec/FlexInMemoryCache.spec.ts | 2.796875 | 3 | import { FlexInMemoryCache } from '../src/FlexInMemoryCache';
describe('InMemoryCache', () => {
let cache: FlexInMemoryCache;
let storage: { [key: string]: { timer: NodeJS.Timer; data: unknown } };
beforeAll(() => {
jest.useFakeTimers();
});
beforeEach(() => {
storage = {};
... |
947b7bb52e94d9c374b1ea821cd8cddf4dc8f9ea | TypeScript | DefinitelyTyped/DefinitelyTyped | /types/ckeditor__ckeditor5-table/src/tableutils.d.ts | 3.125 | 3 | import { Plugin } from '@ckeditor/ckeditor5-core';
import { Element as ModelElement, Range as ModelRange } from '@ckeditor/ckeditor5-engine';
import Writer from '@ckeditor/ckeditor5-engine/src/model/writer';
import TableWalker from './tablewalker';
import ModelSelection from '@ckeditor/ckeditor5-engine/src/model/select... |
8e53e2f4fb10c8cb5dc4d3a62238daa8c448d20e | TypeScript | fengkx/leetcode | /group-anagrams/group-anagrams.ts | 2.796875 | 3 | function groupAnagrams(strs: string[]): string[][] {
const cache = {};
for (let i = 0, len = strs.length; i < len; i++) {
const str = strs[i];
const normalized = str.split('').sort().join('');
if (!cache[normalized]) {
cache[normalized] = []
};
cache[normalize... |
bc43d9af5d7841e9d8cc97d5c6ae669a8cb643b4 | TypeScript | tett23/ckusro | /old/src/cli/renderers/staticRenderer/assets/modules/fileBuffers.ts | 2.703125 | 3 | import { FileBufferId } from '../../../../../models/FileBuffer';
import { FileBuffersState as FBState } from '../../../../../models/FileBuffersState';
export type FileBuffersState = {
fileBuffersState: FBState;
currentFileBufferId: FileBufferId;
};
const UpdateCurrentFileBufferId: 'FileBuffers/UpdateCurrentFileBu... |
6e0afb89bbc5f98f390a9601e813e14bbfe86b73 | TypeScript | UpUpLiu/entitas-ts | /example/src/systems/PlayerInputSystem.ts | 2.625 | 3 | module example {
import Pool = entitas.Pool;
import Group = entitas.Group;
import Entity = entitas.Entity;
import Matcher = entitas.Matcher;
import Exception = entitas.Exception;
import TriggerOnEvent = entitas.TriggerOnEvent;
import IExecuteSystem = entitas.IExecuteSystem;
import IInitializeSystem = e... |
5176d20438e43f40d7a4864bb7cb3a762ba1b95f | TypeScript | DessaureD/QuizAppReUpload | /src/QuizApp/wwwroot/file.ts | 3.546875 | 4 | class Test {
totalPoints() {
alert(`${total} points earned! Nice!`)
}
}
let finalTotal = new Test();
alert("Welcome to your first quiz my friend!");
let total = 0;
let question1 = prompt("What color is the sky? Please choose between these three options: White, Blue, or Red.");
if (question1 == "Bl... |
9c765092f6be938f6fcf4d48fc0b2d5e8b51334f | TypeScript | chaoticsparks/angular-mentoring-epam | /src/app/store/reducers/add-edit-course.reducer.ts | 2.765625 | 3 | import {AddEditCourseActions, AddEditCourseActionTypes} from '../actions/add-edit-course.actions';
import {ICourse} from '../../courses/i-course';
export interface IAddEditCourseState {
courseToSubmit: ICourse | null;
}
export const initialAddEditCourseState: IAddEditCourseState = {
courseToSubmit: null
};
expo... |
c5016e9bbe5f394b6062f2ae2f62a94fda76a489 | TypeScript | rahulathi5/ng6-demo | /src/app/map/components/basic-map/basic-map.component.ts | 2.546875 | 3 | import { Component, OnInit } from '@angular/core';
import { MouseEvent } from '@agm/core';
@Component({
selector: 'app-basic-map',
templateUrl: './basic-map.component.html',
styleUrls: ['./basic-map.component.css']
})
export class BasicMapComponent {
zoom: number = 5;
lat: number = 22.160311576947638;
lng... |
a6fcf8ba326cb38ceb0a5c937450dfa7ff32bdfc | TypeScript | orange4glace/epidemic-simulator | /src/world-impl.ts | 2.6875 | 3 | import { IWorld } from './world';
import { Society } from './society-impl';
import { Person } from './person-impl';
import { Entity } from './entity';
import { Vector2 } from './util';
import { Engine } from './engine';
import { SIRState } from './person';
import { SIRModel } from './sir-model';
let k = 0;
... |
e4be12154e33fe8fb2a094982e90e2f2f55b4114 | TypeScript | jas-haria/VOID_0.1 | /angular-application/src/app/shared/models/topcard-details.model.ts | 2.5625 | 3 | export class TopCardDetails {
title: string;
middleValue: string;
bottomValue: string;
bottomValueSuccess: boolean;
bottomMessage: string;
icon: string;
iconBgColor: string;
constructor(title: string, icon: string, iconBgColor: string) {
this.title = title;
this.icon = i... |
dca03465fbb69605cfa26528ab93550b96722e4f | TypeScript | lucasgmagalhaes/D3-Stuff | /src/app/class/circle.ts | 2.796875 | 3 | import * as d3 from 'd3';
export class Circle {
public static selectAllCircles() {
/*
//The line bellow search for the html element circle.
But, as i gonna use more circles in this page, i can not call the element.
I must use a class.
const circles = d3.selectAll('circle');... |
c838adb6f4f934b93a1f72ad46260c2d6760294f | TypeScript | movibe/domain-preview-api | /src/index.ts | 2.6875 | 3 | import * as express from 'express'
import {getLinkPreview} from 'link-preview-js'
const app = express();
const port = process.env.PORT || 8080; // default port to listen
const urlPreview = async (url: string) => {
try {
const response = await getLinkPreview(url);
const domain = url.split('//')[1].split('/').shif... |
21204db7c0fe8c216c4916ed9030bf6dcc3d7582 | TypeScript | benkeil/react-todo-app-clean-architecture | /code/applications/react/src/hooks/useObservableEffect.ts | 2.53125 | 3 | import { DependencyList, useEffect } from 'react';
import { Observable, Observer } from 'rxjs';
const useObservableEffect = <T>(
observable: Observable<T>,
observer: Partial<Observer<T>>,
deps: DependencyList = [],
): void => {
return useEffect(() => {
const subscription = observable.subscribe(observer);
... |
59c7c124ce5ff80d4ce236ffc85b6e8aee7053b8 | TypeScript | worstpractice/babbys-first-goap | /src/utils/sorting/toTrimmed.ts | 2.515625 | 3 | export const toTrimmed = <T extends string>(str: T): string => {
return str.trim();
};
|
53eec5b53f16a8847609bfadf68a90417ed5a37f | TypeScript | PatrickHaussmann/rki-covid-api | /src/utils.ts | 2.921875 | 3 | export function getStateAbbreviationById(id: number): string | null {
switch (id) {
case 1:
return "SH";
case 2:
return "HH";
case 3:
return "NI";
case 4:
return "HB";
case 5:
return "NW";
case 6:
return "HE";
case 7:
return "RP";
case 8:
... |
dc3df4803ccb807e01a578b14329f2eb55e8b959 | TypeScript | OpenAPITools/openapi-generator | /samples/client/petstore/typescript-aurelia/default/PetApi.ts | 2.546875 | 3 | /**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://op... |
7e0b090b7bdd950cc9723965c0df5c6ad0db584c | TypeScript | omarqazidev/Data-Security-and-Encryption-Assignment | /src/index.ts | 2.890625 | 3 | import { Hasher } from './algorithms/Hasher';
import { PrimeNumber, PrimitiveRoot, DiffieHellman, RSA } from './algorithms';
// console.clear();
// console.log('================================================================================');
// console.log('\t\t\t Diffie Hellman');
// console.log('=================... |
7db9734e0ef5d590b26e829e065228a6b89be28b | TypeScript | connext/indra | /modules/utils/src/typedEmitter.ts | 2.984375 | 3 | import { IBasicEventEmitter, EventName, EventPayload } from "@connext/types";
import { Evt, to, Ctx } from "evt";
// Disable max handlers warnings
Evt.setDefaultMaxHandlers(0);
export class TypedEmitter implements IBasicEventEmitter {
private evt: Evt<[EventName, EventPayload[EventName]]>;
constructor() {
thi... |
3baffb6d30d24adfe2bfe961e67fed785f77df6b | TypeScript | typeorm/typeorm | /test/github-issues/6471/entity/SomeEntity.ts | 2.859375 | 3 | import { Column, Unique, PrimaryGeneratedColumn } from "../../../../src"
import { Entity } from "../../../../src"
export enum CreationMechanism {
SOURCE_A = "SOURCE_A",
SOURCE_B = "SOURCE_B",
SOURCE_C = "SOURCE_C",
SOURCE_D = "SOURCE_D",
}
@Entity({ name: "some_entity" })
@Unique(["field1", "field2"])... |
73fd4b5a70d95cf2f257599dbddc09f74902f3e8 | TypeScript | myprojectsfile/socket | /src/app/socket.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import * as io from 'socket.io-client';
@Injectable()
export class SocketService {
private url = 'http://localhost:3000';
public socket;
constructor() {
this.socket = io(this.url);
}
on(eventName, callback) {
this.socket.on(eventName, () => {
callba... |
a0641fa1c1925ad7ac78554d6f1403b542feb8d8 | TypeScript | dev00rob/newTP | /bankAccount.ts | 3.375 | 3 | class BankAccount {
owner: string;
balance: number;
transactions: number[];
constructor(o: string, b: number, t: number[]){
this.owner = o;
this.balance = b;
this.transactions = t;
}
getBalance():number{
return this.balance;
}
transact(n: number):number{
... |
b3301d5871413b760f454c46720742f51ac413ba | TypeScript | downplay/create-rogue-app | /games/hero/src/mechanics/canMove.ts | 2.84375 | 3 | import { text, Vector, add, length } from "@hero/text";
import { GameState } from "../engine/game";
import { EntityState } from "../engine/entity";
import { LifeState } from "./hasLife";
import { StatsState } from "./hasStats";
// TODO: Putting all the interactions in `move` seems like the wrong way around; as this
//... |
3d4d3f3f9fb8cf0767a744787f5ca8ef448558a9 | TypeScript | nestdotland/hatcher | /lib/utilities/box.ts | 2.671875 | 3 | import { colors, Table } from "../../deps.ts";
const characters = {
top: "─",
topMid: "┬",
topLeft: "╭",
topRight: "╮",
bottom: "─",
bottomMid: "┴",
bottomLeft: "╰",
bottomRight: "╯",
left: "│",
leftMid: "├",
mid: "─",
midMid: "┼",
right: "│",
rightMid: "┤",
middle: "│",
};
for (const ch... |
327c57e7cd342485c27e0d6f36bc5ce8b2633018 | TypeScript | olist/olist-orders-frontend | /src/home/classes/Search.ts | 2.828125 | 3 | export interface ISearch {
value: string;
}
class Search implements ISearch {
public value = '';
constructor(newValue: string) {
this.value = newValue;
}
}
export default Search;
|
45c6a7b36df39769426b29e677fbdcf1f0f7ce5a | TypeScript | andreluizsgf/Scheduler-api-typescript | /src/controllers/RuleController.ts | 2.546875 | 3 | /* eslint-disable max-len */
import * as express from 'express';
import Rule from '../models/Rule.model';
import Interval from '../models/Interval.model';
import * as scheduler from '../helpers/SchedulerHelper';
import * as file from '../helpers/FileHelper';
import moment from 'moment';
import {DATABASE_JSON} from '../... |
5f7e351f5762c88182d40a7dc2c7cb0a219e1abf | TypeScript | DavidTurnbough/FoodAlert | /src/providers/item-data-service.ts | 2.921875 | 3 | import { Injectable } from '@angular/core';
import { File } from '@ionic-native/file';
@Injectable()
export class ItemDataServiceProvider {
itemsObject: any;
path: string;
fileReady = false;
constructor(private file: File)
{
this.path = this.file.externalDataDirectory; //Define the path
this.checkI... |
bbc5934284e8a30afbb6575588ef2bfe4e52fa53 | TypeScript | NiluK/api | /packages/types/src/codec/createType.spec.ts | 2.9375 | 3 | // Copyright 2017-2018 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { TypeDefInfo, typeSplit, getTypeClass, getTypeDef } from './createType';
describe('typeSplit', () => {
it('splits sim... |
b183ee062a5bfb910c2a079c95308c90fccbcd29 | TypeScript | MiggieNRG/vscode-gitblame | /test/suite/is-url.test.ts | 2.890625 | 3 | import * as assert from 'assert';
import { isUrl } from '../../src/util/is-url';
suite('Is URL', (): void => {
test('Valid', (): void => {
assert.strictEqual(isUrl("http://github.com/"), true);
assert.strictEqual(isUrl("https://microsoft.com/"), true);
assert.strictEqual(isUrl("https... |
da202fbb6f6cab743d0093b390eefc238eb424e3 | TypeScript | mickeeri/egghead-redux-obs | /src/epics/testing.ts | 2.515625 | 3 | import fetch from 'node-fetch';
import { forkJoin, from } from 'rxjs';
import { map, mergeMap } from 'rxjs/operators';
const topStories = `https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty`;
const storyUrl = (id: string) =>
`https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`;
const... |
e7604de933c65a772a81fa10a2a449049055294e | TypeScript | nm-hoang/sakila-frontend | /src/stores/reducers/customer.Reducers.ts | 2.796875 | 3 | import * as TYPES from '../constants/customer.Constants'
interface InitialStateI {
requesting?: boolean,
success?: boolean,
obj_data?: any,
list_data?: any,
message?: any
}
const initialState: InitialStateI = {
requesting: false,
success: false
}
const customerReducers = (state: InitialSta... |
43840a1d1f1690f6e12dea16b25705ca0eeb7793 | TypeScript | phonowell/fire-keeper | /test/toString.ts | 3.46875 | 3 | import { $ } from './index'
// interface
type ListQuestion = [
number,
string,
boolean,
number[],
{ [key: string]: number },
() => void,
Date,
Error,
Buffer,
null,
undefined,
typeof NaN,
]
// function
const a = () => {
const listQuestion: ListQuestion = [
42, // number
'Aloha', // ... |
acd5f3e94cb94dbac4d53a15e73eb60c2eef66ec | TypeScript | Mandustas/Coordinate | /src/types/detectedObjectUpdate.ts | 2.734375 | 3 | export interface DetectedObjectState {
detectedObject: { id: number, title: string, description: string, missionId: number, isDesired: boolean };
}
export enum DetectedObjectActionTypes {
FETCH_DETECTEDOBJECT_UPDATE = 'FETCH_DETECTEDOBJECT_UPDATE',
}
interface FetchDetectedObjectAction {
type: DetectedObj... |
0c1fb6664023a112e26e2e9230aed0a8d15808f9 | TypeScript | Sergey-lang/Card-Learning-app | /src/02-Pages/06-Cards/cards-reducer.ts | 2.515625 | 3 | import {Dispatch} from 'redux';
import {cardsAPI} from '../../01-API/04-cards-api';
import {ThunkDispatch} from 'redux-thunk';
import {AppStoreType} from '../../00-App/store';
import {setAppStatus} from '../../00-App/app-reducer';
type ActionsType = ReturnType<typeof setCards>
| ReturnType<typeof setFilter>
| ... |
29adde00e698f4f0ad0a192f9b777b7a4d168719 | TypeScript | def-codes/the-better-thing | /packages/meld/graph-it.ts | 2.703125 | 3 | import { getInUnsafe } from "@thi.ng/paths";
import {
Subgraph,
object_graph_to_dot_subgraph,
depth_first_walk,
graph,
empty_traversal_state,
default_traversal_spec,
} from "@def.codes/graphviz-format";
import { dot_updater } from "@def.codes/node-web-presentation";
interface Sketch {
path?: string; // s... |
a29db75149e42b62a7830af4b4a96a630550175d | TypeScript | gitter-badger/planktos | /lib/channel.ts | 2.890625 | 3 | import * as socketio from 'socket.io-client';
import { EventEmitter } from 'events';
const SimplePeer = require('simple-peer');
export interface Message {
type: string;
content: any;
}
/* Bi-directional communication via message passing between a
* source and destination
* Emits: message(msg: Message), connect(... |
f5677ccba06c7de272ef3f639678f8742273a6e0 | TypeScript | uber/nebula.gl | /modules/edit-modes/test/lib/measure-distance-mode.test.ts | 2.859375 | 3 | import { MeasureDistanceMode } from '../../src/lib/measure-distance-mode';
import {
createFeatureCollectionProps,
createClickEvent,
createPointerMoveEvent,
createKeyboardEvent,
} from '../test-utils';
const expectToBeCloseToArray = (actual, expected) => {
expect(actual.length).toBe(expected.length);
actual... |
4481785219e4e5e8c927e67bb06a9c83387cbfbb | TypeScript | remorses/play-xml | /src/time.ts | 3.46875 | 3 | import { isUndefined } from "lodash"
export type TimeObject =
| number
| {
isBpm?: boolean
isFps?: boolean
seconds: number
timeString: string
toString: () => string
}
export function Beats(n: number, bpm: number = 120): TimeObject {
return {
... |
d8a5b7a73afe3a58d1fa633d9eb1ee4766ae3d2e | TypeScript | hudhudhud/lhkj | /new_admin/src/api/modules/OrderCreditGoodsDetailResponse.ts | 2.65625 | 3 | import Pager from "../base/Pager";
/**
* 作者没有写注释!!!
*/
export default class OrderCreditGoodsDetailResponse {
/**
* 积分类型id
*/
public creditTypeId!: number;
/**
* 积分类型名称
*/
public creditTypeName!: string;
/**
* 兑换比
*/
public exchangeRate!: number;
/**
... |
2f7ed917cb44b314d95ec42204926b02b5d9bb29 | TypeScript | 42LeetCoDong/Top-Interview-Questions_Easy | /09. Others/05. Valid Parentheses/Valid-Parentheses_hjeon.ts | 3.421875 | 3 | function isValid(s: string): boolean {
let stack: string[] = [];
for (let c of s) {
if (/\(|\[|\{/.test(c)) stack.push(c);
else {
let earlierOne: number = (stack.pop() || '').charCodeAt(0);
let cCode: number = c.charCodeAt(0);
if (c === ')') cCode -= 1;
else cCode -= 2;
if (earlierOne !== cCode) ... |
33c1a0c815f211834087526efd543eb75a6c06cf | TypeScript | inesscw/primera-app | /src/app/contador/contador.component.ts | 2.625 | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
@Component({
selector: 'app-contador',
templateUrl: './contador.component.html',
styleUrls: ['./contador.component.scss']
})
export class ContadorComponent implements OnInit, OnChanges {
@Input() contador: number;
contadorB... |
06a10dbdb932ffb189810cd30455cfd868057774 | TypeScript | recruit-tech/redux-pluto | /src/server/services/__tests__/utils.formatPathname.test.ts | 2.671875 | 3 | import assert from "assert";
import { formatPathname } from "../utils";
test("utils: formatPathname", () => {
const testCases = [
{ pathname: "", params: [], expected: "" },
{ pathname: "?", params: ["foo"], expected: "foo" },
{ pathname: "/", params: [], expected: "/" },
{ pathname: "/foo", params: ... |
2cc07eed849260424eccd263a9b3d6c259d7cd5a | TypeScript | freeman1995/react-beitzim | /src/react-beitzim/masonry-virtualization-hooks.ts | 2.671875 | 3 | import { ItemSizeGetter } from "react-beitzim/types";
import { useEffect, useState } from "react";
import { flatten, range, last } from "lodash/fp";
type MasonryItemOffset = {
itemId: string;
itemIndex: number;
offset: number;
columnIndex: number;
};
export function useItemOffsets<ItemType>(
items: ItemType... |
22ecc407b8fb462fe20f4bd8f65d6774f94938bd | TypeScript | guicostaarantes/cashbook-server | /src/modules/transactions/services/counterparts/UpdateCounterpartService.ts | 2.671875 | 3 | import 'reflect-metadata';
import { inject, injectable } from 'tsyringe';
import AppError from '../../../../shared/errors/AppError';
import ICounterpart from '../../entities/counterparts/ICounterpart';
import { ICounterpartsRepository } from '../../repositories/counterparts/ICounterpartsRepository';
interface IServic... |
d412e8eddb789d7fd50e765574551da4312dcbda | TypeScript | sketchthat/acx | /examples/private/trades.ts | 2.890625 | 3 | // Import Keys
import * as fs from 'fs';
const keys = JSON.parse(fs.readFileSync('./examples/keys.json', 'utf8'));
// Start Example
import { ACX } from '../../src';
const acx = new ACX(keys.accessKey, keys.secret);
/**
* Get Trades
*
* Market: BTCAUD
*/
acx.private().trades('btcaud')
.then(trades => {
cons... |
7749f90108b36e8414b2c9ac3c91effa72d153a6 | TypeScript | samyue/tote | /src/app/shared/pipes/tote-dividend.pipe.ts | 2.53125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { Dividend } from '../../tote-bet/models/dividend.model';
import { ProductType } from '../../tote-bet/models/product-type.const';
import { CurrencyPipe } from '@angular/common';
@Pipe({
name: 'toteDividend',
})
export class ToteDividendPipe implements Pip... |
d8efccb983ce9235faf93815e456eb1257d56d3c | TypeScript | reimagined/resolve-cloud-common | /s3/uploadS3Object.ts | 2.53125 | 3 | import S3, { Body as S3ObjectBody } from 'aws-sdk/clients/s3'
import { retry, Options, getLog, Log } from '../utils'
async function uploadS3Object(
params: {
Region: string
BucketName: string
FileKey: string
Body: S3ObjectBody
ContentType?: string
Metadata?: Record<string, string>
},
log... |
1b4e66b412ee5da19488e2a99f391d03b49998f1 | TypeScript | gabmarini/ng-cacheable | /src/decorators/cacheable.decorator.ts | 2.546875 | 3 | import {ICacheBusterMetadataInterface, ICachedMetadataInterface} from '../interfaces/Icacheable-metadata.interface';
import {CacheService} from '../services/cache.service';
import {cacheResultOperator, Defaults} from '../constants/defaults.constant';
import {isObservable, throwError} from 'rxjs';
import {catchError, ta... |
e80480f46b27c30681ebdad24737f65870f964ee | TypeScript | andreslt67/Barbermanager-web | /src/app/interfaces/resena.ts | 2.578125 | 3 | /**
* Interfaz para parsear json Resena
*/
export interface Resena {
idresena: number,
fecha: Date,
peluquero: string,
contenido: string,
valoracion: number
}
/**
* Interfaz para parsear json ResenaPelu
*/
export interface ResenaPelu {
idresena: number,
fecha: Date,
cliente: string,... |
bab3eb063462b19a125253a28f51dfcf8506edea | TypeScript | zz8023wanjin-moyuxin/hello-wrold | /src/policyContext/CashContext.ts | 3.015625 | 3 | import {CashSuper} from "@/Utils/cash/CashSuper";
import {CashRebates} from "@/Utils/cash/CashRebates";
import {CashReturn} from "@/Utils/cash/CashReturn";
import {CashNormal} from "@/Utils/cash/CashNormal";
export enum DiscountType {
FIVE_DISCOUNT = '打五折',
SEVEN_DISCOUNT = '打七折',
NINE_DISCOUNT = '... |
f3fd32f143ef4ba702124625a41d25dd59acddb8 | TypeScript | blake256/avaxcast | /frontend/src/reducers/marketFilter.ts | 3.171875 | 3 | import { Market } from "common/enums";
/**
* Reducer for the {@link Market} filter
* @param state - Current state
* @param action - Action to be carried out
* @returns The chosen {@link Market} to filter by
*/
function marketFilterReducer(state = Market.ALL, action: Action): Market {
switch (action.type) {
... |
25eb83d7fde85dcb07cbed641607196fbb15746f | TypeScript | Quione/aula3 | /app.ts | 3.46875 | 3 | class Hero{
constructor(public codenome:string, public identidadeSecreta:string){}
//metodo (função)
getIdentidade():void{
console.log(`A identidade secreta do(a) ${this.codenome} é ${this.identidadeSecreta}`);
}
}
interface Habilidade{
superPoder?:string;
pericia?:string;
pod... |
03a375294e60aedea313f2dc5ff1d08569fcc383 | TypeScript | cydran/cydran | /src/component/ElementOperationsImpl.ts | 2.9375 | 3 | import ElementOperations from "component/ElementOperations";
import { requireNotNull } from "util/Utils";
class ElementOperationsImpl<E extends HTMLElement> implements ElementOperations<E> {
private element: E;
constructor(element: E) {
this.element = requireNotNull(element, "element");
}
public get(): E {
... |
eeab97bb1642ae269e35efc57181c42b743d6b7a | TypeScript | sojulover/Tetris-with-Angular2 | /tetris_multi/src/app/tetris/game.ts | 2.71875 | 3 | export class Game
{
mode: number = 0; // game mode(SINGLE: 0, MULTI: 1)
level: number = 0; // game level(easy: 0, normal: 1, hard: 2)
map: any = null; // root element
flag: boolean = false; // game flag: true=live, false=die.
isReady: boolean = false... |
2d4033a47e7b70b823968950bcb8d2274c720aa4 | TypeScript | borlaym/game-engine | /dist/GameCamera.d.ts | 2.53125 | 3 | import { Camera, Vector3 } from 'three';
export default class GameCamera {
readonly camera: Camera;
constructor(camera?: Camera);
/**
* Intersect the plane at 0 height to get the point the camera is currently pointing at
*/
readonly lookingAt: Vector3;
rotateLeft(): void;
rotateRight()... |
8477955d14c19059acbe52ed5fefe933bc29ed67 | TypeScript | davisb10/serilogger | /test/helpers.ts | 2.796875 | 3 | import {Sink} from '../src/sink';
import {PipelineStage} from '../src/pipeline';
import {ConsoleProxy} from '../src/consoleSink';
import {LogEvent} from "../src/logEvent";
export class ConcreteSink implements Sink {
emit(events: LogEvent[]) {
}
flush(): Promise<any> {
return Promise.resolve();
... |
6dc92afc3e24aab6a2bcd653d88f43db6a87e5ed | TypeScript | objuan/petrorov | /app/deck/ClientApp/src/app/common/ping-timer.ts | 3.078125 | 3 | import { Injectable, EventEmitter, OnDestroy } from "@angular/core";
export class PingTimer implements OnDestroy {
//private pingRequest: Request;
private pingInterval: number = 10 ;
private pingHandle: any;
/*
* An event emitted when the service is pinging.
*/
public onPing: EventEmitte... |
c9af64c71815bd3a64516661d957ac70120a778e | TypeScript | themikelester/SketchBase | /src/base/CameraTypes.ts | 2.890625 | 3 | //----------------------------------------------------------------------------------------------------------------------
// Notes: Basic camera types. Create and push them onto the camera stack via the CameraSystem.
//
// Author: Mike Lester
// Date C: 2020/12/07
//-----------------------------------------------------... |
ad5ca40870a6a4dbf70422c7616437b9fe948956 | TypeScript | akanosenritu/sk-frontend | /utils/assign/assign.ts | 3.125 | 3 | export const detectNumberOfPeopleDiscrepancies = (
required: {
male: number,
female: number,
unspecified: number
},
current: {
male: number,
female: number
}
) => {
// positive number means there is a vacancy for the slot
// negative number means the slot is overflowing.
const result: ... |
2184f14d1e4a779cb3b5a3649ccd429d4f42a615 | TypeScript | hugomatheus/udemy-nestjs-zero-to-hero | /src/tasks/entities/task.entity.ts | 2.546875 | 3 | import {
Column,
CreateDateColumn,
Entity,
PrimaryColumn,
UpdateDateColumn,
} from 'typeorm';
import { TaskStatus } from '../task-status.enum';
import { v4 as uuid } from 'uuid';
@Entity('tasks')
export class Task {
@PrimaryColumn()
id: string;
@Column()
title: string;
@Column()
description: str... |
048f174b98a4fc1ef198cd874676ad8af7ca0d55 | TypeScript | thomas4t/quacky-clean-fe | /lib/utils/localStorage.ts | 2.890625 | 3 | const globalWindow =
typeof window === "undefined" ? { localStorage: null } : window;
type JSONPrimitive = string | number | boolean | null;
type JSONValue = JSONPrimitive | JSONObject | JSONArray;
type JSONObject = { [member: string]: JSONValue };
interface JSONArray extends Array<JSONValue> {}
export const localS... |
6f5a54539c2c00aeae0b819d082353aa8285f98c | TypeScript | WillIbbetson/rich-editor | /plugins/rich-editor/src/scripts/editor/index.ts | 2.609375 | 3 | /*
* @author Adam (charrondev) Charron <adam.c@vanillaforums.com>
* @copyright 2009-2018 Vanilla Forums Inc.
* @license https://opensource.org/licenses/GPL-2.0 GPL-2.0
*/
import Quill from "../quill/index";
import * as utility from "@dashboard/utility";
import { ensureHtmlElement } from "@dashboard/dom";
const op... |
bf333ed31272f3588485f3058dd6cd4d9221f55f | TypeScript | Laotouy/ms | /packages/sponge/src/typings/org.spongepowered.api.event.server.query.QueryServerEvent.Basic.ts | 2.875 | 3 | declare namespace org {
namespace spongepowered {
namespace api {
namespace event {
namespace server {
namespace query {
namespace QueryServerEvent {
// @ts-ignore
interface Basic ... |
bb21b5c1e61ea1e4430f9084b3813615fcc97caf | TypeScript | Shubhamg2595/TypeScript | /TypeScript Notes/1. Basics/5.Delayed Initialization.ts | 3.53125 | 4 | //! delayed initialization : declaring a variable and then initializing it later
// // issue
// let words = ['red','green']
// let foundWord; //type: any
// for(let i=0;i<words.length;i++){
// if(words[i] === 'greem'){
// foundWord = true;
// }
// }
// solution
let words = ['red','green']
let foun... |
b990df15f5e219508c707ed6641407493d45c7c1 | TypeScript | deepslam/feature-framework | /src/Models/Translations.ts | 2.90625 | 3 | import { Locale } from 'locale-enum';
import { IApp } from '../Interfaces';
import { TranslationItemType } from '../Types';
export type LocaleKey = keyof typeof Locale;
export default class Translations<T = TranslationItemType> {
private app?: IApp<any>;
constructor(
private readonly translations: { [key in k... |
99a44e6dff7c0f39948775faddfe12bd1b9cba83 | TypeScript | springtype-org/st-validate | /src/validate/not-null.ts | 2.515625 | 3 | import {getParameterValidateDecorator} from "../function/get-parameter-validate-decorator";
import {validatorNameFactory} from "../function/validator-name-factory";
export const NOT_NULL = 'not-null';
// decorator @NotNull
export const NotNull = () => getParameterValidateDecorator(not_null, NOT_NULL);
export const n... |
8240c3a93aa2f74f3916dd0faba6735ab0664c19 | TypeScript | dviramontes/reddit-newsletter | /src/reddit.ts | 2.5625 | 3 | import axios from "axios";
import { ok, err } from "neverthrow";
import { Child, ChildData } from "./types";
export const fetchPosts = async (subreddit: String) => {
try {
const {
data: {
data: { children },
},
} = await axios.get(
`https://www.reddit.com/r/${subreddit}/top.json?lim... |
1b3a8666f90acd5eaa3595476b1e7bbdde90fb84 | TypeScript | HiP-App/HiP-CmsAngularApp | /app/feature-toggle/features/shared/feature.service.ts | 2.65625 | 3 | import { Injectable } from '@angular/core';
import { Response } from '@angular/http';
import { Feature } from './feature.model';
import { FeatureToggleApiService } from '../../../shared/api/featuretoggle-api.service';
/**
* Service which does feature toggle related api calls
*/
@Injectable()
export class FeatureSer... |
c9b9a5578169c1affd8bdb4ed8463a252950017e | TypeScript | rg-ubbcluj-ro/lab9x-AnaSavu | /bikes-web/src/main/webapp/src/app/employees/shared/employee.model.ts | 2.515625 | 3 | export interface Employee {
id: number;
name: string;
position: string;
workedHours: number;
}
|
200d39268906d543425277227932645e07c11d8a | TypeScript | import-keshav/oppia | /core/templates/dev/head/expressions/ExpressionSyntaxTreeService.ts | 2.5625 | 3 | // Copyright 2014 The Oppia Authors. All Rights Reserved.
//
// 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 ap... |
078dfedd24ca4360e97dc29ed51001c2b320e4b9 | TypeScript | vl0w/TargetShootingDatabase | /routes/gateways.ts | 2.734375 | 3 | /**
* Created by jonashansen on 29/04/15.
*/
/// <reference path="../typings/express.d.ts" />
import express = require("express");
import keys = require("./keys");
export var ERR_NO_API_KEY = "ERR: NO_APY_KEY";
export var ERR_INVALID_API_KEY = "ERR: INVALID_API_KEY";
interface Gateway {
handleRequest(req:expr... |
316d8aad8f47d299e815c5a63122d47f853737a5 | TypeScript | tsedbrpp/apiexpress | /react-typescript-app/src/Rule.ts | 2.65625 | 3 | import LogicSet from "./LogicSet";
import OvPair from "./OvPair";
import Outputer from "./Outputer";
import Statement from "./Statement";
import Logic from "./Logic";
import { StatementForm } from "./Statement";
import Nodes from "./Nodes";
export default class Rule {
myName: string;
ParsedOk: boolean;
Reference... |
e9e0ef19899193c989182c79a9ec2a0b1879d8ae | TypeScript | JayKay24/coding_challenges | /algorithms_and_data_structures_masterclass/reverse.ts | 3.234375 | 3 | export const reverse = (str: string): string => {
if (str.length <= 1) return str;
return `${str[str.length - 1]}${reverse(str.slice(0, -1))}`;
};
let res = reverse("awesome");
console.log(res);
|
6d6a157ae5c29f53f938bed42242fb6276680d51 | TypeScript | albizures/flashruad | /src/entities/word/word.entity.ts | 2.625 | 3 | // TODO: remove this entity
import {
Entity,
Column,
PrimaryGeneratedColumn,
Unique,
ManyToOne,
CreateDateColumn,
UpdateDateColumn,
} from 'typeorm';
import { ObjectType, Field, Int, ArgsType, InputType } from 'type-graphql';
import { Language } from '../internals';
@Entity()
@ObjectType()
@Unique(['word... |
b67caf12023baa9d4ff06238d5a81b462f13458d | TypeScript | chris-schmitz/binary-operations-presentation | /source-client/common/BrickColor.ts | 3.515625 | 4 | import { BrickColor as RGBBrickColor } from "./Interfaces";
export class BrickColor {
static withRandomColor(): BrickColor {
const color = new BrickColor()
color.setColorRGB({ red: BrickColor.getRandomColorValue(), green: BrickColor.getRandomColorValue(), blue: BrickColor.getRandomColorValue() })
return ... |
b34bfdc48f4144d16609abbf3e4c66da7694bcf9 | TypeScript | brscherer/ng-ecommerce | /src/app/core/functions/dynamic-sort.spec.ts | 3.171875 | 3 | // export function dynamicSort(property: string) {
// let sortOrder = 1;
import { dynamicSort } from './dynamic-sort';
// if (property[0] === '-') {
// sortOrder = -1;
// property = property.substr(1);
// }
// return function (a: any, b: any) {
// const result = a[property] < b[property] ? -1 : a... |
c345475bf481780630f26c769fe0bf812dcd3066 | TypeScript | PrendiProgramming/EFTClient.IPInterface.Typescript | /ts/index.ts | 2.53125 | 3 | import { tcpSocket } from "./tcp_socket";
import * as net from 'net'
import { createEFTTransactionRequest, createEFTLogonRequest, createSendKeyRequest, createSetDialogRequest, createEFTStatusRequest, createGetClientListRequest } from "./request_parser";
import { EFTTransactionRequest } from "./model/transaction";
i... |
e4f4f23788f08956b4375cfb2bf0e976a39a788d | TypeScript | qlonik-forks/matechs-effect-legacy | /packages/core/demo/demo10.ts | 3.0625 | 3 | import * as A from "../src/Array"
import { pipe } from "../src/Function"
import * as T from "../src/next/Effect"
import * as Has from "../src/next/Has"
import * as L from "../src/next/Layer"
import * as S from "../src/next/Semaphore"
abstract class Console {
abstract readonly putStrLn: (s: string) => T.Sync<void>
}
... |
29321a1126a7635ed15feccac19fb58589b4fe87 | TypeScript | isuru89/vscode-nyql | /src/nyModel.ts | 2.578125 | 3 | import { Disposable } from "vscode";
export class NyConnection {
name: string;
dialect: string;
host: string;
port: number;
username: string;
password: string;
databaseName: string;
additionalOptions?: string;
autoCapitalizeTableNames?: boolean;
}
export class NySchemaInfo {
... |
e440cf584a79d8ceb67a187fef3cb08875e434bb | TypeScript | isatix971/prototipo_sgt | /src/infrastructure/repository/persistence/profesional.ts | 2.65625 | 3 |
import { EntityRepository, getRepository } from "typeorm";
import { ProfesionalEntity } from "../entity/profesional";
import { ProfesionalRepoContract } from "../interfaces/profesional";
import { keysToLowerCase } from "../../../application/common/utils";
import { InputProfesional } from "../../../application/resolve... |
8f657de80689d16433340ed703bb28614ba6d5e2 | TypeScript | can-i/see-example | /services/ModelService.ts | 2.71875 | 3 |
import {Injectable} from "can-i/IOC";
import _ = require("lodash");
export interface Model{
id:number
}
let collection = new Map<string,Model[]>()
let primary_key = new Map<string,number>();
export abstract class ModelService{
public name:string;
public get collection(){
return this.getCollec... |
cb05485fbd407acf909105333920a9047bb3951b | TypeScript | MerHS/sarissa | /src/utils/types/scoreTypes.ts | 2.734375 | 3 | export type Coord = [number, number];
/**
* [bottom-left Coord, [width, height]]
*/
export type Rect = [Coord, Coord];
export type Beat = [number, number];
export type NoteIndex = string;
export type SoundIndex = string;
export type LaneIndex = number;
export type TrackIndex = number;
export interface ScoreMetaData ... |
f704ee6480a9b82adacf5ec5d2a7b4b3af62336b | TypeScript | brunnre8/thelounge | /server/plugins/messageStorage/sqlite.ts | 2.546875 | 3 | import type {Database} from "sqlite3";
import log from "../../log";
import path from "path";
import fs from "fs/promises";
import Config from "../../config";
import Msg, {Message} from "../../models/msg";
import Chan, {Channel} from "../../models/chan";
import Helper from "../../helper";
import type {SearchResponse, S... |
0c09bc2b3b1c8608fed5caaf6f77050e83cfd7eb | TypeScript | SaeedYaghuti/kasabe-16 | /src/accounting/models/account/dto/create-tree-account.dto.ts | 2.578125 | 3 | import { IsNotEmpty, IsOptional, IsInt, IsString } from 'class-validator';
export class CreateTreeAccountDto {
@IsNotEmpty()
@IsString()
title: string; // english
@IsNotEmpty()
@IsString()
titleArb: string; // Arabic
@IsNotEmpty()
@IsString()
titlePer: string; // Persian
@IsOptional... |
5679699b05155bc1391486ca374dc31b60b8306a | TypeScript | NirajBhavnani/DiscoveryLandCo | /src/components/PressArticles/PressArticles.ts | 2.515625 | 3 | interface IArticlesDataItem {
title: string;
subtitle: string;
}
import { Options, Vue } from "vue-class-component";
import PressArticlesCard from "../PressArticlesCard/PressArticlesCard.vue";
@Options({
name: "PressArticles",
components: {
PressArticlesCard,
},
data() {
return {
page: 0 as n... |
4a08b320b919391a98dd9938af89ea0ecc9e6581 | TypeScript | VoicuIuliana/angular | /learning/src/app/heroes/heroes.component.ts | 2.734375 | 3 | import { Component, OnInit } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'app-heroes',
templateUrl: './heroes.component.html',
styleUrls: ['./heroes.component.css']
})
export class HeroesComponent implements OnInit {
hero: Hero = {
id: 1,
name: 'Windstorm',
age: 23
... |
61d3b078098bd1f62c6f6da9d13830f37dfbc495 | TypeScript | petebacondarwin/ts-simple-ast | /src/tests/compiler/literal/template/taggedTemplateExpressionTests.ts | 2.75 | 3 | import * as ts from "typescript";
import {expect} from "chai";
import {TaggedTemplateExpression} from "./../../../../compiler";
import {getInfoFromTextWithDescendant} from "./../../testHelpers";
function getExpression(text: string) {
return getInfoFromTextWithDescendant<TaggedTemplateExpression>(text, ts.SyntaxKin... |
8775e67f33353da7a7b6da96ad9be8dd3514813b | TypeScript | yin0105/SpaceNextDoor-onslib | /src/modules/media/media.controller.ts | 2.75 | 3 | import { BadRequestError } from '../../exceptions';
import {
IFileDetail,
IResizeImageQueryParam,
IResizeImageResult,
IUploadImagesQueryParam,
IUploadImagesResult,
} from './interfaces/media.interface';
import { MediaService } from './media.service';
export class MediaController {
private bucketUrl: string... |
6d51a08ac7dd8b10c55d04c587c27c6d965637ae | TypeScript | crystalis-randomizer/crystalis-randomizer | /src/js/pass/fixskippableexits.ts | 2.96875 | 3 | import {Rom} from '../rom';
import { UnionFind } from '../unionfind';
import { Exit } from '../rom/location';
// There's an oddity where map screens that can be fallen into (i.e.
// via a pit) can have their exits skipped over while the screen is
// shaking on impact (the game stops checking exits during that time,
//... |
6dc0e5406d16921a81b4d4220bf3cea7fde54960 | TypeScript | nkint/umbrella | /packages/bench/src/index.ts | 3.96875 | 4 | export type TimingResult<T> = [T, number];
/**
* Calls function `fn` without args, prints elapsed time and returns
* fn's result. The optional `prefix` will be displayed with the output,
* allowing to label different measurements.
*
* @param fn
* @param prefix
*/
export const timed = <T>(fn: () => T, prefix = "... |
741c19096b3663f928703fbd5d1cd1fbcce79d78 | TypeScript | aadorian/TuringVscode | /client/src/providers/moduleProvider.ts | 2.71875 | 3 | import * as vscode from 'vscode';
import { functionCompletion, moduleCompletion, variableCompletion } from './completions';
// Module autocomplete
export const moduleProvider = vscode.languages.registerCompletionItemProvider(
't',
{
provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) {... |
3315a890800c1df43e8d6a6c893d6025756290e0 | TypeScript | bokeh/bokeh | /bokehjs/test/integration/colors.ts | 2.90625 | 3 | import {column, display, fig, row} from "./_util"
import {ColumnDataSource, GlyphRenderer, Circle} from "@bokehjs/models"
import type {ColorNDArray} from "@bokehjs/api/glyph_api"
import type {OutputBackend} from "@bokehjs/core/enums"
import * as nd from "@bokehjs/core/util/ndarray"
import {isArrayable} from "@bokehjs/... |