Skip to content

Instantly share code, notes, and snippets.

View Illyism's full-sized avatar
πŸš€

Ilias Ism Illyism

πŸš€
View GitHub Profile
@Illyism
Illyism / link-rules.js
Created April 2, 2025 15:47
Prevent <Link> imports from lucide-react
@Illyism
Illyism / custom-rules.js
Last active April 2, 2025 15:40
ESLint 200-Line Max File Size Rule for Better AI Coding
/**
* 🧠 My game-changing ESLint rule that makes AI coding 10x better:
* - Enforces 200-line max file size
* - Counts only actual code (ignores comments)
* - Gives helpful refactoring suggestions
* - Works perfectly with Cursor AI's "Fix in Chat"
*
* Custom ESLint rule to limit file size to 200 lines
* @type {import("eslint").Rule.RuleModule}
*/
@Illyism
Illyism / detect-unused
Last active November 15, 2024 16:42
Detects unused files in Next.js
// grab all the files in src/
import { glob } from 'glob'
import { basename, extname } from 'node:path'
function getName(a: string) {
return basename(a, extname(a))
}
function isSameFileName(fpA, fpB) {
@Illyism
Illyism / posthog-avg-time.sql
Last active August 10, 2023 21:08
How to get average time on page in PostHog - https://gradient.page example
/*
https://twitter.com/illyism/status/1689679677563006976
Shared for gradient.page: https://eu.posthog.com/shared/xTSSqCWgGVUnhselqI_YOoxGVPtlWQ
Modify it by settings your domain below
*/
SELECT
avg(time_on_page) AS avg_time_on_page,
count(time_on_page) AS counts,
─────────────────────────────────────
β”€β”€β”€β”€β”€β”€β”€β”€β”€β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„β–„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”€β”€β”€β”€β”€β”€β–„β–ˆβ–ˆβ–€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–€β–€β–ˆβ–ˆβ–„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”€β”€β”€β”€β–„β–ˆβ–€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–€β–ˆβ–ˆβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”€β”€β–„β–ˆβ–€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–€β–ˆβ–„β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”€β–ˆβ–€β”€β”€β–ˆβ–ˆβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–ˆβ–ˆβ”€β”€β”€β–€β–ˆβ–ˆβ”€β”€β”€β”€β”€β”€β”€β”€
β–ˆβ–€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–ˆβ–ˆβ”€β”€β”€β”€β”€β”€β”€
β–ˆβ”€β”€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ”€β”€β”€β”€β”€β”€β”€β–ˆβ”€β”€β”€β”€β”€β”€β”€
β–ˆβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–ˆβ”€β”€β”€β”€β”€β”€β”€
β–ˆβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–ˆβ”€β”€β”€β”€β”€β”€β”€
@Illyism
Illyism / AutoHotKey
Created December 21, 2013 13:01
AutoHotKey configuration for running cmder, sublime text and Gmail.
; Ctrl+Alt+T - Run Command Line
^!t::
SetWorkingDir, C:\Tools\cmder
Run Cmder.bat
Return
; Win+Z - Run Sublime Text
#z::
Run "C:\Program Files\Sublime Text 3\sublime_text.exe"
Return
@Illyism
Illyism / bench.sh
Created October 10, 2013 18:02
Benchmark for linux. Perfect for VPS. CPU, RAM, SWAP, uptime, download speedtest, I/O
#!/bin/bash
cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo )
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
freq=$( awk -F: ' /cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo )
tram=$( free -m | awk 'NR==2 {print $2}' )
swap=$( free -m | awk 'NR==4 {print $2}' )
up=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }')
echo "CPU model : $cname"
@Illyism
Illyism / Remove All Missing Links
Created May 15, 2013 14:11
It removes all the missing links and keeps the frames.
@Illyism
Illyism / gist:3552285
Created August 31, 2012 12:47
Folder Creation On Tabs.
var bStrm = new ActiveXObject("Adodb.Stream");
var wShell = new ActiveXObject("Wscript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
var debug = false;
if (typeof XMLHttpRequest == "undefined")
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) {}
//Microsoft.XMLHTTP points to Msxml2.XMLHTTP.3.0 and is redundant
throw new Error("This browser does not support XMLHttpRequest.");