Skip to content

Instantly share code, notes, and snippets.

View BarishNamazov's full-sized avatar
♾️
stuck in a loop

Abutalib (Barish) Namazov BarishNamazov

♾️
stuck in a loop
View GitHub Profile
@BarishNamazov
BarishNamazov / naive-ui.ts
Created April 22, 2024 18:59
Naive UI plugin for Nuxt that adds styles to the head tag. Removes style load lag. Use with caution as it increases rendered HTML size.
import { setup } from "@css-render/vue3-ssr";
import { defineNuxtPlugin, type NuxtSSRContext } from "#app";
export default defineNuxtPlugin((nuxtApp) => {
if (process.server) {
const { collect } = setup(nuxtApp.vueApp);
const originalRenderMeta = nuxtApp.ssrContext?.renderMeta;
nuxtApp.ssrContext = nuxtApp.ssrContext || ({} as NuxtSSRContext);
nuxtApp.ssrContext.renderMeta = () => {
@BarishNamazov
BarishNamazov / useFetchy.ts
Last active March 28, 2024 00:46
Custom wrapper for Nuxt's useFetch while keeping type completion features
import type { AsyncData, UseFetchOptions, FetchResult } from "nuxt/app";
import type { FetchError } from "ofetch";
import type {
NitroFetchRequest,
AvailableRouterMethod as _AvailableRouterMethod,
} from "nitropack";
// Custom options
interface UseFetchyOptions<
_ResT,
@BarishNamazov
BarishNamazov / useApi.ts
Created January 29, 2024 22:12
A nice composable for fetching
import { ref, watch } from 'vue';
type Func = (...args: any[]) => any;
const apiState = reactive({
triggers: {} as Record<string, number>
});
export function refetchApi(key: string) {
apiState.triggers[key] = (apiState.triggers[key] || 0) + 1;
@BarishNamazov
BarishNamazov / eolymp.js
Last active January 26, 2023 09:48
This script adds the problem number to eolymp problem title in contest problems
// ==UserScript==
// @name Eolymp Group Problem Number
// @namespace http://tampermonkey.net/
// @version 0.1
// @description it's hard to know the problem number in eolymp groups, use this for more efficiency
// @author Barish Namazov
// @match https://www.eolymp.com/*/contests/*/problems/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=eolymp.com
// @grant none
// ==/UserScript==
@BarishNamazov
BarishNamazov / A
Created January 17, 2017 14:22
Məsələ A
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int birinci = (n/10000)%10;
int ikinci = (n/1000)%10;
int dorduncu = (n/10)%10;
int besinci = n%10;