Skip to content

Instantly share code, notes, and snippets.

View andkon's full-sized avatar
🤠

Andrew Konoff andkon

🤠
View GitHub Profile
@andkon
andkon / ViewController.h
Created June 25, 2014 18:35
UIKit Gravity!
@property (strong, nonatomic) UIDynamicAnimator *animator;
@property (strong, nonatomic) UIView *boxView;
@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 / DismissGravity.h
Created July 3, 2014 00:51
Animated transitions and UIKit Dynamics
@interface DismissGravity : NSObject <UIViewControllerAnimatedTransitioning>
@property (strong, nonatomic) UIDynamicAnimator *animator;
@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 / gist:6fd173142a8b8391885a
Last active August 29, 2015 14:15
iPhone screen size macros
// http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices
#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPhone" ] )
#define IS_IPHONE_4 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )480 ) < DBL_EPSILON )
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define IS_IPHONE_6 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )667 ) < DBL_EPSILON )
#define IS_IPHONE_6_PLUS ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )736 ) < DBL_EPSILON )
@andkon
andkon / Install instructions
Created March 14, 2015 18:12
Installing celery on django and heroku
pip install celery
heroku addons:add cloudamqp
heroku config | grep CLOUDAMQP_URL
^^ that is the URL to put in celeryconfig
@andkon
andkon / Steps
Created May 14, 2015 17:02
ZeroPush notification setup
1. Add zeropush to heroku.
2. Get the pre-cert stuff in Apple Dev:
a) register the App ID/bundle ID
b) create a development cert
c) create a distribution cert
d) I think that's it?
3. Now get the aps certs. terminal:
pem -d
4. prod cert in terminal:
@andkon
andkon / ABOUT
Last active August 29, 2015 14:21 — forked from Skirmantas/ABOUT
Changing django's username AND email field.
This code is a suggested answer to question asked on Stackoverflow:
http://stackoverflow.com/questions/4827965/can-i-change-djangos-auth-user-username-field-to-be-100-chars-long-without-break/
@andkon
andkon / songsearch.py
Last active August 29, 2015 14:25
davesingskaraoke
import pyen
en = pyen.Pyen(YOUR_API_KEY)
songs = []
for row in db:
try:
res = en.get('song/search', title=row.title, artist=row.artist, bucket=["song_type"])
if len(res.get('songs')) > 0:
songs.append(res.get('songs')[0])
except pyen.PyenException:
@andkon
andkon / README.md
Last active March 3, 2016 16:14
Camelot

excalibur: an unsupervised leader-finding process

Camelot is a big place with a lot of problems, but there's one we care about. In this first paragraph, you must explain what that problem is. Our problem is that Camelot needs a leader.

Camelot needs a solution, and excalibur is the (clever -- maybe even cheeky) name of the one thing that solves this one problem best. It sounds almost magical in how it could simply solve the problems above - problems that many people have tried to solve before. Now, you explain how it solves those problems: excalibur tells you instantly whether or not a person is that leader.

In this final introductory paragraph, you explain how excalibur works differently than most other attempted solutions. Specifically, it's hard to pull out of a stone, so only real leaders can do it.

Installation