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 | |
// 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 | |
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
/** | |
* origFrame and origCenter are properties | |
*/ | |
origFrame = self.customView.frame; | |
origCenter = self.customView.center; | |
[UIView animateWithDuration:2.0 | |
animations:^ { | |
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
CGFloat tabMiddle = CGRectGetMidX([[[[[self tabBarController] tabBar] subviews] objectAtIndex:tabIndex] frame]); |
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
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { | |
[self.delegate tabBarController:self didSelectViewController:self.selectedViewController]; | |
} |
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
#!/usr/local/zend/bin/php | |
<?php | |
require_once 'Zend/Loader/Autoloader.php'; | |
Zend_Loader_Autoloader::getInstance(); | |
try { | |
$db = Zend_Db::factory('Pdo_Mssql', 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
CGPoint roundedCenterPoint(CGPoint pt) { | |
return CGPointMake(round(pt.x), round(pt.y)); | |
} | |
leftLabel.frame = CGRectIntegral(leftLabelFrame); | |
leftLabel.center = roundedCenterPoint(leftLabel.center); |
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
SteveJobs *spj = [[SteveJobs alloc] initWithExtraordinary:genius withWorldChanging:vision]; | |
[spj execute]; | |
NSDateComponents *components = [[NSDateComponents alloc]init]; | |
[components setDay:5]; | |
[components setMonth:10]; |
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
# http://stackoverflow.com/questions/1531501/json-serialization-of-google-app-engine-models | |
class jsonEncoder(simplejson.JSONEncoder): | |
def default(self, obj): | |
isa = lambda x: isinstance(obj, x) # isa(<type>)==True if obj is of type <type> | |
return obj.isoformat() if isa(datetime.datetime) else \ | |
db.to_dict(obj) if isa(db.Model) else \ | |
obj.email() if isa(users.User) else \ | |
simplejson.JSONEncoder.default(self, obj) |