Skip to content

Instantly share code, notes, and snippets.

@schickling
schickling / gist-content.md
Created August 28, 2025 10:42
Git Repository Lines of Code History Analyzer - Monthly LOC tracking with cloc and terminal visualization

Git Repository Lines of Code History Analyzer

A TypeScript script that analyzes the lines of code (LOC) growth of a Git repository month by month using cloc's git-aware functionality.

Features

  • 📈 Monthly LOC tracking over any time period
  • 🎯 Git-aware analysis - no need to checkout commits
  • 🚀 Language breakdown - see which languages grow over time
  • 📊 Terminal visualization with ASCII bar charts
tags level
best-practices
typescript
boolean
warn

Enforce Explicit Value Comparisons

Detects shorthand value usage patterns (implicit truthiness/falsiness checking) in JavaScript/TypeScript code. This rule helps identify places where explicit comparisons might be preferred for clarity and type safety. Common cases include checking for undefined/null, empty strings, zero values, and boolean states.

@Chronos2500
Chronos2500 / AllowsSwipeBack.Swift
Created May 16, 2025 17:59
This should be declared only once in the root view of the NavigationStack.
import SwiftUI
extension View {
/// Allows swipe back when navigation bar is hidden.
/// This modifier should be applied to a view that resides within a NavigationStack.
/// - Returns: A view that allows swipe back when navigation bar is hidden.
public func allowsSwipeBackWhenNavBarHidden() -> some View {
modifier( AllowsSwipeBackWhenNavBarHiddenModifier() )
}
}
@AnandChowdhary
AnandChowdhary / generate-changelog.ts
Last active July 18, 2025 10:11
Changelog automation
import slugify from "@sindresorhus/slugify";
import { execSync } from "child_process";
import dotenv from "dotenv";
import fs from "fs";
import { DateTime } from "luxon";
import { OpenAI } from "openai";
import path from "path";
import prettier from "prettier";
import { env } from "process";
@jlia0
jlia0 / agent loop
Last active September 25, 2025 16:56
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
import SwiftUI
//自作パッケージの切り出しなので変数名がめちゃくちゃです
//詳しくはこれの実装を見てください https://github.com/Chronos2500/CustomNavigationTitle
struct ContentView: View {
var body: some View {
NavigationStack{
ScrollView {
Color.blue.frame(height: 200)
@morajabi
morajabi / FPSCounter.swift
Created December 29, 2024 19:16
An FPS Counter for macOS apps built for inline.chat
import AppKit
import Charts
import CoreVideo
import SwiftUI
struct FPSMeasurement: Identifiable, Equatable {
let id: Int
let fps: Int
static func == (lhs: FPSMeasurement, rhs: FPSMeasurement) -> Bool {
@dena-sohrabi
dena-sohrabi / AppDatabase.swift
Created October 16, 2024 12:27
Encrypted Database (GRDB + SQLCipher)
import Foundation
import GRDB
// MARK: - DB main class
public final class AppDatabase: Sendable {
public let dbWriter: any DatabaseWriter
public init(_ dbWriter: any GRDB.DatabaseWriter) throws {
self.dbWriter = dbWriter
@morajabi
morajabi / FormState.swift
Last active October 16, 2024 12:28
Form state management in Swift UI
import SwiftUI
struct FormStateData {
var loading: Bool
var error: String?
var succeeded: Bool?
}
// A helper for easier state management for simple forms
class FormState: ObservableObject {
@Shpigford
Shpigford / .cursorrules
Last active April 25, 2025 01:22
Cursor Rules
# Original instructions: https://forum.cursor.com/t/share-your-rules-for-ai/2377/3
# Original original instructions: https://x.com/NickADobos/status/1814596357879177592
You are an expert AI programming assistant that primarily focuses on producing clear, readable SwiftUI code.
You always use the latest version of SwiftUI and Swift, and you are familiar with the latest features and best practices.
You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.
- Follow the user’s requirements carefully & to the letter.