repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
hoodmane/rp-recording | src/recorder.ts | import type {Player, ReplayData} from "ractive-player";
import type RecordingManager from "./recording-manager";
export type IntransigentReturn = [number, number];
export abstract class Recorder<T = unknown, F = T[]> {
protected manager: RecordingManager;
protected player: Player;
/**
A recorder is intransi... |
hoodmane/rp-recording | src/types/MediaRecorder.ts | declare interface MediaRecorderErrorEvent extends Event {
name: string;
}
declare interface MediaRecorderDataAvailableEvent extends Event {
data: Blob;
}
interface MediaRecorderEventMap {
"dataavailable": MediaRecorderDataAvailableEvent;
"error": MediaRecorderErrorEvent ;
"pause": Event;
"resume": Event;
... |
hoodmane/rp-recording | src/recorders/replay-data-recorder.ts | <filename>src/recorders/replay-data-recorder.ts<gh_stars>1-10
import * as React from "react";
import {useMemo, useState} from "react";
import {Recorder} from "../recorder";
import {Player, Utils} from "ractive-player";
const {bind} = Utils.misc,
{onClick} = Utils.mobile,
{formatTimeMs, parseTime} = Utils.... |
hoodmane/rp-recording | src/types.ts | import * as React from "react";
import type {Recorder} from "./recorder";
export interface RecorderPlugin {
enabled?: () => boolean;
icon: JSX.Element;
key: string;
name: string;
recorder: Recorder;
saveComponent: React.FC<{data: any}>;
title?: string;
}
|
hoodmane/rp-recording | src/RecordingRow.tsx | <filename>src/RecordingRow.tsx<gh_stars>1-10
import * as React from "react";
import {useCallback, useState} from "react";
import {usePlayer} from "ractive-player";
import type {RecorderPlugin} from "./types";
interface Props {
data: {
[key: string]: any;
};
pluginsByKey: {
[key: string]: RecorderPlugin... |
hoodmane/rp-recording | src/plugin.tsx | import "../style.css";
export type {RecorderPlugin} from "./types";
import RecordingControl from "./Control";
export {RecordingControl};
import RecordingManager from "./recording-manager";
export {RecordingManager};
export {Recorder} from "./recorder";
export {ReplayDataRecorder} from "./recorders/replay-data-recor... |
hoodmane/rp-recording | src/recorders/audio-recorder.tsx | import "../types/MediaRecorder";
import * as React from "react";
import {Recorder, IntransigentReturn} from "../recorder";
import type {RecorderPlugin} from "../types";
interface RecordData {
startDelay: number;
stopDelay: number;
url: string;
}
const icon = (
<g transform="scale(0.126261032057) translate(1... |
hoodmane/rp-recording | src/recorders/marker-recorder.tsx | import * as React from "react";
import {useMemo, useState} from "react";
import {Recorder} from "../recorder";
import type {RecorderPlugin} from "../types";
import {Player, Utils} from "ractive-player";
const {bind} = Utils.misc,
{onClick} = Utils.mobile,
{formatTimeMs} = Utils.time;
type Marker = [strin... |
rhdeck/dependency-resolver | src/index.ts | <gh_stars>0
export class DepResolverError extends Error {
constructor(message: string) {
super(message);
}
}
function removeExcluded(
depMap: { [key: string]: any },
node: string,
excludeItems: string[]
) {
depMap[node] = depMap[node].filter(function (item: string) {
return !excludeItems.includes(it... |
rhdeck/dependency-resolver | spec/dep-res.spec.ts | <filename>spec/dep-res.spec.ts
import { resolve as DepResolver, DepResolverError } from "../src/dep-res";
describe("Dependencies resolver", function () {
it("should resolve shallow dep-map", function () {
let depMap = { a: ["b"], b: [] };
expect(DepResolver(depMap)).toEqual(["b", "a"]);
});
it("should r... |
oha-Ohashi/ts_ideal_layout | src/calc.ts | export class Calculation{
costs: {position: number, movement: number}
xy_array: number[][]
n_alternate: number
cost_sum: number
constructor(xy_array: number[][]){
this.costs = {
position: 0,
movement: 0
}
this.xy_array = xy_array
this.n_alternate = 0
this.create_cost()
this.cost_sum = this.costs.... |
oha-Ohashi/ts_ideal_layout | src/io.ts | <filename>src/io.ts
export function string_to_xyarray(text: string, keys_in1row: string): number[][]{
let res: number[][] = []
text.split("").forEach((item) => {
const xy = c_to_xy(item, keys_in1row)
if(xy != null){
res.push(xy)
}
})
return res
}
function c_to_xy(item: string, keys_in1row: string): number[... |
oha-Ohashi/ts_ideal_layout | src/index.ts | <reponame>oha-Ohashi/ts_ideal_layout<gh_stars>0
import * as ev from "./evaluate";
import * as sch from "./search";
//ev.disp_eval('QWERTYUIOPASDFGHJKL_ZXCVBNM___')
|
skovlund/vsts-fsharp | Tasks/FAKE5.dev/runFake5.ts |
"use strict";
import * as tl from "vsts-task-lib/task";
import * as trm from 'vsts-task-lib/toolrunner';
import * as path from "path";
import * as fs from "fs";
import * as common from "vsts-fsharp-task-common";
import * as semver from "semver";
import { isNullOrUndefined } from "util";
function exitWithError(messag... |
skovlund/vsts-fsharp | Tasks/SetPaketCredentialProvider.dev/setCredentialManager.ts |
"use strict";
import * as tl from "vsts-task-lib/task";
import * as common from "vsts-fsharp-task-common";
function exitWithError(message, exitCode) {
tl.error(message);
tl.setResult(tl.TaskResult.Failed, message);
process.exit(exitCode);
}
async function doMain() {
try {
await common.setupPaketCredenti... |
skovlund/vsts-fsharp | Common/myvault.ts |
// This is a defensive copy from https://raw.githubusercontent.com/Microsoft/vsts-task-lib/91e03a14f1188edc658954320f9d75565b2d1da5/node/vault.ts
// To save ourself from breaking changes...
// Add some members for retrieving the decrypted value and use IV.
import fs = require('fs');
import crypto = require('crypto');... |
skovlund/vsts-fsharp | Common/githubTyped.ts | <filename>Common/githubTyped.ts
// from http://json2ts.com/
export interface Author {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_... |
skovlund/vsts-fsharp | Tasks/PaketCredentialCleanup.dev/cleanup.ts | <filename>Tasks/PaketCredentialCleanup.dev/cleanup.ts
"use strict";
import * as tl from "vsts-task-lib/task";
import * as fs from "fs";
import * as os from "os";
import * as tmp from "tmp";
import * as path from "path";
import * as common from "vsts-fsharp-task-common";
import { IExecOptions } from "vsts-task-lib/too... |
skovlund/vsts-fsharp | Common/paketCredMgr.ts | <gh_stars>10-100
"use strict";
import * as tl from "vsts-task-lib";
import * as tmp from "tmp";
import * as path from "path";
import * as fs from 'fs';
export async function setup() {
tmp.setGracefulCleanup();
let credentialProviderPath = path.join(__dirname, "CredentialProvider");
if (!fs.existsSync(`$... |
skovlund/vsts-fsharp | Tasks/FAKE5Vault.dev/runFake5Vault.ts |
"use strict";
import * as tl from "vsts-task-lib/task";
import * as common from "vsts-fsharp-task-common";
function exitWithError(message, exitCode) {
tl.error(message);
tl.setResult(tl.TaskResult.Failed, message);
process.exit(exitCode);
}
async function doMain() {
try {
let secretFilePath = tl.getPath... |
skovlund/vsts-fsharp | Common/common.ts | <filename>Common/common.ts
"use strict";
import * as semver from "semver";
import * as credMgr from "./paketCredMgr";
import * as vault from "./myvault";
import * as fake5 from "./fake5";
export async function setupPaketCredentialManager() {
await credMgr.setup();
}
export async function cleanupPaketCredentialM... |
skovlund/vsts-fsharp | Common/fake5.ts |
import * as path from "path";
import * as fs from "fs";
import * as tl from "vsts-task-lib";
import * as semver from "semver";
import * as rm from 'typed-rest-client';
import * as toolLib from 'vsts-task-tool-lib/tool';
import * as ghTyped from "./githubTyped";
import * as vault from "./myvault";
import { isNullOrUnde... |
sadasant/ms-rest-browserauth | samples/react-app/src/constants.ts | // react-scripts supports reading custom environment variables from an .env file
// and will automatically import any environment variable defined there if it
// starts with the pattern `REACT_APP_`
// Please refer to this document for more information:
// https://create-react-app.dev/docs/adding-custom-environment-var... |
ianlibanio/wongames-client | src/templates/Home/test.tsx | <reponame>ianlibanio/wongames-client
import 'match-media-mock'
import { screen } from '@testing-library/react'
import { renderWithTheme } from 'utils/test-utils'
import bannersMock from 'components/BannerSlider/mock'
import gamesMock from 'components/GameCardSlider/mock'
import highlightMock from 'components/Highlight... |
ianlibanio/wongames-client | src/components/Container/test.tsx | <reponame>ianlibanio/wongames-client
import theme from 'styles/theme'
import { renderWithTheme } from 'utils/test-utils'
import { Container } from '.'
describe('<Container />', () => {
it('should render the heading', () => {
const { container } = renderWithTheme(
<Container>
<span>Won Games</span>
... |
ianlibanio/wongames-client | src/components/Highlight/mock.ts | export default {
title: 'Read Dead is back!',
subtitle: "Come see John's new adventures",
backgroundImage: '/img/red-dead-img.png',
buttonLabel: 'Buy now',
buttonLink: '/rdr2',
alignment: 'right'
}
|
ianlibanio/wongames-client | src/components/BannerSlider/mock.ts | import { BannerProps } from 'components/Banner'
export default [
{
img: 'https://cdn1.epicgames.com/1b8a504ec52d4430b65cca2990ad6c7f/offer/EGS_Crashlands_ButterscotchShenanigans_S1-2560x1440-2971f9f3be6e0b5b7e69818577240f54.jpg',
title: 'Defy death 1',
subtitle: '<p>Play the new <strong>CrashLands</stron... |
ianlibanio/wongames-client | src/components/Button/index.tsx | import {
ReactNode,
AnchorHTMLAttributes,
ButtonHTMLAttributes,
ElementType
} from 'react'
import * as S from './styles'
type ButtonTypes =
| AnchorHTMLAttributes<HTMLAnchorElement>
| ButtonHTMLAttributes<HTMLButtonElement>
export type ButtonProps = {
size?: 'small' | 'medium' | 'large'
fullWidth?: bo... |
ianlibanio/wongames-client | src/components/Highlight/stories.tsx | import { Meta, Story } from '@storybook/react'
import { Highlight, HighlightProps } from '.'
import item from './mock'
export default {
title: 'Highlight',
component: Highlight,
args: { ...item }
} as Meta
export const Default: Story<HighlightProps> = (args) => (
<div style={{ maxWidth: '104rem' }}>
<High... |
ianlibanio/wongames-client | src/components/MediaMatch/stories.tsx | import { Meta, Story } from '@storybook/react'
import { MediaMatch } from '.'
export default {
title: 'MediaMatch',
component: MediaMatch,
parameters: {
controls: {
include: 'title'
}
}
} as Meta
export const Desktop: Story = ({ title }) => (
<MediaMatch greaterThan="medium">{title}</MediaMatc... |
ianlibanio/wongames-client | src/components/Footer/stories.tsx | <gh_stars>0
import { Meta, Story } from '@storybook/react'
import { Footer } from '.'
export default {
title: 'Footer',
component: Footer
} as Meta
export const Default: Story = () => (
<div style={{ maxWidth: '130rem', margin: '0 auto' }}>
<Footer />
</div>
)
|
ianlibanio/wongames-client | src/components/Button/stories.tsx | import { Meta, Story } from '@storybook/react'
import { AddShoppingCart } from '@styled-icons/material-outlined/AddShoppingCart'
import { HeartOutline } from '@styled-icons/evaicons-outline/HeartOutline'
import { Button, ButtonProps } from '.'
export default {
title: 'Button',
component: Button,
args: {
chil... |
ianlibanio/wongames-client | src/components/GameCardSlider/mock.ts | import { GameCardProps } from 'components/GameCard'
export default [
{
title: 'Red Dead Redemption',
developer: 'Rockstar Games',
img: '/img/red-dead-card.png',
price: 'R$235,00',
promotionalPrice: 'R$215,00'
},
{
title: 'Red Dead Redemption',
developer: 'Rockstar Games',
img: '/i... |
ianlibanio/wongames-client | src/components/Banner/stories.tsx | <gh_stars>0
import { Meta, Story } from '@storybook/react'
import { Banner, BannerProps } from '.'
export default {
title: 'Banner',
component: Banner,
args: {
img: 'https://cdn1.epicgames.com/1b8a504ec52d4430b65cca2990ad6c7f/offer/EGS_Crashlands_ButterscotchShenanigans_S1-2560x1440-2971f9f3be6e0b5b7e6981857... |
ianlibanio/wongames-client | src/components/Slider/index.tsx | <gh_stars>0
import { ReactNode } from 'react'
import SlickSlider, { Settings } from 'react-slick'
import * as S from './styles'
export type SliderSettings = Settings
export type SliderProps = {
children: ReactNode
settings: SliderSettings
}
export const Slider = ({ children, settings }: SliderProps) => (
<S.W... |
ianlibanio/wongames-client | src/components/Slider/styles.ts | <gh_stars>0
import styled from 'styled-components'
export const Wrapper = styled.section`
.slick-slider {
position: relative;
display: block;
box-sizing: border-box;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: ... |
ianlibanio/wongames-client | src/components/BannerSlider/styles.ts | <gh_stars>0
import styled, { css } from 'styled-components'
import media from 'styled-media-query'
import * as BannerStyles from 'components/Banner/styles'
export const Wrapper = styled.section`
${({ theme }) => css`
.slick-dots {
list-style: none;
display: flex !important;
align-items: center... |
ianlibanio/wongames-client | src/components/Footer/index.tsx | import { Heading } from 'components/Heading'
import { Logo } from 'components/Logo'
import Link from 'next/link'
import * as S from './styles'
export const Footer = () => (
<S.Wrapper>
<Logo color="blue" />
<S.Content>
<S.Column>
<Heading color="black" size="small" lineBottom lineColor="second... |
ianlibanio/wongames-client | src/components/Heading/stories.tsx | <reponame>ianlibanio/wongames-client
import { Meta, Story } from '@storybook/react'
import { Heading, HeadingProps } from '.'
export default {
title: 'Heading',
component: Heading
} as Meta
export const Default: Story<HeadingProps> = (args) => <Heading {...args} />
Default.args = {
children: 'News',
color: '... |
ianlibanio/wongames-client | src/pages/index.tsx | import { GetServerSideProps } from 'next'
import { Home, HomeTemplateProps } from 'templates/Home'
import bannersMock from 'components/BannerSlider/mock'
import gamesMock from 'components/GameCardSlider/mock'
import highlightMock from 'components/Highlight/mock'
export default function Index(props: HomeTemplateProps)... |
ianlibanio/wongames-client | src/pages/_app.tsx | <reponame>ianlibanio/wongames-client
import type { AppProps } from 'next/app'
import { DefaultSeo } from 'next-seo'
import SEO from '../../next-seo.config'
import theme from 'styles/theme'
import { GlobalStyle } from 'styles/global'
import { ThemeProvider } from 'styled-components'
function MyApp({ Component, pageP... |
ianlibanio/wongames-client | src/components/Heading/index.tsx | import { ReactNode } from 'react'
import * as S from './styles'
export type LineColors = 'primary' | 'secondary'
export type HeadingProps = {
children: ReactNode
color?: 'white' | 'black'
lineLeft?: boolean
lineBottom?: boolean
lineColor?: LineColors
size?: 'small' | 'medium'
}
export const Heading = ({
... |
ianlibanio/wongames-client | src/components/GameCardSlider/test.tsx | <reponame>ianlibanio/wongames-client
import 'match-media-mock'
import { screen } from '@testing-library/react'
import { GameCardSlider } from '.'
import { GameCardProps } from 'components/GameCard'
import { renderWithTheme } from 'utils/test-utils'
const items = [
{
title: 'Red Dead Redemption',
developer: ... |
ianlibanio/wongames-client | src/components/BannerSlider/stories.tsx | <filename>src/components/BannerSlider/stories.tsx
import { Meta, Story } from '@storybook/react'
import { BannerSlider, BannerSliderProps } from '.'
import items from './mock'
export default {
title: 'BannerSlider',
component: BannerSlider,
args: { items },
parameters: {
layout: 'fullscreen',
backgrou... |
ianlibanio/wongames-client | src/components/Logo/stories.tsx | import { Meta, Story } from '@storybook/react'
import { Logo, LogoProps } from '.'
export default {
title: 'Logo',
component: Logo
} as Meta
export const Default: Story<LogoProps> = (args) => <Logo {...args} />
Default.args = {
color: 'white',
size: 'normal',
hideOnMobile: false
}
|
ianlibanio/wongames-client | src/templates/Home/index.tsx | import { BannerProps } from 'components/Banner'
import { GameCardProps } from 'components/GameCard'
import { Highlight, HighlightProps } from 'components/Highlight'
import * as S from './styles'
import { Container } from 'components/Container'
import { Footer } from 'components/Footer'
import { Heading } from 'compon... |
ianlibanio/wongames-client | src/components/GameCard/test.tsx | <filename>src/components/GameCard/test.tsx<gh_stars>0
import { screen, fireEvent } from '@testing-library/react'
import { renderWithTheme } from 'utils/test-utils'
import { GameCard } from '.'
const props = {
title: 'Red Dead Redemption',
developer: 'Rockstar Games',
price: 'R$235,00',
img: '/img/red-dead-car... |
ianlibanio/wongames-client | src/components/GameCard/stories.tsx | <gh_stars>0
import { Meta, Story } from '@storybook/react'
import { GameCard, GameCardProps } from '.'
export default {
title: 'GameCard',
component: GameCard,
args: {
title: 'Red Dead Redemption',
developer: 'Rockstar Games',
price: 'R$235,00',
img: '/img/red-dead-card.png',
promotionalPrice... |
ianlibanio/wongames-client | src/components/GameCardSlider/stories.tsx | <filename>src/components/GameCardSlider/stories.tsx<gh_stars>0
import { Meta, Story } from '@storybook/react'
import { GameCardSlider, GameCardSliderProps } from '.'
import items from './mock'
export default {
title: 'GameCardSlider',
component: GameCardSlider,
args: { items, color: 'white' },
parameters: {
... |
ianlibanio/wongames-client | src/components/Menu/index.tsx | <reponame>ianlibanio/wongames-client
import { useState } from 'react'
import { Menu2 as MenuIcon } from '@styled-icons/remix-fill/Menu2'
import { ShoppingCart as ShoppingCartIcon } from '@styled-icons/material-outlined/ShoppingCart'
import { Search as SearchIcon } from '@styled-icons/material-outlined/Search'
import {... |
mbellagamba/rn-feel-your-movie | http/useHttp.d.ts | declare function useHttp(input: RequestInfo): Promise<Response>;
|
verberden/dumb-repo | src/dto/hello.dto.ts | import { IsInt, IsOptional } from "class-validator";
export class HelloDto {
@IsOptional()
@IsInt()
id:number;
} |
verberden/dumb-repo | src/app.service.ts | import { Injectable } from '@nestjs/common';
import { HelloDto } from './dto/hello.dto';
@Injectable()
export class AppService {
getHello(helloDto: HelloDto): string {
return `${helloDto.id} Hello World!`;
}
}
|
onionstack/ext.ArduinoJson | arduinoC/oled12864.ts |
enum SIZE {
//% block="29*29"
1,
//% block="58*58"
2
}
enum LINE {
//% block="1"
1,
//% block="2"
2,
//% block="3"
3,
//% block="4"
4
}
enum BTN {
//% block="A"
A,
//% block="B"
B,
//% block="A+B"
AB
}
//% color="#AA278D" iconWidth=50 iconHeig... |
nileshr/action-slack | __tests__/client.test.ts | <filename>__tests__/client.test.ts
import nock from 'nock';
import { readFileSync } from 'fs';
import { resolve } from 'path';
process.env.GITHUB_WORKFLOW = 'PR Checks';
process.env.GITHUB_SHA = 'b24f03a32e093fe8d55e23cfd0bb314069633b2f';
process.env.GITHUB_REF = 'refs/heads/feature/19';
process.env.GITHUB_EVENT_NAME ... |
Open-Attestation/react-component-template | src/components/Counter.tsx | <reponame>Open-Attestation/react-component-template
import React, { useState, FunctionComponent } from "react";
import styled from "@emotion/styled";
import { getLogger } from "../logger";
const { trace } = getLogger("Counter");
interface CounterProps {
/** Initial counter value */
initialValue?: number;
}
const ... |
Open-Attestation/react-component-template | src/components/Counter.test.tsx | import React from "react";
import { Counter } from "./Counter";
import { render, fireEvent } from "@testing-library/react";
describe("counter component", () => {
it("should increment counter by 1 when clicking on increment button", () => {
const { getByText } = render(<Counter />);
expect(getByText("Counter:... |
timurgaitov/react-native-view-shot | src/index.d.ts | <gh_stars>0
/*!
*
* Copyright 2017 - acrazing
*
* @author acrazing <EMAIL>
* @since 2017-11-11 16:03:17
* @version 1.0.0
* @desc react-native-view-shot.d.ts
*/
declare module 'react-native-view-shot' {
import { Component, ReactInstance, RefObject } from 'react'
import { ViewStyle } from 'react-native'
... |
pierce403/0x-monorepo | packages/website/ts/pages/cfl/code_stepper.tsx | <filename>packages/website/ts/pages/cfl/code_stepper.tsx
import * as React from 'react';
import styled from 'styled-components';
import { Definition, DefinitionProps } from 'ts/components/definition';
import { CodeTab, TabbedCodeDemo } from 'ts/components/tabbed_code_demo';
const StepperContainer = styled.div`
di... |
pierce403/0x-monorepo | packages/contract-wrappers/src/index.ts | <reponame>pierce403/0x-monorepo<filename>packages/contract-wrappers/src/index.ts
export * from '@0x/abi-gen-wrappers';
export * from '@0x/contract-addresses';
export { ContractWrappers } from './contract_wrappers';
export { CoordinatorWrapper } from './coordinator_wrapper';
export { BlockRange } from '@0x/base-contr... |
pierce403/0x-monorepo | packages/website/ts/pages/cfl/default_data.ts | <gh_stars>1-10
import { CFLMetricsPairData } from 'ts/types';
export const defaultData: CFLMetricsPairData[] = [
{
baseAssetSymbol: 'ETH',
quoteAssetSymbol: 'DAI',
tradeAmount: 10000,
},
{
baseAssetSymbol: 'ETH',
quoteAssetSymbol: 'USDC',
tradeAmount: 10000,
... |
pierce403/0x-monorepo | packages/website/ts/pages/cfl/metrics.tsx | import * as React from 'react';
import styled from 'styled-components';
import { InfoTooltip } from 'ts/components/info_tooltip';
import { Paragraph } from 'ts/components/text';
const MetricsContainer = styled.div`
padding: 20px;
background-color: ${props => props.theme.darkBgColor};
width: 100%;
`;
cons... |
pierce403/0x-monorepo | packages/website/ts/pages/cfl.tsx | import * as React from 'react';
import styled from 'styled-components';
import { Banner } from 'ts/components/banner';
import { Button } from 'ts/components/button';
import { Definition } from 'ts/components/definition';
import { DocumentTitle } from 'ts/components/document_title';
import { Hero } from 'ts/components/... |
pierce403/0x-monorepo | packages/website/ts/components/tabbed_code_demo.tsx | import * as React from 'react';
import styled from 'styled-components';
import { CodeDemo } from 'ts/components/code_demo';
export interface CodeTab {
code: string;
label: string;
language: string;
}
export interface TabbedCodeDemoProps {
tabs: CodeTab[];
activeIndex: number;
onTabClick: (ind... |
pierce403/0x-monorepo | packages/website/ts/components/info_tooltip.tsx | import * as React from 'react';
import ReactTooltip from 'react-tooltip';
import styled from 'styled-components';
import { Icon } from 'ts/components/icon';
const InfoTooltipContainer = styled.div<InfoTooltipProps>`
cursor: pointer;
position: relative;
left: ${props => props.left || '0px'};
`;
const Toolt... |
pierce403/0x-monorepo | packages/website/ts/pages/cfl/cfl_metrics.tsx | <reponame>pierce403/0x-monorepo<filename>packages/website/ts/pages/cfl/cfl_metrics.tsx
import numeral from 'numeral';
import * as React from 'react';
import styled from 'styled-components';
import { Icon } from 'ts/components/icon';
import { defaultData } from 'ts/pages/cfl/default_data';
import { Metrics, MetricValue... |
MKrupauskas/react-template | src/components/App/App.tsx | import React from 'react'
import styles from './app.module.scss'
const App: React.FC = () => {
return (
<div className={styles.app}>
<header className={styles['app-header']}>
<p>
Edit <code>src/components/App.tsx</code> and save to reload.
</p>
</header>
</div>
)
}
e... |
MohammadAmirHekmati/User-Athentication | src/uploadfile/upload-file.config.service.ts | import { MulterModuleOptions, MulterOptionsFactory } from '@nestjs/platform-express';
import { diskStorage } from 'multer';
export class UploadFileConfigService implements MulterOptionsFactory{
createMulterOptions(): Promise<MulterModuleOptions> | MulterModuleOptions {
const options:MulterModuleOptions={
s... |
MohammadAmirHekmati/User-Athentication | src/auth/enums/country-banned.enums.ts | export const bannedCountries:string[]=
['unitedstateamerica','iran'] |
MohammadAmirHekmati/User-Athentication | src/user/repository/user.reposiory.ts | import { EntityRepository, Repository } from 'typeorm';
import { UserEntity } from '../model/user.entity';
import { BadRequestException, ConflictException, Injectable, NotFoundException } from '@nestjs/common';
import { UserRegisterDto } from '../dto/user-register.dto';
import { RoleEnum } from 'src/auth/role.enum';
im... |
MohammadAmirHekmati/User-Athentication | src/database/postgres-configuration.service.ts | <reponame>MohammadAmirHekmati/User-Athentication<gh_stars>0
import { TypeOrmOptionsFactory,TypeOrmModuleOptions } from '@nestjs/typeorm';
export class PostgresConfigurationService implements TypeOrmOptionsFactory{
createTypeOrmOptions(connectionName?: string): Promise<TypeOrmModuleOptions> | TypeOrmModuleOptions {
... |
MohammadAmirHekmati/User-Athentication | src/user/dto/update-user-profile.dto.ts | export class UpdateUserProfileDto {
email:string
password:<PASSWORD>
username:string
} |
MohammadAmirHekmati/User-Athentication | src/custom-exception/custom-exeption.handler.ts | import { HttpException, HttpStatus } from '@nestjs/common';
export class ErrorsUserNotFound extends HttpException{
constructor() {
super('User Is Not Found In Database',HttpStatus.NOT_FOUND);
}
}
export class ErrorsPoviderDontHaveAccess extends HttpException{
constructor() {
super('Provider Do Not Hav... |
MohammadAmirHekmati/User-Athentication | src/database/database.module.ts | <filename>src/database/database.module.ts<gh_stars>0
import { Module } from '@nestjs/common';
import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm';
import { PostgresConfigurationService } from './postgres-configuration.service';
const config=require('config')
const dbConfiguation=config.get('db')
@Mod... |
MohammadAmirHekmati/User-Athentication | src/user/model/user.entity.ts | <reponame>MohammadAmirHekmati/User-Athentication<filename>src/user/model/user.entity.ts
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { RoleGuard } from '../../auth/guard/role.guard';
import { RoleEnum } from '../../auth/role.enum';
@Entity()
export class UserEntity {
@PrimaryGeneratedColu... |
MohammadAmirHekmati/User-Athentication | src/user/dto/pagination.dto.ts | import { ApiProperty } from '@nestjs/swagger';
export class PaginationDto {
@ApiProperty()
limit:number
@ApiProperty()
page:number
} |
MohammadAmirHekmati/User-Athentication | src/auth/guard/ip-controll.guard.ts | import { CanActivate, ExecutionContext } from '@nestjs/common';
import axios from 'axios';
import { ICheckIpResponseApi } from '../interfaces/check-ip-api-response.interface';
import { bannedCountries } from '../enums/country-banned.enums';
export class IpControllGuard implements CanActivate{
async canActivate(conte... |
MohammadAmirHekmati/User-Athentication | src/user/middlewares/test.middleware.ts | import { Logger, NestMiddleware } from '@nestjs/common';
export class TestMiddleware implements NestMiddleware{
private logger=new Logger()
use(req: any, res: any, next: () => void): any {
const remoteAddress=req.connection.remoteAddress
this.logger.log(remoteAddress)
next()
}
} |
MohammadAmirHekmati/User-Athentication | src/user/dto/user-login.dto.ts | import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, MaxLength, MinLength } from 'class-validator';
export class UserLoginDto {
@ApiProperty()
@IsNotEmpty()
@MaxLength(15,{message:'Max length of this parametr should be 15 char'})
@MinLength(3,{message:'Min length of this char should be 3 char'})... |
MohammadAmirHekmati/User-Athentication | src/auth/jwt-configuartion.service.ts | import {JwtOptionsFactory,JwtModuleOptions} from '@nestjs/jwt'
export class JwtConfiguartionService implements JwtOptionsFactory{
createJwtOptions(): Promise<JwtModuleOptions> | JwtModuleOptions {
const options:JwtModuleOptions={
secret:'11538832',
signOptions:{
// expiresIn:'3600s',
a... |
MohammadAmirHekmati/User-Athentication | src/auth/role.enum.ts | <gh_stars>0
export enum RoleEnum {
ADMIN='admin',
SUPPORTER='supporter',
USER='user',
SUPERADMIN='superadmin'
} |
MohammadAmirHekmati/User-Athentication | src/auth/auth.module.ts | import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { JwtConfiguartionService } from './jwt-configuartion.service';
import { JwtGuard } from './guard/jwt.guard';
import { JwtStrategy } from './strategy/jwt.strategy';
import { RoleGuard } from './guard/role.guard';
@Module({
impo... |
MohammadAmirHekmati/User-Athentication | src/auth/decorator/role-guard.decorator.ts | <reponame>MohammadAmirHekmati/User-Athentication
import { RoleEnum } from '../role.enum';
import { SetMetadata } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
export const ROLES='roles'
export const RoleGuardDecorator=(...roles:RoleEnum[])=>SetMetadata(ROLES,roles)
|
MohammadAmirHekmati/User-Athentication | src/sentmail/sentmail.module.ts | import { Module } from '@nestjs/common';
import { MailerModule } from '@nestjs-modules/mailer';
import { SentMailConfigService } from './sent-mail-config.service';
@Module({
imports:[MailerModule.forRootAsync({useClass:SentMailConfigService})]
})
export class SentmailModule {}
|
MohammadAmirHekmati/User-Athentication | src/user/services/user.service.ts | <reponame>MohammadAmirHekmati/User-Athentication<gh_stars>0
import {
BadRequestException, Body,
ConflictException,
Injectable,
NotFoundException,
Param, Res,
UploadedFile,
} from '@nestjs/common';
import { UserRegisterDto } from '../dto/user-register.dto';
import { UserReposiory } from '../repository/user.r... |
MohammadAmirHekmati/User-Athentication | src/user/controllers/user.controller.ts | import {
Body,
Controller,
Delete,
Get,
HttpStatus,
Param,
ParseIntPipe,
Post,
Put,
Query,
Res,
UploadedFile,
UseGuards,
UseInterceptors,
ValidationPipe,
} from '@nestjs/common';
import { UserRegisterDto } from '../dto/user-register.dto';
import { UserService } from '../services/user.servi... |
MohammadAmirHekmati/User-Athentication | src/auth/interfaces/check-ip-api-response.interface.ts | export interface ICheckIpResponseApi {
ip: string;
ip_number: string;
ip_version: number;
country_name: string;
country_code2: string;
isp: string;
response_code: string;
response_message: string;
}
|
MohammadAmirHekmati/User-Athentication | src/user/query-type/user-paginate-query-type.ts | import { UserEntity } from '../model/user.entity';
export class UserPaginateQueryType {
data:UserEntity[]
limit:number
page:number
total:number
} |
MohammadAmirHekmati/User-Athentication | src/app.module.ts | import { Module } from '@nestjs/common';
import { AuthModule } from './auth/auth.module';
import { DatabaseModule } from './database/database.module';
import { UserModule } from './user/user.module';
import { UploadfileModule } from './uploadfile/uploadfile.module';
import { SentmailModule } from './sentmail/sentmail.m... |
MohammadAmirHekmati/User-Athentication | src/sentmail/sent-mail-config.service.ts | import { MailerOptions, MailerOptionsFactory } from '@nestjs-modules/mailer';
export class SentMailConfigService implements MailerOptionsFactory{
createMailerOptions(): Promise<MailerOptions> | MailerOptions {
const options:MailerOptions={
transport:{
host:'smtp.gmail.com',
port:'465',
... |
MohammadAmirHekmati/User-Athentication | src/user/dto/user-register.dto.ts | <gh_stars>0
import { ApiProperty } from '@nestjs/swagger';
import { IsDefined, IsEmail, IsNotEmpty, MaxLength, MinLength } from 'class-validator';
import { BadRequestException } from '@nestjs/common';
export class UserRegisterDto {
@ApiProperty()
@IsNotEmpty()
@IsDefined()
@MaxLength(15,{message:'Max length of ... |
MohammadAmirHekmati/User-Athentication | src/user/user.module.ts | import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserReposiory } from './repository/user.reposiory';
import { UserService } from './services/user.service';
import { UserController } from './controllers/user.controller';
imp... |
MohammadAmirHekmati/User-Athentication | src/auth/guard/role.guard.ts | import { Body, CanActivate, ExecutionContext } from '@nestjs/common';
import { Observable } from 'rxjs';
import { RoleEnum } from '../role.enum';
import { Reflector } from '@nestjs/core';
import { ROLES } from '../decorator/role-guard.decorator';
import { query } from 'express';
export class GetUserContext {
usernam... |
theolavaux/github-new-project-clone | src/partials/Initialization/Initialization.tsx | import React from 'react';
import './Initialization.scss';
interface InitializationProps {
createReadme: boolean;
addGitIgnore: boolean;
useLicense: boolean;
onReadmeSet: Function;
onGitIgnoreSet: Function;
onLicenseSet: Function;
}
const Initialization = (props: InitializationProps) => {
const {
cr... |
theolavaux/github-new-project-clone | src/App.tsx | <gh_stars>0
import React, { useState } from 'react';
import './App.scss';
import Head from './partials/Head/Head';
import Description from './partials/Description/Description';
import Privacy from './partials/Privacy/Privacy';
import Initialization from './partials/Initialization/Initialization';
const App = () => {
... |
theolavaux/github-new-project-clone | src/partials/Privacy/Privacy.tsx | import React from 'react';
import './Privacy.scss';
interface PrivacyProps {
onRepositoryPrivacySet: Function;
repositoryPrivacy: string;
}
const Privacy = (props: PrivacyProps) => {
const { onRepositoryPrivacySet, repositoryPrivacy } = props;
return (
<section className="category privacy">
<div cl... |
theolavaux/github-new-project-clone | src/partials/Description/Description.tsx | import React from 'react';
import './Description.scss';
interface DescriptionProps {
onRepositoryOwnerSet: Function;
onRepositoryNameSet: Function;
onRepositoryDescriptionSet: Function;
ownersList: { name: string; value: string }[];
repositoryName: string;
repositoryOwner: string;
repositoryDescription: ... |
theolavaux/github-new-project-clone | src/partials/Head/Head.tsx | <filename>src/partials/Head/Head.tsx<gh_stars>0
import React from 'react';
import './Head.scss';
const Head = () => (
<section className="category head">
<h1 className="head__title">Create a new repository</h1>
<p className="head__intro">
A repository contains all project files, including the revision ... |
maoberlehner/talk-an-introduction-to-typescript | src/index.ts | import { Car } from './classes/Car';
import { ElectroEngine } from './classes/ElectroEngine';
import { GasolineEngine } from './classes/GasolineEngine';
const electroEnginePower = 100;
const electroEngine = new ElectroEngine(electroEnginePower);
const electroCar = new Car(electroEngine);
electroCar.start();
const gas... |
maoberlehner/talk-an-introduction-to-typescript | src/classes/ElectroEngine.ts | import { IEngine } from '../interfaces/IEngine';
export class ElectroEngine implements IEngine {
constructor(public kw: number) { }
public start() {
// tslint:disable-next-line
console.log(`A ${this.kw}kw electro engine makes: Fip Fip`);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.