Skip to content

Instantly share code, notes, and snippets.

View kwylez's full-sized avatar

Cory D. Wiles kwylez

View GitHub Profile
/**
* properties are (int) numberOfViews, (int) secondsForRotation, (MyCustomObject) myCustomObject
*/
- (BOOL)isEqualToCustomWidget:(CustomWidget *)aCustomWidget {
if (self == aCustomWidget)
return YES;
if (numberOfViews != [aCustomWidget numberOfViews])
- (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)
/**
* 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
// Parent UIViewControlller
- (void)viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(refreshSearchBarControllerWithDepartmentCode:)
name:@"DepartmentCodeNotification"
object:nil];
[super viewWillAppear:animated];
<?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);
}
<?php
foreach (new DirectoryIterator('./') as $fileInfo) {
if($fileInfo->isDot()) continue;
echo $fileInfo->getFilename() . "<br>\n";
}
?>
<?php
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$response = array();
$jsonResponse = '';
$gallery = '';
$galleryImages = array();
$galleryDirectories = array();
<?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) {
<?php
$d = dir(".");
echo "Handle: " . $d->handle . "\n";
echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
echo $entry."\n";
}
$d->close();
?>
/**
* origFrame and origCenter are properties
*/
origFrame = self.customView.frame;
origCenter = self.customView.center;
[UIView animateWithDuration:2.0
animations:^ {