repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/App.tsx
import { Helmet } from "react-helmet"; import { MainPageComponent } from "./components/mainPage/mainPage.component"; import React from "react"; const App: React.FC = () => { return ( <div className="App"> <Helmet> <title>{"Valheim Management Dashboard"}</title> </Helmet> <MainPageCompon...
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/shared/errorHandler.tsx
<gh_stars>0 export const onError = (err: Error): void => { console.error("failed to load data"); console.error(err); };
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/components/mainPage/mainPage.ui.tsx
import { Fragment, FunctionComponent } from "react"; // import styled from "styled-components"; import { ServerStatusDto } from "./serverStatus.dto"; import { Button, Grid, makeStyles, Typography } from "@material-ui/core"; import { ServerStatusUi } from "./serverStatus.ui"; type Props = { serverStatus: ServerStatus...
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/components/mainPage/serverStatus.service.ts
import { ServerStatusDto } from "./serverStatus.dto"; import { Config } from "../../shared/config"; import axios from "axios"; import { validate } from "class-validator"; import { plainToClassFromExist } from "class-transformer"; import { get } from "lodash"; export class ServerStatusService { private serverStatusDt...
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/components/mainPage/infoCard.ui.tsx
import { FunctionComponent } from "react"; import { Card, CardContent, CardProps, makeStyles, Typography } from "@material-ui/core"; const useStyles = makeStyles((theme) => ({ card: { padding: theme.spacing(1), height: 220, width: 220, }, })); type Props = CardProps & { title: string; content: str...
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/components/mainPage/serverStatus.dto.ts
<filename>packages/ui/src/components/mainPage/serverStatus.dto.ts import { IsInt } from "class-validator"; export class ServerStatusDto { host?: Host; server?: Server; serverUp?: boolean; syncTimestamp?: Date; } class Host { status = "N/A"; } class Server { name = ""; version = ""; @IsInt() playe...
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/components/mainPage/mainPage.component.tsx
import { MainPageUi } from "./mainPage.ui"; import { FunctionComponent, useEffect, useState } from "react"; import { serverStatusService } from "./serverStatus.service"; import { Config } from "../../shared/config"; import { cloneDeep } from "lodash"; import { onError } from "../../shared/errorHandler"; export const M...
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/shared/config/index.ts
<filename>packages/ui/src/shared/config/index.ts import { decodeDto } from "@ansik/sdk/lib/utils"; import { string } from "io-ts"; export const Config = { EC2_START_URL: decodeDto(string, process.env.REACT_APP_EC2_START_URL), EC2_STOP_URL: decodeDto(string, process.env.REACT_APP_EC2_STOP_URL), EC2_STATUS_URL: de...
ibrahimusluu/network-operators
network-operator-dialog/network-operator-dialog.component.ts
import { Component, OnInit, Inject } from "@angular/core"; import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog"; import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapt...
ibrahimusluu/network-operators
network-operator.service.ts
import { Injectable } from '@angular/core'; import { HttpClient } from "@angular/common/http"; @Injectable({ providedIn: 'root' }) export class NetworkOperatorService { constructor(private http: HttpClient) { } /** * gibt ein JSON Objekt mit allen Netzbetreibern zurück / returns a JSON object with all netwo...
ibrahimusluu/network-operators
network-operator/network-operator.component.ts
import { Component, OnInit, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { MatPaginator } from '@angular/material/paginator'; import { MatSnackBar } from '@angular/material/snack-bar'; import { MatTableDataSource } from '@angular/material/table'; import { NetworkOperato...
1-EXON/star-battle
app/src/models/users.ts
<reponame>1-EXON/star-battle import User from '../data/User' export let user1: User = new User('', 0, 0) export let user2: User = new User('', 0, 0)
1-EXON/star-battle
app/src/data/User.ts
<reponame>1-EXON/star-battle<gh_stars>1-10 export default class User { name: string stars: number followers: number constructor(name: string, stars: number, followers: number) { this.name = name this.stars = stars this.followers = followers } public Reset(name: string, ...
1-EXON/star-battle
app/src/components/UserContent.tsx
import React, { Component } from 'react' class UserContent extends Component { public render() { return ( <div className="users"> <table> <thead> <tr> <th id="user1"></th> ...
1-EXON/star-battle
app/src/components/Main.tsx
import React, { Component } from 'react' import { getStar as getUserStar } from '../data/GetStar' import { getFollowers as getUserFollowers } from '../data/GetFollowers' import { user1, user2 } from '../models/users' import UserContent from './UserContent' const Selector = (param: string) => { return document.querySel...
1-EXON/star-battle
app/src/App.tsx
import React from 'react' import './css/App.css' import Main from './components/Main' function App() { return ( <div className="App"> <header className="App-header"> <div className="head"> <h1>Github Star Battle</h1> <p>깃허브 스타 대결 사이트!</p> ...
1-EXON/star-battle
app/src/data/GetStar.ts
<gh_stars>1-10 export async function getStar(name: string) { const repos = await fetch(`https://api.github.com/users/${name}/repos`).then(resp => resp.json()) return repos.reduce((acc: any, cur: { stargazers_count: any }) => acc += cur.stargazers_count, 0) }
ickeep/think-mail
src/think-mail.ts
<gh_stars>0 // @ts-ignore import { think, Context } from 'thinkjs' export interface IConf { apiUser: string, apiKey: string, from: string, captchaTemplate?: string, logDb?: string, logTable?: string, } export interface ISendTemplateOpt { to: string[], sub: { '%action%': string[], '%code%': Array<strin...
andrefillypesilva/clever-weather
src/app/models/interfaces/weather-forecast.interface.ts
<reponame>andrefillypesilva/clever-weather<gh_stars>0 // Interfaces import { ConsolidatedWeather } from "./consolidated-weather.interface"; import { WeatherParent } from "./weather-parent.interface"; import { WeatherSource } from "./weather-source.interface"; export interface WeatherForecast { consolidated_weather: ...
andrefillypesilva/clever-weather
src/app/shared/components/weather-box/weather-box.component.ts
<reponame>andrefillypesilva/clever-weather import { Component, Input, OnInit } from '@angular/core'; // Interfaces import { ConsolidatedWeather } from 'src/app/models/interfaces/consolidated-weather.interface'; @Component({ selector: 'app-weather-box', templateUrl: './weather-box.component.html', styleUrls: ['....
andrefillypesilva/clever-weather
src/app/models/enums/local-storage.config.enum.ts
export enum LOCALSTORAGECONFIG { FIRST_ACCESS = 'FE__first' }
andrefillypesilva/clever-weather
src/app/models/interfaces/weather-source.interface.ts
export interface WeatherSource { title: string; slug: string; url: string; crawl_rate: number; }
andrefillypesilva/clever-weather
src/app/shared/services/local-storage.service.ts
import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class LocalStorageService { constructor() { } public setItem(key: string, value: any): boolean { try { localStorage.setItem(key, JSON.stringify(value)); return true; } catch { return false; } ...
andrefillypesilva/clever-weather
src/app/shared/shared.module.ts
<filename>src/app/shared/shared.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { HttpClientModule } from '@angular/common/http'; // Components import { WeatherBoxComponent } from './components/weather-box/weather-box.component'; import { WeatherCardComponent ...
andrefillypesilva/clever-weather
src/app/models/interfaces/consolidated-weather.interface.ts
export interface ConsolidatedWeather { id: number; weather_state_name: string; weather_state_abbr: string; wind_direction_compass: string; created: string; applicable_date: string; min_temp: number; max_temp: number; the_temp: number; wind_speed: number; wind_direction: number; air_pressure: num...
andrefillypesilva/clever-weather
src/app/shared/interceptors/request.interceptor.ts
<filename>src/app/shared/interceptors/request.interceptor.ts<gh_stars>0 import { Injectable } from '@angular/core'; import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpHeaders, } from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from 'src/environments/enviro...
andrefillypesilva/clever-weather
src/app/core/home/home.component.ts
<gh_stars>0 import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { Observable } from 'rxjs'; import { Router } from '@angular/router'; // Interfaces import { Place } from 'src/app/models/interfaces/place.interface'; import { ConsolidatedWeather } from 'src/...
andrefillypesilva/clever-weather
src/app/shared/services/local-storage.service.spec.ts
<reponame>andrefillypesilva/clever-weather<filename>src/app/shared/services/local-storage.service.spec.ts import { TestBed } from '@angular/core/testing'; // Enums import { LOCALSTORAGECONFIG } from 'src/app/models/enums/local-storage.config.enum'; // Services import { LocalStorageService } from './local-storage.serv...
andrefillypesilva/clever-weather
src/app/shared/services/weather.service.ts
<reponame>andrefillypesilva/clever-weather<filename>src/app/shared/services/weather.service.ts import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { pluck } from 'rxjs/operators'; // Interfaces import { Place } from 'src/app/models/in...
andrefillypesilva/clever-weather
src/app/models/enums/weather-card-type.enum.ts
<filename>src/app/models/enums/weather-card-type.enum.ts export enum WEATHERCARDTYPE { MAIN = 'main__card', SUPPORT = 'support__card' }
andrefillypesilva/clever-weather
src/app/core/core.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; // Routing import { CoreRoutingModule } from './core-routing.module'; // Modules import { SharedModule } from '../shared/shared.module'; // Components import { ...
andrefillypesilva/clever-weather
src/app/core/onboarding/onboarding.component.spec.ts
import { HttpClientModule } from '@angular/common/http'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; // Components import { OnboardingCardComponent } from 'src/app/shared/components/onboarding-card/onboarding-card.component'; import ...
andrefillypesilva/clever-weather
src/app/shared/services/weather.service.spec.ts
<filename>src/app/shared/services/weather.service.spec.ts import { HttpClientModule } from '@angular/common/http'; import { HttpClientTestingModule, HttpTestingController, } from '@angular/common/http/testing'; import { getTestBed, TestBed } from '@angular/core/testing'; // Test Mocks import { MOCK__PLACES } from ...
andrefillypesilva/clever-weather
src/app/core/onboarding/onboarding.component.ts
<filename>src/app/core/onboarding/onboarding.component.ts import { animate, style, transition, trigger } from '@angular/animations'; import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; // Enums import { LOCALSTORAGECONFIG } from 'src/app/models/enums/local-storage.config.enum';...
andrefillypesilva/clever-weather
src/app/test-mocks/mock-places.mock.ts
export const MOCK__PLACES = [ { title: 'Lisbon', location_type: 'City', woeid: 742676, latt_long: '38.725670,-9.150370', }, ];
andrefillypesilva/clever-weather
src/app/shared/components/onboarding-card/onboarding-card.component.ts
<reponame>andrefillypesilva/clever-weather import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; // Interfaces import { Onboarding } from 'src/app/models/interfaces/onboarding.interface'; @Component({ selector: 'app-onboarding-card', templateUrl: './onboarding-card.component.html', sty...
andrefillypesilva/clever-weather
src/app/shared/components/weather-card/weather-card.component.ts
import { Component, Input, OnInit } from '@angular/core'; // Interfaces import { ConsolidatedWeather } from 'src/app/models/interfaces/consolidated-weather.interface'; @Component({ selector: 'app-weather-card', templateUrl: './weather-card.component.html', styleUrls: ['./weather-card.component.scss'], }) export...
andrefillypesilva/clever-weather
src/app/test-mocks/mock-consolidated-weather.mock.ts
<gh_stars>0 export const MOCK__CONSOLIDATED_WEATHER = [ { id: 5740829197991936, weather_state_name: 'Heavy Cloud', weather_state_abbr: 'hc', wind_direction_compass: 'NW', created: '2021-03-07T19:40:49.698125Z', applicable_date: '2021-03-07', min_temp: 10.745000000000001, max_temp: 16.6...
andrefillypesilva/clever-weather
src/app/shared/interceptors/index.ts
import { HTTP_INTERCEPTORS } from "@angular/common/http"; // Interceptors import { RequestInterceptor } from "./request.interceptor"; export const httpInterceptorProviders = [ { provide: HTTP_INTERCEPTORS, useClass: RequestInterceptor, multi: true }, ];
chaos7theory/polecat
src/services/users/users.class.ts
<reponame>chaos7theory/polecat import { Params } from '@feathersjs/feathers'; import { Service, NedbServiceOptions } from 'feathers-nedb'; import { Application } from '../../declarations'; export interface UserData { _id?: string; email?: string; discordId: string; name?: string; avatar?: string; }...
chaos7theory/polecat
test/users.helper.ts
import {UserData} from '../src/services/users/users.class'; import app from '../src/app'; // An example account that's not used for anything beyond testing export const userInfo = { email: '<EMAIL>', discordId: '823737099332616216', avatar: 'https://cdn.discordapp.com/avatars/823737099332616216/3936a0db667...
chaos7theory/polecat
test/authentication.test.ts
<reponame>chaos7theory/polecat import assert from 'assert'; import app from '../src/app'; describe('authentication', () => { it('registered the authentication service', () => { assert.ok(app.service('authentication')); }); // describe('discord strategy', () => { // before(async () => { ...
chaos7theory/polecat
src/authentication.ts
<gh_stars>0 import { Params, ServiceAddons } from '@feathersjs/feathers'; import { AuthenticationRequest, AuthenticationService, JWTStrategy } from '@feathersjs/authentication'; import { expressOauth, OAuthProfile, OAuthStrategy } from '@feathersjs/authentication-oauth'; import { Application } from './declarations'; i...
chaos7theory/polecat
src/services/messages/messages.hooks.ts
<reponame>chaos7theory/polecat import * as authentication from '@feathersjs/authentication'; import { alterItems, disallow, iff, isProvider, keep, populate, required, setNow, stashBefore, validate } from 'feathers-hooks-common'; import {HookContext} from '@feathersjs/feathers'; // Do...
chaos7theory/polecat
src/models/characters.model.ts
import NeDB from 'nedb'; import path from 'path'; import { Application } from '../declarations'; export default function (app: Application): NeDB<any> { const dbPath = app.get('nedb'); const Model = new NeDB({ filename: path.join(dbPath, 'characters.db'), autoload: true }); return Mode...
chaos7theory/polecat
test/services/users.test.ts
import assert from 'assert'; import app from '../../src/app'; import {remove_user, userInfo} from '../users.helper'; describe('\'users\' service', () => { beforeEach(async () => { await remove_user(); }); it('registered the service', () => { const service = app.service('users'); a...
chaos7theory/polecat
test/services/messages.test.ts
<filename>test/services/messages.test.ts import assert from 'assert'; import app from '../../src/app'; import {create_user, get_user} from '../users.helper'; describe('\'messages\' service', () => { beforeEach(async () => { await create_user(); }); it('registered the service', () => { cons...
danielcondemarin/rust-lambda-test
deployment/bin/stack.ts
import * as cdk from "@aws-cdk/core"; import { LambdaStack } from "../lib/lambda-stack"; import * as pkg from "../../package.json"; // Allow appending a randomized benchmark number. const { BENCHMARK_SUFFIX } = process.env; const STACK_NAME = BENCHMARK_SUFFIX ? `${pkg.name}-${BENCHMARK_SUFFIX}` : pkg.name; /** * Co...
danielcondemarin/rust-lambda-test
benchmark/benchmark.ts
import { LambdaClient, GetFunctionConfigurationCommand, UpdateFunctionConfigurationCommand, UpdateFunctionConfigurationCommandInput, InvokeCommand, InvokeCommandInput, } from "@aws-sdk/client-lambda"; import { XRayClient, GetTraceSummariesCommand, GetTraceSummariesCommandInput, BatchGetTracesCommand...
powerpool-finance/snapshot.js
dist/index.d.ts
declare const _default: { plugins: { aragon: typeof import("./plugins/aragon").default; gnosis: typeof import("./plugins/gnosis").default; }; strategies: { balancer: typeof import("./strategies/balancer").strategy; 'erc20-received': typeof import("./strategies/erc20-received"...
powerpool-finance/snapshot.js
src/strategies/powerpool/index.ts
import {formatUnits, parseUnits} from '@ethersproject/units'; import {getBlockNumber} from '../../utils/web3'; import {multicall, call} from '../../utils'; export const author = 'powerpool'; export const version = '0.1.0'; const abi = [ { constant: true, inputs: [ { internalType: 'address', ...
powerpool-finance/snapshot.js
dist/utils/multicaller.d.ts
import { JsonRpcProvider } from '@ethersproject/providers'; export default class Multicaller { network: string; provider: JsonRpcProvider; abi: any[]; options: any; calls: any[]; paths: any[]; constructor(network: string, provider: JsonRpcProvider, abi: any[], options?: any); call(path: ...
powerpool-finance/snapshot.js
dist/strategies/the-graph-indexing/indexers.d.ts
import { GraphAccountScores } from '../the-graph/graphUtils'; export declare function indexersStrategy(_space: any, network: any, _provider: any, addresses: any, options: any, snapshot: any): Promise<GraphAccountScores>;
powerpool-finance/snapshot.js
dist/schemas/index.d.ts
<filename>dist/schemas/index.d.ts declare const _default: { space: { title: string; type: string; properties: { name: { type: string; title: string; minLength: number; maxLength: number; }; pr...
powerpool-finance/snapshot.js
dist/utils/provider.d.ts
export default function getProvider(network: string): any;
powerpool-finance/snapshot.js
dist/utils/contentHash.d.ts
<reponame>powerpool-finance/snapshot.js<gh_stars>0 import { Provider } from '@ethersproject/abstract-provider'; export declare function decodeContenthash(encoded: any): { protocolType: any; decoded: any; error?: undefined; } | { protocolType: any; decoded: any; error: any; }; export declare func...
powerpool-finance/snapshot.js
dist/strategies/the-graph/utils.d.ts
import { BigNumber } from '@ethersproject/bignumber'; export declare const GRAPH_NETWORK_SUBGRAPH_URL: { 1: string; 4: string; }; export declare const WEI = "1000000000000000000"; export interface GraphAccountScores { [key: string]: number; } export declare function bdMulBn(bd: string, bn: string): BigNumbe...
dorzey/vscode-dbt-language
src/dbtDefinitionProvider.ts
<gh_stars>1-10 import * as vscode from 'vscode'; import { Uri, Range, ProviderResult, Definition, DefinitionLink, Location } from 'vscode'; import { DBTManifestCacheInstance } from './dbtManifestCache'; export const DBT_MODE = { language: 'jinja-sql', scheme: 'file' }; class RefDefinitionProvider { private stati...
dorzey/vscode-dbt-language
src/extension.ts
<filename>src/extension.ts import * as vscode from 'vscode'; import { DbtDefinitionProvider, DBT_MODE } from './dbtDefinitionProvider'; import { DbtDocumentHighlightProvider } from './dbtDocumentHighlightProvider'; export function activate(context: vscode.ExtensionContext) { context.subscriptions.push( vscode.lang...
dorzey/vscode-dbt-language
src/dbtDocumentHighlightProvider.ts
<reponame>dorzey/vscode-dbt-language<filename>src/dbtDocumentHighlightProvider.ts import * as vscode from 'vscode'; export class DbtDocumentHighlightProvider implements vscode.DocumentHighlightProvider { provideDocumentHighlights(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationTo...
dorzey/vscode-dbt-language
src/dbtManifestCache.ts
<gh_stars>1-10 import * as vscode from 'vscode'; import { Location, Uri, Range, Definition } from 'vscode'; const fs = require('fs'); class DBTManifestCache { modelToLocationMap: Map<String, String> = new Map(); constructor() { let dbtManifastLocation = vscode.workspace.getConfiguration().get<string>...
kundanb/ninjahost
index.d.ts
<reponame>kundanb/ninjahost export default function hello(dir: string, port?: number = 1123): number;
cremalab/boilerplate-app-web
src/components/App/App.test.tsx
<reponame>cremalab/boilerplate-app-web import { render, screen } from "@testing-library/react" import { App } from "./App" describe("App", () => { it("renders expected text", () => { // Arrange const text = "Learn React" // Act render(<App />) const received = screen.getByText(text) // Asse...
cremalab/boilerplate-app-web
.storybook/preview.ts
import "../src/index.css" export const parameters = { actions: { argTypesRegex: "^on[A-Z].*" }, }
Allisone/dstruct
lib/ArrayUtilities.ts
export function clear(array: any[]) { while (array.length > 0) { array.pop(); } }
Allisone/dstruct
lib/structures/trees/RedBlackTree.ts
import Interfaces = require("../../Interfaces"); import RedBlackTreeHelpers = require("./RedBlackTreeHelpers"); import Error = require("../../Error"); import MapHelpers = require("../maps/MapHelpers") // TODO: this could use a lot of improvements. Look at CLR more and the gnu opensource implementation // https://www.o...
Allisone/dstruct
lib/structures/maps/biMaps/HashBiMap.ts
import Interfaces = require("../../../Interfaces"); import MapHelpers = require("../MapHelpers"); import Error = require("../../../Error"); import IterableHelpers = require("../../IterableHelpers"); import HashMap = require("../HashMap"); class HashBiMap<K extends Interfaces.IBaseObject, V extends Interfaces.IBaseObje...
Allisone/dstruct
lib/structures/maps/TreeMap.ts
import Interfaces = require("../../Interfaces"); import Error = require("../../Error"); import MapHelpers = require("./MapHelpers"); import RedBlackTree = require("../trees/RedBlackTree"); import IterableHelpers = require("../IterableHelpers"); class TreeMap<K extends Interfaces.IComparableBaseObject, V extends Interf...
Allisone/dstruct
lib/structures/maps/ES6Helpers.ts
<filename>lib/structures/maps/ES6Helpers.ts import * as Interfaces from '../../Interfaces'; /** * Based on the MDN ES6 documentation of the upcoming ES6 Map proposal. * Not necessarily complete, only the methods used within the library are part of the interface. * https://developer.mozilla.org/en-US/docs/Web/JavaS...
Allisone/dstruct
lib/structures/maps/MapHelpers.ts
import * as Interfaces from '../../Interfaces'; import * as Error from '../../Error'; export function equals<K extends Interfaces.IBaseObject, V extends Interfaces.IBaseObject>(map: Interfaces.IMap<K, V>, otherMap: Interfaces.IMap<K, V>): boolean { return false; // TODO! implement /* return iterable...
Allisone/dstruct
lib/structures/tables/MapBasedTable.ts
import * as Interfaces from '../../Interfaces'; import * as Error from '../../Error'; // TODO: attempt implementation without two maps. export class MapBasedTable<R extends Interfaces.IBaseObject, C extends Interfaces.IBaseObject, V extends Interfaces.IBaseObject> implements Interfaces.ITable<R, C, V> { ...
Allisone/dstruct
lib/structures/sets/MapSet.ts
import Interfaces = require("../../Interfaces"); import Error = require("../../Error"); import IterableHelpers = require("../IterableHelpers"); class MapSet<E extends Interfaces.IBaseObject> implements Interfaces.ISet<E> { constructor(private map: Interfaces.IMap<E, boolean>) { } add(element: E): boolean { ...
Allisone/dstruct
lib/structures/lists/DoublyLinkedListHelpers.ts
<reponame>Allisone/dstruct<gh_stars>0 import Interfaces = require("../../Interfaces"); export class Node<E extends Interfaces.IBaseObject> { constructor(public value: E, public prev?: Node<E>, public next?: Node<E>) { } } // Circular doubly linked export class Iterator<E extends Interfaces.IBaseObject> implements...
Allisone/dstruct
lib/structures/maps/WeakHashMap.ts
import Interfaces = require("../../Interfaces"); import ES6BaseMap = require("./ES6BaseMap"); class WeakHashMap<K extends Interfaces.IBaseObject, V extends Interfaces.IBaseObject> extends ES6BaseMap<K, V> { constructor() { super(<any>new WeakMap()); } } export = WeakHashMap;
Allisone/dstruct
lib/structures/multiSets/TreeMultiSet.ts
<gh_stars>0 import Interfaces = require("../../Interfaces"); import TreeMap = require("../maps/TreeMap"); import BaseMultiSet = require("./BaseMultiSet"); // TODO: create SortedMultiSet interface! class TreeMultiSet<E extends Interfaces.IComparableBaseObject> extends BaseMultiSet<E> { constructor() { super(new ...
Allisone/dstruct
lib/structures/trees/RedBlackTreeHelpers.ts
import Interfaces = require("../../Interfaces"); //TODO: interface?! export class Node<K extends Interfaces.IComparableBaseObject, V extends Interfaces.IBaseObject> { public red = true; constructor(public key: K = null, public value: V = null, public left: Node<K, V> = null, public right: Node<K, V> = null) { } ...
Allisone/dstruct
lib/structures/IterableHelpers.ts
import * as Interfaces from '../Interfaces'; import * as Error from '../Error'; // TODO: generic equals for maps may be different that lists since keys, and values must be comparaed! export function equals<E extends Interfaces.IBaseObject>( iterable: Interfaces.IIterable<E>, otherIterable: Interfaces.IIterable<E...
Allisone/dstruct
lib/structures/sets/HashSet.ts
<filename>lib/structures/sets/HashSet.ts<gh_stars>0 import Interfaces = require("../../Interfaces"); import MapSet = require("./MapSet"); import HashMap = require("../maps/HashMap"); class HashSet<E extends Interfaces.IBaseObject> extends MapSet<E> implements Interfaces.ISet<E> { constructor() { super(new HashM...
Allisone/dstruct
lib/structures/multiSets/BaseMultiSet.ts
<reponame>Allisone/dstruct<gh_stars>0 import Interfaces = require("../../Interfaces"); import Error = require("../../Error"); import IterableHelpers = require("../IterableHelpers"); interface MultiSet<E> { } //TODO: Create an interface for MultiSets! class BaseMultiSet<E extends Interfaces.IBaseObject> { construct...
Allisone/dstruct
lib/dsa.ts
<reponame>Allisone/dstruct<filename>lib/dsa.ts import Interfaces = require("./Interfaces"); // FOR BROWSER USERS // Configure this file with the data structures and algorithms you require // for your project. Remove any require statements and exports you do not use. // Lists import ArrayList = require("./structures/l...
Allisone/dstruct
lib/Primitive.ts
<reponame>Allisone/dstruct<filename>lib/Primitive.ts interface Number { hashCode(): number; equals(otherNumber: Number); compareTo(otherNumber: Number): number; } interface String { hashCode(): number; equals(otherString: String); compareTo(otherString: String): number; } interface Boolean { hashCode():...
Allisone/dstruct
lib/structures/lists/ArrayList.ts
// import Interfaces = require("../../Interfaces"); import * as Interfaces from '../../Interfaces'; import * as Error from '../../Error'; import * as IterableHelpers from '../IterableHelpers'; import { ArrayListIterator } from './ArrayListIterator'; import * as ArrayUtilities from '../../ArrayUtilities'; /** * Resi...
Allisone/dstruct
lib/Error.ts
// Exceptions export class BaseException { error: Error; name: string; constructor(message?: string) { this.error = new Error(message); this.error.name = this.name + 'Exception'; //TODO: adding exception necesary? } } export class IllegalArgument extends BaseException { name =...
Allisone/dstruct
lib/structures/sets/TreeSet.ts
import Interfaces = require("../../Interfaces"); import MapSet = require("./MapSet"); import TreeMap = require("../maps/TreeMap"); class TreeSet<E extends Interfaces.IComparableBaseObject> extends MapSet<E> implements Interfaces.ISortedSet<E> { constructor() { super(new TreeMap<E, boolean>()); } } export = ...
Allisone/dstruct
lib/structures/maps/HashMap.ts
<reponame>Allisone/dstruct import * as Interfaces from '../../Interfaces'; import {ES6BaseMap} from './ES6BaseMap'; export class HashMap<K extends Interfaces.IBaseObject, V extends Interfaces.IBaseObject> extends ES6BaseMap<K, V> { constructor() { super(<any>new Map()); } }
Allisone/dstruct
lib/structures/stacks/ArrayStack.ts
<filename>lib/structures/stacks/ArrayStack.ts import Interfaces = require("../../Interfaces"); import ArrayList = require("../lists/ArrayList"); class ArrayStack<E extends Interfaces.IBaseObject> extends ArrayList<E> implements Interfaces.IStack<E> { peek(): E { return this.get(this.size() - 1); } pop(): E...
Allisone/dstruct
lib/structures/queues/LinkedListQueue.ts
<filename>lib/structures/queues/LinkedListQueue.ts import Interfaces = require("../../Interfaces"); import DoublyLinkedList = require("../lists/DoublyLinkedList"); class LinkedListQueue<E extends Interfaces.IBaseObject> extends DoublyLinkedList<E> implements Interfaces.IQueue<E> { peek(): E { return this.get(0)...
Allisone/dstruct
lib/search/Search.d.ts
declare module dsa.search { /* export interface Search<E> { search(list: dsa.structs.List<E>, value: E, comparator?: dsa.structs.Comparator<E> = dsa.structs.DefaultComparator) } */ }
Allisone/dstruct
lib/structures/lists/DoublyLinkedList.ts
import Interfaces = require("../../Interfaces"); import DoublyLinkedListHelpers = require("./DoublyLinkedListHelpers"); import Error = require("../../Error"); import IterableHelpers = require("../IterableHelpers"); import Node = DoublyLinkedListHelpers.Node; class DoublyLinkedList<E extends Interfaces.IBaseObject> imp...
Allisone/dstruct
lib/Interfaces.d.ts
declare module Interfaces { /** * An object which can be compared for equality and hashed. All objects * used with the collections and algorithms must implement this algorithm. * Primitive types are modified in "Primitive" to implement this interface. */ export interface IBaseObject { hashCode(): n...
Allisone/dstruct
lib/sort/InsertionSort.ts
/** * Created by codystebbins on 4/13/14. */ /* //best, average, worst // O(n), O(n^2), O(n^2) function insertionSort(array) { for (var i = 1; i < array.length; i++) { insert(array, i, array[i]); } } function insert(array, position, value) { var i = position - 1; while (i >= 0 && array[i] > value) { ar...
Allisone/dstruct
lib/search/BinarySearch.ts
/* module dsa.search { export function BinarySearch<E>( list: dsa.structs.List<E>, value: E, comparator: dsa.structs.Comparator<E> = dsa.structs.DefaultComparator) { var minIndex = 0; var maxIndex = list.size() - 1; var midIndex: number; var midValue: E; //Check for sorted condition? // Return two's compli...
Allisone/dstruct
lib/structures/multiSets/HashMultiSet.ts
import Interfaces = require("../../Interfaces"); import HashMap = require("../maps/HashMap"); import BaseMultiSet = require("./BaseMultiSet"); class HashMultiSet<E extends Interfaces.IBaseObject> extends BaseMultiSet<E> { constructor() { super(new HashMap<E, number>()); } } export = HashMultiSet;
Allisone/dstruct
lib/structures/maps/ES6BaseMap.ts
<filename>lib/structures/maps/ES6BaseMap.ts<gh_stars>0 import {IIterator} from '../../Interfaces'; import * as Interfaces from '../../Interfaces'; import * as Error from '../../Error'; import {IEntry} from './ES6Helpers'; import * as MapHelpers from './MapHelpers'; import ...
Allisone/dstruct
lib/sort/MergeSort.ts
<gh_stars>0 /** * An implementation for Mergesort. Less efficient * than Quicksort. Again, you'd just use Array.sort * but if you found yourself unable to use that * there's always this option. * * Tests with: * * var array = []; * for(var i = 0; i < 20; i++) { * array.push(Math.round(Math.random() * 100)); * ...
Allisone/dstruct
lib/sort/QuickSort.ts
<reponame>Allisone/dstruct /** * Partitions the (sub)array into values less than and greater * than the pivot value * * @param {Array} array The target array * @param {int} pivot The index of the pivot * @param {int} left The index of the leftmost element * @param {int} left The index of the rightmost element *...
Allisone/dstruct
lib/structures/lists/ArrayListIterator.ts
import * as Interfaces from '../../Interfaces'; export class ArrayListIterator<E extends Interfaces.IBaseObject> implements Interfaces.IIterator<E> { private index = 0; constructor(private array: E[]) { } next(): Interfaces.IIteratorReturn<E> { var next = this.index < this.array.length ...
samjeyam/nestjs-passport-clientcert-demo
src/helloworld/helloworld.controller.ts
import { Controller, Get, Query, UseGuards } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport' @Controller('helloworld') export class HelloworldController { // https://localhost:443/helloworld/ - no client cert auth enforcement @Get() getHello(): string { return "hello world" ...
samjeyam/nestjs-passport-clientcert-demo
src/main.ts
import { NestFactory } from '@nestjs/core'; import { AppModule } from './app/app.module'; import { NestApplicationOptions } from '@nestjs/common'; import * as path from "path"; const fs = require("fs"); function getFileContent(path) { if (!path) { return null; } return fs.readFileSync(path); } const certPath...
samjeyam/nestjs-passport-clientcert-demo
src/auth/auth.module.ts
<reponame>samjeyam/nestjs-passport-clientcert-demo import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config' import {ClientCertStrategy} from "./client-cert.strategy"; @Module({ imports: [ConfigModule], providers: [ClientCertStrategy], exports: [ClientCertStrategy] }) export cl...