repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
MicroFocus/srf.reporter.jasmine | lib/jasmine-reporter-types.ts |
/*! (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Apache License ... |
MicroFocus/srf.reporter.jasmine | lib/core/srf-json-logger.ts | /*! (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Apache License 2... |
MicroFocus/srf.reporter.jasmine | lib/core/srf-reporter-facade.ts | <gh_stars>0
/*! (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Apac... |
MicroFocus/srf.reporter.jasmine | lib/app.ts | <reponame>MicroFocus/srf.reporter.jasmine
/*! (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/l... |
MicroFocus/srf.reporter.jasmine | lib/srf-jasmine-reporter.ts | <reponame>MicroFocus/srf.reporter.jasmine
/*! (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/... |
MicroFocus/srf.reporter.jasmine | lib/core/srf-reporter-type-guard.ts | /*! (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Apache License 2... |
HikaruEgashira/useFirebaseAuth | src/shared/setup.ts | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { defineComponent, createApp, h } from 'vue-demi';
type InstanceType<V> = V extends { new (...arg: any[]): infer X } ? X : never;
type VM<V> = InstanceType<V> & { unmount(): void };
/*... |
HikaruEgashira/useFirebaseAuth | src/index.ts | <reponame>HikaruEgashira/useFirebaseAuth<gh_stars>0
import { ref, onMounted } from 'vue-demi';
import firebase from 'firebase';
export function useFirebaseAuth(auth: firebase.auth.Auth) {
const user = ref<firebase.User | null>(null);
const state = ref<'loading' | 'sign-out' | 'sign-in'>('loading');
const update... |
radonlab/rollup-plugin-typescript | test/sample/classes.ts | <gh_stars>0
export class Test {
private label: string = '';
constructor () {
this.label = 'FooBar';
}
}
|
radonlab/rollup-plugin-typescript | test/sample/imports.ts | import { Test } from './classes';
let t: Test = new Test();
console.log(t);
|
radonlab/rollup-plugin-typescript | test/sample/omitted.ts | function func(arg) {
return arg + 'Bar';
}
console.log(func('Foo'));
|
radonlab/rollup-plugin-typescript | test/sample/simple.ts | <reponame>radonlab/rollup-plugin-typescript
let a: number = 10;
console.log(a);
|
radonlab/rollup-plugin-typescript | test/sample/jsfunc.d.ts | declare function jsfunc (): string;
export default jsfunc;
|
radonlab/rollup-plugin-typescript | test/sample/imports2.ts | import jsfunc from './jsfunc';
console.log(jsfunc());
|
radonlab/rollup-plugin-typescript | test/sample/imports3.ts | import { version } from 'typescript'
console.log(version)
|
grayhildreth/meal-tracker | app/meal.model.ts | <gh_stars>0
export class Meal {
public done: boolean = false;
constructor(public description: string, public details: string, public calories: number) { }
}
|
grayhildreth/meal-tracker | app/meal-list.component.ts | import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Meal } from './meal.model';
@Component({
selector: 'meal-list',
template: `
<div class="col-sm-6">
<select (change)="onChange($event.target.value)">
<option value="over500" selected="selected">Over 500 Calories</option>
... |
zinoviosDev/jhipster-bpm-camunda | src/main/webapp/app/shared/bpm/bpm.service.ts | <reponame>zinoviosDev/jhipster-bpm-camunda<filename>src/main/webapp/app/shared/bpm/bpm.service.ts<gh_stars>0
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { SERVER_API_URL } from '../../app.constants';
import { ResponseWrapper } from '../index';
import { Observable }... |
zinoviosDev/jhipster-bpm-camunda | src/main/webapp/app/admin/logs/logs.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { SERVER_API_URL } from '../../app.constants';
import { Log } from './log.model';
@Injectable()
export class LogsService {
constructor(private http: Http) { }
changeLevel(l... |
lovingZhenyu/ts-antd | tsStudy.ts | <reponame>lovingZhenyu/ts-antd
//基本数据类型
let sex: boolean = true
let myName: string = 'xu'
let age: number = 21
//undifinde,null为基本数据的子集
let u: undefined = undefined
let n: null = null
let F: number
F = u
F = null
//数组类型
//定义一个数组里面的元素只能存放number或者它的子集,长度不限
let numOfArr: number[] = [1,2]
//定义一个数组,里面的长度和元素的类型是有限制的,
let ... |
agile-fan430/angular2-material | src/app/app.module.ts | <reponame>agile-fan430/angular2-material
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { Appproduct } from './product.component';
import { AppInventory} from './Inventory.component';
import { AppComponent } from './app.component';
import { PageNotFound... |
agile-fan430/angular2-material | src/app/product-form.component.ts | import { Component } from '@angular/core';
import { Product } from './products';
@Component({
selector: 'product-form',
templateUrl: './product-form.component.html'
})
export class ProductFormComponent {
model = new Product(1, 'ProductA');
} |
agile-fan430/angular2-material | src/app/multiplier.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe ({
name: 'Multiplier'
})
export class MultiplierPipe implements PipeTransform {
transform(value: number, multiply: string): number {
let mul = parseFloat(multiply);
return mul * value;
}
} |
seankwon/openmrs-esm-patient-registration | src/patient-registration/patient-registration.component.tsx | import * as Yup from 'yup';
import React, { useState, useEffect } from 'react';
import XAxis16 from '@carbon/icons-react/es/x-axis/16';
import styles from './patient-registration.scss';
import camelCase from 'lodash-es/camelCase';
import capitalize from 'lodash-es/capitalize';
import find from 'lodash-es/find';
import ... |
martin-garcia-blanco/github-release-message-sender | src/helpers/sendMessage.ts | const fetch = require('node-fetch');
export const sendMessage = async (url: string): Promise<void> => {
const options = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ text: 'Sended from the action'})
}
await fetch(url, options)
} |
martin-garcia-blanco/github-release-message-sender | dist/helpers/sendMessage.d.ts | <filename>dist/helpers/sendMessage.d.ts
export declare const sendMessage: (url: string) => Promise<void>;
|
martin-garcia-blanco/github-release-message-sender | src/index.ts | import { getInput, setFailed } from "@actions/core";
import { getOctokit } from "@actions/github";
import { sendMessage } from "./helpers/sendMessage";
const token =
getInput("token") || process.env.GH_PAT || process.env.GITHUB_TOKEN;
const slackChannelURL = getInput("SLACK_CHANNEL_URL") || process.env.SLACK_CHANNEL... |
wojciech-kowalik/nestjs-shop | src/user/user.entity.ts | import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { BasketItem } from '../basket/basket-item.entity';
@Entity()
export class User {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({
length: 255,
})
email: string;
@Column()
pwdHash: string;
@Column({
null... |
wojciech-kowalik/nestjs-shop | migration/1627323992529-NewVersion.ts | <reponame>wojciech-kowalik/nestjs-shop
import {MigrationInterface, QueryRunner} from "typeorm";
export class NewVersion1627323992529 implements MigrationInterface {
name = 'NewVersion1627323992529'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query("CREATE TABLE `shop_i... |
wojciech-kowalik/nestjs-shop | src/user/user.service.ts | <reponame>wojciech-kowalik/nestjs-shop
import { Injectable } from '@nestjs/common';
import { RegisterDto } from './dto/register.dto';
import { RegisterUserResponse } from '../shop/interfaces/user';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { User } from './user.ent... |
wojciech-kowalik/nestjs-shop | src/slogan/slogan.service.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { SloganService } from './slogan.service';
describe('SloganService', () => {
let service: SloganService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [SloganService],
}).compile();
... |
wojciech-kowalik/nestjs-shop | src/shop/shop.service.ts | import { forwardRef, Inject, Injectable } from '@nestjs/common';
import { BasketService } from '../basket/basket.service';
import { GetPaginatedListResponse } from './interfaces/shop';
import { InjectRepository } from '@nestjs/typeorm';
import { ShopItem } from './shop-item.entity';
import { Repository } from 'typeorm'... |
wojciech-kowalik/nestjs-shop | src/filters/global-exception.filter.ts | <gh_stars>0
import {
ExceptionFilter,
Catch,
ArgumentsHost,
HttpException,
HttpStatus,
} from '@nestjs/common';
import { Response } from 'express';
@Catch()
export class GlobalExceptionFilter implements ExceptionFilter {
catch(exception: any, host: ArgumentsHost) {
const ctx = host.switchToHttp();
... |
wojciech-kowalik/nestjs-shop | src/auth/jwt.strategy.ts | <filename>src/auth/jwt.strategy.ts
import { Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { User } from '../user/user.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from ... |
wojciech-kowalik/nestjs-shop | src/pipes/description-length.pipe.ts | <reponame>wojciech-kowalik/nestjs-shop<filename>src/pipes/description-length.pipe.ts
import {
PipeTransform,
Injectable,
ArgumentMetadata,
BadRequestException,
} from '@nestjs/common';
import { SloganDto } from '../slogan/dto/slogan.dto';
interface DescriptionLengthPipeOptions {
minLength: number;
}
@Inject... |
wojciech-kowalik/nestjs-shop | src/shop/interfaces/shop.ts | <filename>src/shop/interfaces/shop.ts
export interface ShopItemInterface {
id: string;
name: string;
description: string;
price: number;
}
export type GetProductResponse = ShopItemInterface;
export type GetProductListResponse = ShopItemInterface[];
export interface GetPaginatedListResponse {
items: ShopItemI... |
wojciech-kowalik/nestjs-shop | src/slogan/dto/slogan.dto.ts | export class SloganDto {
description: string;
isHighlighted: boolean;
}
|
wojciech-kowalik/nestjs-shop | src/basket/basket.controller.ts | <filename>src/basket/basket.controller.ts
import {
Body,
Controller,
Delete,
Inject,
Post,
Get,
Param,
ParseUUIDPipe,
UseInterceptors,
UseGuards,
} from '@nestjs/common';
import { AddProductDto } from './dto/add-product.dto';
import {
ProductsFromBasketResponse,
GetTotalPriceResponse,
GetStati... |
wojciech-kowalik/nestjs-shop | src/basket/basket.service.ts | import { forwardRef, Inject, Injectable } from '@nestjs/common';
import { AddProductDto } from './dto/add-product.dto';
import { ShopService } from '../shop/shop.service';
import {
GetStatisticsResponse,
GetTotalPriceResponse,
} from '../shop/interfaces/basket';
import {
AddProductToBasketResponse,
RemoveProduc... |
wojciech-kowalik/nestjs-shop | src/slogan/slogan.controller.ts | <reponame>wojciech-kowalik/nestjs-shop<gh_stars>0
import {
Body,
Controller,
Delete,
Get,
Inject,
Param,
Post,
Put,
} from '@nestjs/common';
import { Slogan } from './slogan.schema';
import { SloganService } from './slogan.service';
import { SloganDto } from './dto/slogan.dto';
import { DescriptionLengt... |
wojciech-kowalik/nestjs-shop | src/shop/shop.controller.ts | import {
Get,
Inject,
Controller,
Param,
Delete,
Post,
Body,
ParseIntPipe,
ParseUUIDPipe,
} from '@nestjs/common';
import { ShopService } from './shop.service';
import {
GetPaginatedListResponse,
GetProductResponse,
} from './interfaces/shop';
import { ShopItem } from './shop-item.entity';
@Contr... |
wojciech-kowalik/nestjs-shop | src/shop/interfaces/basket.ts | <filename>src/shop/interfaces/basket.ts
import { BasketItem } from '../../basket/basket-item.entity';
export type AddProductToBasketResponse =
| {
isSuccess: true;
id: string;
}
| {
isSuccess: false;
};
export interface RemoveProductFromBasketResponse {
isSuccess: boolean;
}
export in... |
wojciech-kowalik/nestjs-shop | src/cron/cron.service.ts | <reponame>wojciech-kowalik/nestjs-shop
import { Injectable } from '@nestjs/common';
import { Cron, CronExpression } from '@nestjs/schedule';
@Injectable()
export class CronService {
@Cron(CronExpression.EVERY_5_MINUTES)
showInformation() {
console.log('Current system time: ', new Date());
}
}
|
wojciech-kowalik/nestjs-shop | src/shop/shop-item.entity.ts | import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { ShopItemInterface } from './interfaces/shop';
import { BasketItem } from '../basket/basket-item.entity';
@Entity()
export class ShopItem implements ShopItemInterface {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({
... |
wojciech-kowalik/nestjs-shop | src/auth/auth.service.ts | import { Injectable } from '@nestjs/common';
import { Response } from 'express';
import { AuthLoginDto } from './dto/auth-login.dto';
import { User } from '../user/user.entity';
import { hashPwd } from '../utils/hash-pwd';
import { v4 as uuid } from 'uuid';
import { sign } from 'jsonwebtoken';
import { JwtPayload } fro... |
wojciech-kowalik/nestjs-shop | src/slogan/slogan.service.ts | import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Slogan } from './slogan.schema';
import { Model } from 'mongoose';
import { SloganDto } from './dto/slogan.dto';
@Injectable()
export class SloganService {
constructor(
@InjectModel(Slogan.name)
private slog... |
wojciech-kowalik/nestjs-shop | src/slogan/slogan.module.ts | import { Module } from '@nestjs/common';
import { SloganService } from './slogan.service';
import { SloganController } from './slogan.controller';
import { MongooseModule } from '@nestjs/mongoose';
import { Slogan, SloganSchema } from './slogan.schema';
@Module({
imports: [
MongooseModule.forFeature([
{
... |
indragunawanping/kontak-ku | src/actions.test.tsx | <filename>src/actions.test.tsx
import { UPDATE_ERROR_MODAL, updateErrorModalStatus } from "./actions";
import { ErrorModalProps } from "./state";
describe("actions", () => {
it("should create an action to update error modal status", () => {
const errorModal: ErrorModalProps = {
isOpen: false
};
con... |
indragunawanping/kontak-ku | src/modals/UpdateContactModal.test.tsx | import UpdateContactModal from "./UpdateContactModal";
import React from "react";
import ReactDOM from "react-dom";
it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(
<UpdateContactModal
updateContactModalOpen={false}
updateActionType='Add'
firs... |
indragunawanping/kontak-ku | src/common/LoadingComponent.test.tsx | <filename>src/common/LoadingComponent.test.tsx<gh_stars>0
import React from "react";
import ReactDOM from "react-dom";
import renderer from "react-test-renderer";
import LoadingComponent from "./LoadingComponent";
it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(<Lo... |
indragunawanping/kontak-ku | src/actionsContact.ts | import * as uuid from "uuid";
import { REACT_APP_APPLICATION_BASE_URL } from "./config";
import { AnyAction } from "redux";
import { ThunkDispatch } from "redux-thunk";
import { Contact, ErrorModalProps, HttpCall, HttpCallMethod, HttpCallStatus } from "./state";
import { addNewHttpCall, sendHttpRequest, updateHttpCallS... |
indragunawanping/kontak-ku | src/Components/ContactDetailPage.test.tsx | import React from "react";
import ReactDOM from "react-dom";
import ContactDetailPage from "./ContactDetailPage";
import { dummyContact } from "../master-data/dummyData";
it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(
<ContactDetailPage
currentContact={... |
indragunawanping/kontak-ku | src/reducers.test.ts | import { communicationReducer, controlReducer, dataReducer, sessionReducer } from "./reducers";
import { Contact, HttpCallMethod, HttpCallStatus } from "./state";
import { UPDATE_ERROR_MODAL } from "./actions";
import {
UPDATE_CONTACT_LIST,
UPDATE_CURRENT_CONTACT, UPDATE_DELETING_CONTACT_STATUS, UPDATE_FETCHING_CON... |
indragunawanping/kontak-ku | src/Components/HomePage.test.tsx | import React from "react";
import ReactDOM from "react-dom";
import { dummyContacts } from "../master-data/dummyData";
import renderer from "react-test-renderer";
import HomePage from "./HomePage";
it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(
<HomePage
... |
indragunawanping/kontak-ku | src/master-data/dummyData.ts | <gh_stars>0
import { Contact } from "../state";
export const dummyContact: Contact = {
firstName: 'Budi',
lastName: 'Setianto',
age: 30,
photo: 'https://via.placeholder.com/150',
};
export const dummyContacts: Contact[] = [
{
firstName: 'Budi',
lastName: 'Setianto',
age: 30,
photo: '... |
indragunawanping/kontak-ku | src/Components/App.tsx | <reponame>indragunawanping/kontak-ku<filename>src/Components/App.tsx
import React from 'react';
import './App.css';
import HomePageContainer from "../Containers/HomePageContainer";
import ErrorModalContainer from "../Containers/ErrorModalContainer";
import { Route, Switch } from "react-router-dom";
import ContactDetail... |
indragunawanping/kontak-ku | src/Containers/HomePageContainer.test.tsx | import React from "react";
import ReactDOM from "react-dom";
import { configure } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import HomePageContainer from "./HomePageContainer";
configure({ adapter: new Adapter() });
it("renders without crashing", () => {
const div = document.createElement("div")... |
miguelquo/twitter-clone | src/auth/auth.module.ts | <filename>src/auth/auth.module.ts
import { Module, HttpModule } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './entities/user.entity';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { PassportModule} from '@nestjs/... |
miguelquo/twitter-clone | src/api/api.controller.ts | import {
Controller,
Injectable,
Get,
Request,
Response,
UseGuards,
Post,
Body,
UsePipes,
ValidationPipe,
Put,
Param,
} from '@nestjs/common';
import { Repository, Brackets } from 'typeorm';
import { Tweet } from './entities/tweet.entity';
import { User } from 'src/auth/entities/user.entity';
import { Injec... |
miguelquo/twitter-clone | src/auth/entities/user.dto.ts | <filename>src/auth/entities/user.dto.ts
export class UserDTO{
readonly id: number
readonly first_name: string
readonly last_name: string
readonly username: string
readonly email: string
readonly is_active: boolean
readonly last_login: string
readonly date_joined: string
reado... |
miguelquo/twitter-clone | src/api/entities/follows.entity.ts | import { Entity, PrimaryGeneratedColumn, OneToOne, Column, JoinColumn, ManyToMany, ManyToOne } from "typeorm";
import { User } from "src/auth/entities/user.entity";
@Entity()
export class Follows{
@PrimaryGeneratedColumn()
id: number
@ManyToOne(() => User, user => user.following)
user: User
... |
miguelquo/twitter-clone | src/main.ts | import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import * as cookieParser from 'cookie-parser';
import AppModule from './app.module';
import { join, resolve } from 'path';
async function bootstrap() {
const app = await NestFactory.create<NestExpressAppli... |
miguelquo/twitter-clone | src/app.controller.ts | <filename>src/app.controller.ts<gh_stars>1-10
import { Controller, Get, Response, Request } from '@nestjs/common';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
home(@Request() req, @Response() res) {
... |
miguelquo/twitter-clone | src/api/entities/tweet.create.ts | <filename>src/api/entities/tweet.create.ts
import { IsNotEmpty } from "class-validator";
export class TweetCreate{
@IsNotEmpty()
text: string
} |
miguelquo/twitter-clone | src/api/entities/favs.entity.ts | import { Entity, PrimaryGeneratedColumn, ManyToOne, Column } from "typeorm";
import { User } from "src/auth/entities/user.entity";
import { Tweet } from "./tweet.entity";
@Entity()
export class Favs{
@PrimaryGeneratedColumn()
id: number
@ManyToOne(() => User, user => user.faved_tweets)
user: User
... |
miguelquo/twitter-clone | src/api/api.module.ts | import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Tweet } from './entities/tweet.entity';
import { ApiController } from './api.controller';
import { User } from 'src/auth/entities/user.entity';
import { AuthModule } from 'src/auth/auth.module';
import { Reply } from './e... |
miguelquo/twitter-clone | src/common/middlewares/passport-initialize.middleware.ts | <filename>src/common/middlewares/passport-initialize.middleware.ts
import { NestMiddleware, Injectable } from "@nestjs/common";
import {initialize} from 'passport'
@Injectable()
export class PassportInitializeMiddleware implements NestMiddleware{
use(req: any, res: any, next: () => void) {
initialize()(re... |
miguelquo/twitter-clone | src/auth/auth.controller.ts | import { Controller, Injectable, Post, Body, UsePipes, ValidationPipe, UseGuards, Request, Response, UseInterceptors, ClassSerializerInterceptor, Redirect, Res } from "@nestjs/common";
import { Repository } from "typeorm";
import { InjectRepository } from "@nestjs/typeorm";
import { UserCreate } from "./entities/user.... |
miguelquo/twitter-clone | src/api/entities/reply.entity.ts | import { ManyToOne, Entity, PrimaryGeneratedColumn } from "typeorm";
import { Tweet } from "./tweet.entity";
@Entity()
export class Reply{
@PrimaryGeneratedColumn()
id: number
@ManyToOne(() => Tweet, tweet => tweet.replies)
tweet: Tweet
} |
miguelquo/twitter-clone | src/app.module.ts | import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm';
import { Connection } from 'typeorm';
import { ApiModule } from './api/api.modul... |
miguelquo/twitter-clone | src/api/entities/reply.create.ts | import { IsNumber } from 'class-validator'
export class ReplyCreate{
@IsNumber()
id: number
@IsNumber()
tweet: number
} |
miguelquo/twitter-clone | src/common/middlewares/express-session.middleware.ts | import { NestMiddleware, Injectable, Inject } from "@nestjs/common";
import { Repository } from "typeorm";
import { Session } from "src/auth/entities/session.entity";
import { InjectRepository } from "@nestjs/typeorm";
import * as expressSesion from 'express-session'
import { ConfigService } from "src/config/config.se... |
miguelquo/twitter-clone | src/common/middlewares/morgan.middleware.ts | <reponame>miguelquo/twitter-clone
import { Injectable, NestMiddleware } from '@nestjs/common';
import * as morgan from 'morgan'
@Injectable()
export class MorganMiddleware implements NestMiddleware {
private static options: morgan.Options;
private static format: string | morgan.FormatFn;
public static config... |
miguelquo/twitter-clone | src/config/config.service.ts | <reponame>miguelquo/twitter-clone
import { Injectable } from '@nestjs/common';
import * as dotenv from 'dotenv'
import * as fs from 'fs'
@Injectable()
export class ConfigService {
private readonly envConfig: { [key: string]: string };
constructor() {
let NODE_ENV = process.env.NODE_ENV
NODE_ENV ... |
miguelquo/twitter-clone | src/common/middlewares/helmet.middleware.ts | import { NestMiddleware } from "@nestjs/common";
import * as helmet from 'helmet'
export class HelmetMiddleware implements NestMiddleware{
private static options: helmet.IHelmetConfiguration
public static configure(options: helmet.IHelmetConfiguration | void){
this.options = options
}
use(r... |
miguelquo/twitter-clone | src/auth/entities/user.create.ts | import {IsNotEmpty, IsEmail} from 'class-validator'
export class UserCreate{
@IsNotEmpty()
first_name: string
@IsNotEmpty()
last_name: string
@IsNotEmpty()
username: string
@IsNotEmpty()
password: string
@IsEmail()
email: string
} |
miguelquo/twitter-clone | src/app.service.ts | <gh_stars>1-10
import { Injectable } from '@nestjs/common';
import { ConfigService } from './config/config.service';
@Injectable()
export class AppService {
//constructor(private config: ConfigService){}
count: number = -1;
getCount(): number {
this.count++;
return this.count;
}
}
|
miguelquo/twitter-clone | src/common/middlewares/csurf.middleware.ts | <gh_stars>1-10
import { NestMiddleware } from "@nestjs/common";
import * as csurf from 'csurf'
export class CsurfMiddleware implements NestMiddleware{
private static options: any
public static configure(options: any){
this.options = options
}
use(req: any, res: any, next: () => void) {
... |
miguelquo/twitter-clone | src/api/entities/tweet.entity.ts | import { Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn, ManyToMany, JoinTable, ManyToOne, OneToMany } from 'typeorm'
import { User } from '../../auth/entities/user.entity'
import { Reply } from './reply.entity'
import { Favs } from './favs.entity'
@Entity()
export class Tweet {
@PrimaryGeneratedCol... |
miguelquo/twitter-clone | src/common/middlewares/morgan.middleware.spec.ts | import { MorganMiddleware } from './morgan.middleware';
describe('MorganMiddleware', () => {
it('should be defined', () => {
expect(new MorganMiddleware()).toBeDefined();
});
});
|
miguelquo/twitter-clone | src/auth/entities/user.entity.ts | <reponame>miguelquo/twitter-clone
import {
Entity,
PrimaryGeneratedColumn,
Column,
OneToMany
} from 'typeorm';
import { Tweet } from '../../api/entities/tweet.entity';
import { Follows } from 'src/api/entities/follows.entity';
import { Favs } from 'src/api/entities/favs.entity';
@Entity()
export class ... |
miguelquo/twitter-clone | src/common/middlewares/cors.middleware.ts | import { NestMiddleware } from "@nestjs/common";
import * as cors from 'cors'
export class CORSMiddleware implements NestMiddleware{
private static options: cors.CorsOptions
public static configure(options: cors.CorsOptions){
this.options = options
}
use(req: any, res: any, next: () => void... |
miguelquo/twitter-clone | src/common/middlewares/passport-session.middleware.ts | <reponame>miguelquo/twitter-clone
import { NestMiddleware, Injectable } from "@nestjs/common";
import {session} from 'passport'
@Injectable()
export class PassportSessionMiddleware implements NestMiddleware{
use(req: any, res: any, next: () => void) {
session()(req, res, next)
}
} |
miguelquo/twitter-clone | src/auth/auth.service.ts | <gh_stars>1-10
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { JwtService } from '@nestjs/jwt';
import { Repository, FindOneOptions } from 'typeorm';
import { hash, compare } from 'bcrypt';
import { User } from './entities/user.entity';
import { UserCreate } fr... |
tflins/t-full-scroll | src/index.ts | <gh_stars>0
import TFullPage from './instance'
import './style/base.scss'
export default TFullPage
|
tflins/t-full-scroll | src/instance/index.ts | import { $, $$, getWheelDelta, throttle, addClass, removeClass, hasClass } from '../utils'
// 动画时长
const ANIMATION_TIME: number = 1000
// 容器 class
const CON_CLS: string = 't-full-page'
// 单页 class
const PAGE_CLS: string = 'page'
// 导航按钮激活 class
const ACT_CLS: string = 'active'
export default class TFullPage {
// 滚... |
tflins/t-full-scroll | src/utils/index.ts | <filename>src/utils/index.ts
const trim = (str: string): string => {
return (str || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
}
export const $ = (selector: string, scope: HTMLElement | Document = document): HTMLElement => scope.querySelector(selector)
export const $$ = (selector: string, scope: HTMLElement | D... |
kctang/ng-quick-form | projects/ng-quick-form/src/lib/util/getErrorMessage.ts | <reponame>kctang/ng-quick-form<gh_stars>1-10
import { AbstractControl } from '@angular/forms'
export const getErrorMessage = (control: AbstractControl) => {
if (control.errors && !control.pristine) {
const messages = Object.keys(control.errors).map(key => {
const obj = control.getError(key)
switch (k... |
kctang/ng-quick-form | projects/ng-quick-form/src/lib/QuickFormFieldType.ts | <filename>projects/ng-quick-form/src/lib/QuickFormFieldType.ts<gh_stars>1-10
/**
* Supported field types.
*/
export type QuickFormFieldType =
'autocomplete'
| 'checkbox'
| 'chips'
| 'datepicker'
| 'password'
| 'radio'
| 'select'
| 'separator'
| 'switch'
| 'text'
| 'textarea'
|
kctang/ng-quick-form | projects/demo/src/app/simple-demo/simple-demo.component.ts | import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'
import { FormGroup, Validators } from '@angular/forms'
import { QuickForm, QuickFormField } from 'ng-quick-form'
@Component({
selector: 'app-simple-demo',
templateUrl: 'simple-demo.component.html',
changeDetection: ChangeDetectionStrategy... |
kctang/ng-quick-form | projects/demo/src/app/code.ts | <gh_stars>1-10
export const code = {
simpleDemo: {
html: `<div padding>
<!--
flex-cell and related attributes are features provided by https://common-style-attributes.surge.sh/
-->
<div flex-cell default-cell-6 gutter>
<form [formGroup]="form" flex-cell gutter default-cell-6>
<... |
kctang/ng-quick-form | projects/demo/src/app/app.component.ts | <reponame>kctang/ng-quick-form
import { ChangeDetectionStrategy, Component } from '@angular/core'
import { code } from './code'
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styles: [],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class AppComponent {
code = code
}
|
kctang/ng-quick-form | projects/demo/src/app/field-types-demo/field-types-demo.component.ts | import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'
import { FormGroup, Validators } from '@angular/forms'
import { QuickForm, QuickFormField, CheckboxValidators } from 'ng-quick-form'
@Component({
selector: 'app-field-types-demo',
templateUrl: './field-types-demo.component.html',
changeDe... |
kctang/ng-quick-form | projects/ng-quick-form/src/public-api.ts | <filename>projects/ng-quick-form/src/public-api.ts
/*
* Public API Surface of ng-quick-form
*/
export * from './lib/QuickForm'
export * from './lib/QuickForm.module'
export * from './lib/QuickFormField'
export * from './lib/QuickFormFieldOptionDefinition'
export * from './lib/QuickFormFieldType'
export * from './lib... |
kctang/ng-quick-form | projects/ng-quick-form/src/lib/QuickForm.module.ts | import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { NgModule } from '@angular/core'
import { MatAutocompleteModule } from '@angular/material/autocomplete'
import { MatButtonModule } from '@angular/material/button'
import { MatCheckboxModule } from '@angular/material/checkbox'
import { MatChipsMod... |
kctang/ng-quick-form | projects/ng-quick-form/src/lib/preProcessFormValues.ts | <reponame>kctang/ng-quick-form<filename>projects/ng-quick-form/src/lib/preProcessFormValues.ts
/**
* Pre-process form values on form submission to convert raw form values to a structure that
* mimics field definitions.
*/
export const preProcessFormValues = (formValues: { [ key: string ]: any }) => {
return Object... |
kctang/ng-quick-form | projects/ng-quick-form/src/lib/makeForm.ts | /**
* Convert QuickFormField[] to FormBuilder's controls config.
*
* @param fields
*/
import { QuickFormField } from './QuickFormField'
import { FormBuilder } from '@angular/forms'
import { setDefaultValues } from './setDefaultValues'
import { assert } from './util/assert'
export const makeForm = (fields: QuickFor... |
kctang/ng-quick-form | projects/ng-quick-form/src/lib/mat/QuickFormField.component.ts | <filename>projects/ng-quick-form/src/lib/mat/QuickFormField.component.ts
import {
ChangeDetectionStrategy, ChangeDetectorRef,
Component, ElementRef,
Input, OnChanges, OnDestroy,
SimpleChanges, ViewChild
} from '@angular/core'
import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms'
im... |
kctang/ng-quick-form | projects/demo/src/app/app.module.ts | /// <reference path="../global.d.ts" />
import { BrowserModule } from '@angular/platform-browser'
import { NgModule } from '@angular/core'
import { AppComponent } from './app.component'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { BrowserAnimationsModule } from '@angular/platform-browser/a... |
kctang/ng-quick-form | projects/ng-quick-form/src/lib/util/resolveOptions.ts | import { QuickFormFieldOptionDefinition } from '../QuickFormFieldOptionDefinition'
export const resolvedOptions = (options: QuickFormFieldOptionDefinition[]) => {
return options.map<any>(option => {
if (typeof option === 'string') {
// convert to { value: string, label: string }
return { label: optio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.