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
from django.forms import EmailField | |
from django.core.exceptions import ValidationError | |
def isEmailAddressValid( email ): | |
try: | |
EmailField().clean(email) | |
return True | |
except ValidationError: | |
return False |
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/sh | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
NAME=git-daemon | |
PIDFILE=/var/run/$NAME.pid | |
DESC="the git daemon" | |
DAEMON=/usr/lib/git-core/git-daemon | |
DAEMON_OPTS="--base-path=/home/git/repositories --export-all --verbose --syslog --detach --p$ | |
test -x $DAEMON || exit 0 |
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)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | |
{ | |
if ([sender isKindOfClass:[UIButton class]]) | |
{ | |
PGResultsViewController* resultsVc = segue.destinationViewController; | |
resultsVc.picture = _baseImage; | |
UIButton* correctButton = (UIButton*)[self.view viewWithTag:_correctAnswerIndex+1]; | |
if (sender == correctButton) |
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)drawRect:(CGRect)rect | |
{ | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
for (int i=0; i<kColorCount; i++) | |
{ | |
UIColor* color = [UIColor colorWithHue:i*(1.0/kColorCount) | |
saturation:1.0 brightness:1.0 alpha:1.0]; | |
[color setFill]; | |
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 - from UIImagePickerDelegate | |
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info | |
{ | |
UIImage* selectedImage = | |
info[UIImagePickerControllerOriginalImage]; | |
self.imageView.image = selectedImage; | |
[self dismissViewControllerAnimated:YES completion:nil]; | |
self.imageView.backgroundColor = [UIColor whiteColor]; | |
} |
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
UIStoryboard* storyboard = [UIStoryboard | |
storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; | |
TCBuildingInfoViewController* infoVC = [storyboard | |
instantiateViewControllerWithIdentifier:@"BuildingInfoViewController"]; | |
infoVC.building = _selectedBuilding; | |
UIPopoverController* popover = | |
[[UIPopoverController alloc] initWithContentViewController:infoVC]; | |
infoVC.popover = popover; | |
[popover presentPopoverFromRect:_selectedBuilding.frame inView:self.view |
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 <Foundation/Foundation.h> | |
#import "DDXMLNode.h" | |
@interface DDXMLNode (CDATA) | |
/** | |
Creates a new XML element with an inner CDATA block | |
<name><![CDATA[string]]></name> | |
*/ | |
+ (id)cdataElementWithName:(NSString *)name stringValue:(NSString *)string; |
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
- (UITableViewCell *)tableView:(UITableView *)tableView | |
cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"MessagesCell"; | |
UITableViewCell *cell = [tableView | |
dequeueReusableCellWithIdentifier:CellIdentifier]; | |
MEMessage* message = [_messages objectAtIndex:indexPath.row]; | |
cell.textLabel.text = [NSString stringWithFormat:@"%@ - %@", |
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)downloadUsers | |
{ | |
NSURLSessionConfiguration* sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; | |
NSURLSession* session = [NSURLSession sessionWithConfiguration:sessionConfig delegate:nil delegateQueue:[NSOperationQueue mainQueue]]; | |
NSURL* url = [NSURL URLWithString: | |
@"http://atleast.aut.bme.hu/mobilszoftverek/meetworld/users"]; | |
[[session dataTaskWithURL: url |
OlderNewer