Skip to content

Instantly share code, notes, and snippets.

Avatar

Oliver Drobnik odrobnik

View GitHub Profile
View BCKCodeFunctions.m
NSUInteger BCKCodeMaxBarScaleThatFitsCodeInSize(BCKCode *code, CGSize size, NSDictionary *options)
{
NSInteger retScale = 1;
NSMutableDictionary *mutableOptions = [NSMutableDictionary dictionaryWithDictionary:options];
for (NSUInteger scale=1;;scale++)
{
mutableOptions[BCKCodeDrawingBarScaleOption] = @(scale);
CGSize neededSize = [code sizeWithRenderOptions:mutableOptions];
@odrobnik
odrobnik / gist:10758388
Created Apr 15, 2014
Barcodes with iOS Affiliate Link
View gist:10758388
http://www.manning.com/drobnik/?a_aid=cocoanetics&a_bid=f92809ec
@odrobnik
odrobnik / gist:739ecd7b2e1a89446f01
Created Jul 10, 2014
Getting all generator CIFilters
View gist:739ecd7b2e1a89446f01
NSArray *filters = [CIFilter filterNamesInCategory:kCICategoryGenerator];
NSLog(@"%@", filters);
result:
<__NSArrayI 0x7ffb63863520>(
CIAztecCodeGenerator,
CICheckerboardGenerator,
CICode128BarcodeGenerator,
CIConstantColorGenerator,
View gist:82797fe7cb22b9774ae2
pod 'OBImagePicker', :git => 'https://github.com/openbakery/OBImagePicker.git', :branch => 'develop'
View gist:54cf170eb36b211739ba
Summary:
If you install an extension via Extension Builder and modify something, the changes are ignored if you remove and reinstall the extension.
Steps to Reproduce:
1. Add the Reload.safariextension (from developer sample code) in Extension Builder
2. Click install
3. Note the shown Version to be 1.0.
4. Modify Bundle version, shown version and description
5. Click deinstall, then click install
@odrobnik
odrobnik / gist:9c5ec3b54eedf254d916
Created Nov 5, 2014
Workaround for iPhone 6+ horizontal size class bug (when using "present as popover" initial show comes with compact class, only after rotation it is correctly regular)
View gist:9c5ec3b54eedf254d916
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// workaround for iPhone 6+ bug
if (self.traitCollection.displayScale==3)
{
CGSize windowSize = [UIScreen mainScreen].bounds.size;
CGSize viewSize = self.view.bounds.size;
@odrobnik
odrobnik / PLYTableView.m
Last active Aug 29, 2015
Workaround for rdar://19411256
View PLYTableView.m
//
// PLYTableView.m
// ProdlyApp
//
// Created by Oliver Drobnik on 08/01/15.
// Copyright (c) 2015 ProductLayer. All rights reserved.
//
#import "PLYTableView.h"
View gist:2a2a7360c7ef1796a96a
- (void)testLoginButtonTapped
{
// mock a Server
id serverMock = OCMClassMock([Server class]);
OCMStub([serverMock loginUserWithName:[OCMArg any] password:[OCMArg any]]).andReturn(YES);
_loginVC.serverToUse = serverMock;
// simulate input in name field
_loginVC.userTextField.text = @"foo";
View gist:b2d80c4816d0de1cd207
- (void)testLoginButtonTapped
{
// mock a Server
id serverMock = OCMClassMock([Server class]);
OCMStub([serverMock loginUserWithName:[OCMArg any] password:[OCMArg any]]).andReturn(YES);
_loginVC.serverToUse = serverMock;
// simulate input in name field
_loginVC.userTextField.text = @"foo";
View gist:f6759d3cabe67d947ffb
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UINavigationController *nav = (UINavigationController *)self.window.rootViewController;
NotesListViewController *list = (NotesListViewController *)[nav topViewController];
list.notesManager = [NotesManager new];
// Override point for customization after application launch.
return YES;
}