Skip to content

Instantly share code, notes, and snippets.

View andkon's full-sized avatar
🤠

Andrew Konoff andkon

🤠
View GitHub Profile
@andkon
andkon / Thing.m
Created July 18, 2014 18:27
Not sure what's in a dict you GET'd?
NSDictionary *dict = responseObject;
NSLog(@"dict");
for (id key in dict) {
id obj = [dict objectForKey:key];
NSLog(@"key=%@ value=%@ class=%@", key, obj, [obj class]);
}
@andkon
andkon / DismissGravity.h
Created July 3, 2014 00:51
Animated transitions and UIKit Dynamics
@interface DismissGravity : NSObject <UIViewControllerAnimatedTransitioning>
@property (strong, nonatomic) UIDynamicAnimator *animator;
@andkon
andkon / RootVC.h
Created June 25, 2014 18:58
Notification views
@interface RootVC : UIViewController <UIDynamicAnimatorDelegate>
@property (strong, nonatomic) UIDynamicAnimator *animator;
@property (strong, nonatomic) UIView *noticeView;
@andkon
andkon / ViewController.h
Created June 25, 2014 18:35
UIKit Gravity!
@property (strong, nonatomic) UIDynamicAnimator *animator;
@property (strong, nonatomic) UIView *boxView;
@andkon
andkon / InteractiveTransition.h
Created June 22, 2014 03:19
Interactive Transitions
@interface InteractiveTransition.h : NSObject <UIViewControllerAnimatedTransitioning>
@end
@andkon
andkon / RootVC.h
Created June 20, 2014 19:00
Custom dismissal animation
@interface RootVC : UIViewController <UIViewControllerTransitioningDelegate>
@andkon
andkon / BouncyTransition.h
Created June 20, 2014 03:13
Custom Transitions Between VCs
#import <Foundation/Foundation.h>
@interface BouncyTransition : NSObject <UIViewControllerAnimatedTransitioning>
@end
@andkon
andkon / UIViewController.m
Created June 16, 2014 23:49
Making a view behind iOS 7 status bar
- (void)viewDidLoad
{
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, 20);
UIView *statusBarBg = [[UIView alloc] initWithFrame:rect];
[self.view addSubview:statusBarBg];
statusBarBg.backgroundColor = [UIColor purpleColor];
}
@andkon
andkon / images.py
Last active August 29, 2015 14:02
Using Image from Pillow
from PIL import Image
img = Image.open("imagefilename.png")
print img.size
# 512, 512
print img.format
# PNG
print img.mode
# RGB
@andkon
andkon / DjangoDebugging.py
Last active August 29, 2015 14:01
Python-Django debugging with Foreman/gunicorn/celery.
# 1. Use Celery:
# http://celery.readthedocs.org/en/latest/tutorials/debugging.html
from celery import task
from celery.contrib import rdb
@task()
def add(x, y):
result = x + y
rdb.set_trace() # <- set breakpoint