Skip to content

Instantly share code, notes, and snippets.

View TangoPJ's full-sized avatar
🎯
Focusing

Rail Batyrshin TangoPJ

🎯
Focusing
  • Kyrgyzstan
View GitHub Profile
@TangoPJ
TangoPJ / editor.ts
Created September 26, 2023 13:45
Editor.ts
// 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 = '*'
/**
* @param {string[]} strings
* @return {string}
*/
const longestCommonPrefix = (strings) => {
if (strings.length === 1) {
return strings[0];
}
const sortedStrings = strings.sort();
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 = '';
@TangoPJ
TangoPJ / gist:efb44601ac5e69ea2986c9a055ac9124
Created December 3, 2022 18:56
start_function_to_longest_common_prefix_string.js
const longestCommonPrefix = (strings) => {
if (strings.length === 1) {
return strings[0];
}
};
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([])
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) {
.wrapper {
background-color: #2f3660;
text-align: center;
padding-top: 48px;
padding-bottom: 48px;
}
.title {
color: #ebebeb;
letter-spacing: 2px;
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}>
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" />
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}`);