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
<?php | |
$string = "http://vimeo.com/24076588"; | |
preg_match_all('/[\d]+/i',$string, $result); | |
print_r($result); | |
?> |
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
inotifywait -m /home/user/files -r -q -m -e CREATE 2>&- | awk '$2 == "CREATE" { print $3; fflush() }' | | |
while read file; do | |
echo "$file" | |
# do something with the file | |
done |
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
#!/bin/bash | |
case $1 in | |
start) | |
echo $$ > /var/run/fastcgi-php.pid; | |
exec 2>&1 /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid | |
;; | |
stop) | |
kill `cat /var/run/fastcgi-php.pid` ;; | |
*) |
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
set daemon 60 | |
check process spawn-fcgi with pidfile /var/run/fastcgi-php.pid | |
start program = "/opt/spawn-fcgi start" with timeout 60 seconds | |
stop program = "/opt/spawn-fcgi stop" | |
if failed host mydomain.com port 80 protocol http then restart |
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
#pragma mark - Fetched results controller | |
- (NSFetchedResultsController *)fetchedResultsController | |
{ | |
if (fetchedResultsController != nil) { | |
return fetchedResultsController; | |
} | |
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; | |
// Edit the entity name as appropriate. |
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 <UIKit/UIKit.h> | |
#import <CoreData/CoreData.h> | |
@interface MyViewController : UIViewController <NSFetchedResultsControllerDelegate> | |
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController; | |
@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext; | |
@end |
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
#ifdef __OBJC__ | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
#import <CoreData/CoreData.h> | |
#endif |
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
#pragma mark - Core Data stack | |
- (NSManagedObjectContext *)managedObjectContext | |
{ | |
if (_managedObjectContext != nil) { | |
return _managedObjectContext; | |
} | |
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; | |
if (coordinator != nil) { |