Skip to content

Instantly share code, notes, and snippets.

View fxzhukov's full-sized avatar
🚀
Make it work

Evgeniy Zhukov fxzhukov

🚀
Make it work
View GitHub Profile
@fxzhukov
fxzhukov / gist:8287a432596ae750ffc631a67911bfc9
Last active August 21, 2025 07:01
ебучая ссанина
async sendMessageStream(
request: SimpleChatRequest,
onChunk: (chunk: string, metadata?: any) => void,
onComplete: (response: SimpleChatResponse) => void,
onError: (error: Error) => void
): Promise<void> {
const controller = new AbortController()
const timeoutId = setTimeout(() => controller.abort(), this.requestTimeout)
try {
@fxzhukov
fxzhukov / ReactRecaptcha.js
Created February 5, 2020 15:31
ReactRecaptcha.js
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
const loadedScripts = []
function useScript(src) {
const [state, setState] = useState({
loaded: false,
error: false,
})
/**
* Test if lines equal
* @param s1 - first segment [{x, y}, {x,y}]
* @param s2 - second segment [{x, y}, {x,y}]
*/
linesEqual(s1, s2) {
let s1Eq = [(s1[0].y - s1[1].y), (s1[1].x - s1[0].x), ((s1[0].x * s1[1].y) - (s1[1].x * s1[0].y))];
let s2Eq = [(s2[0].y - s2[1].y), (s2[1].x - s2[0].x), ((s2[0].x * s2[1].y) - (s2[1].x * s2[0].y))];
let returnVal = 'joint';