repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
hiagovinicius0/template-nestjs-typeorm | src/users/users.service.ts | import { Inject, Injectable } from '@nestjs/common';
import { BadRequest } from 'src/error/badRequest.exception';
import { Repository } from 'typeorm';
import { CreateUserDto } from './dto/create-user.dto';
import { UpdateUserDto } from './dto/update-user.dto';
import { Users } from './users.entity';
@Injectable()
exp... |
hiagovinicius0/template-nestjs-typeorm | src/users/users.entity.ts | <filename>src/users/users.entity.ts
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
@Entity()
export class Users {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ length: 500 })
name: string;
@Column({
type: 'varchar',
unique: true,
})
email: string;
} |
hiagovinicius0/template-nestjs-typeorm | src/error/badRequest.exception.ts | <gh_stars>0
import { BadRequestException, HttpException, HttpStatus } from '@nestjs/common';
export class BadRequest extends BadRequestException {
constructor(message: string) {
super(message);
}
}
|
roonz11/RestBEA | src/environments/environment-interface.ts | <gh_stars>0
export interface EnvironmentInterface {
production: boolean;
environment: string;
restInterval: number;
};
|
roonz11/RestBEA | src/app/services/heart-beat.service.ts | <reponame>roonz11/RestBEA<gh_stars>0
import { Injectable } from '@angular/core';
import { BehaviorSubject, interval, Observable } from 'rxjs';
import { takeWhile } from 'rxjs/operators';
import { environment } from '../../environments/environment';
import * as dayjs from 'dayjs';
@Injectable({
providedIn: 'root'
})
... |
roonz11/RestBEA | src/environments/environment.web.ts | import { EnvironmentInterface } from './environment-interface';
export const environment: EnvironmentInterface = {
production: false,
environment: 'WEB',
restInterval: 10000
};
|
roonz11/RestBEA | src/app/detail/detail.component.ts | <gh_stars>0
import { Component, OnInit } from '@angular/core';
import * as dayjs from 'dayjs';
import { HeartBeatService } from '../services/heart-beat.service';
@Component({
selector: 'app-detail',
templateUrl: './detail.component.html',
styleUrls: ['./detail.component.scss']
})
export class DetailComponent imp... |
antonioacg/realstates | src/modules/RealStates/routes/RealStates-post.ts | import { Request, Response } from "express";
import RealState from "../models/RealState";
export const addNew = (req: Request, res: Response): any => {
const address: string = req.body.address;
const price: number = req.body.price;
const realState = new RealState({
address,
price,
});
... |
antonioacg/realstates | src/modules/RealStates/models/RealState.ts | import * as mongoose from "mongoose";
const realStateSchema = new mongoose.Schema({
address: { type: String, required: true },
price: { type: Number, required: true },
},
{
toJSON: {
transform(doc: any, ret: any) {
delete ret._id;
},
versionKey: false,
virtuals: ... |
antonioacg/realstates | src/modules/RealStates/routes/index.ts | <filename>src/modules/RealStates/routes/index.ts
import * as express from "express";
import * as realStatesGet from "./RealStates-get";
import * as realStatesPost from "./RealStates-post";
const RealStateRoutes = express.Router();
RealStateRoutes.get("/", realStatesGet.getAll);
RealStateRoutes.get("/:id", real... |
antonioacg/realstates | src/modules/Authenticator/routes/index.ts | <reponame>antonioacg/realstates
import * as express from "express";
import * as AuthenticatorGet from "./Authenticator-get";
const AuthenticatorRoutes = express.Router();
AuthenticatorRoutes.post("/", AuthenticatorGet.Login);
export default AuthenticatorRoutes;
|
antonioacg/realstates | src/modules/RealStates/routes/_apidoc.ts | <reponame>antonioacg/realstates
/**
* @api {get} /realstates Lists all Real States
* @apiName GetAllRealStates
* @apiGroup Real State
* @apiVersion 1.0.0
* @apiPermission Token
* @apiHeader {String} Authorization Bearer token
*
*/
/**
* @api {get} /realstates/:id Get a real state by its id
* @apiName GetRea... |
antonioacg/realstates | src/modules/RealStates/routes/RealStates-get.ts | <reponame>antonioacg/realstates
import { Request, Response } from "express";
import RealState from "../models/RealState";
export const getAll = (req: Request, res: Response): any => {
RealState.find()
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(500).json({ er... |
antonioacg/realstates | src/routes.ts | <reponame>antonioacg/realstates
import { Application } from "express";
import RealStatesRoutes from "./modules/RealStates/routes/index";
import Authenticator from "./modules/Authenticator/routes/index";
const urlBase = "/api/v1";
const allRoutes = (server: Application): void => {
server.use(`${urlBase}/realstates`,... |
antonioacg/realstates | src/modules/Authenticator/routes/Authenticator-get.ts | <reponame>antonioacg/realstates<gh_stars>0
import { NextFunction, Request, Response } from "express";
import * as jwt from "jsonwebtoken";
import configDev from "../../../config/config-dev";
import configProd from "../../../config/config-prod";
// set environment
const config = (process.env.NODE_ENV === "production"
... |
antonioacg/realstates | src/config/config-dev.ts | <filename>src/config/config-dev.ts<gh_stars>0
const configDev = {
jwtSecret: "antonioacg_seedz_201802",
modalTimer: 5000,
mongoDB: "mongodb://localhost:27017/seedz",
};
export default configDev;
|
antonioacg/realstates | src/config/config-prod.ts | <reponame>antonioacg/realstates<gh_stars>0
const configProd = {
jwtSecret: "antonioacg_seedz_201802",
modalTimer: 5000,
mongoDB: "mongodb://admin:<EMAIL>:57848/heroku_47gv1v4x",
};
export default configProd;
|
antonioacg/realstates | src/test/realstates.ts | <reponame>antonioacg/realstates<gh_stars>0
import chai = require("chai");
import chaiHttp = require("chai-http");
import * as mocha from "mocha";
import * as request from "supertest";
import server from "../";
chai.use(chaiHttp);
const expect = chai.expect;
const baseUrlRealStates = "/api/v1/realstates";
const realSt... |
antonioacg/realstates | src/modules/Authenticator/routes/_apidoc.ts | /**
* @api {get} /login Get Authorization Bearer token for use with protected routes
* @apiName Login
* @apiGroup Authentication
* @apiVersion 1.0.0
* @apiPermission Token
*
*/
|
antonioacg/realstates | src/index.ts | <reponame>antonioacg/realstates
import * as BodyParser from "body-parser";
import * as cors from "cors";
import * as express from "express";
import * as basicAuth from "express-basic-auth";
import * as jwt from "express-jwt";
import * as session from "express-session";
import * as helmet from "helmet";
import * as mong... |
imsnif/bit-envs | src/find-configuration/index.ts | export {findConfiguration, findOptions, FindStrategy, defaultGetBy} from './find-configuration'
|
imsnif/bit-envs | src/babel-dependencies/index.ts | <reponame>imsnif/bit-envs
export {
getBabelDynamicPackageDependencies,
babelFindConfiguration,
getPresetPackageName,
getPluginPackageName
} from './babel-dependencies'
|
imsnif/bit-envs | src/env-utils/private-require.ts | <reponame>imsnif/bit-envs
import path from 'path'
import fs from 'fs-extra'
const IGNORE_FOLDER = '.bitTmp'
const defaultBodyExpression = 'require(pathToModule)'
export function createPrivateRequire(directory:string, bodyExpression = defaultBodyExpression, folder = IGNORE_FOLDER) {
const privateRequireContent = `... |
imsnif/bit-envs | src/babel/babel.ts | <filename>src/babel/babel.ts
import { CompilerExtension, API, ExtensionApiOptions } from '../env-utils/types'
import Vinyl from 'vinyl'
import {
getPluginPackageName,
getPresetPackageName,
} from '../babel-dependencies'
import resolve from 'resolve'
import path from 'path'
import * as babel from 'babel-core'
im... |
imsnif/bit-envs | src/env-utils/index.ts | <filename>src/env-utils/index.ts
export {
fillDependencyVersion,
findByName,
getVersion,
loadPackageJsonSync
} from './compiler-utils'
export {
ActionTesterOptions,
API,
CompilerExtension,
ExtensionApiOptions,
Logger,
Options,
TesterExtension,
TestResult
} from './types'... |
imsnif/bit-envs | src/webpack/default-config.ts | const babelPresetEs2015 = require('babel-preset-es2015');
const babelPresetReact = require('babel-preset-react');
const stage0 = require('babel-preset-stage-0');
//indirect
require('babel-loader');
require('babel-core');
require('style-loader');
require('css-loader');
require('sass-loader');
require('node-sass');
requ... |
imsnif/bit-envs | test/utils/configuration.spec.ts | <filename>test/utils/configuration.spec.ts
import { setup, generatePackageJson, createExtensionInfo } from '../envs-test-utils'
import path from 'path'
import {findConfiguration, FindStrategy , defaultGetBy} from '../../src/find-configuration'
import { expect, use } from 'chai';
import subset from 'chai-subset'
import ... |
lintuming/react-sheet | src/actions/actionCell.ts | import { ActionName } from './types';
import { register, createAction } from './register';
import { Cell } from 'types';
const ActionEditCell = register(
createAction({
name: ActionName.editCell,
commitHistory: true,
perform(
_,
{ x, y, payload }: { x: number; y: number; payload: Partial<Cell... |
lintuming/react-sheet | src/actions/actionToolbar.tsx | import { ActionName } from './types';
import React from 'react';
import { register, createAction } from './register';
import { isMergeViewport, isViewportsCoincide } from 'core/utils/viewport';
import { unmergeByCellCoords, mergeViewport } from 'core/utils/merges';
import Viewport from 'core/Viewport';
import SheetMana... |
lintuming/react-sheet | src/Spreadsheet/components/LayerUI.tsx | <reponame>lintuming/react-sheet<gh_stars>0
import React from 'react';
import Scrollor from './Scrollor';
import { sendWheelEvent } from '../utils';
import { useSpreadSheetStore } from '..';
import { measureScrollBarInner } from '../maths';
import {
ActionPointerDown,
ReactPointerEvent,
ActionPointerMove,
Action... |
lintuming/react-sheet | src/core/SheetTags.ts | const Noop = /* */ 0b000000000;
const MainButtonPressed = /* */ 0b000000001;
const SerieBoxPressed = /* */ 0b000000011;
const markTag = (tag: number, tagToMarked: number) => {
return tag | tagToMarked;
};
const clearTag = (tag: number,... |
lintuming/react-sheet | src/consts.ts | import { CellStyle, SheetData, SpreadsheetConfig } from 'types';
import { border, deepFreeze } from './utils';
const IS_SERVE = typeof window === 'undefined';
enum POINTER_BUTTON {
MAIN = 0,
WHEEL,
RIGHT,
}
export enum Borders {
all,
inside,
horizontal,
vertical,
outside,
top,
left,
right,
botto... |
lintuming/react-sheet | src/core/SheetManage.ts | import { SheetDataPartial } from 'types';
import { merge } from 'utils';
import { actions } from 'actions';
import { ActionManagerNotify } from 'actions/types';
import { DEFAULT_SHEET_DATA } from 'consts';
import Sheet from './Sheet';
import { ActionsManage } from '../actions/manager';
import { Injection } from './type... |
lintuming/react-sheet | src/core/EventEmmit.ts | type Wildcard = '*';
type EventName<E> = E | Wildcard;
type EventNames<E> = EventName<E> | EventName<E>[];
class EventEmmit<E, VALUE, CALLBACK extends (value: VALUE) => void> {
eventListeners: Map<EventName<E>, CALLBACK[]>;
constructor() {
this.eventListeners = new Map();
}
on(eventNames: EventNames<E>, l... |
lintuming/react-sheet | src/i18n.ts | import LanguageDetector from 'i18next-browser-languagedetector';
import fallbackLanguageData from './locales/en.json';
const languageDetector = new LanguageDetector();
languageDetector.init();
const allLanguages = [
{
lng: 'zh-CN',
label: '简体中文',
data: 'zh-CN.json',
},
];
export const languages = [{ ... |
lintuming/react-sheet | src/hooks/useUpdateEffect.ts | import React, { DependencyList, EffectCallback } from 'react';
export const useLayoutUpdateEffect = (
callback: EffectCallback,
deps: DependencyList
) => {
const isMounted = React.useRef(false);
React.useLayoutEffect(() => {
if (isMounted.current) {
callback();
}
}, deps);
React.useLayoutEff... |
lintuming/react-sheet | stories/Thing.stories.tsx | import React from 'react';
import SpreadSheet from '../src/index';
export default {
title: 'Welcome',
};
export const Default = (props?: Partial<{}>) => (
<>
<SpreadSheet width={1080} height={1080} />
</>
);
|
lintuming/react-sheet | src/core/types.ts | <reponame>lintuming/react-sheet
import { ScrollState, SpreadsheetConfig, SheetInternalState } from 'types';
import { CURSOR_TYPE } from 'consts';
import { ActionFnBind, ActionShape } from 'actions/types';
interface Injection {
getCanvas: () => [HTMLCanvasElement | null, HTMLCanvasElement | null];
getConfig: () => ... |
lintuming/react-sheet | src/Spreadsheet/index.tsx | <filename>src/Spreadsheet/index.tsx
import React from 'react';
import { SpreadsheetProps } from 'types';
import { dpr, merge, throwError, assertIsDefined } from 'utils';
import SheetManager, { SheetManagerEventName } from 'core/SheetManage';
import { useIsomorphicLayoutEffect } from 'hooks/useIsomorphicLayoutEffect';
... |
lintuming/react-sheet | src/utils.ts | <reponame>lintuming/react-sheet
import { IS_SERVE } from 'consts';
export function deleteAt<T>(arr: T[], index: number) {
arr[index] = arr[arr.length - 1];
arr.length -= 1;
return arr;
}
export function parseBorder(border: string) {
const [_lineWidth, lineStyle, strokeStyle] = border.split(/\s+/);
const line... |
lintuming/react-sheet | src/hooks/useRerender.ts | import React from 'react';
export default function useRerender() {
const update = React.useState({})[1];
const rerender = React.useCallback(() => {
update({});
}, []);
return rerender;
}
|
lintuming/react-sheet | src/core/utils/__test__/cell.test.tsx | <filename>src/core/utils/__test__/cell.test.tsx
import { getCell, stringAt, viewportCellIterator } from '../cell';
import React from 'react';
import { render } from '@testing-library/react';
import SpreadSheet from 'index';
import SheetManager from 'core/SheetManage';
import Sheet from 'core/Sheet';
import {
DEFAULT_... |
lintuming/react-sheet | src/actions/index.ts | export { ActionScroll, ActionWheel } from './actionScroll';
export { ActionRedo, ActionUndo } from './actionHistory';
export {
ActionPointerDown,
ActionPointerMove,
ActionPointerUp,
} from './actionMouse';
export { ActionMerge } from './actionToolbar';
export { ActionEditCell } from './actionCell';
export { actio... |
lintuming/react-sheet | src/core/utils/viewport.ts | import SheetBasic from 'core/SheetBasic';
import { getCell } from './cell';
import { EmptyCell } from 'consts';
import { getColSize, colAdvanceByPixel } from './col';
import { getRowSize, rowAdvanceByPixel } from './row';
import { distanceOfCellToCanvasOrigin } from './distance';
import Viewport from 'core/Viewport';
i... |
lintuming/react-sheet | src/Spreadsheet/maths.ts | <gh_stars>0
import SheetManager from 'core/SheetManage';
import { getPixelDistanceOfRows } from 'core/utils/row';
import { getPixelDistanceOfCols } from 'core/utils/col';
import { getLastViewport, getViewportBoundingRect } from 'core/utils/viewport';
import Sheet from 'core/Sheet';
const getExtractSpaceFromLastViewpor... |
lintuming/react-sheet | src/actions/types.ts | import SheetInstance from 'core/SheetBasic';
import SheetManager from 'core/SheetManage';
import Sheet from 'core/Sheet';
export enum ActionName {
scroll = 'scroll',
wheel = 'wheel',
pointerDown = 'pointerDown',
pointerMove = 'pointerMove',
pointerUp = 'pointerUp',
undo = 'undo',
redo = 'redo',
updateS... |
lintuming/react-sheet | src/core/utils/hitTest.ts | <filename>src/core/utils/hitTest.ts
import SheetBasic from 'core/SheetBasic';
import { getColSize } from './col';
import { getRowSize } from './row';
import { distanceOfCellToCanvasOrigin } from './distance';
import { DRAGGER_SIZE } from 'consts';
export const hitSeriebox = (
sheet: SheetBasic,
mouseX: number,
m... |
lintuming/react-sheet | src/Spreadsheet/components/CellTextEditor.tsx | import React from 'react';
import { useSpreadSheetStore } from 'Spreadsheet';
import { CellStyle } from 'types';
import { merge, getBorderWidthFromStyle } from 'utils';
import './CellTextEditor.css';
import { getViewportRenderCell } from 'core/utils/cell';
import { getViewportBoundingRect } from 'core/utils/viewport';... |
lintuming/react-sheet | src/actions/actionScroll.ts | import { ActionName } from './types';
import { register, createAction } from './register';
import { getViewportAfterWheel } from 'core/utils/viewport';
export const ActionScroll = register(
createAction({
name: ActionName.scroll,
perform(
_,
{
offset,
vertical,
}: {
... |
lintuming/react-sheet | src/core/SheetRenderer.ts | import {
assertIsDefined,
dpr,
merge,
parseBorder,
getBorderWidthFromStyle,
} from 'utils';
import { Colors, DRAGGER_SIZE, RESIZER_SIZE } from 'consts';
import { Cell, CellStyle, SheetData } from 'types';
import SheetBasic from './SheetBasic';
import SheetManager from './SheetManage';
import { hasTag, MainBut... |
lintuming/react-sheet | src/core/SheetBasic.ts | import { Cell, SheetData, SheetInternalState } from 'types';
import { DefaultStyleConfig, EmptyCell } from 'consts';
import SheetManager from './SheetManage';
import { Injection } from './types';
import { EventEmmit } from './EventEmmit';
import { Noop } from './SheetTags';
import { produce } from 'immer';
import Vie... |
lintuming/react-sheet | src/types.ts | <reponame>lintuming/react-sheet
import SheetManager from 'core/SheetManage';
import { Formats } from 'consts';
import Viewport from 'core/Viewport';
declare global {
const __DEV__: boolean;
}
export type Sparse<T> = {
[key: string]: T;
[key: number]: T;
};
export type SparseArray<T> = Sparse<T> & { length: numbe... |
lintuming/react-sheet | src/actions/register.ts | <filename>src/actions/register.ts<gh_stars>0
import { ActionName, ActionShape } from './types';
let actions: ActionShape[] = [];
const createAction = <F extends ActionName, T>(
props: ActionShape<F, T>
): ActionShape<F, T> => {
return {
...props,
};
};
const register = <T extends ActionName, F>(
action: ... |
lintuming/react-sheet | src/core/utils/merges.ts | <reponame>lintuming/react-sheet<filename>src/core/utils/merges.ts
import SheetBasic from 'core/SheetBasic';
import { isCellInMergeViewport } from './hitTest';
import { SheetInternalState } from 'types';
import { isViewportContain } from './viewport';
import { deleteAt } from 'utils';
import Viewport from 'core/Viewport... |
lintuming/react-sheet | src/core/utils/distance.ts | <reponame>lintuming/react-sheet
import SheetBasic from 'core/SheetBasic';
import { getPixelDistanceOfCols, colAdvanceByPixel } from './col';
import { getPixelDistanceOfRows, rowAdvanceByPixel } from './row';
import Viewport from 'core/Viewport';
export const distanceOfCellToViewportOrigin = (
sheet: SheetBasic,
ce... |
lintuming/react-sheet | src/core/utils/col.ts | <gh_stars>0
import { RowOrCol } from 'types';
import SheetBasic from 'core/SheetBasic';
export const getColSize = (sheet: SheetBasic, i: number) => {
const state = sheet.getState();
return state.cols[i] ?? state.cols.defaultSize;
};
export const viewportColIterator = function*(sheet: SheetBasic) {
const state =... |
lintuming/react-sheet | src/Spreadsheet/utils.ts | import SheetManager from 'core/SheetManage';
import { ScrollState } from 'types';
import { ActionWheel } from 'actions/actionScroll';
import { getColSize } from 'core/utils/col';
import { getRowSize } from 'core/utils/row';
const sendWheelEvent = (
sheetManager: SheetManager,
scrollState: ScrollState,
{
delt... |
lintuming/react-sheet | src/Spreadsheet/components/Toolbar.tsx | import React from 'react';
import { useSpreadSheetStore } from 'Spreadsheet';
import { ActionMerge } from 'actions';
export function ToolBar() {
const store = useSpreadSheetStore();
const sheetManager = store.sheetManager;
const C = ActionMerge.component!;
return (
<div>
<C sheetManager={sheetManager... |
lintuming/react-sheet | src/actions/actionHistory.ts | import { ActionName } from './types';
import { register, createAction } from './register';
const ActionUndo = register(
createAction({
name: ActionName.undo,
perform(_, __, sheet) {
sheet.undo();
},
keyTest: event => event.ctrlKey && event.key === 'z',
})
);
const ActionRedo = register(
cr... |
lintuming/react-sheet | src/core/utils/cell.ts | import {
getRowSize,
isRowLocateSelectedGroupViewport,
isRowAllLocateSelectedGroupViewport,
} from './row';
import {
getColSize,
isColLocateSelectedGroupViewport,
isColAllLocateSelectedGroupViewport,
} from './col';
import SheetBasic from 'core/SheetBasic';
import { EmptyCell } from 'consts';
import { throw... |
lintuming/react-sheet | src/Spreadsheet/components/Scrollor.tsx | import React from 'react';
import './ScrollBar.css';
import { useSpreadSheetStore } from '..';
import { useIsomorphicLayoutEffect } from 'hooks/useIsomorphicLayoutEffect';
import { ActionScroll } from 'actions';
import { sendWheelEvent } from '../utils';
import { SCROLLBAR_SIZE } from 'consts';
import { getRowSize } fr... |
lintuming/react-sheet | src/actions/actionMouse.ts | import SheetManager from 'core/SheetManage';
import { CURSOR_TYPE, RESIZER_SIZE } from 'consts';
import Sheet from 'core/Sheet';
import { SheetInternalState } from 'types';
import { register, createAction } from './register';
import { ActionName } from './types';
import {
markTag,
clearTag,
SerieBoxPressed,
Mai... |
lintuming/react-sheet | src/core/Sheet.ts | import { assertIsDefined, scheduleUpdate } from 'utils';
import { SheetData, SheetInternalState } from 'types';
import SheetManager from './SheetManage';
import { Renderer } from './SheetRenderer';
import { ActionPayload, SheetHistory, SnapshotState } from './types';
type Update = {
(updator: Sheet): void;
};
/*
*... |
lintuming/react-sheet | src/core/utils/resize.ts | <filename>src/core/utils/resize.ts<gh_stars>0
import SheetBasic from 'core/SheetBasic';
import { getColSize } from './col';
import { distanceOfCellToCanvasOrigin } from './distance';
import { getRowSize } from './row';
import { RESIZER_SIZE } from 'consts';
export const getRowSizeAfterResize = (
sheet: SheetBasic,
... |
lintuming/react-sheet | src/actions/manager.ts | import SheetManager from 'core/SheetManage';
import {
ActionManagerNotify,
ActionName,
ActionShape,
ActionsManagerInterface,
} from './types';
class ActionsManage implements ActionsManagerInterface {
sheetManager: SheetManager;
actions: ActionsManagerInterface['actions'];
updater: ActionManagerNotify;
... |
lintuming/react-sheet | src/index.tsx | import Spreadsheet from 'Spreadsheet';
export default Spreadsheet;
|
lintuming/react-sheet | src/core/Viewport.ts | <filename>src/core/Viewport.ts
import SheetBasic from './SheetBasic';
import { colAdvanceByPixel } from './utils/col';
import { rowAdvanceByPixel } from './utils/row';
export default class Viewport {
x: number;
y: number;
xEnd: number;
yEnd: number;
constructor(x: number, y: number, xEnd: number, yEnd: numb... |
lintuming/react-sheet | src/core/utils/row.ts | import { RowOrCol } from 'types';
import SheetBasic from 'core/SheetBasic';
export const getRowSize = (sheet: SheetBasic, i: number) => {
const state = sheet.getState();
return state.rows[i] ?? state.rows.defaultSize;
};
export const viewportRowIterator = function*(sheet: SheetBasic) {
const state = sheet.getS... |
lintuming/react-sheet | src/core/formats.ts | import { Formats } from 'consts';
import { t } from 'i18n';
// Render the content(Style) of cell
const noop = (v?: string | number) => String(v);
const formats = [
{
label: t('format.auto'),
key: Formats.auto,
formatter: noop,
},
{
label: t('format.duration'),
key: Formats.duration,
for... |
lintuming/react-sheet | src/hooks/useMutableValue.ts | <gh_stars>0
import React, { DependencyList, EffectCallback } from 'react';
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
export const useMutableValue = <T>(v: T) => {
const ref = React.useRef<T>(v);
useIsomorphicLayoutEffect(() => {
ref.current = v;
});
return ref;
};
|
getapper/generator-g-react | generators/init/templates/src/App/index.tsx | import React, {memo} from "react";
import { MuiThemeProvider } from "@material-ui/core";
import { Switch, Route } from "react-router-dom";
import { AppSnackbar } from "components";
import useAppHooks from "./index.hooks";
const App: React.FC = () => {
const { theme } = useAppHooks();
return (
<MuiThemeProvide... |
getapper/generator-g-react | generators/init/templates/src/components/index.tsx | <gh_stars>1-10
export * from './AppSnackbar';
export * from './AppAlertBox';
export * from "./AppTextField";
export * from "./AppSelect";
|
smtaha512/fullstack-boilerplate | src/shared/utils/prop-selector.ts | <reponame>smtaha512/fullstack-boilerplate
export function propsSelector<T>(keysToSelect: (keyof T | string)[]) {
return (obj: T) =>
Object.entries(obj)
.filter(([key]) => keysToSelect.includes(key))
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {} as T);
}
|
smtaha512/fullstack-boilerplate | src/modules/blogs/models/get-blogs.model.ts | import { ArgsType, Field } from '@nestjs/graphql';
@ArgsType()
export class GetBlogs {
@Field({ nullable: true }) content?: string;
@Field({ nullable: true }) title?: string;
}
|
smtaha512/fullstack-boilerplate | src/modules/blogs/blogs.module.ts | <reponame>smtaha512/fullstack-boilerplate
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { BlogsController } from './blogs.controller';
import { BlogsEntity } from './blogs.entity';
import { BlogsResolver } from './blogs.resolver';
import { BlogsService } from './blogs.... |
smtaha512/fullstack-boilerplate | src/shared/utils/get-first-from-array.ts | <reponame>smtaha512/fullstack-boilerplate<filename>src/shared/utils/get-first-from-array.ts
export function getFirstFromArray<T>(arr: T[]): T {
return arr.length ? arr[0] : ({} as T);
}
|
smtaha512/fullstack-boilerplate | src/environments/environment.ts | <reponame>smtaha512/fullstack-boilerplate<filename>src/environments/environment.ts
import { ConnectionOptions } from 'typeorm';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const typeormEnvs = require('../../ormconfig');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { env } = r... |
smtaha512/fullstack-boilerplate | src/shared/decorators/gql-requested-fields.ts | <reponame>smtaha512/fullstack-boilerplate
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import { GqlExecutionContext } from '@nestjs/graphql';
import { GraphQLResolveInfo } from 'graphql';
import * as graphqlFields from 'graphql-fields';
export enum RequestedFieldsMode {
RAW,
STRINGS,
}
... |
smtaha512/fullstack-boilerplate | src/modules/blogs/blogs.service.ts | import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, Like } from 'typeorm';
import { BlogsEntity } from './blogs.entity';
import { CreateBlog } from './models/create-blog.model';
import { GetBlogs } from './models/get-blogs.model';
import { getFirstFromA... |
smtaha512/fullstack-boilerplate | src/modules/blogs/blogs.entity.ts | <filename>src/modules/blogs/blogs.entity.ts
import {
Column,
CreateDateColumn,
Entity,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { ObjectType, Field } from '@nestjs/graphql';
@ObjectType('Blog')
@Entity('blog')
export class BlogsEntity {
@Field() @PrimaryGeneratedColumn('uuid') uui... |
smtaha512/fullstack-boilerplate | src/modules/blogs/blogs.resolver.ts | <filename>src/modules/blogs/blogs.resolver.ts
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
import { RequestedFields } from '../../shared/decorators/gql-requested-fields';
import { BlogsService } from './blogs.service';
import { CreateBlog } from './models/create-blog.model';
import { GetBlogs } f... |
smtaha512/fullstack-boilerplate | src/modules/blogs/blogs.controller.ts | <reponame>smtaha512/fullstack-boilerplate
import { Controller } from '@nestjs/common';
@Controller('blogs')
export class BlogsController {}
|
smtaha512/fullstack-boilerplate | src/modules/blogs/models/create-blog.model.ts | <reponame>smtaha512/fullstack-boilerplate
import { InputType, Field } from '@nestjs/graphql';
@InputType()
export class CreateBlog {
@Field() title: string;
@Field() content: string;
}
|
redeemer5/ionic-4-Loing-Reg | src/app/profile/profile.page.ts | import { Component, OnInit } from '@angular/core';
import { NavController, ModalController } from '@ionic/angular';
import { AuthenticationService } from '../services/authentication.service';
@Component({
selector: 'app-profile',
templateUrl: './profile.page.html',
styleUrls: ['./profile.page.scss'],
})
export c... |
redeemer5/ionic-4-Loing-Reg | src/app/app.component.ts | import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import {AuthenticationService } from '../app/services/authentication.service'
import { NavController } from '@i... |
redeemer5/ionic-4-Loing-Reg | src/app/dashboard/dashboard.page.ts | <gh_stars>0
import { Component, OnInit } from '@angular/core';
import { NavController, ModalController } from '@ionic/angular';
import { AuthenticationService } from '../services/authentication.service';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.page.html',
styleUrls: ['./dashboard.page.s... |
redeemer5/ionic-4-Loing-Reg | src/app/services/cart.service.ts | import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class CartService {
private data = [
{
category: 'Pizza',
expanded: true,
products: [
{ id: 0, name: 'Salami', price: '8' },
{ id: 1, name: 'Classic', price: '5' },
{ id: 2, name: '... |
redeemer5/ionic-4-Loing-Reg | src/app/menu/menu.page.ts | import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { CartService } from '../services/cart.service';
@Component({
selector: 'app-menu',
templateUrl: './menu.page.html',
styleUrls: ['./menu.page.scss'],
})
export class MenuPage implements OnInit {
cart = [];
it... |
C0DK/managed-bots | jirabot/src/bot.ts | import ChatTypes from 'keybase-bot/lib/types/chat1'
import * as Message from './message'
import * as Errors from './errors'
import CmdSearch from './cmd-search'
import CmdComment from './cmd-comment'
import CmdAuth from './cmd-auth'
import reacji from './reacji'
import CmdNew from './cmd-new'
import CmdConfig from './c... |
C0DK/managed-bots | jirabot/src/message.ts | <reponame>C0DK/managed-bots<filename>jirabot/src/message.ts
import ChatTypes from 'keybase-bot/lib/types/chat1'
import * as Utils from './utils'
import {Context} from './context'
import * as Errors from './errors'
import logger from './logger'
import * as Configs from './configs'
import * as Jira from './jira'
export ... |
C0DK/managed-bots | jirabot/src/utils.ts | <reponame>C0DK/managed-bots
import crypto from 'crypto'
import {Context} from './context'
import {MessageContext} from './message'
import * as Errors from './errors'
const quotes: {
[key: string]: string
} = {
'"': '"',
"'": "'",
'`': '`',
'“': '”',
'‘': '’',
}
const spaces = [' ', '\n', '\r', '\t']
const... |
mooyoul/node-unipass | src/cargo-clearance-progress/index.ts | <reponame>mooyoul/node-unipass
export { CargoClearanceProgress } from "./client";
export * as CargoClearanceProgressTypes from "./types";
|
mooyoul/node-unipass | src/cargo-clearance-progress/client.ts | <reponame>mooyoul/node-unipass
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
import { CargoClearanceProgressParser, QueryResult } from "./parser";
export class CargoClearanceProgress {
// tslint:disable-next-line
private readonly API_ENDPOINT = "https://unipass.customs.go.kr:38010/ext/rest/carg... |
mooyoul/node-unipass | src/index.ts | <filename>src/index.ts
export * from "./cargo-clearance-progress";
|
mooyoul/node-unipass | test/cargo-clearance-progress/client.test.ts | import * as nock from "nock";
import { sandbox } from "../helper";
import { CargoClearanceProgress } from "../../src/cargo-clearance-progress/client";
import { CargoClearanceProgressParser } from "../../src/cargo-clearance-progress/parser";
describe(CargoClearanceProgress.name, () => {
let parser: CargoClearancePro... |
mooyoul/node-unipass | src/cargo-clearance-progress/parser.ts | <reponame>mooyoul/node-unipass
import { parse as parseXML } from "fast-xml-parser";
import * as moment from "moment-timezone";
import {
CompactQueryResultRecord,
DetailedQueryResult,
MultipleQueryResult,
QueryResult,
} from "./types";
export { QueryResult };
export class CargoClearanceProgressParser {
publ... |
mooyoul/node-unipass | test/helper.ts | <filename>test/helper.ts
import { promises as fs } from "fs";
import * as path from "path";
import * as sinon from "sinon";
export async function readFixture(name: string) {
const fixturePath = path.join(__dirname, "..", "fixtures", name);
return await fs.readFile(fixturePath);
}
export const sandbox = sinon.crea... |
mooyoul/node-unipass | test/cargo-clearance-progress/parser.test.ts | import { readFixture } from "../helper";
import { CargoClearanceProgressParser } from "../../src/cargo-clearance-progress/parser";
describe(CargoClearanceProgressParser.name, () => {
let parser: CargoClearanceProgressParser;
beforeEach(() => {
parser = new CargoClearanceProgressParser();
});
describe("Er... |
mooyoul/node-unipass | src/cargo-clearance-progress/types.ts | export interface CompactQueryResultRecord {
// 화물관리번호
ref: string; // cargMtNo
// MBL 번호
masterBL: string; // mblNo
// HBL 번호
houseBL: string; // hblNo
arrival: {
// 입항일자
date: Date; // etprDt "20200608"
port: {
// 양륙항코드
code: string; // dsprCd "KRINC"
// 양륙항명
name: ... |
andrew-x/classnames-plus | __tests__/options.test.ts | <filename>__tests__/options.test.ts
import Classes from "../src/index";
describe("options", () => {
it("should return an array", () => {
expect(Classes.opt({ output: "array" }).process("a", "b c")).toEqual([
"a",
"b",
"c",
]);
});
it("should return empty array", () => {
expect(Clas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.