repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
FlipsideCrypto/flipside-js | src/components/withFcas/index.tsx | <reponame>FlipsideCrypto/flipside-js
import {
h,
Component,
AnyComponent,
ComponentFactory,
ComponentChildren,
Ref,
RenderableProps
} from "preact";
import API from "../../api";
type Data = {
asset_name: string;
percent_change: number;
slug: string;
symbol: string;
value: number;
};
type Props... |
FlipsideCrypto/flipside-js | src/spectrum/plot/index.tsx | <reponame>FlipsideCrypto/flipside-js<gh_stars>1-10
import { h, Component } from "preact";
import { sortObjectArray } from "../../utils";
import classNames from "classnames";
import * as css from "./style.css";
import { score } from "../../score/style.css";
const PLOT_WIDTH = 240;
const PLOT_SCALE = PLOT_WIDTH / 1000;
... |
FlipsideCrypto/flipside-js | src/table/index.tsx | <filename>src/table/index.tsx
import { h, Component } from "preact";
import keyBy from "lodash/keyBy";
import CustomLinks from "./components/customLinks";
import "./styles.scss";
import API from "../api";
function getMetricTrend(change: number) {
if (change < 0) {
return "down";
} else if (change == 0) {
r... |
FlipsideCrypto/flipside-js | src/components/trend/style.css.d.ts | <gh_stars>1-10
// This file is automatically generated.
// Please do not change this file!
export const down: string;
export const icon: string;
export const up: string;
export const wrapper: string;
|
FlipsideCrypto/flipside-js | src/custom.d.ts | <reponame>FlipsideCrypto/flipside-js
declare module "*.css" {
const css: any;
export default css;
}
interface Window {
Highcharts: any;
}
|
FlipsideCrypto/flipside-js | src/components/rank/index.tsx | <reponame>FlipsideCrypto/flipside-js
import { h, Component } from "preact";
import classNames from "classnames";
import * as css from "./style.css";
type Props = {
score: number;
grade?: string;
kind?: "slim" | "normal" | "large";
class?: string;
};
type State = {
showTooltip: boolean;
};
export default cl... |
FlipsideCrypto/flipside-js | src/spectrum/plot/style.css.d.ts | // This file is automatically generated.
// Please do not change this file!
export const dark: string;
export const legend: string;
export const light: string;
export const line: string;
export const marker: string;
export const related: string;
export const relatedLine: string;
export const wrapper: string;
|
FlipsideCrypto/flipside-js | src/utils.ts | <filename>src/utils.ts
import isArray from "lodash/isArray";
import mergeWith from "lodash/mergeWith";
export const compare = (key: string) => {
return (a: any, b: any) => {
const valueA = a[key];
const valueB = b[key];
let comparison = 0;
if (valueA > valueB) {
comparison = 1;
} else if (v... |
FlipsideCrypto/flipside-js | src/spectrum/components/carousel/style.css.d.ts | // This file is automatically generated.
// Please do not change this file!
export const carousel: string;
export const dark: string;
export const dotActive: string;
export const dotItem: string;
export const dots: string;
export const light: string;
export const slide: string;
export const wrapper: string;
|
FlipsideCrypto/flipside-js | src/components/customLinks/index.tsx | import { h, Component, render } from "preact";
import API, { WidgetLinksLink } from "../../api";
import find from "lodash/find";
import classNames from "classnames";
import * as css from "./style.css";
type Props = {
widget:
| "spectrum"
| "multi-table"
| "table"
| "score"
| "chart"
| "price-... |
FlipsideCrypto/flipside-js | src/spectrum/components/carousel/index.tsx | <reponame>FlipsideCrypto/flipside-js
import { h, Component, ComponentChildren } from "preact";
import classNames from "classnames";
import * as css from "./style.css";
type Props = {
mode: "light" | "dark";
items: any[];
renderSlide: any;
};
type State = {
currentSlide: number;
};
export default class Carous... |
FlipsideCrypto/flipside-js | src/table/components/customLinks/index.tsx | <filename>src/table/components/customLinks/index.tsx
import { h, Component, render } from "preact";
import "./style.scss";
import API, { WidgetLinksLink } from "../../../api";
import find from "lodash/find";
type Props = {
widget: "spectrum" | "multi-table" | "table";
api: API;
};
type State = {
links: WidgetLi... |
FlipsideCrypto/flipside-js | src/spectrum/style.css.d.ts | <gh_stars>1-10
// This file is automatically generated.
// Please do not change this file!
export const dark: string;
export const fcas: string;
export const header: string;
export const icon: string;
export const light: string;
export const meta: string;
export const name: string;
export const rank: string;
export con... |
FlipsideCrypto/flipside-js | src/chart/helpers.ts | import { ChartSeries } from ".";
import { APISeriesPayload, APISeries } from "../api";
import Highcharts, { SeriesLineOptions } from "highcharts";
import zipObject from "lodash/zipObject";
/**
* Converts an array of ChartSeries to an APISeriesPayload by grouping metric names by symbol.
*/
export function createApiSe... |
FlipsideCrypto/flipside-js | src/api.ts | <gh_stars>1-10
import axios, { AxiosInstance, AxiosPromise } from "axios";
export default class API {
key: string;
client: AxiosInstance;
constructor(apiKey: string) {
this.key = apiKey;
this.client = axios.create({
baseURL: "https://api.flipsidecrypto.com/api/v1",
params: { api_key: apiKey ... |
FlipsideCrypto/flipside-js | src/chart/style.css.d.ts | <filename>src/chart/style.css.d.ts
// This file is automatically generated.
// Please do not change this file!
export const dark: string;
export const light: string;
export const wrapper: string;
|
FlipsideCrypto/flipside-js | src/score/style.css.d.ts | // This file is automatically generated.
// Please do not change this file!
export const change: string;
export const down: string;
export const fcas: string;
export const header: string;
export const link: string;
export const score: string;
export const trend: string;
export const up: string;
export const value: stri... |
FlipsideCrypto/flipside-js | src/index.tsx | <filename>src/index.tsx
// ie11 polyfills
import "core-js/fn/promise";
import "core-js/fn/object/assign";
import { h, render } from "preact";
import API from "./api";
import Table from "./table";
import { defaultsWithoutArrays } from "./utils";
import Spectrum, { Props as SpectrumProps } from "./spectrum";
import Mult... |
FlipsideCrypto/flipside-js | src/multiTable/index.tsx | import { h, Component } from "preact";
import classnames from "classnames";
import Rank from "../components/rank";
import Trend from "../components/trend";
import CustomLinks from "../components/customLinks";
import API from "../api";
import { Row, ColumnName, ColumnDefinition } from "./types";
import sortBy from "loda... |
FlipsideCrypto/flipside-js | src/chart/index.tsx | import { h, Component } from "preact";
import merge from "lodash/merge";
import API from "../api";
import { createApiSeries, createSeries } from "./helpers";
import zipObject from "lodash/zipObject";
import { DEFAULT_HIGHCHARTS, DEFAULT_YAXIS } from "./defaults";
import CustomLinks from "../components/customLinks";
imp... |
FlipsideCrypto/flipside-js | src/spectrum/index.tsx | <filename>src/spectrum/index.tsx
import { h, Component } from "preact";
import CustomLinks from "../components/customLinks";
import Plot from "./plot";
import * as css from "./style.css";
import API, { WidgetLinksLink } from "../api";
import Rank from "../components/rank";
import Trend from "../components/trend";
impor... |
FlipsideCrypto/flipside-js | src/chart/defaults.ts | <reponame>FlipsideCrypto/flipside-js
export const DEFAULT_HIGHCHARTS: Highcharts.Options = {
chart: {
backgroundColor: "transparent",
style: {
fontFamily: "inherit"
}
},
title: {
text: undefined,
align: "left",
style: {
fontSize: "24px"
}
},
colors: ["#F5A623", "#2D57... |
FlipsideCrypto/flipside-js | src/components/noDataMessage/index.tsx | import { h } from "preact";
import * as css from "./style.css";
const NoDataMessage = () => <div></div>;
export default NoDataMessage;
|
FlipsideCrypto/flipside-js | src/components/trend/index.tsx | <gh_stars>1-10
import { h } from "preact";
import classNames from "classnames";
import * as css from "./style.css";
type Props = {
change?: number;
pointChange?: number;
value: number;
class?: string;
};
export function calculateTrendDiff(value: number, percent: number): number {
return Math.round(Math.abs(... |
FlipsideCrypto/flipside-js | src/dynamic/index.tsx | <gh_stars>1-10
import loadJS from "load-js";
import API from "../api";
import template from "lodash/template";
import mapValues from "lodash/mapValues";
import { stringify } from "querystring";
type DynamicOpts = {
widgetId: string;
darkMode?: boolean;
data?: object;
};
export default async function dynamic(api... |
FlipsideCrypto/flipside-js | src/dynamic/load-js.d.ts | declare module 'load-js' {
const fn: any;
export default fn;
}
|
FlipsideCrypto/flipside-js | src/frame/index.tsx | <gh_stars>1-10
import { h, Component } from "preact";
type Props = {
apiKey: string;
mode: string;
url: string;
width?: string;
height?: string;
data?: any;
messageKey?: string;
messagePayloadType?: string;
messagePayloadActionKey?: string;
};
type State = {
height: string;
width: string;
};
ex... |
FlipsideCrypto/flipside-js | src/score/index.tsx | import { h } from "preact";
import withFcas, { WithFcasProps } from "../components/withFcas";
import Trend from "../components/trend";
import Rank from "../components/rank";
import * as css from "./style.css";
import CustomLinks from "../components/customLinks";
import API from "../api";
import { defaultFlipsideLink } ... |
FlipsideCrypto/flipside-js | src/multiTable/types.d.ts | <filename>src/multiTable/types.d.ts<gh_stars>1-10
export type Row = {
symbol: string;
asset_name: string;
fcas: number;
dev: number;
utility: number;
fcas_change: number;
dev_change: number;
utility_change: number;
market_maturity: number;
market_maturity_change: number;
percent_change_7d: number;... |
FlipsideCrypto/flipside-js | src/components/rank/style.css.d.ts | // This file is automatically generated.
// Please do not change this file!
export const a: string;
export const b: string;
export const c: string;
export const f: string;
export const large: string;
export const normal: string;
export const rank: string;
export const s: string;
export const slim: string;
export const ... |
audacitus/duphlux-ionic-2-sdk | src/pages/home/home.ts | // Developed by Audacitus. Homecrafted Themes and Apps for the IonicFramework
// For custom themes, and plugins in Ionic 2
// https://www.audacitus.com/site
import { Component, ViewChild } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Headers, Http, RequestOptions } from '@angular/http'... |
audacitus/duphlux-ionic-2-sdk | src/providers/duphlux-io-service.ts | import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs';
import { Subject } from 'rxjs/Subject';
import 'rxjs/add/operator/map';
/*
Generated class for the DuphluxIoService provider.
See https://angular.io/docs/ts/latest/guide/dependency-injection.html
... |
audacitus/duphlux-ionic-2-sdk | src/components/timer/timer.ts | <reponame>audacitus/duphlux-ionic-2-sdk
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
/**
* countDown timer for duplux-ionic
*
*
*/
@Component({
selector: 'timer',
templateUrl: 'timer.html'
})
export class Timer implements OnInit {
@Input() timeInSeconds : number = 10; ... |
myrobotbitPID/PXT-MyLightSensor | MyLightSensor.ts | /**
* support for Light sensor
*/
//% weight=10 icon="\uf11e" color=#33ccff block="MySensor"
namespace MySensor {
export enum analogPins {
P0,
P1,
P2,
P3,
P4,
P10
}
/**
* read analog sensor value from P0 -P4 and P10
* @param selectpin se... |
fleagleman/spectacle | index.d.ts | <reponame>fleagleman/spectacle
// Type definitions for Spectacle 7.0.0
// Project: Formidable Spectacle
// Definitions by: <NAME>, <NAME>, and <NAME>
declare module 'spectacle' {
import * as React from 'react';
import * as StyledSystem from 'styled-system';
export type TemplateFn = (options: {
numberOfSlide... |
marcbowes/qldb-quark | src/mode/PartiQLMode.tsx | import ace from "ace-builds/src-noconflict/ace";
export class PartiQLHighlightRules extends ace.acequire(
"ace/mode/text_highlight_rules"
).TextHighlightRules {
constructor() {
super();
var keywords = (
"action|alter|and|any|are|as|asc|assertion|at|authorization|bag|begin|" +
... |
marcbowes/qldb-quark | src/core/App.tsx | import * as React from "react";
import {createMuiTheme, createStyles, makeStyles, Theme, ThemeProvider} from '@material-ui/core/styles';
import Drawer from '@material-ui/core/Drawer';
import CssBaseline from '@material-ui/core/CssBaseline';
import Toolbar from '@material-ui/core/Toolbar';
import DrawerItems from "./Dra... |
marcbowes/qldb-quark | src/core/ledger.ts | <gh_stars>0
import {AWSError, QLDB} from "aws-sdk";
import {CreateLedgerRequest, LedgerList, LedgerSummary, ListLedgersResponse} from "aws-sdk/clients/qldb";
import { dom } from "ion-js";
import {openLedger, sessionEndpointValue} from "./session";
import {ClientConfiguration} from "aws-sdk/clients/acm";
import {qldbReg... |
marcbowes/qldb-quark | src/core/query-history.ts | <filename>src/core/query-history.ts
import {IOUsage, TimingInformation} from "amazon-qldb-driver-nodejs";
import {Value} from "ion-js/dist/commonjs/es6/dom";
import * as fs from "fs";
import * as readline from "readline";
const HISTORY_FILE = ".qldb-quark-history";
export type QueryStats = { timingInformation: { proc... |
marcbowes/qldb-quark | src/core/session.ts | import {QldbDriver, Result, RetryConfig, TransactionExecutor} from "amazon-qldb-driver-nodejs";
import {Agent} from "https";
const SEPARATOR = ";"
export let sessionEndpointValue = ""
export const setSessionEndpoint = (endpoint: string) => sessionEndpointValue = endpoint
const executeStatement = (driver: QldbDriver) ... |
marcbowes/qldb-quark | src/core/History.tsx | import * as React from "react";
import {IconButton, List, ListItem, ListItemSecondaryAction, ListItemText, withStyles} from "@material-ui/core";
import DeleteIcon from '@material-ui/icons/Delete';
import {QueryHistoryEntry, replaceHistory, SetHistoryFn} from "./query-history";
type Props = { historyEntry: QueryHistory... |
marcbowes/qldb-quark | src/core/AppBar.tsx | import * as React from "react";
import Toolbar from "@material-ui/core/Toolbar";
import Typography from "@material-ui/core/Typography";
import AppBar from "@material-ui/core/AppBar";
import {createStyles, makeStyles, Theme, useTheme} from "@material-ui/core/styles";
import {
Accordion, AccordionDetails,
Accordi... |
marcbowes/qldb-quark | src/core/QueryHandler.tsx | import {openLedger} from "./session";
import * as React from "react";
import {flattenQueryStats, recordHistory, SetHistoryFn} from "./query-history";
export const executeStatement = async (ledgerName: string, statement: string, setHistory: SetHistoryFn) => {
try {
const result = await openLedger(ledgerName... |
marcbowes/qldb-quark | src/core/Results.tsx | import * as React from "react";
import {
Box,
Button, Grid, IconButton,
Paper,
Tab,
Table, TableBody, TableCell,
TableContainer,
TableHead,
TableRow,
Tabs,
Toolbar, Tooltip
} from "@material-ui/core";
import HistoryIcon from '@material-ui/icons/History';
import ReceiptIcon from '... |
marcbowes/qldb-quark | src/core/Composer.tsx | <filename>src/core/Composer.tsx<gh_stars>0
import * as React from "react";
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-text"
import "ace-builds/src-noconflict/theme-textmate"
import "ace-builds/src-noconflict/theme-ambiance"
import "ace-builds/src-noconflict/ext-language_tools"
import "ace... |
marcbowes/qldb-quark | src/index.ts | <reponame>marcbowes/qldb-quark<gh_stars>0
import { app, BrowserWindow } from "electron";
import * as electronIsDev from "electron-is-dev";
import * as path from "path"
require("electron-reload")(__dirname, {
electron: path.join(__dirname, '..', '..', 'node_modules', '.bin', 'electron')
});
function createWindow (... |
Navneet7716/SocialMediaProject | src/controllers/UserController.ts | <gh_stars>1-10
import { NextFunction, Request, Response } from "express";
import { hash } from "bcryptjs";
import { body, validationResult } from "express-validator";
import { prisma } from "../server";
export const userValidationRules = [
body("email")
.isLength({ min: 1 })
.withMessage("Email m... |
Navneet7716/SocialMediaProject | src/controllers/PostController.ts | <gh_stars>1-10
import { NextFunction, Request, Response } from "express";
import { body, validationResult } from "express-validator";
import { prisma } from "../server";
interface post {
body: string;
title: string;
userId: number;
tags: [string]
}
export const postValidationRule = [
body("body").... |
Navneet7716/SocialMediaProject | src/routes/PostRoutes.ts | import { Router } from "express";
import * as PostController from "../controllers/PostController";
const postRouter = Router();
postRouter
.route("/")
.get(PostController.getPost)
.post(
PostController.postValidationRule,
PostController.checkForErrors,
PostController.addPost
);... |
Navneet7716/SocialMediaProject | src/routes/VotesRoutes.ts | <reponame>Navneet7716/SocialMediaProject
import { Router } from "express";
import * as VoteController from "../controllers/VoteController";
const voteRouter = Router();
voteRouter
.route("/addvote")
.patch(
VoteController.voteValidationRule,
VoteController.checkForErrors,
VoteControlle... |
Navneet7716/SocialMediaProject | src/controllers/VoteController.ts | <filename>src/controllers/VoteController.ts<gh_stars>1-10
import { NextFunction, Request, Response } from "express";
import { body, validationResult } from "express-validator";
import { prisma } from "../server";
export const voteValidationRule = [
body("by")
.notEmpty()
.withMessage(`by Id Can't b... |
Navneet7716/SocialMediaProject | src/routes/RelationshipRoutes.ts | import { Router } from "express";
import * as RelationshipController from "../controllers/RelationshipController";
const relationshipRouter = Router();
relationshipRouter
.route("/getfollowers")
.get(RelationshipController.getFollowers);
relationshipRouter
.route("/getfollowings")
.get(RelationshipCo... |
Navneet7716/SocialMediaProject | src/routes/UserRoutes.ts | <filename>src/routes/UserRoutes.ts
import { Router } from "express";
import * as UserController from "../controllers/UserController";
const userRouter = Router();
userRouter
.route("/")
.get(UserController.getUser)
.post(
UserController.userValidationRules,
UserController.checkForErrors,
... |
Navneet7716/SocialMediaProject | src/controllers/RelationshipController.ts | import { NextFunction, Request, Response } from "express";
import { body, validationResult } from "express-validator";
import { prisma } from "../server";
export async function getFollowers(req: Request, res: Response) {
try {
let { id } = req.body;
let results = await prisma.relationships.findMan... |
Navneet7716/SocialMediaProject | src/server.ts | <filename>src/server.ts
import express, { Request, Response } from "express";
import userRouter from "./routes/UserRoutes";
import postRouter from "./routes/PostRoutes";
import voteRouter from "./routes/VotesRoutes";
import relationshipRouter from "./routes/RelationshipRoutes";
import { PrismaClient } from "@prisma/cl... |
AckeeCZ/node-template | src/app/shutdown.ts | <filename>src/app/shutdown.ts<gh_stars>1-10
import logger from './logger'
import server from '../server'
/**
* Handles multiple shutdown calls
*/
let shuttingDown = false
/**
* Gracefully closes all listeners
*
* Process exit codes:
* 0 - shutdown (including force shutdown)
* 1 - caused by uncaught exception... |
AckeeCZ/node-template | src/test/globalTeardown.ts | <reponame>AckeeCZ/node-template<gh_stars>1-10
export default async () => {
// TBA: Add teardown tasks, close db conn etc.
}
|
AckeeCZ/node-template | src/app/services/helloService.ts | import { ctrl } from '../controllers'
import * as openapi from '../../openapi'
export const hello = (): Promise<
openapi.OpenAPIResponse<openapi.api.paths['/hello']>
> => {
const message = ctrl.getOasPathAppMessage<openapi.api.paths['/hello']>()
return Promise.resolve({ hello: 'World', payload: message.requestBo... |
AckeeCZ/node-template | src/test/template.test.ts | import config from '../config'
import { E_CODE, ServerError } from '../app/errors'
import { t } from './testing'
describe('Template (System)', () => {
test('Configuration is loaded', () => {
expect(typeof config)
.toBeTruthy()
.toBe('object')
})
describe('Errors', () => {
test('Throws', () =>... |
AckeeCZ/node-template | src/index.ts | import logger from './app/logger'
import config, { safeConfig } from './config'
import server from './server'
import * as shutdown from './app/shutdown'
logger.info(safeConfig, 'Loaded config')
server
.listenAsync(config.server.port)
.then(() => logger.info(`Server started, port=${config.server.port}`))
.catch((... |
AckeeCZ/node-template | src/app/controllers/healthz.ts | import { expressMiddleware } from 'node-healthz'
export default expressMiddleware({
replaceMe: {
crucial: true,
check: () =>
Promise.reject(new Error('Replace me with some useful health check!')),
},
})
|
AckeeCZ/node-template | src/server.ts | <filename>src/server.ts
import { createServer } from 'unicore'
import { ctrl } from './app/controllers'
import logger from './app/logger'
import * as hello from './app/services/helloService'
const server = createServer()
server.use(logger.express)
server.use(ctrl.json)
server.use(ctrl.cors)
server.all('/', ctrl.httpRo... |
AckeeCZ/node-template | src/openapi/api.ts | <gh_stars>1-10
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
*/
export interface paths {
"/hello": {
get: {
responses: {
/** OK */
200: {
content: {
"application/json": {
hello?: string;
... |
AckeeCZ/node-template | src/openapi/index.ts | <filename>src/openapi/index.ts
export * as api from './api'
export type OpenAPIRouteRequestBody<T> = T extends { post: { requestBody: { content: { 'application/json': infer U } } } } ? U : unknown
export type OpenAPIRoutePathParam<T> = T extends { get: { parameters: { path: infer U } } } ? U : unknown
export type Open... |
AckeeCZ/node-template | src/app/controllers/index.ts | <reponame>AckeeCZ/node-template<gh_stars>1-10
import { RequestHandler } from 'express'
import * as express from 'express'
import {
cors as createCors,
defaultFinalHandler,
defaultRootHandler,
jsonParser,
} from 'unicore'
import * as asyncHooks from 'async_hooks'
import * as appMessage from './appMessage'
import... |
AckeeCZ/node-template | src/app/controllers/appMessage.ts | <filename>src/app/controllers/appMessage.ts
import { Request, Response } from 'express'
import * as lodash from 'lodash'
export interface AppMessage {
user: unknown // TODO
locale: string
param: {
[key: string]: string
}
requestBody: any
}
const getBearerToken = (authorizationHeader?: string) => {
con... |
AckeeCZ/node-template | src/config.ts | import { createLoader, safeValues, values } from 'configuru'
import { Level } from 'pino'
const loader = createLoader({
defaultConfigPath: '.env.jsonc',
})
const configSchema = {
logger: {
defaultLevel: loader.custom(x => x as Level)('LOGGER_DEFAULT_LEVEL'),
pretty: loader.bool('LOGGER_PRETTY'),
},
au... |
AckeeCZ/node-template | src/test/testing.ts | <reponame>AckeeCZ/node-template<filename>src/test/testing.ts
import * as supertest from 'supertest'
import server from '../server'
export const request = () => supertest(server)
export const t = {
request,
}
|
mgerst/pyquiz | src/store/actions.ts | <gh_stars>1-10
import {ActionTree} from 'vuex';
import { RootState } from './types';
export const actions : ActionTree<any, RootState> = {
socket_youAre({ commit }, message) {
commit('setIdentity', message);
},
socket_gameState({ commit }, { state }) {
commit('setState', state);
},
... |
mgerst/pyquiz | src/store/mutations.ts | import { MutationTree } from 'vuex';
import { RootState, State, Question, Category } from './types';
export const mutations : MutationTree<RootState> = {
setIdentity(state, { admin, team, logged_in }) {
state.admin = admin;
state.team = team;
state.logged_in = logged_in;
},
setState... |
mgerst/pyquiz | src/store/types.ts | export interface Team {
id : number;
name : string | null;
score : number;
taken : boolean;
}
export interface Question {
id : number
value : number
answer : string
question : string
category : number
daily_double : boolean
visible : boolean
}
export enum QuestionType {
... |
mgerst/pyquiz | src/filters/score.ts | <gh_stars>1-10
import { Team } from '../store/types';
export const score = (value : number) : string => {
return value === 0 ? "-" : value.toString();
};
export const teamName = (team : Team) : string => {
if (!team.taken || !team.name) {
return `Team ${team.id}`;
} else {
return team.name... |
mgerst/pyquiz | src/main.ts | import Vue from 'vue'
import VueSocketIOExt from 'vue-socket.io-extended';
import io from 'socket.io-client';
import App from './App.vue'
import {score, teamName} from './filters/score'
import store from './store'
const socket = io(`${location.protocol}//${document.domain}:${location.port}`);
Vue.use(VueSocketIOExt, ... |
mgerst/pyquiz | src/store/getters.ts | <gh_stars>1-10
import { GetterTree } from 'vuex';
import {RootState, State, Team, Board, Question} from './types';
export const getters : GetterTree<any, RootState> = {
gameState(state) : State {
return state.state;
},
loggedIn(state) : boolean {
return state.logged_in || window.jeopardy.ob... |
mgerst/pyquiz | src/store/index.ts | <reponame>mgerst/pyquiz
import Vue from 'vue'
import Vuex from 'vuex'
import { RootState, State } from './types';
import { getters } from './getters';
import { actions } from './actions';
import { mutations } from './mutations'
Vue.use(Vuex);
const state : RootState = {
state: State.Unknown,
admin: false,
... |
reruin/reserved-ip | src/index.ts | //https://en.wikipedia.org/wiki/Reserved_IP_addresses
const IPV4_CIDR = [
'0.0.0.0/8',
'10.0.0.0/8',
'172.16.58.3/10',
'127.0.0.0/8',
'169.254.0.0/16',
'172.16.0.0/12',
'192.0.0.0/24',//RFC 5736
'192.0.0.0/29',
'192.168.3.11/32',
'172.16.58.3/32',
'172.16.17.32/32',
'192.0.0.170/32',
'192.0.0... |
reruin/reserved-ip | index.d.ts | declare function isReservedIP(ip: string): boolean;
export default isReservedIP; |
XRFoundation/remix-project | libs/remixd/src/services/slitherClient.ts | /* eslint dot-notation: "off" */
import * as WS from 'ws' // eslint-disable-line
import { PluginClient } from '@remixproject/plugin'
import { existsSync, readFileSync, readdirSync } from 'fs'
import { OutputStandard } from '../types' // eslint-disable-line
const { spawn, execSync } = require('child_process')
export c... |
XRFoundation/remix-project | libs/remix-ui/solidity-compiler/src/lib/logic/compiler-helpers.ts | 'use strict'
import { canUseWorker, urlFromVersion } from './compiler-utils'
import { Compiler } from '@remix-project/remix-solidity'
import { CompilerAbstract } from './compiler-abstract'
export const compile = async (compilationTargets, settings, contentResolverCallback) => {
return new Promise((resolve) => {
... |
XRFoundation/remix-project | libs/remix-ui/solidity-compiler/src/lib/logic/compiler-utils.ts | const semver = require('semver')
const minixhr = require('minixhr')
/* global Worker */
export const baseURLBin = 'https://binaries.soliditylang.org/bin'
export const baseURLWasm = 'https://binaries.soliditylang.org/wasm'
export const pathToURL = {}
/**
* Retrieves the URL of the given compiler version
* @param ve... |
XRFoundation/remix-project | libs/remix-debug/test/decoder/vmCall.ts | 'use strict'
import { Transaction as Tx } from '@ethereumjs/tx'
import { Block } from '@ethereumjs/block'
import { BN, bufferToHex, Address } from 'ethereumjs-util'
import { vm as remixlibVM } from '@remix-project/remix-lib'
import VM from '@ethereumjs/vm'
import Common from '@ethereumjs/common'
export function sendTx... |
XRFoundation/remix-project | libs/remix-ui/solidity-compiler/src/lib/logic/index.ts | export * from './compileTabLogic'
export * from './compiler-abstract'
export * from './compiler-helpers'
export * from './compiler-utils'
export * from './contract-parser'
|
XRFoundation/remix-project | libs/remix-debug/test/vmCall.ts | 'use strict'
import { Block } from '@ethereumjs/block'
import VM from '@ethereumjs/vm'
var utileth = require('ethereumjs-util')
var Tx = require('@ethereumjs/tx').Transaction
var BN = require('ethereumjs-util').BN
var remixLib = require('@remix-project/remix-lib')
function sendTx (vm, from, to, value, data, cb) {
va... |
XRFoundation/remix-project | libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx | <reponame>XRFoundation/remix-project
import React, { useState, useEffect } from 'react' // eslint-disable-line
import { ContractSelectionProps } from './types'
import { PublishToStorage } from '@remix-ui/publish-to-storage' // eslint-disable-line
import { TreeView, TreeViewItem } from '@remix-ui/tree-view' // eslint-di... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/controllers/APIv1Router.ts | import { Router } from 'express';
import ToDoControllerRouter from '@/controllers/APIv1/ToDoControllerRouter';
const router = Router();
// Aggregates all controllers bellow under the same route '/api/v1'
router.use('/toDo', ToDoControllerRouter);
export default router;
|
AlmirJNR/Desafio-CI-T | DevelopmentTest/frontend_vue/src/services/ToDoService.ts | import axios from 'axios';
export async function getAllToDos() {
return axios.get('http://localhost:5000/api/v1/todo/');
}
export async function createNewToDo(message: string) {
return axios({
method: 'post',
url: 'http://localhost:5000/api/v1/todo/create',
data: {
text: message,
finished:... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/database/knexfile.ts | <filename>DevelopmentTest/backend_nodejs/database/knexfile.ts
import dotenv from 'dotenv';
// eslint-disable-next-line import/no-extraneous-dependencies
require('tsconfig-paths/register');
dotenv.config({
path: '../.env',
});
const config = {
main: {
client: 'postgresql',
connection: process.env.DATABASE... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/services/ToDoService/RestartSequence.ts | import { ToDoTable } from '@/utils/Constants';
import { knexConnection } from '@/services/database/DatabaseService';
export async function restartIdSequence(): Promise<void> {
return knexConnection().schema.raw(
`ALTER SEQUENCE ${ToDoTable}_id_seq RESTART WITH 1`,
);
}
export async function updateIdValues():... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/services/database/DatabaseService.ts | <gh_stars>0
/* eslint-disable import/prefer-default-export */
import knex, { Knex } from 'knex';
/** The singleton instance of Knex */
let knexInstance: Knex;
/** Returns the Knex singleton */
export const knexConnection = (): Knex => {
// This ensures that the Knex instance will be created when first called
// a... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/services/ToDoService/Put.ts | <filename>DevelopmentTest/backend_nodejs/src/services/ToDoService/Put.ts<gh_stars>0
import { ToDoTable } from '@/utils/Constants';
import { knexConnection } from '@/services/database/DatabaseService';
import { ToDo } from '@/types/model/ToDo';
export async function updateToDoById(id: number, updatedText: string, upd... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/services/ToDoService/Delete.ts | import { ToDoTable } from '@/utils/Constants';
import { knexConnection } from '@/services/database/DatabaseService';
import { ToDo } from '@/types/model/ToDo';
export async function deleteAllToDos(): Promise<ToDo|undefined> {
return knexConnection()
.delete<ToDo[]>()
.from(ToDoTable);
}
export async funct... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/services/ToDoService/Get.ts | import { ToDoTable } from '@/utils/Constants';
import { knexConnection } from '@/services/database/DatabaseService';
import { ToDo } from '@/types/model/ToDo';
export async function getAllToDos(): Promise<ToDo[]|undefined> {
return knexConnection()
.select<ToDo[]>()
.from(ToDoTable)
.orderBy('id');
}
|
AlmirJNR/Desafio-CI-T | DevelopmentTest/frontend_vue/src/router/index.ts | <filename>DevelopmentTest/frontend_vue/src/router/index.ts
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Axios from '../views/Axios.vue';
import NotFound from '../views/NotFound.vue';
const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'Axios',
component: Axio... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/test/ToDo.spec.ts | <reponame>AlmirJNR/Desafio-CI-T
/* eslint-disable no-plusplus */
import { describe, it, before, after } from 'mocha';
import request from 'supertest';
import Server from '@/Server';
import { restartIdSequence, updateIdValues } from '@/services/ToDoService/RestartSequence';
import { deleteAllToDos } from '@/services/To... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/controllers/APIv1/ToDoController/Get.ts | <reponame>AlmirJNR/Desafio-CI-T
import { Router } from 'express';
import { getAllToDos } from '@/services/ToDoService/Get';
const router = Router();
/** GET: returns all registered toDos */
router.get('/', async (request, response) => {
const isSuccess = await getAllToDos();
// Returns 404 if no ToDo is found w... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/utils/Constants.ts | // Insert database table names here
export const ToDoTable = 'todos';
|
AlmirJNR/Desafio-CI-T | DevelopmentTest/frontend_vue/src/types/ToDo.d.ts | <gh_stars>0
import { Moment } from 'moment';
export interface ToDo {
id: number,
text?: string,
finished?: boolean,
dateCreated?: Moment,
dateFinished?: Moment,
}
|
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/services/ToDoService/Post.ts | <reponame>AlmirJNR/Desafio-CI-T
import { ToDoTable } from '@/utils/Constants';
import { knexConnection } from '@/services/database/DatabaseService';
import { ToDo } from '@/types/model/ToDo';
export async function createNewToDo(text: string, finished: boolean, dateCreated: Date): Promise<any|undefined> {
return kn... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/controllers/APIv1/ToDoController/Delete.ts | <reponame>AlmirJNR/Desafio-CI-T<gh_stars>0
import { Router } from 'express';
import { deleteAllToDos, deleteToDoById, deleteToDoList } from '@/services/ToDoService/Delete';
const router = Router();
/** DELETE: delete all ToDos */
router.delete('/all', async (request, response) => {
const isSuccess = await deleteAl... |
AlmirJNR/Desafio-CI-T | DevelopmentTest/backend_nodejs/src/controllers/APIv1/ToDoController/Post.ts | import { Router } from 'express';
import { createNewToDo } from '@/services/ToDoService/Post';
const router = Router();
/** POST: create an new toDo */
router.post('/', async (request, response) => {
const { text, finished, dateCreated } = request.body;
// Returns 400 if request body is incomplete
if (!text |... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.