Skip to content

Instantly share code, notes, and snippets.

@appleios
appleios / VIOSPlain2GroupedIndexTranslationService.h
Last active December 17, 2015 08:47
cheaper-tdd (tools: specta, expecta)
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef enum : NSUInteger {
/**
result == _Failed && resultDescription == _NoSectionsYet @b==>
which means that the messageCountArray contains no section info.
result == _Failed && resultDescription == _PlainIndexOutOfBounds @b==>
which means that the plainIndex is greater than the maximal possible plain index available in given sections (the resulting indexPath contains (section == lastSectionIndex, row == lastPossibleRowInLastSection + 1).
@appleios
appleios / UITabBarController+HideTabBar.h
Created November 16, 2015 13:15 — forked from JRG-Developer/UITabBarController+HideTabBar.h
iOS 6+ Method for Hiding the Tab Bar
//
// UITabBarController+HideTabBar.h
//
// Created by Joshua Greene on 9/26/13.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@appleios
appleios / VIOSMessageHeaderView.h
Created November 9, 2015 12:38
kvo controller and etc
//
// VIOSMessageHeaderView.h
// vipole
//
// Created by Aziz Latypov on 09/11/15.
// Copyright © 2015 vipole. All rights reserved.
//
#import <UIKit/UIKit.h>
@appleios
appleios / Objective-C property name to a string with autocompletion and compile-time check.md
Created October 27, 2015 14:28 — forked from xareelee/NSObject+PropertyName.h
Objective-C property name to a string with autocompletion and compile-time check

Getting a string value for a property of a class with autocompletion feature and checking it at compile-time is very useful.

How to use:

Get the property name for a class:

@interface AnyClass : NSObject
@property (strong) NSData *data;
@appleios
appleios / codestyle.md
Last active September 29, 2015 13:37
my objc codestyle
@appleios
appleios / VIOSXibLoader.h
Created September 21, 2015 10:15
XibLoader
//
// VIOSXibLoader.h
// Created by Aziz Latypov on 8/21/15.
//
// If your TableViewCells are in Xib files and you name them in some convencion
// described with regular expression, you can load them into a table like this:
// In your viewDidLoad method call
// [[VIOSXibLoader defaultLoader] loadXibsForTableView:self.tableView
// withPattern:@"^MyModelClassName(\\w*)TableViewCell$"];
//
@appleios
appleios / keyboard.m
Last active August 29, 2015 14:25
keyboard notification observers (ios)
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillChangeFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
@appleios
appleios / update_string.rb
Last active September 17, 2015 13:48
update_string for xcode
#!/usr/bin/ruby
require 'date'
require 'pp'
COMPANY_NAME="<#company_name#>"
if ARGV.count != 1
puts "Usage: update_strings.rb /path/to/source/dir"
puts "Path and project_name are case sensitive."
@appleios
appleios / family_tv.cpp
Created June 14, 2015 08:17
task about family tv
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
int a,d,m,o,c,f,x;
printf("A D M O C | F\n");
for(x=0; x<32; x++){
a = x & 16;
@appleios
appleios / _test.rb
Last active August 29, 2015 14:20 — forked from jcoglan/_test.rb
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do