Skip to content

Instantly share code, notes, and snippets.

View fayazara's full-sized avatar
Writing Code

Fayaz Ahmed fayazara

Writing Code
View GitHub Profile
@fayazara
fayazara / aliases.sh
Last active March 12, 2025 08:47
My bash aliases - Not sure if these work on Linux/Windows
# Node.js project shortcuts (requires 'ni' package manager - https://github.com/antfu-collective/ni)
alias d="nr dev" # npm/pnpm/yarn run dev
alias s="nr start" # npm/pnpm/yarn run start
alias i="ni" # Install dependencies
alias u="nun" # Uninstall a a package
alias up="nlx taze" # Update dependencies to latest versions
# Open Cursor app
alias c="open $1 -a \"Cursor\""
@fayazara
fayazara / llm-generate.js
Created February 17, 2025 04:08
Generate a huge markdown file from your codebase for using it in LLMs
import { promises as fs } from 'fs';
import path from 'path';
const SKIP_EXTENSIONS = [
'.svg',
'.png',
'.jpg',
'.jpeg',
'.gif',
'.ico',
/// <reference path="../pb_data/types.d.ts" />
routerAdd('GET', '/ai-chat', async (e) => {
try {
const OpenAI = require(`${__hooks}/node_modules/openai/index.js`);
const openai = new OpenAI({
apiKey: 'OPEN_API_KEY',
});
const completion = await openai.chat.completions.create({
@fayazara
fayazara / pocketbase_stripe_utils.js
Created January 23, 2025 19:00 — forked from marnixk/pocketbase_stripe_utils.js
Pocketbase Stripe Javascript Functions
/*
____ _ _ _ _ _ _ _
/ ___|| |_ _ __(_)_ __ ___ | | | | |_(_) |___
\___ \| __| '__| | '_ \ / _ \ | | | | __| | / __|
___) | |_| | | | |_) | __/ | |_| | |_| | \__ \
|____/ \__|_| |_| .__/ \___| \___/ \__|_|_|___/
|_|
Purpose:
@fayazara
fayazara / TextRotator.vue
Created November 12, 2023 05:18
Rotating text with just tailwindcss
<template>
<div class="p-4 bg-gray-100 rounded-md border flex flex-col justify-center items-center overflow-hidden">
<div class="font-extrabold text-lg [text-wrap:balance] text-gray-700">
We design and develop the best
<span class=" inline-flex flex-col h-[calc(theme(fontSize.lg)*theme(lineHeight.tight))] overflow-hidden">
<ul class="block text-left leading-tight [&_li]:block animate-text-slide">
<li class="text-indigo-500">Mobile apps</li>
<li class="text-rose-500">Websites</li>
<li class="text-yellow-500">Admin dashboards</li>
<li class="text-teal-500">Landing pages</li>
@fayazara
fayazara / index.css
Last active April 24, 2023 09:17
Makes Poe better on wider screens. Screenshot 👇
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");
:root {
--font-size-large: 1rem !important;
--text-gray-dark: #334155 !important;
}
body {
font-family: "Inter", sans-serif !important;
}
@fayazara
fayazara / index.js
Last active March 26, 2023 08:32
A cf worker to sumamrize emails even before they hit your inbox. (DOES NOT WORK as there's no way to edit the email content)
const { default: PostalMime } = require("postal-mime");
const AI_MODEL = "gpt-3.5-turbo";
const OPEN_AI_API_KEY = "YOUR_API_KEY_HERE";
const streamToArrayBuffer = async (stream, streamSize) => {
const result = new Uint8Array(streamSize);
let bytesRead = 0;
const reader = stream.getReader();
while (bytesRead < streamSize) {
const { done, value } = await reader.read();
@fayazara
fayazara / index.html
Created June 14, 2022 07:41
Octopus Saas Connection Illustration
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
@fayazara
fayazara / index.vue
Created May 25, 2022 14:36
Vercel like tabs with vue js and tailwindcss
<template>
<main class="py-24 bg-slate-50 min-h-screen">
<div class="border-shadow">
<div class="max-w-4xl mx-auto">
<div ref="wrapper" class="flex items-center relative">
<div
ref="highlighter"
class="bg-slate-200 absolute top-3 rounded-md h-8 transition-all duration-150"
:style="highlightStyles"
></div>
@fayazara
fayazara / scriptable-widget-gh-stars.js
Last active October 19, 2021 00:07
Scriptable widget for displaying a Github repo stars
// Created by Fayaz https://twitter.com/fayazara
let widget = await createWidget();
if (config.runsInWidget) {
Script.setWidget(widget);
} else {
widget.presentSmall();
}
Script.complete();