Skip to content

Instantly share code, notes, and snippets.

View calimarkus's full-sized avatar
🌴

M Emrich calimarkus

🌴
View GitHub Profile
@calimarkus
calimarkus / UIView+Positioning.swift
Created September 17, 2022 20:40
UIView+Positioning.swift
//
// UIView+Positioning.swift
//
import UIKit
extension UIView {
var frameOrigin: CGPoint {
get { frame.origin }
set(origin) { frame = CGRectMake(origin.x, origin.y, frame.size.width, frame.size.height) }
@calimarkus
calimarkus / SomeUIView.m
Created June 19, 2022 12:33
Manual touch handling across multiple buttons
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
UIView *button = [self viewForTouches:touches event:event];
[self setHighlightedView:button];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesMoved:touches withEvent:event];
@calimarkus
calimarkus / JSONCodingPlugin.ts
Created January 24, 2018 18:46
JSONCoding plugin for remodel
/**
* JSONCoding plugin for remodel.
* It generates two additional methods, which convert the object to/from a JSON dictionary:
* - initWithJSONDictionary initializer
* - toJSONDictionary instance method
*
* Add includes<JSONCoding> to your .value file to use.
*
*/
@calimarkus
calimarkus / uikonf2014_min.md
Last active August 29, 2015 14:01
UIKonf 2014 - minimalistic schedule

uikonf '14


    • 10:10am
    • Christopher Downer: Designing Custom Interfaces
    • Katrin Apel: Mobile Backends as a Service - Ready for Production?
    • 12pm
@calimarkus
calimarkus / enums.h
Created July 17, 2013 12:25
All enums in the iOS SDK
typedef void (*BLASParamErrorProc)(const char *funcName, const char *paramName,
typedef float __M128 __attribute__((vector_size (16)));
typedef __M128 VectorFloat;
typedef VectorFloat ConstVectorFloat;
typedef int __CLPK_integer;
typedef int __CLPK_logical;
typedef float __CLPK_real;
typedef double __CLPK_doublereal;
typedef __CLPK_logical (*__CLPK_L_fp)();
typedef int __CLPK_ftnlen;
@calimarkus
calimarkus / validateRetinaImages.py
Last active December 14, 2015 23:59
validate Retina image sizes (they have to be even in width & height and @1x has to be half sized of @2x version)
import os, sys, glob
# logging methods
def printRed(msg):
print "\x1B[" + "31;40m" + msg + "\x1B[0m"
def printGreen(msg):
print "\x1B[" + "32;40m" + msg + "\x1B[0m"
# check for argument
if len(sys.argv) <= 1 :
@calimarkus
calimarkus / gist:4740312
Created February 8, 2013 16:53
UIView+DTDebug.h (debug background calls on uiview methods)
#import "UIView+DTDebug.h"
#import "NSObject+DTRuntime.h"
@implementation UIView (DTDebug)
- (void)methodCalledNotFromMainQueue:(NSString *)methodName
{
NSLog(@"-[%@ %@] being called on background queue. Break on -[UIView methodCalledNotFromMainQueue:] to find out where", NSStringFromClass([self class]), methodName);
}
@calimarkus
calimarkus / gist:4038466
Created November 8, 2012 12:17
Update UITableView insets on keyboard changes
- (void)registerForNotifications
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardStateChanged:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardStateChanged:)
name:UIKeyboardWillHideNotification
object:nil];
@calimarkus
calimarkus / gist:3554413
Created August 31, 2012 15:18
UIImage Loading withouth caching, but as convinient as imageNamed:
@implementation UIImage (NoCaching)
+ (UIImage*) make: (NSString*) filePath
{
NSString* file = [[NSBundle mainBundle] pathForResource: [filePath lastPathComponent] ofType: nil
inDirectory: [filePath stringByDeletingLastPathComponent]];
return [self imageWithContentsOfFile: file];
}
@end
@calimarkus
calimarkus / NSContainer+Subscripting.h
Created August 10, 2012 14:35
Objective-C Literals: Object Subscripting (LLVM 4.0) - ready to use in iOS 5 & 4!
//
// NSContainer+Subscripting.h
//
// Created by Markus Emrich on 10.08.12.
// Copyright 2012 nxtbgthng. All rights reserved.
//
#if !defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
#import "NSContainer+Subscripting.h"