Skip to content

Instantly share code, notes, and snippets.

View icodebuster's full-sized avatar
💭
I may be slow to respond.

Jobin Kurian icodebuster

💭
I may be slow to respond.
View GitHub Profile
@icodebuster
icodebuster / Custom String Sorting C#
Created November 10, 2014 20:21
Custom String Sorting C#
public static string[] customSort(string[] unsortedArray)
{
var onlyNumber = new List<string>();
var onlyAlpha = new List<string>();
var startAlpha = new List<string>();
var startNum = new List<string>();
// Fisrt we will sort the array using the inbuild array sort function
Array.Sort(unsortedArray);
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
font-size: 14px;
@icodebuster
icodebuster / php-upgrade-issue.txt
Created August 9, 2014 17:26
PHP5.5.12 to PHP5.5.15 Upgrade failed due to pear
This file has been truncated, but you can view the full file.
==> Upgrading 1 outdated package, with result:
php55 5.5.15
==> Upgrading php55
rm /usr/local/bin/pear
rm /usr/local/bin/peardev
rm /usr/local/bin/pecl
rm /usr/local/bin/phar
rm /usr/local/bin/phar.phar
rm /usr/local/bin/php
rm /usr/local/bin/php-cgi

UIStatusBarStyle in iOS 7

  • The status bar in iOS 7 is transparent, the view behind it shows through.

  • The style of the status bar refers to the appearances of its content. In iOS 7, the status bar content is either dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent). Both UIStatusBarStyleBlackTranslucent and UIStatusBarStyleBlackOpaque are deprecated in iOS 7.0. Use UIStatusBarStyleLightContent instead.

How to change UIStatusBarStyle

  • If below the status bar is a navigation bar, the status bar style will be adjusted to match the navigation bar style (UINavigationBar.barStyle):
@icodebuster
icodebuster / Retrive Array Index.m
Created February 18, 2014 04:51
Using predicate to retrieve an index of an object in an NSArray.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self.id == %@", @"1"];
NSUInteger index = [mainArray indexOfObjectPassingTest:^(id obj, NSUInteger idx, BOOL *stop) {
return [predicate evaluateWithObject:obj];
}];
@icodebuster
icodebuster / AppSingleton.h
Created February 17, 2014 10:15
App Singleton
#import <Foundation/Foundation.h>
@interface AppSingleton : NSObject
+ (AppSingleton *)sharedInstance;
@end
@icodebuster
icodebuster / Block in Objective-C.txt
Last active December 28, 2015 23:09
How Do I Declare A Block in Objective-C? http://fuckingblocksyntax.com/
How Do I Declare A Block in Objective-C?
http://fuckingblocksyntax.com/
https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html
As a local variable:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
As a property:
- (IBAction)btnTouchEvent:(id)sender
{
__block NSString *str;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Rename" message:@"Enter new file name" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
alert.delegate = alert;
[alert setAlertViewStyle:UIAlertViewStylePlainTextInput];
alert.shouldEnableFirstOtherButtonBlock = ^BOOL(UIAlertView *alertView) {
str = [[alertView textFieldAtIndex:0].text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@icodebuster
icodebuster / NSString+Additions.h
Created November 19, 2013 11:05
NSString+Additions
//
// NSString+Additions.m
//
#import <Foundation/Foundation.h>
@interface NSString (Additions)
- (NSString *)urlFriendlyFileNameWithExtension:(NSString *)extension prefixID:(int)prefixID;