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
| @property (nonatomic) dispatch_once_t oneAnimation; | |
| // ... other code here | |
| - (void)testAnimation | |
| { | |
| dispatch_once(&self->_oneAnimation, ^{ | |
| const CGFloat WidthHeight = 50.0; | |
| UIView *floaterView = [UIView new]; | |
| floaterView.backgroundColor = [UIColor redColor]; |
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)listAvailableFonts | |
| { | |
| for (NSString *s in [UIFont familyNames]) { | |
| NSLog(@"%@: %@", s, [UIFont fontNamesForFamilyName:s]); | |
| } | |
| } |
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
| // Must implement UIImagePickerControllerDelegate | |
| - (IBAction)selectImageTapped:(UIBarButtonItem *)sender | |
| { | |
| [self displayImageSelector]; | |
| } | |
| - (void)displayImageSelector | |
| { |
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 minMaxSumMean(v: Vector[Int]) = { | |
| val min = (Integer.MAX_VALUE /: v) { (large, elem) => Math.min(large, elem) } | |
| val max = (Integer.MIN_VALUE /: v) { (large, elem) => Math.max(large, elem) } | |
| val sum = (0 /: v) { (carryover, elem) => carryover + elem } | |
| val mean = sum / v.length | |
| (min, max, sum, mean) | |
| } | |
| val all = minMaxSumMean(Vector(4,5,6)) | |
| println("ALL> " + all) |
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
| // Takes two functions as arguments, and returns another function. | |
| // | |
| // The resulting function takes a single Vector[Double] argument and first | |
| // performs an inject operation and the first function then takes the result of the inject | |
| // and uses the second function to creates the final result. | |
| // | |
| // foldLeftOperation: the function used in the inject operation | |
| // | |
| // afterFoldLeftOperation: the operation run after the injection. | |
| // |
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
| # For JVM and Scala | |
| export PATH=$PATH:/usr/local/jdk/bin:/usr/local/scala/bin | |
| export SCALA_HOME=/usr/local/scala | |
| export JAVA_OPTS="-Xms300m -Xmx300m -XX:MaxPermSize=100m -XX:ReservedCodeCacheSize=4m -Djava.awt.headless=true" |
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
| @implementation BigViewController | |
| - (void)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| UIImage *grassImage = [UIImage imageNamed:@"Grass"]; | |
| UIImageView *grassImageView = [[UIImageView alloc] initWithImage:grassImage]; | |
| grassImageView.frame = self.view.bounds; |
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
| // | |
| // XNChartOfNuclidesView.m | |
| // Xplore Nuclides | |
| // | |
| // Created by Alicia Key on 24/07/2014. | |
| // Copyright (c) 2014 Alicia M. F. Key. All rights reserved. | |
| // | |
| // | |
| // If this is a child of a scroll view, the size of this view has | |
| // been tested to 9000x5000 on an iPad3 |
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)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region | |
| { | |
| NSString *stateString = @""; | |
| switch (state) { | |
| case CLRegionStateUnknown: | |
| stateString = @"CLRegionStateUnknown"; | |
| break; | |
| case CLRegionStateInside: |
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
| #import "XXX.h" | |
| #import <sys/types.h> | |
| #import <sys/socket.h> | |
| #import <arpa/inet.h> | |
| #import <ifaddrs.h> | |
| NSString * const XXXAddress = @"XXXAddress"; | |
| NSString * const XXXAddressFamily = @"XXXAddressFamily"; |