repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
ymatzki/eslint-plugin | lib/rules/prefer-parameter-instance.ts | <reponame>ymatzki/eslint-plugin
// ------------------------------------------------------------------------------
// Imports
// ------------------------------------------------------------------------------
import { createRule, TSKeywordMap } from "../util";
import {
TSESTree,
AST_NODE_TYPES,
} from "@typescript-e... |
ymatzki/eslint-plugin | lib/rules/use-name-space-import.ts | <reponame>ymatzki/eslint-plugin<filename>lib/rules/use-name-space-import.ts<gh_stars>1-10
// ------------------------------------------------------------------------------
// Imports
// ------------------------------------------------------------------------------
import { createRule } from "../util";
import {
TSEST... |
ymatzki/eslint-plugin | tests/lib/rules/no-multiple-named-imports.spec.ts | <reponame>ymatzki/eslint-plugin<filename>tests/lib/rules/no-multiple-named-imports.spec.ts
import { RuleTester } from "../../util";
import rule from "../../../lib/rules/no-multiple-named-imports";
const tester = new RuleTester({
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
e... |
ymatzki/eslint-plugin | lib/util/keywords.ts | import { AST_NODE_TYPES } from "@typescript-eslint/experimental-utils";
// @see https://github.com/typescript-eslint/typescript-eslint/blob/1765a178e456b152bd48192eb5db7e8541e2adf2/packages/eslint-plugin/src/rules/no-inferrable-types.ts#L95
const keywordMap = {
[AST_NODE_TYPES.TSBigIntKeyword]: "bigint",
[AST_NODE... |
ymatzki/eslint-plugin | lib/rules.ts | <reponame>ymatzki/eslint-plugin
// This file has been automatically generated, in order to update it's content execute "npm run update"
import noMultipleNamedImports from "./rules/no-multiple-named-imports";
import noUseFunctionComponentTypeWithoutChildren from "./rules/no-use-function-component-type-without-children";... |
ymatzki/eslint-plugin | lib/util/isFunctionComponentType.ts | <gh_stars>1-10
const FunctionComponentTypes = ["FunctionComponent", "FC"];
export const isFunctionComponentType = (name: string) =>
FunctionComponentTypes.some((type) =>
new RegExp(String.raw`^.*${type}$`, "u").test(name)
);
|
ymatzki/eslint-plugin | tests/lib/rules/no-use-function-component-type-without-children.spec.ts | import { RuleTester } from "../../util";
import rule from "../../../lib/rules/no-use-function-component-type-without-children";
const tester = new RuleTester({
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
});
tester.run("no-use-f... |
ymatzki/eslint-plugin | lib/util/createRule.ts | <gh_stars>1-10
import { ESLintUtils } from "@typescript-eslint/experimental-utils";
// eslint-disable-next-line new-cap
export const createRule = ESLintUtils.RuleCreator(
(name) =>
`https://github.com/hrbrain/eslint-plugin/blob/master/docs/rules/${name}.md`
);
|
ymatzki/eslint-plugin | tests/lib/rules/use-name-space-import.spec.ts | import { RuleTester } from "../../util";
import rule from "../../../lib/rules/use-name-space-import";
const tester = new RuleTester({
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
});
tester.run("use-name-space-import", rule, {
... |
ymatzki/eslint-plugin | lib/util/index.ts | export * from "./createRule";
export * from "./createLibIndex";
export * from "./isFunctionComponentType";
export * from "./keywords";
|
ymatzki/eslint-plugin | lib/rules/no-multiple-named-imports.ts | // ------------------------------------------------------------------------------
// Imports
// ------------------------------------------------------------------------------
import { createRule } from "../util";
import {
TSESTree,
AST_NODE_TYPES,
} from "@typescript-eslint/experimental-utils";
// ---------------... |
jmfirth/netlify-test-microsite | src/pages/contact/thanks.tsx | <reponame>jmfirth/netlify-test-microsite
import React from "react";
import Layout from '../../components/Layout'
export default (() => (
<Layout>
<section className="section">
<div className="container">
<div className="content">
<h1>Thank you!</h1>
<p>Th... |
jmfirth/netlify-test-microsite | src/cms/preview-templates/common.ts | import { Iterable } from 'immutable';
export interface PreviewProps {
entry: Iterable<any, any>;
widgetFor: (name: string) => string;
getAsset: <R>(name: string) => R;
}
|
jmfirth/netlify-test-microsite | src/cms/preview-templates/BlogPostPreview.tsx | <filename>src/cms/preview-templates/BlogPostPreview.tsx
import React from 'react';
import { BlogPostTemplate } from '../../templates/blog-post';
import { PreviewProps } from './common';
export interface BlogPostPreviewProps extends PreviewProps {}
const BlogPostPreview: React.SFC<BlogPostPreviewProps> = ({ entry, wid... |
jmfirth/netlify-test-microsite | src/components/Navbar.tsx | import React from 'react';
import { Link } from 'gatsby';
import github from '../img/github-icon.svg';
import logo from '../img/logo.svg';
const Navbar: React.SFC = () => (
<nav className="navbar is-transparent">
<div className="container">
<div className="navbar-brand">
<Link to="/" className="nav... |
jmfirth/netlify-test-microsite | src/declarations/external.d.ts | <filename>src/declarations/external.d.ts
declare module '*.svg' {
export default string;
}
// declare module 'netlify-cms' {
// interface NetlifyCMS {
// registerPreviewTemplate: (name: string, component: React.ComponentType<any>) => any;
// }
// const CMS: NetlifyCMS;
// export default C... |
jmfirth/netlify-test-microsite | src/cms/preview-templates/AboutPagePreview.tsx | <reponame>jmfirth/netlify-test-microsite<gh_stars>0
import React from 'react';
import { AboutPageTemplate } from '../../templates/about-page';
import { PreviewProps } from './common';
export interface AboutPagePreviewProps extends PreviewProps {}
const AboutPagePreview: React.SFC<AboutPagePreviewProps> = ({ entry, wi... |
jmfirth/netlify-test-microsite | src/components/PreviewCompatibleImage.tsx | import React from 'react';
import Img from 'gatsby-image';
export interface ChildImageSharp {
fluid: {
src: string;
};
}
export type ChildImageSharpVariants = ChildImageSharp | undefined;
export type Image = ImageInfo | string;
export interface ImageInfo<CIS = ChildImageSharpVariants> {
alt?: string;
ch... |
jmfirth/netlify-test-microsite | src/pages/contact/examples.tsx | <reponame>jmfirth/netlify-test-microsite
import React from 'react';
import Link from 'gatsby-link';
import Layout from '../../components/Layout'
export default class Index extends React.Component {
render() {
return (
<Layout>
<section className="section">
<div className="container">
... |
jmfirth/netlify-test-microsite | src/templates/about-page.tsx | import React from 'react';
import { graphql } from 'gatsby';
import Layout from '../components/Layout';
import Content, { HTMLContent, BaseContentProps } from '../components/Content';
export interface AboutPageTemplateProps {
title?: React.ReactText;
content: string;
contentComponent?: React.ComponentType<BaseCo... |
jmfirth/netlify-test-microsite | src/components/Content.tsx | import React from 'react';
export interface BaseContentProps<C> {
content: C;
className?: string;
}
export interface HTMLContentProps extends BaseContentProps<string> {}
export interface ContentProps extends BaseContentProps<React.ReactText> {}
export const HTMLContent: React.SFC<HTMLContentProps> = ({ content,... |
ansballard/Frontend | src/store/index.ts | import createStore from "unistore";
import devtools from "unistore/devtools"; ///DEV_ONLY
import jwtDecode from "jwt-decode";
import { clearLocalState, setLocalState, getLocalState } from "./local";
import { insertScriptIntoDom } from "./dom";
import { GlobalState } from "../types";
const user = getLocalState();
ex... |
ansballard/Frontend | src/components/modwatch-file.tsx | import { h, Component } from "preact";
import "./modwatch-file.css";
import { Line } from "../types";
export default class ModwatchFile extends Component<{
lines: string[];
complexLines: boolean;
showDescriptor: boolean;
filetype?: string;
filter: string;
showInactiveMods: boolean;
}> {
render() {
... |
ansballard/Frontend | tests/store/index.ts | const test = require("tape");
const proxyquire = require("proxyquire");
const { encode } = require("jwt-simple");
const jwtDecode = require("jwt-decode");
const { rawState, store, actions } = proxyquire("../../src/store/index", {
"unistore/devtools": store => store,
"./local": {
clearLocalState: () => ({}),
... |
ansballard/Frontend | src/router/notFound.tsx | <reponame>ansballard/Frontend<filename>src/router/notFound.tsx
import { h } from "preact";
export default (props: any) => (
<section>
<h1>404 Not Found</h1>
<p>Good try, but this page doesn't exist</p>
</section>
);
|
ansballard/Frontend | src/components/modwatch-modlists.tsx | <gh_stars>0
import { h, Component } from "preact";
import { Link } from "preact-router";
import { searchModlists, getModlists } from "../store/pure";
import { PartialModlist } from "../types";
const styles = {
th: {
borderBottom: "1px solid",
padding: "3px"
},
td: {
padding: "3px"
},
modlistTab... |
ansballard/Frontend | src/__helpers__/mocks.ts | import { Modlist, ModFile, FileName, Game } from "@modwatch/types";
export const profile: Partial<Modlist> = {
timestamp: new Date("1995-12-17T03:24:00"),
tag: "Tag",
game: "skyrim",
enb: "Shiny ENB"
};
export const plugins: ModFile = [
"*UHDAP - en0.esp",
"*UHDAP - en1.esp",
"*UHDAP - en2.esp",
"*UHD... |
ansballard/Frontend | src/components/asyncRoute.tsx | <filename>src/components/asyncRoute.tsx
import { h, Component } from "preact";
function noop() {}
export default class AsyncRoute extends Component<
{
getComponent(url: string, cb: () => any, props: any);
url: string;
matches: any;
},
{
componentData?: any;
}
> {
constructor() {
super();... |
ansballard/Frontend | src/store/pure.ts | import { Modlist } from "@modwatch/types";
import { PartialModlist, User } from "../types";
const getJson = res => res.json();
const _e = encodeURIComponent;
export async function getModlists({
limit = 10
}: {
limit?: number;
} = {}): Promise<PartialModlist[]> {
return await fetch(`${process.env.API_URL}/api/us... |
ansballard/Frontend | src/components/modwatch-notifications.tsx | import { h, Component } from "preact";
import Notification from "./modwatch-notification";
import * as types from "../types";
const color = "#E3A853";
const styles = {
notificationsWrapper: {
fontFamily: "monospace",
fontSize: "16px",
listStyle: "none",
margin: 0,
position: "fixed",
top: "... |
ansballard/Frontend | micro.ts | <reponame>ansballard/Frontend<filename>micro.ts<gh_stars>0
import { ServerRequest, ServerResponse } from "microrouter";
const { router, get, post, del } = require("microrouter");
const { send } = require("micro");
const Cors = require("micro-cors");
const compress = require("micro-compress");
const { encode } = requir... |
ansballard/Frontend | src/router/home.tsx | <filename>src/router/home.tsx
import { h, Component } from "preact";
import ModwatchModlists from "../components/modwatch-modlists";
import ModwatchPostList from "../components/modwatch-postlist";
import { PostMetadata } from "../types";
export default class Home extends Component<
{
path?: string;
},
{
... |
ansballard/Frontend | src/components/modwatch-nav.tsx | import { h, Component } from "preact";
import { route } from "preact-router";
import { Link } from "preact-router";
import "./modwatch-nav.css";
import { StoreProps } from "../types";
export default class ModwatchNav extends Component<
StoreProps,
{
show: boolean;
loginLink: string;
redirect_uri: str... |
ansballard/Frontend | src/components/modwatch-notification.tsx | import { h, Component } from "preact";
import * as types from "../types";
const notificationsWrapperPseudo = {
content: "",
width: "10px",
position: "absolute",
top: 0,
height: "100%",
borderTop: `3px solid`,
borderBottom: `3px solid`,
boxSizing: "border-box",
opacity: "inherit"
};
const styles = {... |
ansballard/Frontend | src/router/modlist.tsx | <gh_stars>0
import { h, Component } from "preact";
import { Link, route } from "preact-router";
import "./modlist.css";
import { getModlist, getModlistFileType } from "../store/pure";
import { RouteProps } from "../types";
import { Modlist } from "@modwatch/types";
import ModwatchFile from "../components/modwatch-fi... |
ansballard/Frontend | src/index.tsx | <filename>src/index.tsx
// import "preact/debug"; ///DEV_ONLY
import { render, h, Component } from "preact";
import { Link } from "preact-router";
import { Provider, connect } from "unistore/preact";
import "unfetch/polyfill/index"; ///NOMODULE_ONLY
import "./global.css";
import Router from "./router";
import { rawSt... |
ansballard/Frontend | src/router/index.tsx | import { h, Component } from "preact";
import Router, { route } from "preact-router";
import AsyncRoute from "../components/asyncRoute";
import NotFound from "./notFound";
import Post from "../components/post";
import { RouteProps, StoreProps } from "../types";
const ROUTE_TRANSITION_TIMEOUT = 150; // needs to match ... |
ansballard/Frontend | src/router/posts/mdx.d.ts | declare module "*.mdx" {
let MDXComponent: (props) => preact.JSX.Element;
export default MDXComponent;
export const metadata: {
title: string;
author: string;
tags: string[];
timestamp: Date;
};
}
|
jm-seabery/angular-web-qt | src/app/webgl/webgl.component.ts | <gh_stars>0
import { Component, OnInit } from '@angular/core';
import { ViewChild, ElementRef } from '@angular/core';
import * as THREE from 'three';
import { ColladaLoader } from 'three-full';
@Component({
selector: 'webgl',
templateUrl: './webgl.component.html',
styleUrls: ['./webgl.component.scss']
})
export ... |
phryneas/postgraphile | src/postgraphile/http/subscriptions.ts | <gh_stars>0
import { Server, IncomingMessage, ServerResponse } from 'http';
import { HttpRequestHandler, mixed, Middleware } from '../../interfaces';
import {
subscribe as graphqlSubscribe,
ExecutionResult,
specifiedRules,
validate,
GraphQLError,
parse,
DocumentNode,
} from 'graphql';
import * as WebSocke... |
danwulff/meal-tracker | app/edit-food.component.ts | <gh_stars>0
import {Component, EventEmitter} from 'angular2/core';
import {Food} from './food.model';
@Component({
selector: 'edit-food',
inputs: ['food'],
template: `
<h3 class="selected">Edit Food Details:</h3>
<input [(ngModel)]="food.name" class="input-lg" style="width: 50%"/>
<input [(ngModel)]="food.... |
danwulff/meal-tracker | app/food-list.component.ts | <filename>app/food-list.component.ts
import { Component, EventEmitter } from 'angular2/core';
import { FoodComponent } from './food.component';
import { Food } from './food.model';
import { HealthyFoodPipe } from './healthy-food.pipe';
import { NewFoodComponent } from './new-food.component';
import { EditFoodComponent ... |
danwulff/meal-tracker | app/new-food.component.ts | <filename>app/new-food.component.ts
import {Component, EventEmitter} from 'angular2/core';
import {Food} from './food.model';
@Component({
selector: 'new-food',
outputs: ['onSubmitNewFood'],
template:`
<form name="newFoodForm">
<h3>Add Food:</h3>
<input placeholder="Name" class="input-lg" style="width:... |
divyajyoti21/CarSalesApp | src/components/Header/Header.tsx | <filename>src/components/Header/Header.tsx
import React from "react";
import { withRouter, Link, Route } from "react-router-dom";
function Header(props: any) {
return (
<React.Fragment>
<nav>
<ul id="navbar">
<li style={{ float: "left" }}>
<a href="/home">
<img
... |
divyajyoti21/CarSalesApp | src/components/MultiFilter/MultiFilter.tsx | import React, { useState } from "react";
import Button from "../Button/Button";
import "./MultiFilter.css";
function MultiFilter(props: any) {
const [colorSelected, updateColorSelected] = useState("allcolors");
const [manufacturerSelected, updateManufacturerSelected] =
useState("allmanufacturers");
function f... |
divyajyoti21/CarSalesApp | src/components/LinkButton/LinkButton.test.tsx | <filename>src/components/LinkButton/LinkButton.test.tsx
import { render, screen, fireEvent } from '@testing-library/react';
import LinkButton from './LinkButton';
describe("<LinkButton />", () => {
test('Linkbutton rendered', () => {
render(<LinkButton />);
});
}); |
divyajyoti21/CarSalesApp | src/components/Footer/Footer.test.tsx | import { render, screen, fireEvent, getByText } from "@testing-library/react";
import Footer from "./Footer";
describe("<Footer />", () => {
test("footer rendered", () => {
render(<Footer />);
});
});
|
divyajyoti21/CarSalesApp | src/components/Button/Button.test.tsx | <reponame>divyajyoti21/CarSalesApp<filename>src/components/Button/Button.test.tsx
import { render, screen, fireEvent, getByText } from "@testing-library/react";
import Button from "./Button";
describe("<Button />", () => {
test("button rendered", () => {
render(<Button />);
});
test("button clicked", async ... |
divyajyoti21/CarSalesApp | src/components/Footer/Footer.tsx | <reponame>divyajyoti21/CarSalesApp<gh_stars>0
import React from "react";
import "./Footer.css";
function Header(props: any) {
return (
<React.Fragment>
<div className="footer">©AUTO 1 Group 2018</div>
</React.Fragment>
);
}
export default Header;
|
divyajyoti21/CarSalesApp | src/components/DisplayCard/DisplayCard.test.tsx | import { render, screen, fireEvent, getByText } from "@testing-library/react";
import DisplayCard from "./DisplayCard";
describe("<DisplayCard />", () => {
test("displaycard rendered", () => {});
});
|
divyajyoti21/CarSalesApp | src/components/Loading/Loading.tsx | <filename>src/components/Loading/Loading.tsx
import React from "react";
import "./Loading.css";
function Loading(props: any) {
return (
<div className="display-card" style={{ padding: "24px", margin: "12px" }}>
<div className="card-img-style"></div>
<div className="loading-info">
<div></div>
... |
divyajyoti21/CarSalesApp | src/app/Favorites/Favorites.tsx | import MultiFilter from "../../components/MultiFilter/MultiFilter";
import DisplayCard from "../../components/DisplayCard/DisplayCard";
import { withRouter } from "react-router-dom";
import "./Favorites.css";
import React, { useEffect, useState } from "react";
function Favorites(props: any) {
const [favorites, update... |
divyajyoti21/CarSalesApp | src/components/DisplayCard/DisplayCard.tsx | import React from "react";
import Button from "../Button/Button";
import "./DisplayCard.css";
import LinkButton from "../LinkButton/LinkButton";
function DisplayCard(props: any) {
function handleClick(id: any) {
props.onViewDetails(id);
}
return (
<div className="display-card" style={{ padding: "24px", ma... |
divyajyoti21/CarSalesApp | src/components/Input/Input.test.tsx | <reponame>divyajyoti21/CarSalesApp
import { render, screen, fireEvent } from '@testing-library/react';
import Input from './Input';
describe("<Input />", () => {
test('input rendered', () => {
render(<Input />);
});
}); |
divyajyoti21/CarSalesApp | src/components/MultiFilter/MultiFilter.test.tsx | import { render, screen, fireEvent } from "@testing-library/react";
import MultiFilter from "./MultiFilter";
describe("<MultiFilter />", () => {
test("Multifilter rendered", () => {
render(
<MultiFilter
manufacturers={["test1", "test2"]}
colors={["test1", "test2"]}
/>
);
});
});... |
divyajyoti21/CarSalesApp | src/components/SelectDropdown/SelectDropdown.test.tsx | <gh_stars>0
import { render, screen, fireEvent } from "@testing-library/react";
import SelectDropdown from "./SelectDropdown";
describe("<SelectDropdown />", () => {
test("Select dropdown rendered", () => {
render(<SelectDropdown params={["test1", "test2"]} />);
});
});
|
divyajyoti21/CarSalesApp | src/app/PageNotFound/PageNotFound.tsx | import { withRouter, Link } from "react-router-dom";
import "./PageNotFound.css";
function PageNotFound() {
return (
<div className="page-not-found">
<div>
<img
style={{ height: "40px" }}
src="https://auto1-js-task-api--mufasa71.repl.co/images/logo.png"
></img>
</d... |
divyajyoti21/CarSalesApp | src/components/Input/Input.tsx | import React from "react";
function Input(props: any) {
function handleChange(event: any) {
props.onInputChange(event.target.value);
}
return (
<input
data-testid={props.testid}
placeholder={props.placeholder}
disabled={props.disabled}
value={props.value}
id="amount"
ty... |
divyajyoti21/CarSalesApp | src/components/LinkButton/LinkButton.tsx | import React from "react";
import "./LinkButton.css";
function LinkButton(props: any) {
function handleClick(event: any) {
if (props.id == "View details") {
props.onClick(event.target.value);
} else {
props.onClick(event.target.id);
}
}
return (
<React.Fragment>
<button
i... |
divyajyoti21/CarSalesApp | src/components/Button/Button.tsx | import React from "react";
import "./Button.css";
function Button(props: any) {
function handleClick(event: any) {
props.onClick(event);
}
return (
<React.Fragment>
<button
className="button"
data-testid={props.testid}
onClick={handleClick}
>
{props.name}
... |
divyajyoti21/CarSalesApp | src/components/Paginate/Paginate.tsx | import React from "react";
import LinkButton from "../LinkButton/LinkButton";
import "./Paginate.css";
function Paginate(props: any) {
function handleClick(id: any) {
props.onClick(id);
}
return (
<React.Fragment>
<div id="paginate" className="paginate">
<div>
<LinkButton id="First... |
divyajyoti21/CarSalesApp | src/components/Paginate/Paginate.test.tsx | <filename>src/components/Paginate/Paginate.test.tsx
import { render, screen, fireEvent } from "@testing-library/react";
import Paginate from "./Paginate";
describe("<Paginate />", () => {
test("paginate rendered", () => {
render(<Paginate />);
});
});
|
divyajyoti21/CarSalesApp | src/App.test.tsx | // app.test.js
import { render, screen } from "@testing-library/react";
import { createMemoryHistory } from "history";
import React from "react";
import { Router } from "react-router-dom";
import "@testing-library/jest-dom/extend-expect";
import App from "./App";
import Details from "./app/Details/Details";
import Pa... |
divyajyoti21/CarSalesApp | src/components/SelectDropdown/SelectDropdown.tsx | import React from "react";
function SelectDropdown(props: any) {
function handleChange(event: any) {
props.onSelectChange(event);
}
return (
<select data-testid={props.testid} id={props.id} onChange={handleChange}>
{props.params.map((elem: any) => (
<option value={elem}>{elem}</option>
... |
divyajyoti21/CarSalesApp | src/App.tsx | import React, { useEffect, useState } from "react";
import { Router, Switch, Route, withRouter } from "react-router-dom";
import Header from "./components/Header/Header";
import Footer from "./components/Footer/Footer";
import Home from "./app/Home/Home";
import Details from "./app/Details/Details";
import { createBrow... |
divyajyoti21/CarSalesApp | src/app/Details/Details.tsx | <reponame>divyajyoti21/CarSalesApp<gh_stars>0
import { withRouter } from "react-router-dom";
import { useEffect, useState } from "react";
import "./Details.css";
import React from "react";
import Button from "../../components/Button/Button";
function Details(props: any) {
useEffect(() => {
if (props.location.sta... |
divyajyoti21/CarSalesApp | src/app/Home/Home.tsx | import MultiFilter from "../../components/MultiFilter/MultiFilter";
import DisplayCard from "../../components/DisplayCard/DisplayCard";
import Paginate from "../../components/Paginate/Paginate";
import { withRouter } from "react-router-dom";
import "./Home.css";
import Loading from "../../components/Loading/Loading";
i... |
fedecech/starter-snake-node-ts | src/routes/end.ts | import { Router, Request, Response } from 'express';
import { GameData } from '../interfaces/gameData';
const router = Router();
router.post('/end', (req: Request, res: Response) => {
const gameData = req.body as GameData;
console.log('/end', gameData);
res.status(200).send('ok');
});
export { router as endRoute... |
fedecech/starter-snake-node-ts | src/routes/start.ts | import { Router, Request, Response } from 'express';
import { GameData } from '../interfaces/gameData';
const router = Router();
router.post('/start', (req: Request, res: Response) => {
const gameData = req.body as GameData;
console.log('/start', gameData);
res.status(200).send('ok');
});
export { router as sta... |
fedecech/starter-snake-node-ts | src/core/Converter.ts | <reponame>fedecech/starter-snake-node-ts<filename>src/core/Converter.ts
import { Coordinates, GameData } from '../interfaces/gameData';
export class Converter {
private gameData: GameData;
constructor(gameData: GameData) {
this.gameData = gameData;
}
public getFood() {
const { height, food } = this.gameData.... |
fedecech/starter-snake-node-ts | src/interfaces/battlesnakeInfo.ts | export interface BattleSnakeInfo {
apiversion: string;
author: string;
color: string,
head: string,
tail: string,
} |
fedecech/starter-snake-node-ts | src/core/util.ts | <gh_stars>0
import { AStarFinder } from '../finders/astar-finder';
import { Coordinates } from '../interfaces/gameData';
import { PossibleMoves } from '../routes/move';
import { Node } from './Node';
/**
* Backtrace from end node through parents and return the path.
* @param node
* @param includeStartingNode
*/
ex... |
fedecech/starter-snake-node-ts | src/index.ts | import { app } from './app';
const PORT = process.env.PORT || 3000;
app.listen(PORT, () =>
console.log(`Battlesnake Server listening at http://127.0.0.1:${PORT}`)
);
|
fedecech/starter-snake-node-ts | src/routes/index.ts | import { Router, Request, Response } from 'express';
import { BattleSnakeInfo } from '../interfaces/battlesnakeInfo';
const router = Router();
// route used to get info about the snakes before the game starts
router.get('/', (_: Request, res: Response) => {
const battlesnakeInfo: BattleSnakeInfo = {
apiversion: '1'... |
fedecech/starter-snake-node-ts | src/app.ts | <filename>src/app.ts
import { json } from 'body-parser';
import express from 'express';
import { baseRouter } from './routes';
import { endRouter } from './routes/end';
import { moveRouter } from './routes/move';
import { startRouter } from './routes/start';
const app = express();
app.use(json());
app.use(baseRoute... |
fedecech/starter-snake-node-ts | src/interfaces/astar.ts | import { HeuristicFN } from './../core/Heuristic';
import { Coordinates } from './gameData';
export interface INodeConstructor {
id: number;
position: Coordinates;
walkable?: boolean;
}
export interface IGridConstructor {
width?: number;
height?: number;
matrix: number[][];
}
export interface IAStarFinderConst... |
fedecech/starter-snake-node-ts | src/core/Node.ts | <reponame>fedecech/starter-snake-node-ts
import { Coordinates } from '../interfaces/gameData';
import { INodeConstructor } from '../interfaces/astar';
export class Node {
readonly id: number;
readonly position: Coordinates;
private fValue: number;
private gValue: number;
private hValue: number;
private parentNo... |
fedecech/starter-snake-node-ts | src/core/Heuristic.ts | <gh_stars>0
import { Coordinates } from './../interfaces/gameData';
export type HeuristicFN = 'Manhatten' | 'Euclidean' | 'Chebyshev' | 'Octile';
export class Heuristic {
public static calculateHeuristic(
hFN: HeuristicFN,
pos0: Coordinates,
pos1: Coordinates,
weight?: number
) {
const dx = Math.abs(pos1.... |
fedecech/starter-snake-node-ts | src/interfaces/gameData.ts | export interface GameData {
game: Game;
turn: number;
board: Board;
you: Snake;
}
export interface Game {
id: string;
ruleset: RuleSet;
timeout: number;
}
export interface RuleSet {
name: string;
version: string;
}
export interface Board {
height: number;
width: number;
snakes: [Snake];
food: Coordinates... |
fedecech/starter-snake-node-ts | src/routes/move.ts | <filename>src/routes/move.ts
import { Heuristic } from '../core/Heuristic';
import { Coordinates } from '../interfaces/gameData';
import { Router, Request, Response } from 'express';
import { GameData } from '../interfaces/gameData';
import { Converter } from '../core/Converter';
import { next_move, next_path } from '.... |
fedecech/starter-snake-node-ts | src/core/Grid.ts | <reponame>fedecech/starter-snake-node-ts<gh_stars>0
import { Coordinates } from './../interfaces/gameData';
import { IGridConstructor } from './../interfaces/astar';
import { Node } from './Node';
export class Grid {
readonly width: number;
readonly height: number;
readonly numberOfFields: number;
private gridNod... |
egozavr/angular2-switcher | src/extension.ts | <filename>src/extension.ts
"use strict";
// 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";
function fileIs(path: string, ...items: string[]): boolean {
if (!items) {
return false;
}
f... |
parsegraph/spotlightpainter | src/index.ts | <reponame>parsegraph/spotlightpainter<gh_stars>0
import SpotlightPainter from "./SpotlightPainter";
export default SpotlightPainter;
|
parsegraph/spotlightpainter | src/SpotlightPainter.ts | import { compileProgram } from "parsegraph-compileprogram";
import {
generateRectangleVertices,
generateRectangleTexcoords,
Matrix3x3,
} from "parsegraph-matrix";
import PagingBuffer from "parsegraph-pagingbuffer";
import Color from "parsegraph-color";
import spotlightPainterVertexShader from "./SpotlightPainter... |
yyzclyang/algae-ui | components/form/form.tsx | import React, { useState } from 'react';
import Input, { InputProps } from '../input';
import {
scopedClassMaker,
classNames,
isNonEmptyArray,
validator,
ValidateFormMessageGroup
} from '../utils';
const sc = scopedClassMaker('algae-ui-form');
export type FormMessageType = 'success' | 'warning' | 'error';
e... |
yyzclyang/algae-ui | site/componentExample/RadioExample/radio.codeDemo3.tsx | <filename>site/componentExample/RadioExample/radio.codeDemo3.tsx
import React, { useState } from 'react';
import { Radio, RadioGroup } from 'algae-ui';
export default () => {
const [value, setValue] = useState<string>('1');
return (
<div className="radio-example-list">
<RadioGroup
value={value}
... |
yyzclyang/algae-ui | components/avatar/style/index.ts | <gh_stars>1-10
// style dependencies
import '../../icon/style';
import './avatar.scss';
|
yyzclyang/algae-ui | site/componentExample/MessageExample/message.example.tsx | <filename>site/componentExample/MessageExample/message.example.tsx
import React from 'react';
import { CodeDemo, Api } from '../CommonDispalyComponents';
import './message.example.scss';
import CodeDemo1 from './message.codeDemo1';
const code1 = require('!!raw-loader!./message.codeDemo1.tsx');
import CodeDemo2 from '.... |
yyzclyang/algae-ui | site/componentExample/ModalExample/modal.codeDemo2.tsx | <filename>site/componentExample/ModalExample/modal.codeDemo2.tsx<gh_stars>1-10
import React from 'react';
import { Modal, confirm, Button } from 'algae-ui';
export default () => {
const showModal = () =>
confirm({
title: 'This is a confirm message',
content: (
<div>
<p>some messages... |
yyzclyang/algae-ui | components/affix/style/index.ts | <reponame>yyzclyang/algae-ui
import './affix.scss';
|
yyzclyang/algae-ui | components/layout/content.tsx | import React from 'react';
import { classNames, scopedClassMaker } from '../utils';
const sc = scopedClassMaker('algae-ui-layout');
interface ContentProps extends React.HtmlHTMLAttributes<HTMLElement> {}
const Content: React.FunctionComponent<ContentProps> = (
props: ContentProps
) => {
const { className, style,... |
yyzclyang/algae-ui | site/componentExample/AvatarExample/index.ts | export { default } from './avatar.example';
|
yyzclyang/algae-ui | components/progress/circleProgress.tsx | import React from 'react';
import Icon from '../icon';
import {
classNames,
scopedClassMaker,
rotateMatrixGenerator,
arcGenerator
} from '../utils';
const sc = scopedClassMaker('algae-ui-progress');
interface CircleProgressProps {
type?: 'circle' | 'dashboard';
radius?: number;
strokeWidth?: number;
b... |
yyzclyang/algae-ui | components/button/index.ts | <reponame>yyzclyang/algae-ui<filename>components/button/index.ts
export { default } from './button';
export { default as ButtonGroup } from './buttonGroup';
|
yyzclyang/algae-ui | components/steps/index.ts | <reponame>yyzclyang/algae-ui
export { default } from './steps';
export { default as Step } from './step';
export { StatusTypes } from './step';
|
yyzclyang/algae-ui | components/modal/style/index.ts | <reponame>yyzclyang/algae-ui
// style dependencies
import '../../icon/style';
import '../../button/style';
import './confirm.scss';
import './dialog.scss';
|
yyzclyang/algae-ui | components/button/button.tsx | <reponame>yyzclyang/algae-ui<gh_stars>1-10
import React from 'react';
import Icon from '../icon';
import { classNames, useDiffuseAnimation } from '../utils';
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
buttonType?: 'default' | 'primary' | 'success' | 'danger';
icon?: string;
ico... |
yyzclyang/algae-ui | components/layout/style/index.ts | <gh_stars>1-10
import './content.scss';
import './layout.scss';
|
yyzclyang/algae-ui | site/componentExample/SwitchExample/switch.codeDemo4.tsx | <filename>site/componentExample/SwitchExample/switch.codeDemo4.tsx
import React from 'react';
import { Switch } from 'algae-ui';
export default () => {
return (
<div className="switch-example-list">
<Switch defaultChecked loading />
<br />
<br />
<Switch loading />
</div>
);
};
|
yyzclyang/algae-ui | components/utils/classNames.ts | const classNames = (...classNames: Array<string | undefined>) => {
return classNames.filter(Boolean).join(' ');
};
export default classNames;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.