Skip to content

Instantly share code, notes, and snippets.

View bimawa's full-sized avatar
:octocat:
Githubing

Maxim Bunkov bimawa

:octocat:
Githubing
View GitHub Profile
@bimawa
bimawa / create-xcframework.sh
Created June 19, 2022 08:01
Create xcframework for some Package.swift's
#!/bin/bash
set -x
set -e
# Pass scheme name as the first argument to the script
NAME=$1
# Rewrite Package.swift so that it declaras dynamic libraries, since the approach does not work with static libraries
perl -i -p0e 's/type: .static,//g' Package.swift
@bimawa
bimawa / gist:ebe0f55fc6ed4334fe15
Created May 12, 2015 15:37
Ouput All Fonts Family avalible.
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNames count]; ++indFont)
@bimawa
bimawa / ReactiveObserverNotificationCenter.m
Last active August 29, 2015 14:20
Handle event of NotificationCenter
@weakify(self);
[[[[[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"NotificationKey"
object:nil] takeUntil:self.rac_willDeallocSignal] filter:^BOOL(NSNotification *notification) {
/*
Validate something for filter
@strongify(self);
NSDictionary *userInfo = notification.userInfo;
return [self.followersViewModel.itemId isEqualToNumber:userInfo[@"itemId"]];
*/
}] deliverOnMainThread] subscribeNext:^(NSNotification *notification) {
#!/bin/bash
mkdir /tmp/curl-ca-bundle
cd /tmp/curl-ca-bundle
wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2
tar xzf curl-7.22.0.tar.bz2
cd curl-7.22.0/lib/
./mk-ca-bundle.pl
if [ ! -d /usr/share/curl/ ]; then
sudo mkdir -p /usr/share/curl/
else
@bimawa
bimawa / NSData+Hex.h
Created November 11, 2014 12:14
NSData category for converting Data to hex clear string
@interface NSData(Hex)
-(NSString*)hexRepresentationWithSpaces_AS:(BOOL)spaces;
@end
@bimawa
bimawa / NSData+Hex.m
Last active August 29, 2015 14:09
NSData category for converting Data to hex clear string
@implementation NSData(Hex)
-(NSString*)hexRepresentationWithSpaces_AS:(BOOL)spaces
{
const unsigned char* bytes = (const unsigned char*)[self bytes];
NSUInteger nbBytes = [self length];
//If spaces is true, insert a space every this many input bytes (twice this many output characters).
static const NSUInteger spaceEveryThisManyBytes = 4UL;
//If spaces is true, insert a line-break instead of a space every this many spaces.
static const NSUInteger lineBreakEveryThisManySpaces = 4UL;
const NSUInteger lineBreakEveryThisManyBytes = spaceEveryThisManyBytes * lineBreakEveryThisManySpaces;
@bimawa
bimawa / UITableViewBlockCellSizeCall.m
Created October 28, 2014 05:56
This method block size request for cells for ios8 and pass for less or eqal ios7.1 Needs for autolayouts cells for iOS8
- (BOOL)respondsToSelector:(SEL)aSelector
{
static BOOL useSelector;
static dispatch_once_t predicate = 0;
dispatch_once(&predicate, ^{
useSelector = SYSTEM_VERSION_LESS_THAN(@"8.0");
});
if (aSelector == @selector(tableView:heightForRowAtIndexPath:))
{
@bimawa
bimawa / UITableViewCellSize.m
Created October 28, 2014 05:53
Property for ios8 UITableView cellSize wuth aoutolayouts.
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
[self.tableView setRowHeight:UITableViewAutomaticDimension];
[self.tableView setEstimatedRowHeight:50];
}
//
// UINavigationItem+KVO.m
// Feeder
//
// Created by Brent Royal-Gordon on 7/5/13.
// Copyright (c) 2013 Architechies. All rights reserved.
//
#import "UINavigationItem+KVO.h"
@bimawa
bimawa / UIView.m
Last active August 29, 2015 14:05
Create init methods for UIVIew elements and subclasses
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self p_configureView];
[self p_configureConstraints];
}
return self;