Skip to content

Instantly share code, notes, and snippets.

View sadatrahman's full-sized avatar

Sadat Rahman sadatrahman

  • Melbourne, Australia
View GitHub Profile
[KWMatchers defineMatcher:@"beUppercaseString" as:^(KWMatcherBuilder *builder) {
[builder match:^(id subject) {
if ([subject isKindOfClass:[NSString class]]) {
NSString *string = (NSString *)subject;
return [[string uppercaseString] isEqualToString:string];
} else {
return NO;
}
}];
}];
@sadatrahman
sadatrahman / UIColor+Hex.h
Created June 15, 2011 07:37
UIColor factory category method - returns an appropriate UIColor instance given a hex colour code.
//
// UIColor+Hex.h
// SRKit
//
// Created by Sadat Rahman on 29/11/08.
// Copyright Sadat Rahman 2008. All rights reserved.
//
@interface UIColor (Hex)
@chrismiles
chrismiles / UIView+CMExtras.h
Created June 9, 2011 09:24
UIView class extension with some of my handy convenience methods
//
// UIView+CMExtras.h
//
// Created by Chris Miles on 9/06/11.
// Copyright 2011 Chris Miles.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@chrismiles
chrismiles / NSDate+CMExtras.h
Created June 6, 2011 10:34
NSDate category extension - handy convenience methods
@interface NSDate ( CMExtras )
- (NSDate *)stripTimeComponent;
@end
@atnan
atnan / gist:997780
Created May 29, 2011 13:28
Fading view transition...
[CATransaction begin];
CATransition *transition = [CATransition animation];
transition.type = kCATransitionFade;
transition.duration = animated ? 0.5f : 0.0f;
transition.fillMode = kCAFillModeForwards;
transition.removedOnCompletion = YES;
[[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"];
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
@orj
orj / gist:985501
Created May 22, 2011 14:05
A Objective-C macro for generating @synthesize statements. Useful when you want to enforce a specific naming convention on synthesized ivars.
/*!
\def N_ARGS
\brief Macro that can tell how many variable arguments have been passed to it (up to a total of 16).
*/
#define N_ARGS(...) N_ARGS_1(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define N_ARGS_1(...) N_ARGS_2(__VA_ARGS__)
#define N_ARGS_2(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, n, ...) n
/*!
\def CAT
@atnan
atnan / gist:961388
Created May 8, 2011 13:51
Simulate memory warning
- (void)simulateMemoryWarning {
#if TARGET_IPHONE_SIMULATOR
#ifdef DEBUG
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);
#endif
#endif
}
@chrismiles
chrismiles / MyLayer.m
Created March 14, 2011 07:35
Animate a custom property in a CALayer example.
//
// MyLayer.m
//
// Created by Chris Miles on 14/03/11.
// Copyright 2011 Chris Miles.
//
/*
Animate custom property example:
@jessedc
jessedc / iOS Icon.png bash script
Last active February 25, 2018 03:02
A simple bash script using OSX command line tool sips to resample a 1024x1024 image
#!/bin/bash
f=$(pwd)
sips --resampleWidth 512 "${f}/${1}" --out "${f}/iTunesArtwork"
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x"
sips --resampleWidth 57 "${f}/${1}" --out "${f}/Icon.png"
sips --resampleWidth 114 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-Small.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 50 "${f}/${1}" --out "${f}/Icon-Small-50.png"
@hramos
hramos / manifest.plist
Created January 11, 2011 14:29
Sample manifest file for Over The Air iOS deployment
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>