Skip to content

Instantly share code, notes, and snippets.

View SaadBazaz's full-sized avatar
🦾
Breaking stuff

Saad A. Bazaz SaadBazaz

🦾
Breaking stuff
View GitHub Profile
@SaadBazaz
SaadBazaz / route.ts
Created December 14, 2023 12:36
Recipe: Connect Canny to Discord with NextJS API Route
// import { ironConfig } from '../../../your-iron-config'; // Provide your own Iron config
import { env } from '@/env.mjs'
import Iron from '@hapi/iron'
import { NextResponse } from 'next/server'
export async function POST(req) {
const {
'canny-timestamp': timestamp,
'canny-nonce': nonce,
'canny-signature': signature
@SaadBazaz
SaadBazaz / App.tsx
Last active December 11, 2023 17:27
PostHog Feature Flag custom hook for Next.js 13+
"use client"
import useFeature from "hooks/use-feature"
const App = () => {
// Example usage
const isTestFeatureEnabled = useFeature("test-feature")
if (isTestFeatureEnabled) return "hello"
return "world"
@SaadBazaz
SaadBazaz / commands.txt
Created November 16, 2023 15:18 — forked from JesseRWeigel/commands.txt
ImageMagick Compression Commands
// Must install ImageMagick first
http://www.imagemagick.org/script/index.php
//This compresses a jpg with no visible loss of quality. Add in your own file names for target.jpg and result.jpg
convert -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% target.jpg result.jpg
// This does the same as above but to an entire folder (will overwrite original files):
mogrify -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% *.jpg
//This does the same thing but to all subfolders as well (Be careful with this one it will overwrite all original files)
@SaadBazaz
SaadBazaz / SearchAIsAndMultiExport.jsx
Last active January 10, 2021 10:26 — forked from TomByrne/MultiExporter.jsx
An Illustrator script for 1) recursively searching AI files in all folders and subfolders, 2) and then exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to [email protected]
@SaadBazaz
SaadBazaz / ccdl.command
Last active July 16, 2022 22:02 — forked from ayyybe/ccdl.command
Adobe Offline Package Generator v0.1.2 (macOS only)
#!/bin/bash
CYAN="$(tput bold; tput setaf 6)"
RESET="$(tput sgr0)"
clear
if command -v python3 > /dev/null 2>&1; then
if [ $(python3 -c "print('ye')") = "ye" ]; then
clear