Skip to content

Instantly share code, notes, and snippets.

View maxkramer's full-sized avatar

Max Kramer maxkramer

View GitHub Profile
<?php
$url = $_GET['url'];
header("refresh:5;url=$url");
//echo $url;
?>
<p align=left>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3255541264170057";
/* sky */
google_ad_slot = "5476903356";
#define IMAGE_WIDTH 320
#define IMAGE_HEIGHT 480
- (void)viewDidLoad
{
[super viewDidLoad];
NSArray *photos = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"1.jpg"],[UIImage imageNamed:@"2.jpg"],[UIImage imageNamed:@"3.png"],[UIImage imageNamed:@"4.jpg"], nil]; // TODO – fill with your photos
// note that the view contains a UIScrollView in aScrollView
@maxkramer
maxkramer / FizzBuzz
Created August 20, 2011 17:26
FizzBuzz - Objective-C
- (NSArray *) fizzBuzzFrom:(unsigned int)from To:(unsigned int) to {
int i = from;
NSMutableArray *array = [NSMutableArray arrayWithCapacity:to];
while (i <= to) {
NSString *string = (++i % 15? (i%5? (i%3 ? [NSString stringWithFormat:@"%d", i] : @"Fizz") : @"Buzz") : @"FizzBuzz");
[array addObject:string];
string = nil;
}
return array;
}
- (void) handlePan:(UIPanGestureRecognizer *) gesture {
if ((gesture.state == UIGestureRecognizerStateChanged) ||
(gesture.state == UIGestureRecognizerStateEnded)) {
CGPoint location = [gesture locationInView:[self.tableView superview]];
if (location.x <= (_tableView.frame.size.width / 2) + 40) {
if (location.x < _tableView.frame.size.width / 2-70 && isFilterViewShowing)
[self.tableView setFrame:CGRectMake(location.x, 0, _tableView.frame.size.width, _tableView.frame.size.height)];
else if (location.x < _tableView.frame.size.width / 2 + 40)
@maxkramer
maxkramer / transparentModalViewController.m
Created May 23, 2012 06:58 — forked from frr149/transparentModalViewController.m
How to create a transparent modal View Controller
#pragma mark - Transparent Modal View
-(void) presentTransparentModalViewController: (UIViewController *) aViewController
animated: (BOOL) isAnimated
withAlpha: (CGFloat) anAlpha{
self.transparentModalViewController = aViewController;
UIView *view = aViewController.view;
view.opaque = NO;
view.alpha = anAlpha;
@maxkramer
maxkramer / UIImagePicker Image Orientation Normalizer
Created June 30, 2012 15:13
UIImagePicker Image Orientation Normalizer
- (UIImage *)normalizedImage {
if (self.imageOrientation == UIImageOrientationUp) return self;
UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);
[self drawInRect:(CGRect){0, 0, self.size}];
UIImage *normalizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return normalizedImage;
}
@maxkramer
maxkramer / NSArray - arrayCreate()
Created August 8, 2012 16:47
Quick NSArray creation objective-c
NSArray *arrayCreate(id firstObject, ...) {
NSMutableArray *objects = [NSMutableArray array];
[objects addObject:firstObject];
va_list args;
va_start(args, firstObject);
id arg;
while ((arg = va_arg(args, id))) {
if (arg == nil)
break;
[objects addObject:arg];
@maxkramer
maxkramer / Codeigniter Bash Create
Created September 26, 2012 22:46
Create new Codeigniter Project
function codeigniter() {
git clone https://github.com/EllisLab/CodeIgniter.git "$@" ;
}
@maxkramer
maxkramer / gist:4734734
Created February 7, 2013 22:15
/etc/dovecot/dovecot.conf
# Dovecot configuration file
# If you're in a hurry, see http://wiki.dovecot.org/QuickConfiguration
# "doveconf -n" command gives a clean output of the changed settings. Use it
# instead of copy&pasting files when posting to the Dovecot mailing list.
# '#' character and everything after it is treated as comments. Extra spaces
# and tabs are ignored. If you want to use either of these explicitly, put the
# value inside quotes, eg.: key = "# char and trailing whitespace "
@maxkramer
maxkramer / gist:5156924
Created March 13, 2013 22:19
CSS Forced Anti-Aliasing
html {
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
}