Skip to content

Instantly share code, notes, and snippets.

View polarity's full-sized avatar
🌍
Working from home

Robert Agthe polarity

🌍
Working from home
View GitHub Profile
@polarity
polarity / gist:3528482
Created August 30, 2012 13:26
UITextField: toLowerCase
// Wird bei jeder Notification (jeder Tastenanschlag)
-(void)type
{
// Text in Kleinbuchstaben umwandeln und wieder in den View schreiben
self.handle.text = [self.handle.text lowercaseString];
}
@polarity
polarity / gist:3528446
Created August 30, 2012 13:23
UITextField: Observe text input
// Typische UIViewController Methode
// Wird ausgeführt wenn der View im Speicher
// vollständig geladen wurde.
- (void)viewDidLoad
{
[super viewDidLoad];
// Wir sagen dem handle das er das mit dem Großbuchstaben bei
// neuen Wörtern einfach schon mal lassen soll.
self.handle.autocapitalizationType = UITextAutocapitalizationTypeNone;
@polarity
polarity / gist:3513788
Created August 29, 2012 14:53
NSNotificationCenter: @selector
// toProfileView wird vom NotificationCenter benachrichtigt und ausgeführt
-(void)toProfileView: (NSNotification *)notification
{
// do Stuff...
UIView *object = [NSNotification object];
}
@polarity
polarity / gist:3513744
Created August 29, 2012 14:50
NSNotificationCenter: postNotificationName
// Irgendeine Methode in irgendeiner Klasse
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// Das aktuelle default NotificationCenter holen und in Variable "nc" referenzieren
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
// Mit nc können wir jetzt....
[nc
postNotificationName:@"goToProfile" // Alle Abonnenten (subscriber) von "goToProfile" informieren...
object:self // und uns selbst bzw. die Instanz dieser Klasse (self) als Objekt übergeben
@polarity
polarity / gist:3513598
Created August 29, 2012 14:42
NSNotificationCenter: Observer hinzufügen
// Typische UIViewController Methode
- (void)viewDidLoad
{
[super viewDidLoad];
// Das aktuelle default NotificationCenter holen und in Variable "nc" referenzieren
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
// Mit nc können wir jetzt....
[nc
@polarity
polarity / gist:3175479
Created July 25, 2012 10:37
PHP JS Demo
var engine = new PHP ('<?php echo "Hello world!"; ?>');
console.log( engine.vm.OUTPUT_BUFFER); // the outputted buffer from the script!