index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/newcomments.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/newcomments'; describe('New Comments Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,700
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/newest.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/newest'; describe('Newest Posts Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,701
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/newpoll.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/newpoll'; describe('New Poll Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,702
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/newsfaq.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/newsfaq'; describe('FAQ Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,703
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/newsguidelines.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/newsguidelines'; describe('Guidelines Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,704
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/newswelcome.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/newswelcome'; describe('Welcome Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,705
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/noobcomments.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/noobcomments'; describe('Noob Comments Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,706
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/noobstories.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/noobstories'; describe('Noob Stories Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,707
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/reply.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/reply'; describe('Reply Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,708
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/security.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/security'; describe('Security Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,709
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/show.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/show'; describe('Show Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,710
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/showhn.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/showhn'; describe('Show HN Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,711
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/shownew.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/shownew'; describe('Show New Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,712
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/submit.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/submit'; describe('Submit Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,713
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/submitted.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/submitted'; describe('Submitted Posts Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,714
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/threads.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/threads'; describe('Threads Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,715
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/user.spec.tsx
/** @jest-environment jsdom */ import Page from '../../pages/user'; describe('User Page', () => { it('has default export', () => { expect(Page).toBeDefined(); }); });
1,716
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/comment-box.spec.tsx
/** @jest-environment jsdom */ import * as React from 'react'; import { render } from '@testing-library/react'; import { CommentBox } from './comment-box'; import { sampleData } from '../data/sample-data'; describe('Comment component', () => { it('renders at different indentation levels', () => { const wrapper ...
1,717
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/comment-box.tsx
import * as React from 'react'; export function CommentBox(): JSX.Element { return ( <tr> <td colSpan={2} /> <td> <form method="post" action="comment"> <input type="hidden" name="parent" value="15237896" /> <input type="hidden" name="goto" value="item?id=15237896" /> ...
1,718
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/comment.spec.tsx
/** @jest-environment jsdom */ import { render } from '@testing-library/react'; import MockDate from 'mockdate'; import * as React from 'react'; import { sampleData } from '../data/sample-data'; import { Comment } from './comment'; const comment = sampleData.comments[0]; // Snapshot will be out of date if we don't us...
1,719
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/comment.tsx
import Link from 'next/link'; import * as React from 'react'; import renderHTML from 'react-render-html'; import { convertNumberToTimeAgo } from '../helpers/convert-number-to-time-ago'; export interface ICommentProps { id: number; creationTime: number; indentationLevel: number; submitterId: string; text: st...
1,720
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/comments.tsx
import * as React from 'react'; import { NewsItemModel } from '../data/models'; import { Comment, commentFragment } from './comment'; export interface ICommentsProps { newsItem: NewsItemModel; } export const commentsFragment = ` fragment Comments on Comment { id comments { id comments { ...
1,721
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/footer.tsx
import Link from 'next/link'; import * as React from 'react'; export function Footer(): JSX.Element { return ( <tr> <td style={{ padding: '0px' }}> <img alt="" src="/static/s.gif" height="10" width="0" /> <table style={{ height: '2px', width: '100%', borderSpacing: '0px' }}> <tbod...
1,722
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/header-nav.tsx
import Link from 'next/link'; import * as React from 'react'; interface IHeaderNavProps { userId?: string; currentUrl: string; isNavVisible: boolean; title: string; } export function HeaderNav(props: IHeaderNavProps): JSX.Element { const { userId, currentUrl, isNavVisible, title } = props; return isNavVi...
1,723
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/header.tsx
import Link from 'next/link'; import * as React from 'react'; import { HeaderNav } from './header-nav'; export interface IHeaderProps { me: { id: string; karma: number } | undefined; currentUrl: string; isNavVisible: boolean; title: string; } export function Header(props: IHeaderProps): JSX.Element { const...
1,724
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/loading-spinner.tsx
import * as React from 'react'; export function LoadingSpinner(): JSX.Element { return ( <tr> <td> <div className="sk-circle"> <div className="sk-circle1 sk-child" /> <div className="sk-circle2 sk-child" /> <div className="sk-circle3 sk-child" /> <div classNa...
1,725
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/news-detail.spec.tsx
/** @jest-environment jsdom */ import { MockedProvider } from '@apollo/client/testing'; import { render } from '@testing-library/react'; import MockDate from 'mockdate'; import * as React from 'react'; import { sampleData } from '../data/sample-data'; import { NewsDetail } from './news-detail'; const newsItem = sampl...
1,726
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/news-detail.tsx
import { useMutation } from '@apollo/client'; import Link from 'next/link'; import Router from 'next/router'; import * as React from 'react'; import { HIDE_NEWS_ITEM_MUTATION } from '../data/mutations/hide-news-item-mutation'; import { convertNumberToTimeAgo } from '../helpers/convert-number-to-time-ago'; export inte...
1,727
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/news-feed.spec.tsx
/** @jest-environment jsdom */ import { MockedProvider } from '@apollo/client/testing'; import { render } from '@testing-library/react'; import MockDate from 'mockdate'; import * as React from 'react'; import { sampleData } from '../data/sample-data'; import { NewsFeedView } from './news-feed'; MockDate.set(150602212...
1,728
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/news-feed.tsx
import * as React from 'react'; import { DataValue } from 'react-apollo'; import { NewsItemModel } from '../data/models'; import { LoadingSpinner } from './loading-spinner'; import { NewsDetail, newsDetailNewsItemFragment } from './news-detail'; import { NewsTitle, newsTitleFragment } from './news-title'; export inte...
1,729
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/news-item-with-comments.tsx
import * as React from 'react'; import { NewsItemModel } from '../data/models'; import { CommentBox } from './comment-box'; import { Comments } from './comments'; import { LoadingSpinner } from './loading-spinner'; import { NewsDetail } from './news-detail'; import { NewsTitle } from './news-title'; export interface ...
1,730
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/news-title.spec.tsx
/** @jest-environment jsdom */ import { MockedProvider } from '@apollo/client/testing'; import * as React from 'react'; import MockDate from 'mockdate'; import { render } from '@testing-library/react'; import { NewsTitle } from './news-title'; import { sampleData } from '../data/sample-data'; MockDate.set(15060221298...
1,731
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/news-title.tsx
import { useMutation } from '@apollo/client'; import Router from 'next/router'; import * as React from 'react'; import { parse } from 'url'; import { UPVOTE_NEWS_ITEM_MUTATION } from '../data/mutations/upvote-news-item-mutation'; export interface INewsTitleProps { id: number; isRankVisible?: boolean; isUpvoteVi...
1,732
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/components
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/__snapshots__/comment-box.spec.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Comment component renders at different indentation levels 1`] = ` <body> <div> <tr> <td colspan="2" /> <td> <form action="comment" method="post" > <input name="parent" ...
1,733
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/components
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/__snapshots__/comment.spec.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Comment component renders at different indentation levels 1`] = ` <body> <div> <tr class="athing comtr " id="15238246" > <td> <table style="border: 0px;" > <tbody> <tr> <td ...
1,734
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/components
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/__snapshots__/news-detail.spec.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`NewsFeed component renders news items passed in as props 1`] = ` <body> <div> <tr> <td colspan="2" /> <td class="subtext" > <span class="score" > 171 points </span> ...
1,735
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/components
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/__snapshots__/news-feed.spec.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`NewsFeed component renders news items passed in as props 1`] = ` <body> <div> <tr> <td style="padding: 0px;" > <table class="itemlist" style="border: 0px; padding: 0px; border-collapse: collapse; border-spacing: 0...
1,736
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/components
petrpan-code/clintonwoo/hackernews-react-graphql/src/components/__snapshots__/news-title.spec.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`NewsTitle component renders news item properties passed in as props 1`] = ` <body> <div> <tr class="athing" > <td class="title" style="text-align: right; vertical-align: top;" > <span class="rank" ...
1,737
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/sample-data.ts
// Interface: Commentable (Object can be commented on) comments, commentCount, commenter // Interface: Voteable (Object can be voted on) upvotes, upvoteCount, hidden, hiddenCount, // Data Type: Comment, can be on a news item or another comment // Every time an upvote/downvote/comment is made, update the count import {...
1,738
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/models/comment-model.ts
export class CommentModel { public readonly id: number; public readonly creationTime: number; public readonly comments: number[]; public readonly parent: number; public readonly submitterId: string; public readonly upvotes: string[]; public readonly text: string; constructor(fields) { if (!fi...
1,739
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/models/feed.ts
export enum FeedType { TOP = 'top', NEW = 'new', BEST = 'best', SHOW = 'show', ASK = 'ask', JOB = 'job', }
1,740
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/models/index.ts
/* Models are pure data representations with validation */ export * from './feed'; export * from './news-item-model'; export * from './user-model'; export * from './comment-model';
1,741
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/models/news-item-model.ts
import { isValidUrl } from '../../helpers/is-valid-url'; let newPostIdCounter = 100; export class NewsItemModel { /** ID of submitter */ public readonly id: number; /** Count of comments on the post */ public readonly commentCount: number; /** List of comments */ public readonly comments; /** Post cr...
1,742
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/models/user-model.ts
import { validateUsername } from '../validation/user'; export class UserModel { public readonly id: string; public readonly about: string; public readonly creationTime: number; public readonly dateOfBirth: number | null; public readonly email: string | null; public readonly firstName: string | null; ...
1,743
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/mutations/hide-news-item-mutation.ts
import gql from 'graphql-tag'; export const HIDE_NEWS_ITEM_MUTATION = gql` mutation HideNewsItem($id: Int!) { hideNewsItem(id: $id) { id hidden } } `;
1,744
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/mutations/submit-news-item-mutation.ts
import gql from 'graphql-tag'; import { newsFeedNewsItemFragment } from '../../components/news-feed'; export interface ISubmitNewsItemGraphQL { submitNewsItem: { id }; // Return type of submitNewsItem mutation } export const SUBMIT_NEWS_ITEM_MUTATION = gql` mutation SubmitNewsItem($title: String!, $url: String) ...
1,745
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/mutations/upvote-news-item-mutation.ts
import gql from 'graphql-tag'; export const UPVOTE_NEWS_ITEM_MUTATION = gql` mutation UpvoteNewsItem($id: Int!) { upvoteNewsItem(id: $id) { id upvoteCount upvoted } } `;
1,746
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/queries/me-query.ts
import gql from 'graphql-tag'; export interface IMeQuery { me: { id: string; karma: number; }; } export const ME_QUERY = gql` query User { me { id karma } } `;
1,747
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/validation/user.ts
import { ValidationError, ValidationCode } from './validation-error'; export function validateUsername({ id }): boolean { if (id.length < 3 || id.length > 32) { throw new ValidationError({ code: ValidationCode.ID, message: 'User ID must be between 3 and 32 characters.', }); } return true; } ...
1,748
0
petrpan-code/clintonwoo/hackernews-react-graphql/src/data
petrpan-code/clintonwoo/hackernews-react-graphql/src/data/validation/validation-error.ts
export enum ValidationCode { ID = 'id', PASSWORD = 'pw', } export class ValidationError extends Error { public code: ValidationCode; constructor(err) { super(err.message); this.code = err.code; Error.captureStackTrace(this, ValidationError); } }
1,749
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/helpers/convert-number-to-time-ago.spec.ts
import { convertNumberToTimeAgo } from './convert-number-to-time-ago'; const ONE_YEAR = 3.154e10; const ONE_MONTH = 2.628e9; // don't care about weeks const ONE_DAY = 8.64e7; const ONE_HOUR = 3.6e6; const ONE_MINUTE = 60000; describe('convert-number-to-time-ago helper function', () => { it('accepts negative numbers...
1,750
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/helpers/convert-number-to-time-ago.ts
/** * Converts a number to text to show how long ago it was * eg. 2 years ago. 3 months ago. 16 minutes ago. */ export const convertNumberToTimeAgo = (number: number): string => { const now = +new Date(); const timeAgo = now - number; const ONE_YEAR = 3.154e10; const ONE_MONTH = 2.628e9; // don't care abo...
1,751
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/helpers/hash-password.ts
import * as crypto from 'crypto'; export const createHash = (password: string, salt: string, iterations: number): Promise<string> => { return new Promise((resolve, reject) => { const saltBuffer = typeof salt === 'string' ? Buffer.from(salt, 'base64') : salt; const callback = (err: Error | null, derivedKey: ...
1,752
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/helpers/init-apollo.tsx
import { InMemoryCache, NormalizedCacheObject } from '@apollo/client/cache'; import { ApolloClient, createHttpLink } from '@apollo/client'; import { debug } from 'debug'; import fetch from 'isomorphic-unfetch'; import { IS_SERVER, GRAPHQL_URI } from '../config'; const logger = debug('app:initApollo'); logger.log = co...
1,753
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/helpers/is-valid-url.ts
/** * Returns whether a string is a valid URL */ export function isValidUrl(str: string): boolean { const pattern = new RegExp( '^' + // protocol identifier '(?:(?:https?|ftp)://)' + // user:pass authentication '(?:\\S+(?::\\S*)?@)?' + '(?:' + // IP address exclusion //...
1,754
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/helpers/user-login-error-code.ts
export enum UserLoginErrorCode { INCORRECT_PASSWORD = 'pw', INVALID_ID = 'invalid_id', LOGGED_IN = 'loggedin', LOGIN_UNSUCCESSFUL = 'unsuccessful', LOGIN_UPVOTE = 'up', USERNAME_TAKEN = 'id', } const userLoginErrorCodeMessages: Record<UserLoginErrorCode, string> = { [UserLoginErrorCode.INCORRECT_PASSWORD...
1,755
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/helpers/with-data.tsx
/* eslint-disable react/jsx-props-no-spreading */ import { ApolloClient, ApolloProvider, NormalizedCacheObject } from '@apollo/client'; import { getDataFromTree } from '@apollo/client/react/ssr'; import * as cookie from 'cookie'; import { debug } from 'debug'; import { withRouter } from 'next/router'; import * as React...
1,756
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/layouts/blank-layout.tsx
import Head from 'next/head'; import * as React from 'react'; export function BlankLayout(props): JSX.Element { const { children } = props; return ( <div className="WordSection1"> <Head> <title>Hacker News Clone</title> <meta name="referrer" content="origin" /> <meta name="viewpo...
1,757
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/layouts/main-layout.tsx
import Head from 'next/head'; import * as React from 'react'; import { useQuery } from '@apollo/client'; import { Footer } from '../components/footer'; import { Header } from '../components/header'; import { IMeQuery, ME_QUERY } from '../data/queries/me-query'; interface IMainLayoutProps { children: React.ReactChil...
1,758
0
petrpan-code/clintonwoo/hackernews-react-graphql/src
petrpan-code/clintonwoo/hackernews-react-graphql/src/layouts/notice-layout.tsx
import Head from 'next/head'; import * as React from 'react'; export function NoticeLayout(props): JSX.Element { const { children } = props; return ( <div> <Head> <title>Hacker News Clone</title> <meta name="referrer" content="origin" /> <meta name="viewport" content="initial-sca...
1,759
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.dockerignore
node_modules build releases installers npm-debug.log .DS_Store .tmp .git node_modules/ .tmp/ dist/
1,760
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.editorconfig
[*] insert_final_newline = true indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true
1,761
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.eslintignore
build/ dist/ vendor/ out/ storybook-static/
1,762
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.eslintrc.js
module.exports = { parserOptions: { sourceType: 'module', ecmaVersion: 2020, }, extends: ['eslint:recommended', 'prettier'], plugins: ['prettier'], rules: { 'prettier/prettier': ['error'], 'no-console': 'error', }, env: { es2017: true, node: true, mocha: true, }, overrides:...
1,763
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.lintstagedrc.json
{ "*.{js,jsx,ts,tsx}": ["eslint --fix"], "*.{js,jsx,ts,tsx,json,css,md}": ["prettier --write"] }
1,764
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.mocharc.yaml
exit: true colors: true timeout: 10000 require: test/setup.ts
1,765
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.npmrc
playwright_skip_browser_download=1
1,766
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.prettierignore
build/ dist/ vendor/ out/
1,767
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/.prettierrc.json
{ "printWidth": 100, "trailingComma": "all", "semi": true, "singleQuote": true, "arrowParens": "always", "jsxBracketSameLine": true }
1,768
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/CONTRIBUTING.md
# Contributing to Sqlectron :+1::tada: First off, thanks for taking the time to contribute! :tada::+1: There are some ways of contributing to Sqlectron, you can either: - Report an issue. - [Contribute to the code base](docs/development). ## Report an issue - Before opening the issue make sure there isn't an issue...
1,769
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/Dockerfile
FROM maxcnunes/electron-distribution:eb3node4-onbuild # Keep the tmp folder inside the project. # This way we dont lose some cache files between distribution tasks ENV TMPDIR /usr/src/app/.tmp # Build all and pack only for Windows # because is not possible packing for OSX from Linux. # Use unsafe-perm to force npm re...
1,770
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/LICENSE
(The MIT License) Copyright (c) 2015 The SQLECTRON Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
1,771
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/README.md
[![Slack Status](https://sqlectron.herokuapp.com/badge.svg)](https://sqlectron.herokuapp.com) [![Build](https://github.com/sqlectron/sqlectron-gui/workflows/Build/badge.svg?branch=master&event=push)](https://github.com/sqlectron/sqlectron-gui/actions?query=workflow%3ABuild+branch%3Amaster) <p align="center"> <img sr...
1,772
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/babel.config.js
module.exports = { presets: [ [ '@babel/preset-env', { targets: 'Chrome > 89', // Electron 12 useBuiltIns: 'usage', corejs: { version: 3, proposals: true }, }, ], '@babel/preset-react', '@babel/preset-typescript', ], plugins: [ [ '@babel/plugin-p...
1,773
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/docker-compose.yml
version: '3' services: # --------------------- # Distribution services # --------------------- dist: image: maxcnunes/electron-distribution:eb3node4-onbuild # Build all and pack only for Windows # because is not possible packing for OSX from Linux. # Use unsafe-perm to force npm respect the tmp...
1,774
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/empty-shim.js
module.exports = null;
1,775
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/package-lock.json
{ "name": "sqlectron", "version": "1.38.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sqlectron", "version": "1.38.0", "license": "MIT", "dependencies": { "@babel/core": "^7.14.3", "@types/react-virtualized": "^9.21.16", "ace-build...
1,776
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/package.json
{ "name": "sqlectron", "version": "1.38.0", "description": "A simple and lightweight SQL client with cross database and platform support", "author": { "name": "The Sqlectron Team", "email": "maxcnunes@gmail.com" }, "main": "./out/browser/main.js", "license": "MIT", "homepage": "https://sqlectron...
1,777
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/postcss.config.js
const autoprefixer = require('autoprefixer'); module.exports = { plugins: { autoprefixer, }, };
1,778
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/tsconfig.build.json
{ "compilerOptions": { "target": "es5", "module": "commonjs", "rootDir": "src", "outDir": "out", "jsx": "react", "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "skipLibCheck": true }, "include": ["src"] }
1,779
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/tsconfig.json
{ "compilerOptions": { "target": "es5", "module": "commonjs", "rootDir": ".", "outDir": "out", "jsx": "react", "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "skipLibCheck": true }, "include": ["src", "test", "stor...
1,780
0
petrpan-code/sqlectron
petrpan-code/sqlectron/sqlectron-gui/webpack.config.js
const path = require('path'); const autoprefixer = require('autoprefixer'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const isProd = pro...
1,781
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/.husky/pre-commit
#!/bin/sh . "$(dirname "$0")/_/husky.sh" # Run linters npx --no-install lint-staged # Run test npm test
1,782
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/.storybook/main.js
module.exports = { stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'], addons: ['@storybook/addon-links', '@storybook/addon-essentials'], core: { builder: 'webpack5', }, };
1,783
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/.storybook/preview.js
export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, controls: { matchers: { color: /(background|color)$/i, date: /Date$/, }, }, };
1,784
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/build/entitlements.mac.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <!-- https://github.com/electron/electron-notarize#prerequisites --> <key>com.apple.security.cs.allow-jit</key> <true/> <key>com.ap...
1,785
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/build/notarize.js
const dotenv = require('dotenv'); const { notarize } = require('electron-notarize'); const fs = require('fs'); const path = require('path'); if (fs.existsSync(path.join(__dirname, '..', '.env'))) { dotenv.config({ path: path.resolve(path.join(__dirname, '..', '.env')), }); } exports.default = async (context) ...
1,786
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/app/configuration-file.md
## Configuration File SQLECTRON keeps a configuration file in the directory: - **macOS:** `~/Library/Preferences/Sqlectron` - **Linux:** (`$XDG_CONFIG_HOME` or `~/.config`) + `/Sqlectron` - **Windows:** (`$LOCALAPPDATA` or `%USERPROFILE%\AppData\Local`) + `\Sqlectron\Config` > For older versions it was stored as `.s...
1,787
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/app/keyboard-shortcuts.md
## General | Windows/Linux | Mac | Action | | :-------------------------------------------- | :----------------------------------------------- | :----------------- | | <kbd>Ctrl</kbd>-<kbd>Q</kbd> | <kbd>Command</...
1,788
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/app/logging.md
## Logging > **IMPORTANT!** Replace any sensitive data (e.g. password) before including the log data in an issue. > > **IMPORTANT!** Disable the log if you are not investigating an issue. It makes the app slower. And with log to file enabled it may saves data to file that you don't want to be saved every time you are ...
1,789
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/development/README.md
# Sqlectron Development If you are only interested in running the Sqlectron from the source [here is](run-from-source.md) the straight forward way. After running the application if you are interested in contributing to the code base as well. Please follow these recommendations below: ## Contributing to the code base...
1,790
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/development/build-instructions.md
# Build 1. `npm install` 1. `npm run dist` 1. The installer will be placed at `dist` folder.
1,791
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/development/docker-databases.md
# Docker databases You can test it using your own database or use a [docker-compose](https://github.com/sqlectron/sqlectron-databases) built for us to bring up several different databases.
1,792
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/development/release.md
# Release We use [electron-builder](https://github.com/electron-userland/electron-builder) to package and distribute the application. Which makes really easy doing that. 1. Merge the changes to the main branch. 1. On GitHub, open the Build action for the last commit and test the app, it will have uploaded the artifac...
1,793
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/development/run-from-source.md
# Run from Source The Sqlectron developer environment requires Node **(10 or higher)** and NPM. **Cloning this project:** ```shell git clone git@github.com:sqlectron/sqlectron-gui.git cd sqlectron-gui ``` **Installing the dependencies:** ```shell npm install ``` **Running the application:** ```shell npm run dev ...
1,794
0
petrpan-code/sqlectron/sqlectron-gui/docs
petrpan-code/sqlectron/sqlectron-gui/docs/development/test-core-changes.md
# Testing changes of sqlectron-db-core This is an easy way to test sqlectron-db-core changes on the GUI project. 1. Make the GUI project use the core from `../sqlectron-db-core` directory: ```bash # from sqlectron-gui directory ./scripts/link-sqlectron-db-core.sh ``` 1. Start the auto compile of sqlectron-db-core: ...
1,795
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/scripts/.eslintrc
{ "env": { "node": true }, "rules": { "no-console": 0, "prefer-destructuring": 0 } }
1,796
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/scripts/dev-auto-restart.js
#!/usr/bin/env node const fs = require('fs'); const { join } = require('path'); const electron = require('electron'); const main = join(__dirname, '../out/browser/main.js'); const watch = [join(__dirname, '../out/browser')]; const pathCore = join(__dirname, '../../sqlectron-db-core/lib'); try { fs.accessSync(pathCo...
1,797
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/scripts/link-sqlectron-db-core.sh
#!/bin/bash set -e rm -rf node_modules/sqlectron-db-core npm link ../sqlectron-db-core
1,798
0
petrpan-code/sqlectron/sqlectron-gui
petrpan-code/sqlectron/sqlectron-gui/scripts/start-test-integration-deps.sh
#!/bin/bash set -e cd .. if [ ! -d "sqlectron-db-core" ]; then # Only clone flat in the CI. In development the developer probably wants to # use the sqlectron-db-core for other changes as well and may need the full history. if [ "$CI" == "true" ]; then git clone --depth 1 https://github.com/sqlectron/sqlect...
1,799