repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
KevinTCoughlin/preact-devtools
src/view/store/react-bindings.ts
import { createContext } from "preact"; import { useEffect, useContext, useState, useMemo, useRef } from "preact/hooks"; import { Store } from "./types"; import { EmitFn } from "../../adapter/hook"; import { watch, Observable } from "../valoo"; export const AppCtx = createContext<Store>(null as any); export const Emit...
KevinTCoughlin/preact-devtools
src/adapter/bridge.ts
<gh_stars>1-10 import { createSimpleBridge } from "../examples/inline-devtools/simple-bridge"; export type Listener<T = any> = (data: T) => void; export type Unsubscribe = () => void; export interface Bridge { _listeners: Map<string, Array<Listener | null>>; listen: (name: string, cb: Listener) => Unsubscribe; sen...
KevinTCoughlin/preact-devtools
src/view/components/profiler/components/RenderedAt/RenderedAt.tsx
import { h } from "preact"; import { useStore, useObserver } from "../../../../store/react-bindings"; import { SidebarPanel } from "../../../sidebar/SidebarPanel"; import s from "./RenderedAt.css"; import { formatTime } from "../../util"; import { mapParents } from "../../flamegraph/transform/util"; export function Re...
KevinTCoughlin/preact-devtools
src/adapter/10/profiler.ts
import { VNode } from "preact"; import { ID, Store } from "../../view/store/types"; import { getEndTime, getStartTime } from "./vnode"; import { valoo } from "../../view/valoo"; export interface ProfilerCommit { /** * Format: * [id, duration, selfDuration, id, duration, selfDuration,...] */ timings: number[]; ...
KevinTCoughlin/preact-devtools
src/examples/inline-devtools/simple-bridge.ts
<reponame>KevinTCoughlin/preact-devtools<gh_stars>1-10 import { Bridge, Listener } from "../../adapter/bridge"; /** * In-memory variant of the bridge that's normally used to pass messages * to the extension. This one here is simplified to be nothing more than * an event emitter. */ export function createSimpleBrid...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/modes/flamegraph.test.ts
import { expect } from "chai"; import { flames } from "../testHelpers"; import { layoutTimeline } from "./flamegraph"; describe("FlameGraph", () => { describe("layoutTimeline", () => { it("should display simple flamegraph", () => { const tree = flames` App ********** Foo **** Bar * ...
KevinTCoughlin/preact-devtools
src/shells/shared/initClient.ts
import { inject, injectStyles } from "./utils"; let lastDetection: any = null; window.addEventListener("message", ev => { if ( ev.source === window && ev.data && ev.data.source === "preact-devtools-detector" ) { chrome.runtime.sendMessage( (lastDetection = { hasPreact: true, }), ); } }); // Fi...
KevinTCoughlin/preact-devtools
src/view/components/icons.tsx
import { h, ComponentChildren, Fragment } from "preact"; export type Size = keyof typeof sizes; const sizes: Record<string, string> = { xs: ".8rem", s: "1rem", m: "2rem", l: "4rem", }; export interface Props { size?: Size; } export function createSvgIcon(size: Size, children: ComponentChildren) { return ( <...
KevinTCoughlin/preact-devtools
src/examples/10/Prime.tsx
<gh_stars>1-10 import { h } from "../vendor/preact-10"; import { useState } from "../vendor/preact-10/hooks"; export function Prime(props: { max: number }) { const [v, set] = useState(0); const primes = getPrimes(props.max); return ( <p> {primes.join(",")} <button onClick={() => set(v + 1)}>Update</button> <...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/transform/patchTree.ts
import { ID, Tree } from "../../../../store/types"; import { mapChildren, adjustNodesToRight, deepClone } from "./util"; export function patchTree(old: Tree, next: Tree, rootId: ID): Tree { const out: Tree = new Map(old); const oldRoot = old.get(rootId); const root = next.get(rootId)!; if (next.size === 0) { re...
KevinTCoughlin/preact-devtools
src/adapter/adapter/highlight.ts
<reponame>KevinTCoughlin/preact-devtools import { Renderer } from "../renderer"; import { render, h } from "preact"; import { getNearestElement, measureNode } from "../dom"; import { ID } from "../../view/store/types"; import { Highlighter, style } from "../../view/components/Highlighter"; /** * This module is respon...
KevinTCoughlin/preact-devtools
src/adapter/10/renderer.ts
import { DevtoolsEvent } from "../adapter/adapter"; import { Commit, MsgTypes, flush } from "../events/events"; import { Fragment, VNode, FunctionalComponent } from "preact"; import { IdMapper, createIdMapper } from "./IdMapper"; import { getStringId } from "../string-table"; import { isRoot, findRoot, getAncestor, ...
KevinTCoughlin/preact-devtools
src/shells/shared/installHook.ts
import { createHook } from "../../adapter/hook"; import { createBridge } from "../../adapter/bridge"; (window as any).__PREACT_DEVTOOLS__ = createHook(createBridge(window));
KevinTCoughlin/preact-devtools
src/examples/inline-devtools/setup.tsx
import { createStore } from "../../view/store"; import { h, render } from "preact"; import { DevTools } from "../../view/components/Devtools"; import { DevtoolsHook } from "../../adapter/hook"; import { applyEvent } from "../../adapter/events/events"; export function setupFrontendStore(hook: DevtoolsHook) { const sto...
KevinTCoughlin/preact-devtools
src/shells/shared/content-script.ts
<gh_stars>1-10 /** * IIFE is here to isolate the variable scope of the content script * as it might be injected into the same window/tab multiple times. */ (function() { let port = chrome.runtime.connect({ name: "contentScript", }); /** * Keeps track whether the event piping done in the background script is ...
KevinTCoughlin/preact-devtools
src/examples/10/TodoList.tsx
<filename>src/examples/10/TodoList.tsx<gh_stars>1-10 import { h } from "../vendor/preact-10"; import { useState } from "../vendor/preact-10/hooks"; function shuffle<T = any>(arr: T[]): T[] { let i = arr.length; // While there remain elements to shuffle... while (0 !== i) { // Pick a remaining element... let ra...
KevinTCoughlin/preact-devtools
src/view/components/profiler/data/commits.ts
import { ID, DevNode } from "../../../store/types"; import { Observable, valoo, watch } from "../../../valoo"; import { resizeToMin } from "../flamegraph/transform/resizeToMin"; import { getRoot } from "../flamegraph/FlamegraphStore"; export interface ProfilerNode extends DevNode { selfDuration: number; duration: nu...
KevinTCoughlin/preact-devtools
src/view/store/props.test.ts
<reponame>KevinTCoughlin/preact-devtools<filename>src/view/store/props.test.ts import { valoo } from "../valoo"; import { expect } from "chai"; import { createPropsStore } from "./props"; import { InspectData } from "../../adapter/adapter/adapter"; const createStore = () => { const inspectData = valoo<InspectData | n...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/testHelpers.ts
import { ID, DevNodeType, Tree } from "../../../store/types"; import { ProfilerNode, CommitData } from "../data/commits"; import { sortTimeline } from "./FlamegraphStore"; /** * Parse a visual flamegraph DSL into a `ProfilerNode` tree. Each * character represents a timing of 10ms, including the component * names. ...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/transform/resizeToMin.ts
<filename>src/view/components/profiler/flamegraph/transform/resizeToMin.ts import { DevNode, ID } from "../../../../store/types"; import { adjustNodesToRight } from "./util"; export function resizeToMin(tree: Map<ID, DevNode>, min: number) { tree.forEach(node => { if (node.treeEndTime - node.treeStartTime < min) { ...
KevinTCoughlin/preact-devtools
src/view/store/react-bindings.test.tsx
import { h } from "preact"; import { expect } from "chai"; import { act } from "preact/test-utils"; import { renderTest } from "../components/DataInput/DataInput.test"; import { valoo } from "../valoo"; import { useObserver } from "./react-bindings"; describe("useObserver", () => { it("should render on update", () =>...
KevinTCoughlin/preact-devtools
src/index.tsx
import "./global.css"; import { initPreact10, renderExamples10 } from "./examples/10/setup"; import { DevtoolsHook, createHook } from "./adapter/hook"; import { setupFrontendStore } from "./examples/inline-devtools/setup"; import { createSimpleBridge } from "./examples/inline-devtools/simple-bridge"; import { h, render...
KevinTCoughlin/preact-devtools
src/view/components/sidebar/ElementProps.tsx
import { h } from "preact"; import s from "./ElementProps.css"; import { Arrow } from "../elements/TreeView"; import { PropDataType, PropData } from "./parseProps"; import { DataInput } from "../DataInput"; import { displayCollection } from "../DataInput/parseValue"; import { ID } from "../../store/types"; import { use...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/transform/focusNode.test.ts
<filename>src/view/components/profiler/flamegraph/transform/focusNode.test.ts<gh_stars>1-10 import { expect } from "chai"; import { focusNode, NodeTransform } from "./focusNode"; describe("FlameGraph", () => { describe("focusNode", () => { it("should focus flat tree", () => { const nodes: NodeTransform[] = [ ...
KevinTCoughlin/preact-devtools
src/examples/Iframes.tsx
<filename>src/examples/Iframes.tsx import { h, Fragment } from "./vendor/preact-10"; import { Iframer } from "./Iframer"; import { Highlighter } from "../view/components/Highlighter"; const spacing = { paddingBottom: 12, paddingTop: 12, paddingLeft: 12, paddingRight: 12, marginBottom: 5, marginTop: 5, marginLef...
KevinTCoughlin/preact-devtools
src/view/components/DataInput/parseValue.ts
<reponame>KevinTCoughlin/preact-devtools<filename>src/view/components/DataInput/parseValue.ts import * as json5 from "json5-es"; export function parseValue(v: string) { v = v.trim(); switch (v) { case "true": case "false": return v === "true"; case "null": return null; case "": case "undefined": ...
KevinTCoughlin/preact-devtools
src/examples/10/DataTypes.tsx
import { h } from "../vendor/preact-10"; import { useState } from "../vendor/preact-10/hooks"; export function Booleans(props: { value: boolean }) { return <p>Boolean: {props.value + ""}</p>; } const Dummy = (props: Record<string, any>) => <div>Dummy {props.count}</div>; export function Complex() { const [i, set] ...
KevinTCoughlin/preact-devtools
src/view/components/tree/windowing.test.ts
import { expect } from "chai"; import { flattenChildren } from "./windowing"; import { ID } from "../../store/types"; describe("flattenChildren", () => { let tree = new Map<ID, { id: ID; children: ID[]; depth: number }>(); tree.set(1, { id: 1, children: [2, 3, 6], depth: 1 }); tree.set(2, { id: 2, children: [4], de...
KevinTCoughlin/preact-devtools
src/view/store/props.ts
import { Observable, valoo, watch } from "../valoo"; import { PropData, parseProps } from "../components/sidebar/parseProps"; import { createCollapser } from "./collapser"; import { InspectData } from "../../adapter/adapter/adapter"; import { flattenChildren } from "../components/tree/windowing"; const PROPS_LIMIT = 7...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/FlamegraphStore.ts
import { watch } from "../../../valoo"; import { ProfilerState, FlamegraphType, ProfilerNode } from "../data/commits"; import { getGradient } from "../data/gradient"; import { ID, Tree } from "../../../store/types"; import { layoutRanked } from "./modes/ranked"; import { layoutTimeline } from "./modes/flamegraph"; impo...
KevinTCoughlin/preact-devtools
src/view/components/profiler/components/RenderReasons.tsx
<filename>src/view/components/profiler/components/RenderReasons.tsx import { h } from "preact"; import { SidebarPanel } from "../../sidebar/SidebarPanel"; import { useStore, useObserver } from "../../../store/react-bindings"; export function RenderReasons() { const store = useStore(); const isRecording = useObserver...
KevinTCoughlin/preact-devtools
src/view/components/profiler/components/TimelineBar/TimelineBar.tsx
import { h } from "preact"; import { Actions, ActionSeparator } from "../../../Actions"; import { CommitTimeline } from "../CommitTimeline/CommitTimeline"; import { IconBtn } from "../../../IconBtn"; import { useStore, useObserver } from "../../../../store/react-bindings"; import { RecordIcon, NotInterested } from "../...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/transform/patchTree.test.ts
<reponame>KevinTCoughlin/preact-devtools import { expect } from "chai"; import { flames } from "../testHelpers"; import { patchTree } from "./patchTree"; import { cloneTree } from "./util"; import { Tree } from "../../../../store/types"; export function toTimings(tree: Tree) { return Array.from(tree.values()) .map(...
KevinTCoughlin/preact-devtools
src/view/components/profiler/flamegraph/FlameGraph.tsx
import { h } from "preact"; import s from "./FlameGraph.css"; import { useStore, useObserver } from "../../../store/react-bindings"; import { useRef, useState, useCallback, useEffect, useMemo, } from "preact/hooks"; import { formatTime } from "../util"; import { CommitData } from "../data/commits"; import { create...
KevinTCoughlin/preact-devtools
src/examples/10/Gradient.tsx
import { h } from "preact"; // import { gradient } from "../../view/components/profiler/data/gradient"; export function Gradient() { // const colors = ["var(--color-selected-bg)", ...gradient]; return null; // return ( // <div style="display: flex"> // {colors.map(x => { // return ( // <div // k...
KevinTCoughlin/preact-devtools
src/view/components/sidebar/parseProps.test.ts
<filename>src/view/components/sidebar/parseProps.test.ts import { expect } from "chai"; import { parseProps } from "./parseProps"; const serialize = (v: Map<any, any>) => Array.from(v.values()); const noop = (v: any) => v; describe("flatten", () => { it("should flatten strings", () => { const tree = new Map(); ...
KevinTCoughlin/preact-devtools
src/view/components/profiler/components/CommitTimeline/CommitTimeline.test.tsx
<gh_stars>1-10 import { h } from "preact"; import { expect } from "chai"; import { renderTest } from "../../../DataInput/DataInput.test"; import { CommitTimeline } from "./CommitTimeline"; import { fireEvent } from "@testing-library/preact"; import * as sinon from "sinon"; const noop = () => null; describe("CommitTim...
KevinTCoughlin/preact-devtools
src/examples/10/Circular.tsx
<reponame>KevinTCoughlin/preact-devtools<filename>src/examples/10/Circular.tsx import { h } from "../vendor/preact-10"; const props: any = { foo: 123, bar: 123 }; props.foo = props; function CircularInner() { return <h1>Circular</h1>; } export function Circular() { return <CircularInner {...props} />; }
KevinTCoughlin/preact-devtools
src/examples/10/setup.tsx
import { h, options, Fragment, render } from "../vendor/preact-10"; import { DevtoolsHook } from "../../adapter/hook"; import { TodoList } from "./TodoList"; import { DeepTree } from "./DeepTree"; import { LegacyContext } from "./legacyContext"; import { Stateful } from "./state"; import { createRenderer } from "../../...
KevinTCoughlin/preact-devtools
src/view/components/DataInput/DataInput.test.tsx
<gh_stars>1-10 import { h, ComponentChild } from "preact"; import { expect } from "chai"; import * as sinon from "sinon"; import { render, fireEvent } from "@testing-library/preact"; import { DataInput } from "."; import { act } from "preact/test-utils"; const noop = () => null; export function renderTest(ui: Compone...
umar-ahmed/react-leaflet-fiber
src/components.tsx
import * as React from 'react'; import * as L from 'leaflet'; import { render, unmountComponentAtNode } from './renderer'; import { LeafletProvider } from './context'; export interface LeafletMapProps { center: L.LatLngExpression; zoom: number; children?: React.ReactChildren; onClick?: L.LeafletMouseEventHand...
umar-ahmed/react-leaflet-fiber
example/index.tsx
<gh_stars>1-10 import 'leaflet/dist/leaflet.css'; import 'react-app-polyfill/ie11'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Example } from './components/Example'; import QuickStart from './components/QuickStart'; import GeoJSON from './components/GeoJSON'; import CustomIcons fr...
umar-ahmed/react-leaflet-fiber
src/types.ts
<reponame>umar-ahmed/react-leaflet-fiber<gh_stars>1-10 import * as L from "leaflet"; export declare namespace ReactLeafletFiber { type Args<T> = T extends new (...args: any) => any ? ConstructorParameters<T> : T; export interface NodeProps<T> { /** Constructor arguments */ args?: Args<T>; chil...
umar-ahmed/react-leaflet-fiber
src/hooks.ts
import * as React from "react"; import { LeafletContext, leafletContext } from "./context"; export const useLeaflet = (): LeafletContext => React.useContext(leafletContext);
umar-ahmed/react-leaflet-fiber
src/context.ts
import * as React from "react"; import * as L from "leaflet"; export interface LeafletContext { map?: L.Map; } export const leafletContext = React.createContext<LeafletContext>({}); export const LeafletConsumer = leafletContext.Consumer; export const LeafletProvider = leafletContext.Provider;
umar-ahmed/react-leaflet-fiber
src/utils.ts
<reponame>umar-ahmed/react-leaflet-fiber export const is = { obj: (a: any) => a === Object(a) && !is.arr(a), fun: (a: any) => typeof a === "function", str: (a: any) => typeof a === "string", num: (a: any) => typeof a === "number", und: (a: any) => a === void 0, arr: (a: any) => Array.isArray(a), equ(a: an...
umar-ahmed/react-leaflet-fiber
src/renderer.ts
<filename>src/renderer.ts import * as React from 'react'; import ReactReconciler from 'react-reconciler'; import * as L from 'leaflet'; import { is, invariant, extractEventHandlers as _extractEvents } from './utils'; const roots = new Map<L.Map, ReactReconciler.FiberRoot>(); interface Events { [x: string]: Functio...
jhoermann/stockslist
frontend/src/app/general-info/add-stock-dialog/add-stock-dialog.component.ts
<gh_stars>0 import { Component, OnInit } from '@angular/core'; import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import { Stock } from 'src/app/interfaces/stock.interface'; @Component({ selector: 'app-add-stock-dialog', templateUrl: './add-stock-dialog.component.html', styleUrls:...
jhoermann/stockslist
server/src/stocks/prices/dtos.ts
<reponame>jhoermann/stockslist<filename>server/src/stocks/prices/dtos.ts import { IsNotEmpty, IsNumber } from 'class-validator' export class CreatePriceDto { @IsNumber() price: number @IsNotEmpty() date: string }
jhoermann/stockslist
server/test/accounts.e2e-spec.ts
<reponame>jhoermann/stockslist<filename>server/test/accounts.e2e-spec.ts import { Test, TestingModule } from '@nestjs/testing' import { INestApplication, ValidationPipe } from '@nestjs/common' import * as request from 'supertest' import { AppModule } from './../src/app.module' import Database from './../src/database' i...
jhoermann/stockslist
server/src/stocks/actions/action.interface.ts
<gh_stars>0 type actionType = 'buy' | 'sell' export interface Action { id: number stockId: number type: actionType quantity: number price: number fees: number date: string }
jhoermann/stockslist
frontend/src/app/classes/stock-helper.ts
import {Stock, EnhancedStock} from './../interfaces/stock.interface' import {Action} from './../interfaces/action.interface' export class StockHelper { private stock: EnhancedStock constructor(stock) { this.stock = stock } enhanceStock(): EnhancedStock { this.stock.quantity = this.getCurrentQuantity(...
jhoermann/stockslist
frontend/src/app/pipes/price.pipe.ts
import { Pipe, PipeTransform } from '@angular/core' @Pipe({ name: 'price' }) export class PricePipe implements PipeTransform { transform(price: number): string { const priceFormated = (Math.abs(price / 100)).toFixed(2) if (isNaN(price)) { return 'N/A' } if (price >= 0) { return '$' + p...
jhoermann/stockslist
server/src/stocks/stocks.service.ts
import { Injectable } from '@nestjs/common' import Database from '../database' import { Stock } from './stock.interface' import { CreateStockDto, UpdateStockDto } from './dtos' import { ActionsService } from './actions/actions.service' import { DividendDatesService } from './dividend-dates/dividend-dates.service' impor...
jhoermann/stockslist
frontend/src/app/pipes/date.pipe.ts
import { Pipe, PipeTransform } from '@angular/core' const moment = require('moment') @Pipe({ name: 'date' }) export class DatePipe implements PipeTransform { transform(date: string): string { return moment(date).format('YYYY-MM-DD') } }
jhoermann/stockslist
server/test/stocks.e2e-spec.ts
<filename>server/test/stocks.e2e-spec.ts import { Test, TestingModule } from '@nestjs/testing' import { INestApplication, ValidationPipe } from '@nestjs/common' import { _ } from 'lodash' import * as request from 'supertest' import { AppModule } from './../src/app.module' import Database from './../src/database' import...
jhoermann/stockslist
server/src/stocks/stocks.module.ts
import { Module } from '@nestjs/common' import { StocksController } from './stocks.controller' import { StocksService } from './stocks.service' import { ActionsModule } from './actions/actions.module' import { DividendDatesModule } from './dividend-dates/dividend-dates.module' import { PricesModule } from './prices/pri...
jhoermann/stockslist
server/src/stocks/actions/actions.controller.ts
import { Controller, Get, Post, Param, Body, ParseIntPipe } from '@nestjs/common' import { Action } from './action.interface' import { CreateActionDto } from './dtos' import { ActionsService } from './actions.service' @Controller('stocks/:stockId/actions') export class ActionsController { constructor(private actions...
jhoermann/stockslist
frontend/src/app/services/stocks.service.ts
<reponame>jhoermann/stockslist<filename>frontend/src/app/services/stocks.service.ts import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http' import { Subject } from 'rxjs' import { Stock, EnhancedStock } from './../interfaces/stock.interface' import { Sums } from './../interfaces/su...
jhoermann/stockslist
server/src/stocks/actions/dtos.ts
<reponame>jhoermann/stockslist import { IsEnum, IsNotEmpty, IsNumber } from 'class-validator' enum ActionType { buy, sell } export class CreateActionDto { @IsNotEmpty() @IsEnum(ActionType) type: string @IsNumber() quantity: number @IsNumber() price: number @IsNumber() fees: number }
jhoermann/stockslist
server/src/stocks/prices/prices.controller.ts
<gh_stars>0 import { Controller, Get, Post, Param, Body, ParseIntPipe } from '@nestjs/common' import { Price } from './price.interface' import { CreatePriceDto } from './dtos' import { PricesService } from './prices.service' @Controller('stocks/:stockId/prices') export class PricesController { constructor(private pr...
jhoermann/stockslist
server/src/db-defaults.ts
export default { standart: { Accounts: [{ id: 1, name: 'Default Account' }], Stocks: [], Actions: [], DividendDates: [], Prices: [], }, test: { Accounts: [{ id: 1, name: 'Default Account' }], Stocks: [{ id: 1, accountId: 1, name: '<NAME...
jhoermann/stockslist
frontend/src/app/app.component.ts
import { Component } from '@angular/core'; import { Account } from './interfaces/account.interface' import { AccountsService } from './services/accounts.service' import { StocksService } from './services/stocks.service' import { Sums } from './interfaces/sums.interface' @Component({ selector: 'app-root', templateU...
jhoermann/stockslist
server/src/accounts/accounts.service.ts
import { Injectable } from '@nestjs/common'; import Database from '../database' import { Account } from './account.interface' @Injectable() export class AccountsService { getAccounts(): Account[] { return Database.db.get('Accounts').value() } getAccount(id: number): Account { return Database.d...
jhoermann/stockslist
server/src/stocks/actions/actions.service.ts
<reponame>jhoermann/stockslist import { Injectable } from '@nestjs/common'; import Database from '../../database' import { Action } from './action.interface' import { CreateActionDto } from './dtos' @Injectable() export class ActionsService { getActions(stockId: number): Action[] { return Database.db.get('Action...
jhoermann/stockslist
server/src/database.ts
const low = require('lowdb') const FileSync = require('lowdb/adapters/FileSync') const lodashId = require('lodash-id') const fs = require('fs'); import { _ } from 'lodash' import dbDefaults from './db-defaults' export default { db: null, connectDb(fileName:string): void { const adapter = new FileSync(fileNam...
jhoermann/stockslist
server/src/stocks/stock.interface.ts
import { Price } from './prices/price.interface' import { DividendDate } from './dividend-dates/dividend-date.interface' import { Action } from './actions/action.interface' export interface Stock { id: number accountId: number name: string isin: string wkn: string industrySector: string cre...
jhoermann/stockslist
frontend/src/app/general-info/add-stock-dialog/add-stock-dialog.component.spec.ts
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AddStockDialogComponent } from './add-stock-dialog.component'; describe('AddStockDialogComponent', () => { let component: AddStockDialogComponent; let fixture: ComponentFixture<AddStockDialogComponent>; beforeEach(async () => { awa...
jhoermann/stockslist
server/src/stocks/dividend-dates/dividend-date.interface.ts
export interface DividendDate { id: number stockId: number dividend: number date: string }
jhoermann/stockslist
server/src/stocks/prices/prices.service.ts
<gh_stars>0 import { Injectable } from '@nestjs/common' import Database from '../../database' import { Price } from './price.interface' import { CreatePriceDto } from './dtos' @Injectable() export class PricesService { getPrices(stockId: number): Price[] { return Database.db.get('Prices') .filter({stockId}...
jhoermann/stockslist
frontend/src/app/interfaces/sums.interface.ts
export interface Sums { total: number totalInclDividends: number earnedDividends: number invested: number winLoss: number winLossPercent: string }
jhoermann/stockslist
server/src/stocks/dividend-dates/dtos.ts
import { IsNotEmpty, IsNumber } from 'class-validator' import { PartialType } from '@nestjs/mapped-types' export class CreateDividendDateDto { @IsNumber() dividend: number @IsNotEmpty() date: string } export class UpdateDividendDateDto extends PartialType(CreateDividendDateDto) {}
jhoermann/stockslist
frontend/src/app/interfaces/stock.interface.ts
<reponame>jhoermann/stockslist import { Price } from './price.interface' import { DividendDate } from './dividend-date.interface' import { Action } from './action.interface' interface Stock { id: number accountId: number name: string isin: string wkn: string industrySector: string created: ...
jhoermann/stockslist
server/src/accounts/accounts.module.ts
import { Module } from '@nestjs/common' import { AccountsController } from './accounts.controller' import { AccountsService } from './accounts.service' import { StocksService } from './../stocks/stocks.service' import { ActionsService } from './../stocks/actions/actions.service' import { DividendDatesService } from './...
jhoermann/stockslist
server/src/stocks/dtos.ts
import { IsNotEmpty, IsNumber } from 'class-validator' import { PartialType } from '@nestjs/mapped-types' export class CreateStockDto { @IsNumber() accountId: string @IsNotEmpty() name: string @IsNotEmpty() isin: string @IsNotEmpty() wkn: string @IsNotEmpty() industrySector: string } export cl...
jhoermann/stockslist
server/src/stocks/dividend-dates/dividend-dates.controller.ts
import { Controller, Get, Post, Put, Delete, Param, Body, ParseIntPipe } from '@nestjs/common' import { DividendDate } from './dividend-date.interface' import { CreateDividendDateDto, UpdateDividendDateDto } from './dtos' import { DividendDatesService } from './dividend-dates.service' @Controller('stocks/:stockId/divi...
jhoermann/stockslist
server/src/app.module.ts
import { Module } from '@nestjs/common'; import { AccountsModule } from './accounts/accounts.module'; import { StocksModule } from './stocks/stocks.module'; @Module({ imports: [AccountsModule, StocksModule], }) export class AppModule {}
jhoermann/stockslist
frontend/src/app/chart/chart.component.ts
import { Component, OnInit } from '@angular/core' import { ChartOptions, ChartType, ChartDataSets } from 'chart.js' import * as pluginDataLabels from 'chartjs-plugin-datalabels' import { Label } from 'ng2-charts' import { StocksService } from './../services/stocks.service' import _ from 'lodash' @Component({ selecto...
jhoermann/stockslist
frontend/src/app/services/accounts.service.ts
import { Injectable } from '@angular/core' import { HttpClient } from '@angular/common/http' import { Observable, Subject } from 'rxjs' import { Account } from './../interfaces/account.interface' @Injectable({ providedIn: 'root' }) export class AccountsService { constructor(private http: HttpClient) {} private b...
jhoermann/stockslist
server/src/stocks/prices/price.interface.ts
<reponame>jhoermann/stockslist<gh_stars>0 export interface Price { id: number stockId: number price: number date: string }
jhoermann/stockslist
frontend/src/app/general-info/general-info.component.ts
import { Component, OnInit } from '@angular/core' import {MatDialog, MatDialogRef } from '@angular/material/dialog' import { StocksService } from './../services/stocks.service' import { Sums } from './../interfaces/sums.interface' import { AddStockDialogComponent } from './add-stock-dialog/add-stock-dialog.component' i...
jhoermann/stockslist
frontend/src/app/data-table/data-table.component.ts
import { Component, OnInit } from '@angular/core'; import { StocksService } from './../services/stocks.service' import { Stock, EnhancedStock } from './../interfaces/stock.interface' import { Sums } from './../interfaces/sums.interface' export interface PeriodicElement { name: string; position: number; weight: n...
jhoermann/stockslist
server/src/stocks/dividend-dates/dividend-dates.service.ts
import { Injectable } from '@nestjs/common' import Database from '../../database' import { DividendDate } from './dividend-date.interface' import { CreateDividendDateDto, UpdateDividendDateDto } from './dtos' @Injectable() export class DividendDatesService { getDividendDates(stockId: number): DividendDate[] { re...
jhoermann/stockslist
frontend/src/app/classes/stock-helper.spec.ts
import { StockHelper } from './stock-helper'; describe('StockHelper', () => { it('should create an instance', () => { expect(new StockHelper()).toBeTruthy(); }); });
jhoermann/stockslist
server/src/stocks/stocks.controller.ts
<filename>server/src/stocks/stocks.controller.ts import { Controller, Get, Post, Put, Delete, Param, Body, ParseIntPipe } from '@nestjs/common' import { Stock } from './stock.interface' import { CreateStockDto, UpdateStockDto } from './dtos' import { StocksService } from './stocks.service'; @Controller('stocks') expor...
jhoermann/stockslist
frontend/src/app/app.module.ts
<filename>frontend/src/app/app.module.ts import { BrowserModule } from '@angular/platform-browser' import { NgModule } from '@angular/core' import { FormsModule } from '@angular/forms' import { AppRoutingModule } from './app-routing.module' import { AppComponent } from './app.component' import { ServiceWorkerModule } ...
jhoermann/stockslist
server/src/stocks/dividend-dates/dividend-dates.module.ts
<filename>server/src/stocks/dividend-dates/dividend-dates.module.ts import { Module } from '@nestjs/common'; import { DividendDatesController } from './dividend-dates.controller'; import { DividendDatesService } from './dividend-dates.service'; @Module({ controllers: [DividendDatesController], providers: [Dividend...
jhoermann/stockslist
server/src/accounts/accounts.controller.ts
<reponame>jhoermann/stockslist<filename>server/src/accounts/accounts.controller.ts import { Controller, Get, Param, ParseIntPipe } from '@nestjs/common' import { Account } from './account.interface' import { Stock } from '../stocks/stock.interface' import { AccountsService } from './accounts.service' import { StocksSer...
NgoBang/AngularJS-2
src/app/app.component.ts
<reponame>NgoBang/AngularJS-2 import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>Hello {{name}}</h1> <h4>App Main component</h4> <my-tutorial></my-tutorial> `, styles:['h4 {color: blue;}'] }) export class AppComponent { name = 'Bang'; }
NgoBang/AngularJS-2
src/app/tutorial.component.ts
<gh_stars>0 import { Component } from '@angular/core'; @Component({ selector: 'my-tutorial', template: `<h2>This is Tedu Angular2 Tutorial</h2> <h4>Sub Component</h4> `, styles:['h4 {color:red;}'] }) export class TutorialComponent { }
giorgosp/cockroach
pkg/ui/src/views/jobs/index.tsx
<filename>pkg/ui/src/views/jobs/index.tsx // Copyright 2018 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software w...
giorgosp/cockroach
pkg/ui/src/views/reports/containers/stores/index.tsx
<reponame>giorgosp/cockroach // Copyright 2018 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be govern...
giorgosp/cockroach
pkg/ui/src/views/reports/containers/localities/index.tsx
// Copyright 2018 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
giorgosp/cockroach
pkg/ui/src/views/statements/statementsPage.tsx
<reponame>giorgosp/cockroach // Copyright 2018 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be govern...
giorgosp/cockroach
pkg/ui/src/views/databases/containers/databaseTables/bar.tsx
<gh_stars>1-10 // Copyright 2018 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the A...
giorgosp/cockroach
pkg/ui/src/components/table/table.tsx
<filename>pkg/ui/src/components/table/table.tsx // Copyright 2019 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this soft...
giorgosp/cockroach
pkg/ui/src/components/pagination/pagination.tsx
<filename>pkg/ui/src/components/pagination/pagination.tsx // Copyright 2019 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of...
matthewp/corset
src/pinfo.ts
<filename>src/pinfo.ts<gh_stars>100-1000 export type PropertyPropName = 'attr' | 'attrValue' | 'attrToggle' | 'attachTemplate' | 'behavior' | 'classToggle' | 'data' | 'each' | 'event' | 'prop' | 'text' | 'storeRoot' | 'storeSet' interface BasePropertyDefinition { flag: number; feat: numbe...
matthewp/corset
test/smoke/basic/src/index.ts
<filename>test/smoke/basic/src/index.ts import sheet, { mount } from '../../../../lib/main'; mount(document, class { bind() { return sheet` body { text: "Hello world"; } `; } });
matthewp/corset
src/types.ts
<filename>src/types.ts import type { Binding } from './binding'; import type { Changeset } from './changeset'; import type { BehaviorContext } from './mount'; import type { SheetWithValues } from './sheet'; type DeclaredInputProperties = string[]; export interface ValueType { inputProperties?: DeclaredInputProperti...