This file contains hidden or 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
// v4 | |
import { connect } from "puppeteer-real-browser"; | |
import fs from 'fs'; | |
import path from 'path'; | |
// Use the exact types from puppeteer-real-browser | |
type ConnectResult = Awaited<ReturnType<typeof connect>>; | |
type PuppeteerBrowser = ConnectResult['browser']; | |
type PuppeteerPage = ConnectResult['page']; |
This file contains hidden or 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
(function () { | |
const originalConsoleError = console.error; | |
const errorSocket = io(location.origin); | |
console.error = function () { | |
originalConsoleError.apply(console, arguments); | |
const errorText = Array.from(arguments).join(' '); | |
const errorInfo = { | |
type: 'console_error', |
This file contains hidden or 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 { useState, useEffect } from 'react'; | |
const breakpoints = { | |
// sm: 640, | |
// md: 768, | |
lg: 1024, | |
// xl: 1280, | |
}; | |
const getBreakpoint = (width) => { |
This file contains hidden or 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 dynamic from 'next/dynamic' | |
import React from 'react' | |
const NoSsr = props => ( | |
<React.Fragment>{props.children}</React.Fragment> | |
) | |
export default dynamic(() => Promise.resolve(NoSsr), { | |
ssr: false | |
}) |
This file contains hidden or 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 React, { useState, useEffect, useRef } from 'react'; | |
interface VisibilityObserverProps { | |
children: (props: { elementRef: React.RefObject<HTMLDivElement>, isVisible: boolean }) => JSX.Element; | |
} | |
const VisibilityObserver: React.FC<VisibilityObserverProps> = ({ children }) => { | |
const [isVisible, setIsVisible] = useState(false); | |
const elementRef = useRef<HTMLDivElement>(null); |
This file contains hidden or 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 'dart:convert'; | |
dynamic parseJson(String jsonString, String path) { | |
var json = jsonDecode(jsonString); | |
List<String> parts = path.split('.'); | |
dynamic element = json; | |
for (var part in parts) { | |
if (part.contains('[') && part.contains(']')) { |
This file contains hidden or 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
// v0.0.18 | |
import path from "path"; | |
import fs from 'fs'; | |
import { Page, BrowserType, BrowserContext, chromium, firefox } from "playwright"; | |
class ChromeConstants { | |
static SHOULD_CRASH_AFTER_URL_RETRY = true | |
static dbPath = "./data/database.json" |
This file contains hidden or 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
[ | |
{ | |
"title": "Vscode", | |
"url": "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-user" | |
} | |
] |
This file contains hidden or 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 { User } from '@interfaces/user.interface'; | |
import { User } from '@interfaces/user.interface'; | |
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | |
export const GetUser = createParamDecorator( | |
(data, ctx: ExecutionContext): User => { | |
const req = ctx.switchToHttp().getRequest(); | |
return req.user; | |
}, | |
); |
This file contains hidden or 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
// @ts-ignore | |
const readline = require("readline") | |
export class Question { | |
static ask(questionTexts: string, callback?: (answer: string) => void): Promise<string> { | |
return new Promise((resolve) => { | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}) |
NewerOlder