Skip to content

Instantly share code, notes, and snippets.

View StephanPartzsch's full-sized avatar

Stephan Partzsch StephanPartzsch

View GitHub Profile
@StephanPartzsch
StephanPartzsch / findPrintStatements.sh
Last active October 16, 2020 11:37
[Find all print statements] Used as run script build phase #Xcode #Swift
#!/bin/bash
SEARCH='print\(.*'
echo "Searching ${SRCROOT} for ${SEARCH}"
find "${SRCROOT}" \( -name "*.swift" \) -not -path "${SRCROOT}/Pods/*" -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($SEARCH).*\$" | perl -p -e "s/($SEARCH)/ warning: Print Violation (use logger instead): \$1/"
@StephanPartzsch
StephanPartzsch / gist:0ab2fd4755335c7cccaa
Last active March 19, 2020 18:10
[Extract UIColor] Extract UIColor value at a specific point in a given UIImage (#UI)
- (UIColor *)colorForImage:(UIImage *)image atPoint:(CGPoint)point
{
CGDataProviderRef provider = CGImageGetDataProvider(image.CGImage);
CFDataRef pixelData = CGDataProviderCopyData(provider);
const UInt8* data = CFDataGetBytePtr(pixelData);
int numberOfColorComponents = 4; // R,G,B, and A
float positionX = point.x;
float positionY = point.y;
float imageWidth = image.size.width;
@StephanPartzsch
StephanPartzsch / UntouchableUIViewContainer.h
Last active March 19, 2020 18:12
[UntouchableUIViewContainer] UIView that does not recognize any touch on itself. Only touches on subviews are detected. (#UI)
#import <Foundation/Foundation.h>
@interface UntouchableUIViewContainer : UIView
@end