This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// git repo: https://github.com/optimalux/js-agent/blob/master/src/editor.ts | |
export class Editor { | |
iframe: HTMLIFrameElement | |
destination: string | |
constructor(iframe: HTMLIFrameElement) { | |
this.iframe = iframe | |
this.destination = '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string[]} strings | |
* @return {string} | |
*/ | |
const longestCommonPrefix = (strings) => { | |
if (strings.length === 1) { | |
return strings[0]; | |
} | |
const sortedStrings = strings.sort(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const longestCommonPrefix = (strings) => { | |
if (strings.length === 1) { | |
return strings[0]; | |
} | |
const sortedStrings = strings.sort(); | |
const first = sortedStrings.at(0).split(''); | |
const last = sortedStrings.at(-1); | |
let result = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const longestCommonPrefix = (strings) => { | |
if (strings.length === 1) { | |
return strings[0]; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Link from 'next/link' | |
import styles from './GithubRender.module.css' | |
import Fork from '../../images/fork.svg' | |
import Star from '../../images/star.svg' | |
import Image from 'next/image' | |
import { getInfoFromGit } from '../../api' | |
import { useEffect, useState } from 'react' | |
export const GithubRender = () => { | |
const [repos, setRepos] = useState([]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Octokit } from "@octokit/core"; | |
export const getInfoFromGit = async (urls) => { | |
const octokit = new Octokit({ | |
auth: process.env.NEXT_PUBLIC_GITHUB_TOKEN, | |
}) | |
const repositories = [] | |
for (const url of urls) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.wrapper { | |
background-color: #2f3660; | |
text-align: center; | |
padding-top: 48px; | |
padding-bottom: 48px; | |
} | |
.title { | |
color: #ebebeb; | |
letter-spacing: 2px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Link from 'next/link' | |
import styles from './GithubRender.module.css' | |
import Fork from '../../images/fork.svg' | |
import Star from '../../images/star.svg' | |
import Image from 'next/image' | |
export const GithubRender = () => { | |
return ( | |
<section className={styles.wrapper}> | |
<h1 className={styles.title}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Head from 'next/head' | |
import styles from '../styles/Home.module.css' | |
export default function Home() { | |
return ( | |
<div className={styles.container}> | |
<Head> | |
<title>Home page</title> | |
<meta name="description" content="Generated by create next app" /> | |
<link rel="icon" href="/favicon.ico" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
const getInfoFromGit = async (urls) => { | |
const response = []; | |
for (const url of urls) { | |
try { | |
const { | |
data: { stargazers_count, forks, name, html_url }, | |
} = await axios.get(`https://api.github.com/repos/${url}`); |
NewerOlder