This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HomeViewController.m | |
// Stories | |
// | |
// Created by Christian Roman on 05/02/14. | |
// Copyright (c) 2014 Christian Roman. All rights reserved. | |
// | |
#import "HomeViewController.h" | |
#import "StoryView.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIScrollView *scrollView = [UIScrollView new]; | |
scrollView.translatesAutoresizingMaskIntoConstraints = NO; | |
[self.view addSubview:scrollView]; | |
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" | |
options:0 | |
metrics:nil | |
views:@{@"scrollView" : scrollView}]]; | |
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView]|" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef void (^AboutBlock)(); | |
@interface MyController : UIViewController { | |
AboutBlock aboutBlock; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CRClient+Requests.h | |
// CRClient | |
// | |
// Created by Christian Roman on 20/12/13. | |
// Copyright (c) 2013 Christian Roman. All rights reserved. | |
// | |
#import "CRClient.h" | |
#import "CRCompletionBlocks.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls, out = [line.strip() for line in open('input')], '' | |
for t in xrange(1, int(ls[0]) + 1): | |
st, n = ls[t].split(' ') | |
n, k, l, p, r = int(n), len(st), 0, 1, '' | |
while n >= p: | |
n -= p | |
p *= k | |
l += 1 | |
for i in range(l): | |
r += st[n % k] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> | |
#include <set> | |
#include <list> | |
#include <cmath> | |
#include <ctime> | |
#include <deque> | |
#include <queue> | |
#include <stack> | |
#include <bitset> | |
#include <cstdio> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lines, w, out, l, c = [line.strip() for line in open('basketball_game.txt')], ' ', '', 1, 0 | |
while l < lines.__len__(): | |
s = lines[l].split(w) | |
tp, rt, ts = int(s[0]), int(s[1]), int(s[2]) | |
tmp = lines[slice(l + 1, l + tp + 1)] | |
pl = [{'name': i.split(w)[0], 'shot': i.split(w)[1], 'height': i.split(w)[2]} for i in tmp] | |
srtd = sorted(pl, key=lambda k: (k['shot'], k['height']), reverse=True) | |
t1, t2 = srtd[0:][::2], srtd[1:][::2] | |
nt1 = t1[-rt % len(t1):] + t1[:-rt % len(t1)] | |
nt2 = t2[-rt % len(t2):] + t2[:-rt % len(t2)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef DEBUG | |
#define DLog(...) NSLog(__VA_ARGS__) | |
#else | |
#define DLog(...) /* */ | |
#endif | |
#define ALog(...) NSLog(__VA_ARGS__) | |
#ifdef DEBUG | |
#define DLog(format, ...) NSLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef VERBOSE_DEBUG_LOGGING | |
# define NSLog(fmt, ...) NSLog((@"%s(%d) " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); | |
#else | |
# define NSLog(...) | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur { | |
if (blur < 0.f || blur > 1.f) { | |
blur = 0.5f; | |
} | |
int boxSize = (int)(blur * 100); | |
boxSize = boxSize - (boxSize % 2) + 1; | |
CGImageRef img = image.CGImage; | |
vImage_Buffer inBuffer, outBuffer; |