This file contains hidden or 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
| searchBar.barStyle = UIBarStyleBlackTranslucent; | |
| searchBar.backgroundColor = [UIColor clearColor]; | |
| [[searchBar.subviews objectAtIndex:0] removeFromSuperview]; |
This file contains hidden or 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
| - (void) enableSearchEmpty { | |
| UITextField *searchBarTextField = nil; | |
| for (UIView *subview in searchBar.subviews) | |
| { | |
| if ([subview isKindOfClass:[UITextField class]]) | |
| { | |
| searchBarTextField = (UITextField *)subview; | |
| break; | |
| } | |
| } |
This file contains hidden or 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
| + (NSString*) getUniqueID { | |
| CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault); | |
| CFStringRef newUniqueIdString = CFUUIDCreateString(kCFAllocatorDefault, newUniqueId); | |
| NSString *uniqueId = [NSString stringWithFormat:@"%@",(NSString *)newUniqueIdString]; | |
| CFRelease(newUniqueId); | |
| CFRelease(newUniqueIdString); | |
| return [[uniqueId retain] autorelease]; | |
| } |
This file contains hidden or 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
| #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) | |
| #import <stdlib.h> | |
| - (CGImageRef) createMaskWithImageAlpha: (CGContextRef) originalImageContext { | |
| UInt8 *data = (UInt8 *)CGBitmapContextGetData(originalImageContext); | |
| float width = CGBitmapContextGetBytesPerRow(originalImageContext) / 4; | |
| float height = CGBitmapContextGetHeight(originalImageContext); | |
This file contains hidden or 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
| data BinaryTree a = BinaryNode a (BinaryTree a) (BinaryTree a) | BinaryNullNode | |
| instance Show a => Show (BinaryTree a) where | |
| show BinaryNullNode = " null" | |
| show (BinaryNode a l r) = " (" ++ show a ++ show l ++ show r ++ ")" | |
| search BinaryNullNode _ = False | |
| search (BinaryNode a l r) v | |
| | v == a = True | |
| | v < a = search l v |
This file contains hidden or 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
| + (void) setFont:(NSString*)fontName andFactor:(CGFloat)factor toView:(UIView*)view { | |
| NSArray *subviews = view.subviews; | |
| for (NSObject *subview in subviews) { | |
| if ([subview isKindOfClass:[UILabel class]]) { | |
| UILabel *label = (UILabel*)subview; | |
| [label setFont:[UIFont fontWithName:fontName size:label.font.pointSize*factor]]; | |
| } | |
| if ([subview isKindOfClass:[UIView class]]) { | |
| [Util setFont:fontName andFactor:factor toView:(UIView*)subview]; | |
| } |
This file contains hidden or 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
| def sumarListas(l:List[Int], m:List[Int]) : List[Int] = (l, m) match { | |
| case (Nil, Nil) => Nil | |
| case (Nil, y :: ys) => y :: sumarListas(Nil, ys) | |
| case (y :: ys, Nil) => y :: sumarListas(ys, Nil) | |
| case (x :: xs, y :: ys) => (x+y) :: sumarListas(xs, ys) | |
| } | |
| def extraerImpares(l:List[Int]) : List[Int] = l match { | |
| case Nil => Nil | |
| case x :: xs => if ( x % 2 != 0) x :: extraerImpares(xs) else extraerImpares(xs) |
This file contains hidden or 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
| case class NB(e:Int, izq:NB, der:NB) | |
| def busquedaBinaria(v:Int, a:NB) : NB = { | |
| if (a == null) | |
| a | |
| else { | |
| if (v == a.e) | |
| NB(v,null,null) | |
| else { | |
| if (v < a.e) |
This file contains hidden or 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
| //Examen Final | |
| //6 Oro Devuelve el elemento maximo de una lista | |
| //e.g. maximo (List(3,4,1,2,9,11,7,5,0)) => 11 | |
| def maximoHelper(l:List[Int], max:Int) : Int = l match { | |
| case Nil => max | |
| case x :: xs => if (x > max) maximoHelper(xs, x) else maximoHelper(xs, max) | |
| } |