repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
potherca-contrib/coderbox | src/app/pages/hash-generator/hash-generator.page.ts | import { Component, OnInit } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { MatRadioChange } from '@angular/material/radio';
interface Hash {
algo: string;
enabled: boolean;
digest: ArrayBuffer;
digestRep... |
potherca-contrib/coderbox | src/app/shared/services/theme/theme.service.ts | import {
Injectable,
Inject,
Renderer2,
RendererFactory2,
PLATFORM_ID
} from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { MediaMatcher } from '@angular/cdk/layout';
import { OverlayContainer } from '@angular/cdk/overlay';
import { DOCUMENT } from '@angular/common';
@Injectab... |
Deivu/piscina | examples/typescript/src/index.ts | import Piscina from '../../..';
import { isMainThread } from 'worker_threads';
interface Inputs {
a : number;
b : number;
}
if (isMainThread) {
const piscina = new Piscina({ filename: __filename });
(async function () {
const task : Inputs = { a: 1, b: 2 };
console.log(await piscina.run(task));
})(... |
kooparse/bast | website/components/GlobalStat/index.tsx | import React, { ReactElement } from "react";
import {
Flex,
Skeleton,
Stat,
StatLabel,
StatHelpText,
StatNumber,
StatGroup,
} from "@chakra-ui/react";
const toReadableTimeFormat = (secondes: number): string => {
return secondes >= 60
? `${Math.floor(secondes / 60)}m`
: `${Math.floor(secondes)}s... |
kooparse/bast | website/components/CodeSnippet/index.tsx | <gh_stars>10-100
import React, { ReactElement } from "react";
import config from "next/config";
import { useClipboard, Code, Button } from "@chakra-ui/react";
const { COLLECT_GHOST_PICTURE, SCRIPT_ENDPOINT } = config().publicRuntimeConfig;
const getSnippet = (websiteId: string | number): string => {
const { origin ... |
kooparse/bast | website/pages/index.tsx | import React, { useState, useEffect, ReactElement, useContext } from "react";
import getUnixTime from "date-fns/getUnixTime";
import endOfMonth from "date-fns/endOfMonth";
import startOfMonth from "date-fns/startOfMonth";
import subDays from "date-fns/subDays";
import subMonths from "date-fns/subMonths";
import addDays... |
kooparse/bast | website/pages/_document.tsx | import React, { ReactElement } from "react";
import { ColorModeScript } from "@chakra-ui/react";
import Document, { Html, Head, Main, NextScript } from "next/document";
import theme from "../utils/theme";
class Bast extends Document {
render(): ReactElement {
return (
<Html>
<Head>
<meta
... |
kooparse/bast | website/components/Graph/index.tsx | <reponame>kooparse/bast
import React, { ReactElement, useEffect, useState } from "react";
import format from "date-fns/format";
import { ArrowBackIcon, ArrowForwardIcon } from "@chakra-ui/icons";
import {
Text,
Flex,
Stack,
Tooltip,
Skeleton,
Box,
RadioGroup,
ButtonGroup,
Button,
Radio,
} from "@cha... |
kooparse/bast | website/components/SystemTable/index.tsx | import React, { ReactElement } from "react";
import { Box } from "@chakra-ui/react";
import Table from "../Table";
const OperatingSystemTable = ({
systems,
loading,
title,
}: {
title: string;
systems: OS[] | Browser[];
loading: boolean;
}): ReactElement => {
let totalCounter = 0;
systems.forEach(({ co... |
kooparse/bast | website/pages/_app.tsx | <gh_stars>10-100
import React, { ReactElement } from "react";
import App, { AppInitialProps } from "next/app";
import NavBar from "../components/NavBar";
import { CSSReset, Box, Flex, ChakraProvider } from "@chakra-ui/react";
import api, { setAuthorization, isLogged } from "../utils/api";
import { UserContext } from ".... |
kooparse/bast | website/components/PageTable/index.tsx | import React, { ReactElement } from "react";
import { Box } from "@chakra-ui/react";
import Table from "../Table";
const PageTable = ({
pages,
loading,
}: {
pages: Page[];
loading: boolean;
}): ReactElement => {
let totalPageviews = 0;
pages.forEach(({ pageviews }) => (totalPageviews += pageviews));
ret... |
roma2341/zigzag-multilevel-menu | src/ts/main.ts | <gh_stars>0
import $ from 'jquery';
console.log("simple-menu.js works");
const MIN_WIDTH_TRIGGER = 576;
let menuIsInited = false;
let $simpleMenu:JQuery<HTMLElement>;
let $simpleMenuFolded:JQuery<HTMLElement>;
let $simpleMenuFoldedSubmenu:JQuery<HTMLElement>;
let $overflowHolder:JQuery<HTMLElement>;
let $menuItems:... |
roma2341/zigzag-multilevel-menu | index.ts | <reponame>roma2341/zigzag-multilevel-menu
import './src/scss/style.scss';
import './src/ts/main.ts'; |
SheikhZayed/ng-esri-demo | src/app/app.module.ts | <gh_stars>1-10
import { CommonModule } from '@angular/common';
import { HttpClientJsonpModule, HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { ... |
SheikhZayed/ng-esri-demo | src/app/components/map-view/map-view.component.ts | <reponame>SheikhZayed/ng-esri-demo
import {
transition, trigger, useAnimation
} from '@angular/animations';
import { HttpClient } from '@angular/common/http';
import {
Component, ElementRef, OnDestroy, OnInit, ViewChild
} from '@angular/core';
import * as esri from 'esri-service';
import { fadeIn } from 'ng-a... |
SheikhZayed/ng-esri-demo | src/environments/environment.prod.ts | <filename>src/environments/environment.prod.ts<gh_stars>1-10
export const environment = {
production: true,
arcgisJsApi: 'https://js.arcgis.com/4.8',
trustedServers: [
'http://map.geoq.cn',
'https://map.geoq.cn',
'127.0.0.1:4200'
],
dojoConfig: {
locale: 'zh-cn',
... |
SheikhZayed/ng-esri-demo | src/app/services/esri-loader-guard.ts | import { Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot
} from '@angular/router';
import { ILoadScriptOptions, loadModules, loadScript } from 'esri-loader';
import { environment } from '../../environments/environment';
@Injectable()
export class EsriLoaderGua... |
SheikhZayed/ng-esri-demo | src/environments/environment.ts | <filename>src/environments/environment.ts<gh_stars>1-10
// The file contents for the current environment will overwrite these during
// build. The build system defaults to the dev environment which uses
// `environment.ts`, but if you do `ng build --env=prod` then
// `environment.prod.ts` will be used instead. The list... |
SheikhZayed/ng-esri-demo | src/app/app-routing.module.ts | <reponame>SheikhZayed/ng-esri-demo
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { environment } from '../environments/environment';
import { HomeComponent } from './components/home/home.component';
import { AboutComponent } from './components/about/about.comp... |
SheikhZayed/ng-esri-demo | src/app/components/home/home.component.ts | import { trigger, transition, useAnimation } from '@angular/animations';
import { Component, OnInit } from '@angular/core';
import { fadeIn } from 'ng-animations';
@Component({
moduleId: module.id,
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
ani... |
DenisKuivalainen/mariadikki | node_modules/use-fit-text/index.ts | <reponame>DenisKuivalainen/mariadikki
import {
useCallback,
useEffect,
useLayoutEffect,
useRef,
useState,
} from "react";
import ResizeObserver from "resize-observer-polyfill";
export type TOptions = {
maxFontSize?: number;
minFontSize?: number;
onFinish?: (fontSize: number) => void;
onStart?: () => ... |
DenisKuivalainen/mariadikki | node_modules/use-fit-text/dist/index.d.ts | <gh_stars>0
/// <reference types="react" />
export declare type TOptions = {
maxFontSize?: number;
minFontSize?: number;
onFinish?: (fontSize: number) => void;
onStart?: () => void;
resolution?: number;
};
declare const useFitText: ({ maxFontSize, minFontSize, onFinish, onStart, resolution, }?: TOpt... |
DenisKuivalainen/mariadikki | node_modules/heroku-self-ping/dist/index.d.ts | /// <reference types="node" />
interface IOptions {
interval?: number;
logger?: (arg: string) => any;
verbose?: boolean;
}
declare const _default: (url?: string, options?: IOptions) => boolean | NodeJS.Timeout;
export default _default;
|
DenisKuivalainen/mariadikki | node_modules/heroku-self-ping/dist/logger.d.ts | declare namespace Logger {
const setLogger: (newLogger: (arg: string) => any) => void;
const setIsVerbose: (value: boolean) => void;
const log: (arg: string) => void;
const verbose: (arg: string) => void;
}
export default Logger;
|
DenisKuivalainen/mariadikki | node_modules/use-fit-text/dist/examples/pages/index.d.ts | <reponame>DenisKuivalainen/mariadikki
/// <reference types="react" />
/**
* Page
*/
declare function Page(): JSX.Element;
export default Page;
|
DenisKuivalainen/mariadikki | node_modules/use-fit-text/examples/pages/index.tsx | <reponame>DenisKuivalainen/mariadikki
import Head from "next/head";
import React, { useCallback, useState } from "react";
import useFitText from "use-fit-text";
/**
* Example1 - wrapping text
*/
function Example1() {
const { fontSize, ref } = useFitText();
return (
<>
<b>Example 1</b>
<div
... |
ansleyr2/interview-tracker | src/app/app.module.ts | <filename>src/app/app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
im... |
ansleyr2/interview-tracker | src/app/home/home.page.ts | <reponame>ansleyr2/interview-tracker<filename>src/app/home/home.page.ts
import { Router } from '@angular/router';
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
import { ModalController, ActionSheetController, AlertController } from '@ionic/angular';
import {
LoadingController
} from '@ionic/a... |
ansleyr2/interview-tracker | src/app/models/Interview.model.ts | export interface Interview{
id: String,
designation: String,
company:{
name: String,
address:{
addressLine: String,
city: String,
state: String,
zipCode: String
}
},
jobDescription?: String,
date: String,
time: String,
... |
ansleyr2/interview-tracker | src/app/map/map.component.ts | import { Component } from '@angular/core';
import { AppService } from '../app.service';
import {
Platform,
LoadingController
} from '@ionic/angular';
import {
GoogleMaps,
GoogleMap,
GoogleMapsEvent,
Marker,
GoogleMapsAnimation,
MyLocation
} from '@ionic-native/google-maps';
@Component({
selector: ... |
ansleyr2/interview-tracker | src/app/app.service.ts | import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';
import { InterviewListItem } from './models/InterviewListItem.model';
import { Interview } from './models/Interview.model';
@Injectable({
providedIn: 'root'
})
export class AppService {
// latitude and longitude for map
_lat: ... |
ansleyr2/interview-tracker | src/app/job-description/job-description.component.ts | <gh_stars>0
import { Component, OnInit, Input } from '@angular/core';
import { ModalController} from '@ionic/angular';
@Component({
selector: 'app-job-description',
templateUrl: './job-description.component.html',
styleUrls: ['./job-description.component.scss'],
})
export class JobDescriptionComponent implement... |
ansleyr2/interview-tracker | src/app/create-interview/create-interview.page.ts | import { Component, OnInit, NgZone } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Interview } from '../models/Interview.model';
import { FormBuilder, FormGroup, Validators, ValidatorFn, AbstractControl } from '@angular/forms';
import { NativeGeocoder, NativeGeocoderOptions... |
ansleyr2/interview-tracker | src/app/models/InterviewListItem.model.ts | export interface InterviewListItem {
id: String,
designation: String,
companyName: String,
date: String,
time: String,
location: {
lat: number,
lng: number
},
address?: string
showLocationBtn: boolean
} |
ansleyr2/interview-tracker | src/app/app.component.ts | import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppService } from '../app/app.service';
import { Router } from '@angular/router';
import {
Loading... |
ansleyr2/interview-tracker | src/app/details/details.component.ts | <filename>src/app/details/details.component.ts
import { Component, OnInit, Input } from '@angular/core';
import { Interview} from '../models/Interview.model';
import { ModalController } from '@ionic/angular';
import { AppService} from '../app.service';
import { JobDescriptionComponent } from '../job-description/job-de... |
bhageena/nimbella-deployer | src/finder-builder.ts | <gh_stars>0
/*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless r... |
nicolasbarb/songplaylist-backend | src/post/post.controller.ts | <gh_stars>0
import { Controller, Param, Post } from '@nestjs/common';
@Controller('post')
export class PostController {
@Post('/ok')
postOk(): string {
return 'ok';
}
@Post('/hello/:prenom')
postHello(@Param('prenom') prenom: string): string {
return prenom;
}
}
|
devmotheg/react-tours-list | src/components/Project.tsx | <filename>src/components/Project.tsx
/*!
* @author <NAME>
* @link https://github.com/devmotheg
*/
import React, { useState, useEffect } from "react";
interface Props {
id: string;
image: string;
name: string;
price: string;
info: string;
children?: React.ReactElement;
}
interface Card {
text: string;
butt... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/src/components/ListView/Filters/Base.ts | <reponame>YueRongLee/WisDOM-Platform-Reference<gh_stars>0
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you und... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/src/components/Menu/Menu.tsx | /* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable no-console */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses ... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/src/middleware/asyncEvent.ts | /* eslint-disable no-console */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Ver... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/cypress-base/cypress/integration/dashboard/url_params.test.ts | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/spec/javascripts/wisDOM/Menu/HelpMenu_spec.tsx | <gh_stars>0
import React from 'react';
// import sinon from 'sinon';
import { mount } from 'enzyme';
import HelpMenu from 'src/components/Menu/HelpMenu';
describe('wisDOM App', () => {
it('is valid', () => {
const wrapper = mount(<HelpMenu />); // mount/render/shallow when applicable
expect(wrapper.find('#us... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/src/components/Menu/LanguagePicker.tsx | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/src/views/CRUD/csstemplates/CssTemplatesList.tsx | /* eslint-disable react-hooks/exhaustive-deps */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Ap... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/src/components/Menu/HelpMenu.tsx | <gh_stars>0
/**
for Operation menual
*/
import React from 'react';
import { MenuItem } from 'react-bootstrap';
import NavDropdown from 'src/components/NavDropdown';
import { t } from '@superset-ui/core';
import AppConfig from 'src/config/app.base.config';
import ReactGA from 'react-ga';
import { useMatomo } from '@da... |
YueRongLee/WisDOM-Platform-Reference | superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx | <reponame>YueRongLee/WisDOM-Platform-Reference<filename>superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx
/* eslint-disable react-hooks/exhaustive-deps */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed wit... |
CyanSalt/font-cloak | lib/runtime.d.ts | <filename>lib/runtime.d.ts
export function encode(text: string, magicString: string): string
|
WHenderson/advanced-promise | src/index.ts | import { AbortablePromiseLike } from './AbortablePromiseLike';
import { CancellablePromiseLike } from './CancellablePromiseLike';
import { AbortApi, ABORT_STATE } from './AbortApi';
import { AbortApiInternal } from './AbortApiInternal';
import { AbortApiPublic } from "./AbortApiPublic";
import { Abortable } from './Abo... |
WHenderson/advanced-promise | src/Timeout.ts | <reponame>WHenderson/advanced-promise
import { ResponseReject, ResponseResolve, Response } from './Promise';
import { CancellablePromiseLike } from './CancellablePromiseLike';
import { AbortablePromiseLike } from './AbortablePromiseLike';
import {ABORT_STATE, AbortApi} from './AbortApi';
import { AbortApiInternal } fro... |
WHenderson/advanced-promise | test/Timeout.spec.ts | <reponame>WHenderson/advanced-promise<filename>test/Timeout.spec.ts<gh_stars>1-10
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import {Timeout} from "../src/Timeout";
chai.use(chaiAsPromised);
const should = chai.should;
const expect = chai.expect;
describe('Timeout', () => {
... |
WHenderson/advanced-promise | test/withTimeout.spec.ts | import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import {Abortable} from "../src/Abortable";
import {Timeout} from "../src/Timeout";
chai.use(chaiAsPromised);
const should = chai.should;
const expect = chai.expect;
describe('Abortable.withTimeout', () => {
it('over time', async ()... |
WHenderson/advanced-promise | src/AbortApi.ts | export type OnAbortCallback = () => void | PromiseLike<void>;
export type OnAbortHandle = unknown | PromiseLike<unknown>;
export enum ABORT_STATE {
NONE,
ABORTING,
ABORTED,
}
export interface AbortApi {
on(cb: OnAbortCallback): OnAbortHandle;
off(handle: OnAbortHandle, ignoreNotFound?: boolean): void;
r... |
WHenderson/advanced-promise | src/AbortablePromiseLike.ts | import { AbortApi } from './AbortApi';
import { Response } from './Promise';
export type AbortablePromiseExecutor<T> = (
resolve: (value?: T | PromiseLike<T>) => void,
reject: (reason?: any) => void,
aapi: AbortApi,
) => void;
export interface AbortablePromiseLike<T> extends Promise<T> {
// Abort with either ... |
WHenderson/advanced-promise | src/AbortApiPublic.ts | <filename>src/AbortApiPublic.ts
import {ABORT_STATE, AbortApi} from "./AbortApi"
import { AbortApiInternal } from "./AbortApiInternal";
export interface AbortApiPublic extends AbortApi {
abort(): PromiseLike<void>;
}
export class AbortApiPublic extends AbortApi implements AbortApiPublic {
public abort: () => ... |
WHenderson/advanced-promise | src/Abortable.ts | import { ABORT_STATE, AbortApi } from './AbortApi';
import { AbortApiInternal } from './AbortApiInternal';
import { Response } from './Promise';
import { Timeout } from './Timeout';
import { AbortablePromiseLike, AbortablePromiseExecutor } from './AbortablePromiseLike';
import {Deconstructed} from "./Deconstructed";
e... |
WHenderson/advanced-promise | src/Deconstructed.ts | import {DeconstructedPromiseLike} from "./DeconstructedPromiseLike";
export class Deconstructed<T> extends Promise<T> implements DeconstructedPromiseLike<T> {
public resolve: (value?: T | PromiseLike<T>) => void;
public reject: (reason?: any) => void;
static get [Symbol.species]() {
return Promise... |
WHenderson/advanced-promise | test/NestedTimeout.ts | <gh_stars>1-10
import {Abortable} from "../src/Abortable";
import {Timeout} from "../src/Timeout";
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
const should = chai.should;
const expect = chai.expect;
describe('NestedTimeout', () => {
const EX_ABORT_... |
WHenderson/advanced-promise | test/Abortable.spec.ts | <filename>test/Abortable.spec.ts
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import {Abortable} from "../src/Abortable";
import {Timeout} from "../src/Timeout";
chai.use(chaiAsPromised);
const should = chai.should;
const expect = chai.expect;
describe('Abortable', () => {
it(... |
WHenderson/advanced-promise | src/AbortApiInternal.ts | import {ABORT_STATE, AbortApi, AbortApiInternal as AbortApiInternalInterface, OnAbortCallback} from './AbortApi';
import {Response} from "./Promise";
export class AbortApiInternal implements AbortApiInternalInterface {
public handlers: [OnAbortCallback, OnAbortCallback | PromiseLike<OnAbortCallback>][];
public sta... |
WHenderson/advanced-promise | test/abortable-process/simple-process.ts | <gh_stars>1-10
import * as process from 'process';
import {Timeout} from "../../src/Timeout";
(async () => {
console.log('begin');
const duration = process.env.MY_DURATION
? parseInt(process.env.MY_DURATION, 10)
: 0;
console.log(`duration ${duration}ms`);
if (duration)
await ... |
WHenderson/advanced-promise | src/Promise.ts | export type Executor<T> = (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
export interface ResponseResolve<T> {
resolve: T | PromiseLike<T>;
}
export interface ResponseReject {
reject: any;
}
export type Response<T> = ResponseResolve<T> | ResponseReject;
|
WHenderson/advanced-promise | src/CancellablePromiseLike.ts | <reponame>WHenderson/advanced-promise<filename>src/CancellablePromiseLike.ts
import { AbortApi } from './AbortApi';
export interface CancellablePromiseLike<T> extends Promise<T> {
cancel(): void | CancellablePromiseLike<T>;
// Add a default onAbort handler which will cancel the promise
withAutoCancel(aapi: Abor... |
WHenderson/advanced-promise | test/Process.spec.ts | <filename>test/Process.spec.ts
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import * as cprocess from 'child_process';
import * as path from 'path';
import {Process} from "../src/Process";
import {Timeout} from "../src/Timeout";
chai.use(chaiAsPromised);
const should = chai.should;... |
WHenderson/advanced-promise | src/Process.ts | import { ChildProcess } from 'child_process';
import { Abortable } from './Abortable';
export interface ProcessResponseResolve {
code: number;
signal: string;
}
export class Process extends Abortable<ProcessResponseResolve> {
public process: ChildProcess;
private static _ctor(process: ChildProcess): Process ... |
blacklane/kiev-js | src/filter.ts | export class AttributesFilter {
filteredText: string = '[FILTERED]'
filters: string[]
constructor(filters: string[] = []) {
this.filters = filters
}
/**
* Returns a new Object with the keys which match the filters wit data filtered.
*
* @param {Object} attrs to be filtered
* @return {Object}... |
blacklane/kiev-js | src/index.test.ts | import * as logLevel from 'loglevel'
import { Logger, LoggerConfig, LogLevel } from '.'
jest.mock('loglevel')
const mockLogLevel = logLevel as jest.Mocked<typeof logLevel>
let defaultLogAttributes: string[]
let logger: Logger
let logMessage: string
let loggerInitConfig: LoggerConfig
const application = 'application-... |
blacklane/kiev-js | src/index.ts | <reponame>blacklane/kiev-js
import * as logger from 'loglevel'
import { AttributesFilter } from './filter'
export enum LogLevel {
TRACE = 'TRACE',
DEBUG = 'DEBUG',
INFO = 'INFO',
WARN = 'WARN',
ERROR = 'ERROR',
SILENT = 'SILENT'
}
export interface LoggerConfig {
application: string
environment: string... |
blacklane/kiev-js | src/filter.test.ts | import { AttributesFilter } from './filter'
let attributesFilter: AttributesFilter
let filterConfig: string[]
const logToBeFiltered = {
firstName: 'John',
lastName: 'Doe',
rolePolicy: 'admin',
email: '<EMAIL>',
address: {
street: 'Some street, 99, 12345-67'
},
settings: {
darkMode: false,
cl... |
private-yusuke/discord-diff-watch-bot | index.ts | import moment from 'moment'
import Watcher from './watcher'
import { Readable } from 'stream'
import DiscordDriver from './drivers/discord'
import MessageLike from './models/message-like'
import fetch from 'node-fetch'
import * as fs from 'fs'
const config: Config = JSON.parse(fs.readFileSync('config.json', 'utf-8'))
... |
private-yusuke/discord-diff-watch-bot | watcher.ts | import fetch from 'node-fetch'
import { JSDOM } from 'jsdom'
import * as diff from 'diff'
import moment from 'moment'
interface WatchTarget {
url: string
selector?: string
}
interface ContentWithDate {
content: string
date: moment.Moment
}
interface DiffWithTarget {
d: string
target: WatchTarget
}
export d... |
eric-hc/kbar | src/Results/Results.tsx | <gh_stars>0
import * as React from "react";
import { useKBar } from "..";
interface Context {
map: Record<
string,
{
index: number;
props?: any;
}
>;
reset: () => void;
getIndex: (id: string) => number;
getHandlers: (index: number, opts: any) => any;
activeIndex: number;
}
export c... |
eric-hc/kbar | src/Results/index.tsx | import Results from "./Results";
import { useResultItem } from "./useResultItem";
export { Results, useResultItem };
|
eric-hc/kbar | src/Results/useResultItem.tsx | <reponame>eric-hc/kbar
import * as React from "react";
import { useKBar } from "..";
import { Action } from "../types";
import { randomId, useIsomorphicLayout } from "../utils";
import { ResultsContext } from "./Results";
interface useResultItemProps {
action: Action;
}
export function useResultItem(props: useResul... |
eric-hc/kbar | example/src/App.tsx | <gh_stars>0
import "./index.scss";
import * as React from "react";
import { KBarAnimator } from "../../src/KBarAnimator";
import { KBarProvider } from "../../src/KBarContextProvider";
import { Results, useResultItem } from "../../src/Results";
import KBarPortal from "../../src/KBarPortal";
import useMatches, { NO_GROUP... |
GreatGodJackChen/myumirnt | src/services/menu.ts | <reponame>GreatGodJackChen/myumirnt
import request from '@/utils/request';
import { isMethod } from '@babel/types';
import { get } from 'http';
//import request from 'umi-request';
export async function getMenuData(): Promise<any> {
var t = request('https://localhost:44349/api/Menu')
return t;
}
|
GreatGodJackChen/myumirnt | src/pages/user/login.tsx | import { Alert, Checkbox, Icon } from 'antd';
import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale';
import React, { Component } from 'react';
import { CheckboxChangeEvent } from 'antd/es/checkbox';
import { Dispatch } from 'redux';
import { FormComponentProps } from 'antd/es/form';
import Link fro... |
GreatGodJackChen/myumirnt | mock/menu.ts | <filename>mock/menu.ts
export default {
// 支持值为 Object 和 Array
'GET /api/getMenuData':
[{
name: '欢迎',
path: '/',
icon: 'smile',
component:'./Welcome'
},
{
name: '系统管理',
path: '/',
icon: 'smile',
component: null,
children: [{
name: '欢迎1'... |
GreatGodJackChen/myumirnt | src/pages/user/index.tsx | import React from 'react';
export default (): React.ReactNode => (
<p style={{ textAlign: 'center' }}>
user!
</p>
);
|
GreatGodJackChen/myumirnt | src/pages/user/services/loginservice.ts | import request from 'umi-request';
import { FromDataType } from '../models/loginmodel';
export async function fakeAccountLogin(params: FromDataType) {
return request('https://localhost:44349/api/Auth', {
method: 'POST',
data: params,
});
}
export async function getFakeCaptcha(mobile: string) {
return re... |
del333ted/memcoin | src/server/middlewares/bot.ts | <reponame>del333ted/memcoin
import { Response, Request, NextFunction } from 'express'
import { Telegram } from 'telegraf'
export function telegrafMiddlware(telegram: Telegram) {
return function (req: Request, _: Response, next: NextFunction) {
// Attach telegram to the request
req.telegram = telegram
// ... |
del333ted/memcoin | types/express.d.ts | <gh_stars>10-100
// Dependencies
import { Telegram } from 'telegraf'
import { Request } from 'express'
import { IUser } from '../src/models/user'
declare global {
namespace Express {
interface Request {
telegram: Telegram,
user: IUser,
}
}
} |
del333ted/memcoin | src/helpers/name.ts | <reponame>del333ted/memcoin<gh_stars>10-100
import { ChatMember } from 'telegram-typings'
export function getName(member: ChatMember) {
const user = member.user
return `${user.username ? user.username : `${user.first_name}${user.last_name ? ` ${user.last_name}` : ''}`}`
} |
del333ted/memcoin | src/app.ts | // Get environment variables
import * as dotenv from 'dotenv'
dotenv.config({ path: `${__dirname}/../.env` })
// Dependencies
import { Telegraf, ContextMessageUpdate } from 'telegraf'
const telegraf = require('telegraf')
import { setupHelp } from './commands/help'
import { setupLeaderboard } from './commands/leaderboar... |
del333ted/memcoin | src/commands/token.ts | // Dependencies
import { Telegraf, ContextMessageUpdate } from 'telegraf'
import {
getUser,
generateApiTokenForUser,
revokeApiTokenForUser,
} from '../models'
import { getName } from '../helpers/name'
import { checkAdmin, isPrivate, isReply } from '../helpers/middleware'
// Token commands
export function setupTo... |
del333ted/memcoin | src/server/middlewares/auth.ts | <reponame>del333ted/memcoin<filename>src/server/middlewares/auth.ts
import { Response, Request, NextFunction } from 'express'
import { getUserByToken } from '../../models/user'
class InvalidTokenError extends Error {
type = 'InvalidTokenError'
message = 'Invalid token'
code = 401
}
class TokenNotFoundError exten... |
del333ted/memcoin | src/commands/leaderboard.ts | <filename>src/commands/leaderboard.ts
// Dependencies
import { Telegraf, ContextMessageUpdate } from 'telegraf'
import {
getLeaderboard,
UserInfo,
getUserInfo,
getCardinalLeaderboard,
} from '../models'
import { findIndex } from 'lodash'
// Leaderboard command
export function setupLeaderboard(bot: Telegraf<Con... |
del333ted/memcoin | src/helpers/middleware.ts | // Dependencies
import { ContextMessageUpdate } from 'telegraf'
export function isPrivate(ctx: ContextMessageUpdate, next: () => any) {
if (ctx.chat.type === 'private') return next()
return Promise.resolve()
}
export function isReply(ctx: ContextMessageUpdate, next: () => any) {
if (
!ctx.message ||
(!c... |
del333ted/memcoin | src/server/index.ts | // Dependencies
import * as express from 'express'
import { Telegram } from 'telegraf'
import { telegrafMiddlware, auth } from './middlewares'
import { UserRoute, TransferRoute } from './routes'
export function setupAPI(telegram: Telegram) {
// Create a new express application instance
const app: express.Applicat... |
del333ted/memcoin | src/server/routes/transfer.ts | <filename>src/server/routes/transfer.ts
// Dependencies
import { Router, Request, Response } from 'express'
import { getUser } from '../../models'
import { transfer } from '../../helpers/transfer'
const router = Router()
router.post('/', async (req: Request, res: Response) => {
try {
// Get sender and receiver ... |
del333ted/memcoin | src/models/user.ts | <reponame>del333ted/memcoin
// Dependencies
import { prop, Typegoose, InstanceType } from 'typegoose'
import * as hash from 'object-hash'
import { Telegram } from 'telegraf'
import { getName } from '../helpers/name'
// User class definition
class User extends Typegoose {
@prop({ required: true, index: true })
chat... |
del333ted/memcoin | src/server/routes/user.ts | // Dependencies
import { Router } from 'express'
import { getUser, getUserInfo } from '../../models'
const router = Router()
router.get('/:id', async (req, res) => {
try {
// Get id
const { id } = req.params
// Get user from db
const user = await getUser(parseInt(id, 10))
// Get user info with b... |
WesamAlmasri/social-app | data/posts.ts | const posts = [
{
id: '9357e9f9-bfa1-4088-b180-07079a4f475d',
text: 'This is no word to write, so I just try to write anything just to test the app, so I hope you are not reading this.',
created_at: '2021-06-22T14:50:41.201Z',
am_like: false,
category: {
id: '9357e9f9-bfa1-4088-b180-07079234... |
WesamAlmasri/social-app | store/comments/actionTypes.ts | <gh_stars>0
export const GET_COMMENTS = 'GET_COMMENTS';
export const DELETE_COMMENT = 'DELETE_COMMENT'; |
WesamAlmasri/social-app | components/Post/index.tsx | import React from 'react';
import { View, TouchableOpacity } from 'react-native';
import styles from './style';
import PostBody from './PostBody';
import PostFooter from './PostFooter';
import PostHeader from './PostHeader';
import { PostType } from '../../types';
import { useNavigation } from '@react-navigation/native... |
WesamAlmasri/social-app | screens/VerificationCodeScreen.tsx | import { useNavigation } from '@react-navigation/native';
import React, { useEffect, useState } from 'react';
import { View, Dimensions, Keyboard, Text, KeyboardAvoidingView, Platform, TextInput, TouchableOpacity, Alert, StyleSheet, TouchableWithoutFeedbackBase } from 'react-native';
import { NavigationProp } from '@re... |
WesamAlmasri/social-app | components/ProfileHeader/index.tsx | <gh_stars>0
import React from 'react';
import { View, Text } from 'react-native';
import styles from './style';
import { ProfileType, UserFileType } from '../../types';
import ProfilePicture from '../ProfilePicture';
import { FontAwesome } from '@expo/vector-icons';
export type ProfileHeaderProps = {
profile: Prof... |
WesamAlmasri/social-app | components/ConversationInterface/index.tsx | import React, { useEffect, useRef } from 'react';
import { View, FlatList, Text } from 'react-native';
import styles from './style';
import { MessageType } from '../../types';
import MessageBubble from '../MessageBubble';
export type ConversationInterfaceProps = {
conversation: MessageType[] | null,
}
const Conv... |
WesamAlmasri/social-app | store/chat/reducer.ts | <filename>store/chat/reducer.ts
import { combineReducers } from 'redux';
import * as actionTypes from './actionTypes';
import {
ActiveChatActionType,
ActiveChatStateType,
ActiveChatUserActionType,
ActiveChatUserStateType,
} from './types';
const activeChatInitialState: ActiveChatStateType = {
activeChat: nul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.