repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
Huxiaoyu1992/react-ts
src/components/useRefButton.tsx
import React, { useState, useEffect, useRef } from 'react' const UseRefButton: React.FC = () => { const [like, setLike] = useState(0) const likeRef = useRef(0) useEffect(() => { document.title = '点击了' + like + '次' }, [like]) function handleClick() { setTimeout(() => { alert('click' + likeRef....
Huxiaoyu1992/react-ts
src/components/button.tsx
import React, { useState, useEffect, Fragment } from 'react' import userMousePosition from '../hooks/useMousePosition' // const Button: React.FC = () => { // const [state, setstate] = useState({num: 0, on: true}) // return ( // <Fragment> // <button onClick={() => setstate({ num: state.num + 1, on: !stat...
Huxiaoyu1992/react-ts
src/components/TestButton.tsx
<gh_stars>0 import React, { useState, useEffect } from 'react' // 在这样的情况下: 假如将like点击四次,然后点击Alert按钮,再立马点击setLike, 最后handleClick输出的结果是4而不是最终的结果。 const TestButton: React.FC = () => { const [like, setLike] = useState(0) useEffect(() => { document.title = `点击了${like}次` }, [like]) function handleClick () { se...
Huxiaoyu1992/react-ts
src/components/FuncRefUse.tsx
<filename>src/components/FuncRefUse.tsx import React, { useRef, useEffect, MutableRefObject } from 'react' const FuncRefUse: React.FC = () => { const ref = useRef() as MutableRefObject<any> useEffect(() => { ref.current.focus() }, []) return ( <div> <input type="text" name="child" ref={ref} /> ...
Huxiaoyu1992/react-ts
src/App.tsx
import React, { useState, createContext } from 'react'; import './App.css'; import Hello from './components/Hello' import Button from './components/button' import MouseTracker from './components/MouseTracker' import useMousePosition from './hooks/useMousePosition' import useUrlLoader from './hooks/useUrlLoader' import ...
Huxiaoyu1992/react-ts
src/components/classRef.tsx
<gh_stars>0 import React, { Component } from 'react' class MyRef extends Component { // class里怎么使用createRef inputRef: React.RefObject<HTMLInputElement> constructor(props: {} | Readonly<{}>) { super(props) this.inputRef = React.createRef<HTMLInputElement>() } render() { return ( <input type...
Huxiaoyu1992/react-ts
src/hooks/useUrlLoader.tsx
/* eslint-disable react-hooks/exhaustive-deps */ import { useState, useEffect } from 'react' import axios from 'axios' const useUrlLoader = (url: string, deps: any[] = []) => { const [data, setData] = useState<any>(null) const [loading, setLoading] = useState(false) useEffect(() => { setLoading(true) axi...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/ril.d.ts
declare module "ril" { /** * 返回一个数值,表示GSM信号强度,有效值为(0-31,99) */ export function getGsmSignalStrength(): any /** * 开启监听:信号强度变化 * @param callback */ export function onSignalStrengthChange(callback: Function): any /** * 取消监听信号强度变化 * @param callback */ export function offSignalStrengthC...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/uart.d.ts
<gh_stars>0 declare interface uart { /** * 设置串口接受数据接口函数 * @param func */ onData(func: Function): void /** * 发送数据 * @param buffer buffer 类型数据 */ write(buffer: Buffer): void /** * 关闭串口设备 */ close(): void }
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/cfgm.d.ts
declare module "cfgm" { /** * 设置系统配置。当配置不存在时,会创建新的配置项 * @param item * @param value */ export function setSystemCfg(item: string, value: string): boolean /** * 获取系统配置项。当配置不存在时,返回 UNDEFINED * @param item */ export function getSystemCfg(item: string): string /** * 设置应用配置。当配置不存在时,会创建新的配...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/wifi.d.ts
declare interface wifi { /** * 扫描获取周围的 Wifi 热点信息 * 扫描成功返回 true 否则返回 false */ scan(): boolean /** * 监听扫描 WiFi 结束事件 * @param callback 回调函数 */ onScanEvent(callback: Function): void /** * 连接指定的 WiFi 网络 * @param param wifi 信息对象{ssid: wifi 设备 ssid, bssid: wifi 设备 bssid, password: wifi 设备密码...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/mvvm.d.ts
declare class MVVM{ constructor(options?: object) /** * 初始化 mvvm,需传入一个 options 对象 * @param options */ init(options: object): void /** * 往当前页面中插入自定义面板 * @param mountedNodeName 自定义面板要挂载的节点 * @param panels 要插入的自定义面板 * @param widgets 自定义面板中 widgets 信息(符合 mvvm 要求的格式) */ insertCustomPanel...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/pm.d.ts
<reponame>Rbb666/Launcher<gh_stars>0 //@ts-nocheck declare namespace pm { function request(params: { url: string; data?: string | object; header?: object; method?: string; success?: Function; complete?: Function; fail?: Function; }): void /** * 获取 WiFi 对象 */ function createWi...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/Page.d.ts
declare function Page(page: page): void declare interface page { /** * 页面生命周期函数,在页面初始化完成后由系统调起,主要供用户在页面显示前针对页面元素做相关赋值初始化等。比如加载自定义面板、启动模块功能等。与页面生命周期函数 onExit 成对。 */ onLoad(): pageEvent; /** * 页面生命周期函数,在页面第一次显示完成之后由系统调起,主要用于延后加载某些和底层交互有关的数据等,以达到先显示页面后加载或初始化部分页面元素的效果。 */ onResume(): pageEvent; /**...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/emq.d.ts
<gh_stars>0 declare module "emq" { /** * 创建一个消息接收端点,返回消息队列操作 API */ export function createEP(): queue /** * 发送数据至 HUB 的一个通道上 * @param hubName * @param data */ export function send(hubName: string, data: any): boolean export interface queue { /** * 监听一个 HUB 上面的一个通道。 * @param ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/hardware.d.ts
<filename>ART-BadgeV2.0_launcher/@types/hardware.d.ts declare module "hardware" { /** * 获取时间戳 */ export function getRealTime(): number /** * 设置时间戳 * @param timestamp */ export function setRealTime(timestamp: number): boolean /** * 开启监听:realtime 时间戳变化 * @param callback 注册的onChange回调函数,数...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/sensor.d.ts
declare module "sensor" { /** * 获取加速度ID值,如 51(0x33) */ export function getAccelerometerID(): number /** * 获取加速度三轴数据 */ export function getAccelerometerData(): any /** * 打开加速度传感器 */ export function openAccelerometer(): boolean /** * 关闭加速度传感器 */ export function closeAcceleromet...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/storage.d.ts
declare module "storage" { /** * 使用键值对形式设置缓存 * @param key * @param data */ export function setStorageSync(key: string, data: any): boolean /** * 通过 key 值从缓存中获取指定的 data * @param key */ export function getStorageSync(key: string): any /** * 通过 key 值在缓存中删除指定的数据 * @param key */ ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/Event.d.ts
declare function Event(): Event declare interface Event { /** * 配置 name 名称事件的回调模式,当没有对事件进行配置时,默认模式为事件触发时回调所有注册函数 * @param name 事件名称 * @param mode 事件触发模式 */ mode(name: string, mode: boolean): void /** * 注册回调函数 * @param name 事件名称 * @param func 回调函数 */ on(name: string, func: Function): vo...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/tsdb.d.ts
declare module "tsdb" { /** * 连接数据库 * @param param */ export function connect(param: { uri: string, maxLen: number, maxSize: number, success: Function, fail: Function, complete: Function, }): void /** * 往数据库中追加数据 * @param param */ export function append(param: { ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/dcm.d.ts
declare module "dcm" { /** * 创建数据池,数据池名字全局唯一。创建成功返回 true,创建失败返回 false * @param name */ export function Create(name: string): boolean /** * 打开数据池,数据池存在时返回数据池操作 API,数据池不存时返回 UNDEFINED * @param name */ export function Open(name: string): pool export interface pool { /** * 存放数据到数据池中。...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/http.d.ts
<filename>ART-BadgeV2.0_launcher/@types/http.d.ts<gh_stars>0 declare module "http" { /** * 使用键值对形式设置缓存 * @param params */ export function request(params: { url: string; data?: string | object; header?: object; method?: string; success?: Function; complete?: Function; fail?: Fun...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/assert.d.ts
<filename>ART-BadgeV2.0_launcher/@types/assert.d.ts declare module "assert" { /** * 获取 Assert 模块错误触发统计次数。 */ export function errorTimes(): number /** * 重置错误触发统计次数 */ export function clearErrorTimes(): void /** * value 为 false 时用给定的操作及错误信息抛出错误(AssertionError). * @param value 测试值 * @para...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/mqtt.d.ts
declare module "mqtt" { /** * 根据 endpoint 与 options,创建一个 MQTT Client。 返回:mqtt.client 对象 * @param endpoint broker 的URL地址 * @param options 设定选项 */ export function Client(endpoint: string, options?: { keepalive?: number, clientId?: string, clean?: boolean, reconnectPeriod?: number, con...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/canvas.d.ts
export enum lineCap{ butt = 'butt', square = 'square', round = 'round' } export enum fontAlign{ left = 'left', right = 'right', center = 'center' } export enum textBaseLine{ top = 'top', center = 'center', bottom = 'bottom', normal = 'normal' } declare interface canvas { /** * 设置填充样式 * ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/videoPlayer.d.ts
<filename>ART-BadgeV2.0_launcher/@types/videoPlayer.d.ts declare interface videoPlayer { /** * 退出全屏模式 */ exitFullScreen(): void /** * 进入全屏模式 */ requestFullScreen(): void /** * 播放视频 */ play(): void /** * 暂停视频 */ pause(): void /** * 跳转到指定位置 * @param position 需要跳转到的位置 ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/untar.d.ts
declare interface untar{ /** * 解压本地 tar 包 * @param tar tar 包路径 * @param dir 指定文件解压路径 * @param success 接口调用成功回调函数(可选) * @param fail 接口调用失败回调函数(可选) * @param complete 接口调用完成回调函数 调用成功或失败都会执行(可选) */ /** * 监听解压进度变化事件 * @param callback 回调函数 */ onProgressUpdate(callback:Function): void /...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/message.d.ts
// import {Buffer} from './Buffer' declare function Message(): message declare interface message { /** * js 想 底层发送数据 * @param name 名称 * @param value 需要发送的数据 */ send(name: string, value: string | Buffer): void /** * 监听底层发送过来的信息(消息回调) * @param name 事件名称 * @param func 回调函数 */ on(name: st...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/notification.d.ts
declare module "notification" { /** * 从未读通知队列中取出指定位置的通知 * @param index 要获取通知的下标 */ export function getMsg(index: number): object /** * 按照获取规则取出通知数组 * @param select_mode select_mode 为选择类型,可用值为:“NotRead”,“HeaveRead”,“SelectAll” */ export function getMsgs(select_mode: string): object /** ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/app.d.ts
<reponame>Rbb666/Launcher export enum listAppInstalledArgv { system = "system", user = "user", } declare namespace app { /** * 启动 APP 并切换到前台 * 当 APP 在前台时不做任何操作;当 APP 在后台时切换到前台;当 APP 前后台都不在时启动 APP * * @param {string} uri APP 路径 * @returns {boolean} */ function launch(uri?: string): boolean ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/FileSystemManager.d.ts
declare interface FileSystemManager { /** * 判断文件/目录是否存在 * @param path 需要判断的文件/目录的路径 * @param success 调用成功回调函数(可选) * @param fail 调用失败回调函数(可选,接受错误信息作为参数) * @param complete 调用结束回调函数(成功或失败都会执行,可选) */ access(path: string, success?: Function, fail?: Function, complete?: Function): void /** * 在指定文件...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/animator.d.ts
export enum interpolator { linear = 'linear', accelerate = 'accelerate', negexp = 'negexp', bounce = 'bounce', anticipate = 'anticipate' } export enum timing { 'ease-in' = 'ease-in', 'ease-out' = 'ease-out', 'ease-in-out' = 'ease-in-out' } export enum direction { normal = 'normal', reverse = 'reve...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/IIC.d.ts
declare interface IIC { /** * 读取数据 * @param addr 要读取数据的设备的地址 * @param buffer 存放读取到的数据的buffer,包含要读取的数据的长度,即 buffer 的大小 */ read(addr: number, buffer: Buffer): void /** * 读取数据,先写命名再读取数据 * @param addr 要读取数据的设备的地址 * @param buffer1 要写入的命名的 buffer 对象 * @param buffer2 读取到的数据的 buffer,包含 buffer 的大...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/Buffer.d.ts
export enum encoding{ utf8 = 'utf8', ascii = 'ascii', hex = 'hex' } /** * Buffer 类 * @param pramas 需要创建的 buffer 数据或者长度 * @param encoding 编码格式 */ declare class Buffer { /** * 使用array分配一个新的 Buffer,array 类型为数字类型,比如: * var arr = [0x01, 0x02, 0x03, 0x04, 0x05]; * var bufferObj = new Buffer(arr); * ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/touch.d.ts
//@ts-nocheck declare module "touch" { /** * 页面触摸初始化 * @param page page 对象 */ export function PageTouchInit(page: page): void /** * 页面触摸初始化 * @param page page 对象 */ export function PageTouchUninit(page: page): void /** * 页面触摸初始化 * @param page page 对象 * @param event 事件对象 * @pa...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/URI.d.ts
<reponame>Rbb666/Launcher declare function URI(uri: string): void declare interface uri{ scheme: string; authority: string; path: string; query: { id: string, name: string } | string// or query: "id=123&name=abc" } declare namespace URI{ function encode(uri: uri): void }
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/global.d.ts
/** * 引入一个模块 * @param name 模块名,具体规则见参考资料的开发指南 * @param res 资源包路径 uri,如:internal://widgets#/res.prc,不填默认为当前应用资源包 */ export declare function require(name: string, res?: string): void /** * 从缓存中移除模块实例 * @param module 模块实例,即 require 返回值 */ export declare function unrequire(module: string | object): void /** * 单次定...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/audio.d.ts
declare interface audio{ /** * 设置音量。开机默认为上次设定值,断电保存 * @param volume 整数 0-100 */ setVolume(volume: number): void /** * 获取当前音量 */ getVolume (): number /** * 设置播放音频文件的路径。一般将音频文件放在与 app.js 同级的 resource 文件夹内,那么相对路径为“./resource/xx.mp3”,绝对路径为“/gui/resource/xx.mp3” * @param url 音频文件相对于 app.js ...
Rbb666/Launcher
ART-BadgeV2.0_launcher/@types/net.d.ts
declare module "net" { /** * 使用键值对形式设置缓存 * @param options 连接设定选项 * @param connectionListener 事件 Connection 的 Listener */ export function createServer(options?: { allowHalfOpen?: boolean, readable?: boolean, writeable?: boolean }, connectionListener?: Function): server export interface s...
OttoLaitinen/oal-site-frontend
src/components/common/SocialLinksList.tsx
import * as React from "react" import styled from "@emotion/styled" import GitHubIcon from "../../assets/github.inline.svg" import InstagramIcon from "../../assets/instagram.inline.svg" import LinkedInIcon from "../../assets/linkedin.inline.svg" import SocialLink from "./SocialLink" const SocialLinksList: React.FC = ...
OttoLaitinen/oal-site-frontend
src/components/common/SocialLink.tsx
<filename>src/components/common/SocialLink.tsx import * as React from "react" import styled from "@emotion/styled" import VisuallyHidden from "@reach/visually-hidden" interface SocialLinkProps { url: string title: string children?: React.ReactNode } const SocialLink: React.FC<SocialLinkProps> = props => { con...
OttoLaitinen/oal-site-frontend
src/templates/photograph.tsx
import React from "react" import { graphql, Link, PageProps } from "gatsby" import { GatsbyImage, getImage } from "gatsby-plugin-image" import Moment from "react-moment" import Markdown from "react-markdown" import Seo from "../components/seo" import { SinglePhotographQuery } from "../../graphql-types" import styled fr...
OttoLaitinen/oal-site-frontend
src/pages/photography.tsx
import * as React from "react" import { graphql, PageProps } from "gatsby" import { GatsbyImage, getImage } from "gatsby-plugin-image" import styled from "@emotion/styled" import { PhotographyPageQuery } from "../../graphql-types" import StyledMarkdown from "../components/common/StyledMarkdown" import Seo from "../com...
OttoLaitinen/oal-site-frontend
graphql-types.ts
<gh_stars>0 export type Maybe<T> = T | null; export type InputMaybe<T> = Maybe<T>; export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] }; export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> }; export type MakeMaybe<T, K extends keyof T> = Omit<T,...
OttoLaitinen/oal-site-frontend
src/components/Gallery.tsx
import React from "react" import { GatsbyImage, IGatsbyImageData } from "gatsby-plugin-image" import { chunk, sum } from "lodash" import styled from "@emotion/styled" import { Link, navigate } from "gatsby" export const GALLERY_IMAGE_MAX_WIDTH = 750 interface GalleryImage { id: string aspectRatio: number imageD...
OttoLaitinen/oal-site-frontend
src/pages/index.tsx
import * as React from "react" import { graphql, PageProps, useStaticQuery } from "gatsby" import { GatsbyImage, getImage, ImageDataLike } from "gatsby-plugin-image" import styled from "@emotion/styled" import StyledMarkdown from "../components/common/StyledMarkdown" import SocialLinksList from "../components/common/S...
OttoLaitinen/oal-site-frontend
src/components/LinkList.tsx
<gh_stars>0 import * as React from "react" import styled from "@emotion/styled" import { useTheme } from "@emotion/react" import { Link } from "gatsby" import VisuallyHidden from "@reach/visually-hidden" import MenuIcon from "../assets/menu.inline.svg" import CrossIcon from "../assets/cross.inline.svg" const LinkList...
OttoLaitinen/oal-site-frontend
src/components/TopBar.tsx
import * as React from "react" import styled from "@emotion/styled" import LogoWithText from "../assets/logowithtext.inline.svg" import { Link } from "gatsby" import LinkList from "./LinkList" const TopBar: React.FC = () => { return ( <TopBarBackground> <Header> <LogoLinkWrapper to="/"> ...
OttoLaitinen/oal-site-frontend
src/custom-typings.d.ts
<filename>src/custom-typings.d.ts<gh_stars>0 declare module "*.svg" { const content: any export default content } declare module "*.png" declare module "*.jpg" declare module "*.inline.svg" { const content: React.FunctionComponent<React.SVGAttributes<SVGElement>> export default content }
OttoLaitinen/oal-site-frontend
src/emotion.d.ts
import { Theme as WebTheme } from "./styles/theme" // Enables the use of Theme in typing without import declare module "@emotion/react" { export interface Theme extends WebTheme {} }
OttoLaitinen/oal-site-frontend
src/components/common/StyledMarkdown.tsx
<filename>src/components/common/StyledMarkdown.tsx<gh_stars>0 import React from "react" import ReactMarkdown from "react-markdown" import styled from "@emotion/styled" const StyledMarkdown: React.FC<{ content: string | undefined | null }> = ({ content, }) => { return ( <MarkdownWrapper> {content && ( ...
OttoLaitinen/oal-site-frontend
src/components/seo.tsx
/** * SEO component that queries for data with * Gatsby's useStaticQuery React hook * * See: https://www.gatsbyjs.com/docs/use-static-query/ */ import * as React from "react" import PropTypes from "prop-types" import { Helmet } from "react-helmet" import { useStaticQuery, graphql } from "gatsby" import { useLoca...
OttoLaitinen/oal-site-frontend
src/styles/theme.ts
<reponame>OttoLaitinen/oal-site-frontend import { Global, css } from "@emotion/react" import emotionReset from "emotion-reset" const rem = (pixels: number) => `${pixels / 16}rem` const fontNames = { regular: "Karla", title: "Quicksand", } const breakpoints = { phone: 767, tablet: 1023, desktop: 1800, } co...
OttoLaitinen/oal-site-frontend
src/components/Footer.tsx
import * as React from "react" import styled from "@emotion/styled" import SocialLinksList from "./common/SocialLinksList" const Footer: React.FC = () => { return ( <FooterGrid> <SocialLinksList /> <p>© <NAME> {new Date().getFullYear()}</p> </FooterGrid> ) } const FooterGrid = styled.div` d...
OttoLaitinen/oal-site-frontend
src/components/layout.tsx
import * as React from "react" import PropTypes from "prop-types" import { useStaticQuery, graphql, PageProps } from "gatsby" import styled from "@emotion/styled" import TopBar from "./TopBar" import { ImageDataLike } from "gatsby-plugin-image" import Footer from "./Footer" const Layout: React.FC = ({ children }) => {...
yuanjun708/cocos_creator_3.0_base
assets/script/base/bl_tools.ts
<filename>assets/script/base/bl_tools.ts // Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scri...
yuanjun708/cocos_creator_3.0_base
temp/declarations/jsb.d.ts
/// <reference path="/Applications/CocosCreator/Creator/3.0.0-Preview.1/CocosCreator.app/Contents/Resources/resources/3d/jsb-adapter/@types/jsb.d.ts"/>
yuanjun708/cocos_creator_3.0_base
temp/declarations/cc.d.ts
/// <reference path="/Applications/CocosCreator/Creator/3.0.0-Preview.1/CocosCreator.app/Contents/Resources/resources/3d/engine/bin/.declarations/cc.d.ts"/> /** * @deprecated Global variable `cc` was dropped since 3.0. Use ES6 module syntax to import Cocos Creator APIs. */ declare const cc: never;
szafran89/nest-catalog
src/products/products.controller.ts
<reponame>szafran89/nest-catalog import { Controller, Get, Post, Param, Body, Put, Delete, Query } from '@nestjs/common'; import { ProductsService } from './products.service'; import { CreateProductDto } from './dto/create-product.dto'; import { UpdateProductDto } from './dto/update-product.dto'; import { PaginationQu...
szafran89/nest-catalog
src/product.ts
import { IsString, IsNumber, IsOptional } from 'class-validator' export class Product { @IsNumber() @IsOptional() readonly id: number @IsString() readonly name: string @IsString() readonly description: string @IsString() readonly image: string }
szafran89/nest-catalog
src/products/entities/product.entity.ts
<reponame>szafran89/nest-catalog<filename>src/products/entities/product.entity.ts<gh_stars>0 import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose' import { Document} from 'mongoose' @Schema() export class Product extends Document { @Prop() name: string @Prop() description: string @Prop() image: ...
szafran89/nest-catalog
src/app.module.ts
<filename>src/app.module.ts import { Module } from '@nestjs/common'; import { MongooseModule } from '@nestjs/mongoose' import { ProductsModule } from './products/products.module'; import * as dotenv from 'dotenv' dotenv.config() @Module({ imports: [ ProductsModule, MongooseModule.forRoot(process.env.MONGO_CO...
szafran89/nest-catalog
src/products/dto/create-product.dto.ts
import { IsString } from "class-validator" export class CreateProductDto { @IsString() readonly name: string; @IsString() readonly description: string @IsString() readonly image: string }
szafran89/nest-catalog
src/products/products.service.ts
import { Injectable, NotFoundException } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model, Types } from 'mongoose'; import { Product } from './entities/product.entity'; import { CreateProductDto } from './dto/create-product.dto'; import { UpdateProductDto } from './dto/update-produc...
szafran89/nest-catalog
src/products/dto/update-product.dto.ts
<gh_stars>0 import { PartialType } from '@nestjs/mapped-types' import { CreateProductDto } from './create-product.dto' export class UpdateProductDto extends PartialType(CreateProductDto) {}
PoetaKodu/vscode-pacc
src/extension.ts
<reponame>PoetaKodu/vscode-pacc<gh_stars>1-10 // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below import * as vscode from 'vscode'; import { ProjectTreeProvider, ProjectTreeItem } from './views/Projects'; import { NewProjectWizard...
PoetaKodu/vscode-pacc
src/pacc/Pacc.ts
import * as vscode from 'vscode'; import * as path from 'path'; import * as fs from 'fs'; import { promisify } from 'util'; import { spawnShellScript } from '../util/Shell'; import { PaccViewModel } from '../ExtensionViewModel'; const mkdir = promisify(fs.mkdir); export class Pacc { projectFile = ""; buildDirectory...
PoetaKodu/vscode-pacc
src/views/NewProjectWizard.ts
import * as vscode from 'vscode'; import { TextEncoder } from 'util'; import * as path from "path"; import * as fs from "fs"; export class NewProjectWizardWebviewHandler implements vscode.Disposable { projectCreated : vscode.EventEmitter<string>; extensionPath?: string; private webview? : vscode.WebviewPanel; pr...
PoetaKodu/vscode-pacc
src/ExtensionViewModel.ts
import { Pacc } from "./pacc/Pacc"; import { ProjectTreeProvider } from './views/Projects'; import { NewProjectWizardWebviewHandler } from "./views/NewProjectWizard"; export class PaccViewModel { model? : Pacc; newProjectWizard? : NewProjectWizardWebviewHandler; projectTree? : ProjectTreeProvider; setup() { t...
untypedjay/globefy
src/util/random.ts
import {getAllCountries} from '../services/api/countries'; export async function getRandomCountry() { const countries = await getAllCountries(); return countries[Math.floor(Math.random() * (countries.length - 1))]; }
untypedjay/globefy
src/App.tsx
import React, {useEffect, useState} from 'react'; import CountryCard from './components/CountryCard'; import './App.css'; import {getRandomCountry} from './util/random'; import styled from 'styled-components'; const AppStyles = styled.div` background-color: var(--clr-primary-lt); height: 100%; `; export default f...
untypedjay/globefy
src/components/CountryCard.tsx
import React from 'react'; import styled from 'styled-components'; interface Props { children: any; } const CountryCardStyles = styled.div` background-color: var(--clr-white); border-radius: var(--br-card); padding: 1em; img { max-width: 500px; } `; export default function CountryCard({ children }...
untypedjay/globefy
src/services/api/countries.ts
<gh_stars>0 const BASE_ENDPOINT = 'https://restcountries.eu/rest/v2'; export async function getAllCountries() { const requestOptions = { method: 'GET' }; const response = await fetch(`${BASE_ENDPOINT}/all`, requestOptions); return response.json(); }
Tejash-7span/gourley-web
src/app/general/models/parts/job-part.model.ts
import { PartModel } from './part.model'; export class JobPartModel { id: number; jobTypeId: number; jobId: number; partId = 0; quantity = 0; part: PartModel; public static createInstance(partId: number, quantity: number) { const jobPart = new JobPartModel(); jobPart.id = 0...
Tejash-7span/gourley-web
src/app/modules/workers/components/update-worker.component.ts
import { Component, OnInit, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { FormGroup, Validators, FormBuilder } from '@angular/forms'; import { WorkerService } from '../../../general/services/worker.service'; import { RejectedResponse } fr...
Tejash-7span/gourley-web
src/app/modules/parts/components/part-list.component.ts
<filename>src/app/modules/parts/components/part-list.component.ts import { Component, OnInit, ViewChild } from '@angular/core'; import { PER_PAGE, PAGINATION_MAX_SIZE, PRICE_FORMAT, ROUTES } from '../../../general/models/constants'; import { SelectedPage } from '../../../general/models/paged-data.model'; import { Route...
Tejash-7span/gourley-web
src/app/general/guards/auth.guard.ts
<gh_stars>0 import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, Router } from '@angular/router'; import { AuthenticationService } from '../services/authentication.service'; import { ROUTES } from '../models/constants'; import { LocalStorageService } from '../se...
Tejash-7span/gourley-web
src/app/_nav.ts
interface NavAttributes { [propName: string]: any; } interface NavWrapper { attributes: NavAttributes; element: string; } interface NavBadge { text: string; variant: string; } interface NavLabel { class?: string; variant: string; } export interface NavData { name?: string; url?: string; icon?: stri...
Tejash-7span/gourley-web
src/app/modules/parts/parts-routing.module.ts
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AuthGuard } from '../../general/guards/auth.guard'; import { PartListComponent } from './components/part-list.component'; import { CreatePartComponent } from './components/create-part.component'; import { UpdatePa...
Tejash-7span/gourley-web
src/app/general/components/register.component.ts
<reponame>Tejash-7span/gourley-web import { Component, OnInit, AfterViewInit, ViewChild, ElementRef } from '@angular/core'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { Router, ActivatedRoute } from '@angular/router'; import { UserService } from '../../modules/users/services/user.servic...
Tejash-7span/gourley-web
src/app/general/services/job-type.service.ts
<reponame>Tejash-7span/gourley-web<filename>src/app/general/services/job-type.service.ts<gh_stars>0 import { Injectable } from '@angular/core'; import { RestService } from './rest.service'; import { LocalStorageService } from './localstorage.service'; import { JobType } from '../models/jobtype/job-type.model'; @Injec...
Tejash-7span/gourley-web
src/app/modules/users/users-routing.module.ts
<filename>src/app/modules/users/users-routing.module.ts import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AuthGuard } from '../../general/guards/auth.guard'; import { UserListComponent } from './components/user-list.component'; import { CreateUserComponent } from...
Tejash-7span/gourley-web
src/app/modules/workers/workers-routing.module.ts
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AuthGuard } from '../../general/guards/auth.guard'; import { WorkerListComponent } from './components/worker-list.component'; import { CreateWorkerComponent } from './components/create-worker.component'; import { ...
Tejash-7span/gourley-web
src/app/general/services/part.service.ts
import { Injectable } from '@angular/core'; import { RestService } from './rest.service'; import { PartModel } from '../models/parts/part.model'; import { PagedData } from '../models/paged-data.model'; @Injectable() export class PartService { constructor(private restService: RestService) { } public getA...
Tejash-7span/gourley-web
src/app/modules/status/status.module.ts
import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ChartsModule } from 'ng2-charts/ng2-charts'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { ButtonsModule } from 'ngx-bootstrap/buttons'; import { StatusRoutingModule } from './stat...
Tejash-7span/gourley-web
src/app/modules/jobs/jobs.module.ts
<filename>src/app/modules/jobs/jobs.module.ts<gh_stars>0 import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ChartsModule } from 'ng2-charts/ng2-charts'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { ButtonsModule } from 'ngx-bootst...
Tejash-7span/gourley-web
src/app/general/models/jobs/job-list-model.ts
<filename>src/app/general/models/jobs/job-list-model.ts export class JobListModel { id = 0; jobTypeId = 0; contactName: string = null; name: string = null; customerAddress: string = null; customerPhone: string = null; active = false; invoiced = false; readyToBill = false; column1...
Tejash-7span/gourley-web
src/app/modules/jobs/components/bid-job.component.ts
import { Component, OnInit, ViewChild, ElementRef, AfterViewInit, Renderer2 } from '@angular/core'; import { Router } from '@angular/router'; import { FormGroup, Validators, FormBuilder } from '@angular/forms'; import { JobService } from '../services/job.service'; import { RejectedResponse } from '../../../general/serv...
Tejash-7span/gourley-web
src/app/general/models/jobs/job.model.ts
<reponame>Tejash-7span/gourley-web import { FormGroup } from '@angular/forms'; import { JobPartModel } from '../parts/job-part.model'; import { JobType } from '../jobtype/job-type.model'; import { JobTypeEnum } from '../../enums/worktype.enum'; export class JobModel { id = 0; jobTypeId = 0; contactName: st...
Tejash-7span/gourley-web
src/app/general/services/worker.service.ts
import { Injectable } from '@angular/core'; import { RestService } from './rest.service'; import { PagedData } from '../models/paged-data.model'; import { JobTypeEnum } from '../enums/worktype.enum'; import { WorkerModel } from '../models/workers/worker.model'; @Injectable() export class WorkerService { construct...
Tejash-7span/gourley-web
src/app/modules/dashboard/dashboard.module.ts
<gh_stars>0 import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { ChartsModule } from 'ng2-charts/ng2-charts'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { ButtonsModule } from 'ngx-bootstrap/buttons'; import { DashboardComponent } from './components/da...
Tejash-7span/gourley-web
src/app/general/models/loader.state.interface.ts
export interface LoaderState { show: boolean; }
Tejash-7span/gourley-web
src/app/general/services/status.service.ts
import { Injectable } from '@angular/core'; import { RestService } from './rest.service'; import { PagedData } from '../models/paged-data.model'; import { StatusModel } from '../models/status/status.model'; @Injectable() export class StatusService { constructor(private restService: RestService) { } publ...
Tejash-7span/gourley-web
src/app/general/enums/worktype.enum.ts
<reponame>Tejash-7span/gourley-web<gh_stars>0 export enum JobTypeEnum { All = 0, DryWall = 1, Stone = 2, Stucco = 3, MetalFraming = 4 }
Tejash-7span/gourley-web
src/app/general/models/jobs/job-calendar.model.ts
export class JobCalendar { id = 0; jobTypeId = 0; contactName: string = null; name: string = null; dateStarted: Date; readyToBill = false; invoiced = false; jobInvoiceDate: Date; }
Tejash-7span/gourley-web
src/app/general/models/change-password.request.ts
<filename>src/app/general/models/change-password.request.ts import { FormGroup } from '@angular/forms'; export class ChangePasswordRequest { userName: string; oldPassword: string; newPassword: string; public static createIntance(userName: string, form: FormGroup): ChangePasswordRequest { const...
Tejash-7span/gourley-web
src/app/modules/shared/shared.module.ts
import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { NgModule } from '@angular/core'; import { ModalModule } from 'ngx-bootstrap/modal/'; import { ConfirmModalComponent } from './components/confirm-modal.component'; import { UserImageComponent } from './components/user-...
Tejash-7span/gourley-web
src/app/general/models/workers/worker.model.ts
import { FormGroup } from '@angular/forms'; export class WorkerModel { id = 0; name = ''; active = true; jobTypeId = 0; public static createInstance(id: number, jobTypeId: number, form: FormGroup) { console.log(form.value); const worker = new WorkerModel(); worker.id = id; ...
Tejash-7span/gourley-web
src/app/general/models/parts/part.model.ts
import { FormGroup } from '@angular/forms'; export class PartModel { id = 0; description = ''; averagePrice = 0; crewCost = 0; priceB = 0; priceC = 0; active = true; jobTypeId = 0; public static createInstance(id: number, form: FormGroup) { const part = new PartModel(); ...
Tejash-7span/gourley-web
src/app/modules/shared/pipes/job-name.pipe.ts
import { Pipe, PipeTransform } from '@angular/core'; import { LocalStorageService } from '../../../general/services/localstorage.service'; import { JobType } from '../../../general/models/jobtype/job-type.model'; @Pipe({ name: 'jobTypeName' }) export class JobTypeNamePipe implements PipeTransform { jobTypes: JobTy...