Skip to content

Instantly share code, notes, and snippets.

View mubaidr's full-sized avatar
🎯
Adding bugs to web applications!

Muhammad Ubaid Raza mubaidr

🎯
Adding bugs to web applications!
View GitHub Profile
@taminhtienhai
taminhtienhai / code_flags.md
Last active January 19, 2026 19:46
VSCode: Enable GPU Acceleration

My Device

❯ fastfetch
                  -`                     
                 .o+`                    -----------
                `ooo/                    OS: Arch Linux x86_64
               `+oooo:                   Host:
              `+oooooo:                  Kernel: Linux 6.16.0-3-cachyos
              -+oooooo+:                 Uptime: 1 hour, 36 mins

Beast Mode

Beast Mode is a custom chat mode for VS Code agent that adds an opinionated workflow to the agent, including use of a todo list, extensive internet research capabilities, planning, tool usage instructions and more. Designed to be used with 4.1, although it will work with any model.

Below you will find the Beast Mode prompt in various versions - starting with the most recent - 3.1

Installation Instructions

  • Go to the "agent" dropdown in VS Code chat sidebar and select "Configure Modes".
  • Select "Create new custom chat mode file"
@mubaidr
mubaidr / 01.auth.global.ts
Created January 28, 2025 05:51
A sample implementation of middleware for Nuxt Atnetication whcih supports unauthenticated access.
export default defineNuxtRouteMiddleware(async (to) => {
const { loggedIn, user, clear } = useUserSession()
const auth = to.meta.auth as
| undefined
| boolean
| {
unauthenticatedOnly: boolean
navigateAuthenticatedTo: string | undefined
}

Volar 2.0: The Rewrite

I'm Johnson, the author of Volar (now Vue Language Tools). We released 2.0 in March 2024. This is a look back at what we changed, why, and what it cost.

Why we needed to rewrite

Vetur and Volar v1 implemented Vue's IDE support through the Language Server Protocol. For small and medium projects this worked fine. For larger projects it broke down, and the reason was always the same: memory.

TypeScript Server and the Vue Language Server each kept their own copy of the project's TS AST — every file, every .d.ts in node_modules. When a project pulled in thousands of .d.ts files (common for anything with a big dependency tree), the two processes together could exhaust available memory.

@yellinben
yellinben / vscode_proxy.jsonc
Last active June 6, 2025 09:50
Allow HTTP proxy in VS Code & Copilot
// Add these settings at the end of VSCode's `settings.json` file to allow HTTP inspection.
// For use with any MITM, self-signed HTTP proxy (Proxyman, Charles, Fiddler, etc).
// Last tested on VSCode 1.78.2. It's possible security settings will be hardened in future releases.
// Make sure to enable SSL-proxying of relevant hostnames to intercept complete requests/responses.
// For Copilot: `copilot-proxy.githubusercontent.com`
// These settings are obviously not secure, so disable them when not needed!
{
/* rest of your vscode settings */
@atinux
atinux / sse.ts
Last active January 21, 2026 11:23
SSE endpoint example with Nuxt 3
// ~/server/api/sse.ts
export default defineEventHandler(async (event) => {
if (!process.dev) return { disabled: true }
// Enable SSE endpoint
setHeader(event, 'cache-control', 'no-cache')
setHeader(event, 'connection', 'keep-alive')
setHeader(event, 'content-type', 'text/event-stream')
setResponseStatus(event, 200)
@lukeed
lukeed / cron-human.ts
Last active May 7, 2023 18:53
cron syntax & human readable output — https://t.co/CBThaezwzC
// https://crontab.guru/
// https://www.typescriptlang.org/play?ts=4.9.5#code/C4TwDgpgBAwgSgeQHJQLxQAYBIDe9kB0AogB5gBOEAzlQJYD2AdgL5S75LFmU0Mtt5EnUhWp0mrdkK6jeEgRxk9xLDAG4AUAHotUPVAB6Afg0bQkKABVqwAIxpY0gBIBXALYBDRgB4ARAGYABigATigAKgiI3wA+TR19QxMzcGhrKmAAJgdFV08fX0iwyJLY+N19Y1NzNJt-HOd3Lz9wrXriqPCy7Qq9KpSLdOAAFgbCPObCtoitUZLouJ7E-pqrGwBWMc4Jgtb6+dLFhMrk1aGANi2CHZaZ-c7u477T1LWMgHYrm99bTdbsg6PXpJaqvIYADi+TV2UXuXSOwJWYJsYXQuWhtxK00O5WWL0GNlswTRjXymKg+y0AKBeNBBIytnsJPGGMKsJm2WGNJOdNqDOyzO2rOCmUpAOxs25z15bzs9UF11ZYVFHLuUC5CNpAz5dlGCu+rV+M0ukX2UpB2tlRv1rIOFIWuJ5SwAtK6AMYuYCu52mAAmEDdABsPJQoIwPG5qGAPG7oBwoDgNHoIGR6ORgFBViJlHwHABycJ5qAAHzD7gARhByCXMK1cIwK1XmOpTMnU+nM68bpYoCngBBGL6qI5kDEHEnElZeyR+4Ph9gcLRGAAzKtQACykkXK7XTi3S9X1YAIpuBAe1+vT7hz8eAOrNieTqBGKy0SPeJwAGnXY77A6HmDXju1Y9n+c5QBk5BLgA5g+T6JC+R4eCA3iXp+UAnuhR63r+M7-vOQGHhh06zgBkEwXB8EIcRYEAb4vhQI+VH6C+lhMcxUAAFyATglisEwAhHpRHHcYwEAAG5Vuxk6iRJUlUbJknkJoE4JN6jETmcb4QB+9AuOQ6HrkunoQGO6BMUZDb9iR+FQAWRbSS+Th6dWtHDvZegvnmcnkCAUBuMZ-ZFgk8wAPpQOFoXSdxzn6TZ4ELjeUBOPFAENm4
@davidlu1001
davidlu1001 / fix_vscode_copilot_cert.sh
Created March 13, 2022 22:54
Fix Github Copilot cert issue behind proxy for VSCode
#!/usr/bin/env bash
set -uo pipefail
_VSCODEDIR="$HOME/.vscode/extensions"
_COPILOTDIR=$(ls "${_VSCODEDIR}" | grep -E "github.copilot-[1-9].*" | sort -V | tail -n1) # For copilot
_COPILOTDEVDIR=$(ls "${_VSCODEDIR}" | grep "github.copilot-nightly-" | sort -V | tail -n1) # For copilot-nightly
_EXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDIR}/dist/extension.js"
_DEVEXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDEVDIR}/dist/extension.js"
@deckchairlabs
deckchairlabs / filters.js
Created May 17, 2021 03:04
Prisma Custom Generator
#!/usr/bin/env node
const path = require('path')
const generatorHelper = require('@prisma/generator-helper')
const { Project, StructureKind, VariableDeclarationKind } = require('ts-morph')
generatorHelper.generatorHandler({
onManifest(config) {
return {
prettyName: 'Filters',
defaultOutput: path.resolve(__dirname, 'filters'),
@robertleeplummerjr
robertleeplummerjr / migrate-assert-to-expect.js
Created August 14, 2019 10:30
A script that migrates from using assert to jest's expect
const { parse } = require('acorn');
const fs = require('fs');
const file = fs.readFileSync('./__tests__/file-name.js').toString();
const rootAST = parse(file, {
locations: true
});
function traverse(ast) {
if (Array.isArray(ast)) {
for (let i = 0; i < ast.length; i++) {