This file contains 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
/** | |
* properties are (int) numberOfViews, (int) secondsForRotation, (MyCustomObject) myCustomObject | |
*/ | |
- (BOOL)isEqualToCustomWidget:(CustomWidget *)aCustomWidget { | |
if (self == aCustomWidget) | |
return YES; | |
if (numberOfViews != [aCustomWidget numberOfViews]) |
This file contains 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
- (BOOL)isEqual:(id)other { | |
if (other == self) | |
return YES; | |
if (!other || ![other isKindOfClass:[self class]]) | |
return NO; | |
return [self isEqualToWidget:other]; | |
} | |
- (BOOL)isEqualToWidget:(MyWidget *)aWidget { | |
if (self == aWidget) |
This file contains 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
/** | |
* Assume that first name is the first instance of characters before the first | |
* " ". Everything else will be considered the last name. | |
*/ | |
NSArray *nameSplitArray = [self.employee.name componentsSeparatedByString:@" "]; | |
NSMutableArray *nameSplitMutableArray = [nameSplitArray mutableCopy]; | |
[nameSplitMutableArray removeObjectAtIndex:0]; | |
// set the first and last name properties |
This file contains 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
// Parent UIViewControlller | |
- (void)viewWillAppear:(BOOL)animated { | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(refreshSearchBarControllerWithDepartmentCode:) | |
name:@"DepartmentCodeNotification" | |
object:nil]; | |
[super viewWillAppear:animated]; |
This file contains 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
<?php | |
$dir = "."; | |
if (is_dir($dir)) { | |
if ($dh = opendir($dir)) { | |
while (($file = readdir($dh)) !== false) { | |
echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; | |
} | |
closedir($dh); | |
} |
This file contains 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
<?php | |
foreach (new DirectoryIterator('./') as $fileInfo) { | |
if($fileInfo->isDot()) continue; | |
echo $fileInfo->getFilename() . "<br>\n"; | |
} | |
?> |
This file contains 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
<?php | |
require_once 'Zend/Loader/Autoloader.php'; | |
Zend_Loader_Autoloader::getInstance(); | |
$response = array(); | |
$jsonResponse = ''; | |
$gallery = ''; | |
$galleryImages = array(); | |
$galleryDirectories = array(); |
This file contains 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
<?php | |
// PHP version < 5.3 | |
function compareFileName($a, $b, $keyToSortBy) { | |
return strnatcmp($a[$keyToSortBy], $b[$keyToSortBy]); | |
} | |
usort($arrayThatIsPopulated, 'compareFileName'); | |
// PHP version >= 5.3 | |
usort($arrayThatIsPopulated, function($a, $b, $keyToSortBy) { |
This file contains 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
<?php | |
$d = dir("."); | |
echo "Handle: " . $d->handle . "\n"; | |
echo "Path: " . $d->path . "\n"; | |
while (false !== ($entry = $d->read())) { | |
echo $entry."\n"; | |
} | |
$d->close(); | |
?> |
This file contains 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
/** | |
* origFrame and origCenter are properties | |
*/ | |
origFrame = self.customView.frame; | |
origCenter = self.customView.center; | |
[UIView animateWithDuration:2.0 | |
animations:^ { | |