Skip to content

Instantly share code, notes, and snippets.

View Abeansits's full-sized avatar
🙃
...

Sebastian Nystorm Abeansits

🙃
...
View GitHub Profile
@Abeansits
Abeansits / linus_torvalds_code_review.md
Last active October 17, 2026 07:49
Code review roaster in the voice of Linus Torvalds

Code review roaster in the voice of Linus Torvalds

It's time to review some code, assume this personality:

Role Definition

You are Linus Torvalds, legendary software architect and creator of Linux. You've spent decades building systems that millions depend on daily. Apply those principles to the code in front of you. Analyze the quality risks. Prefer software that is simple, reliable, and does not break what already works.

My Core Philosophy

1. "Good Taste" (Good Taste) - My First Principle

@Abeansits
Abeansits / one_rule_to_rule_them_all.sh
Created June 25, 2025 22:33
symlink coding agents rule files into one master rule
#!/bin/bash
# Master rule file
MASTER_FILE="AGENTS.md"
# Array of symlink names
SYMLINKS=(
"CLAUDE.md"
"GEMINI.md"
".cursorrules"
#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
#
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
TEXT=$(cat "$1" | sed '/^#.*/d')
if [ -n "$TEXT" ]
then
echo "[$NAME] $TEXT" > "$1"
@Abeansits
Abeansits / CallbackDictionary.swift
Last active May 25, 2017 18:38
A thread safe callback dictionary
import Foundation
/// A thread-safe container for mapping a String key to a `CallbackBlock`. A callback-block can be invoked individually or all at once.
public struct CallbackDictionary<ResultType> {
// MARK: - Initializing
public init() {}
// MARK: - Public Interface
protocol FirstDependency {}
protocol SecondDependency {}
protocol ThirdDependency {}
protocol HasFirstDependency {
var first: FirstDependency { get }
}
protocol HasSecondDependency {
var second: SecondDependency { get }
@Abeansits
Abeansits / UIScrollView+Extensions.h
Created January 8, 2014 14:27
A category on UIScrollView for detecting when content has scrolled to top or bottom.
//
// UIScrollView+Extensions.h
//
//
@interface UIScrollView (Extensions)
/// Returns true if the content has been scrolled all the way to the top (by pulling the content up).
- (BOOL)isScrolledToTop;
@Abeansits
Abeansits / NSString+Extensions.h
Created June 24, 2013 07:31
A utility box for NSStrings. Converts to: SHA1, NSNumber. Test for being empty. Contains substrings and replace substrings from NSDictionary.
#import <Foundation/Foundation.h>
@interface NSString (Extensions)
+ (NSString *)stringToSha1:(NSString *)str;
- (NSNumber*)stringToNSNumber;
- (BOOL)isEmpty;
- (BOOL)stringContainsSubString:(NSString *)subString;
- (NSString *)stringByReplacingStringsFromDictionary:(NSDictionary *)dict;
@Abeansits
Abeansits / gist:5487191
Created April 30, 2013 07:40
Printing character per character to find those hard to see invisible characters that may mess up your JSON-parsing or similar.
const unsigned char *ptr = [data bytes];
for(NSUInteger i=0; i<[data length]; ++i) {
unsigned char c = *ptr++;
NSLog(@"char=%c hex=%x", c, c);
}
@Abeansits
Abeansits / project.pbxproj
Created September 25, 2012 09:57
Possibly broken project file.
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0E27D737133B88F700953527 /* CDataScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E27D722133B88F700953527 /* CDataScanner.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };