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 | |
public function __call($method, $arguments) { | |
$realMethodName = "_" . $method; | |
if (method_exists($this, $realMethodName)) { | |
$response = $this->callOldVersion($arguments); |
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
let types = UIUserNotificationSettings(forTypes: [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound], categories: nil) | |
UIApplication.sharedApplication().registerUserNotificationSettings(types) | |
UIApplication.sharedApplication().registerForRemoteNotifications() |
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
//Load a nib with a given name | |
class func loadFromNibNamed(nibNamed: String, bundle : NSBundle = NSBundle.mainBundle()) -> UIView! { | |
return UINib(nibName: nibNamed, bundle: bundle).instantiateWithOwner(nil, options: nil)[0] as? UIView | |
} |
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 | |
while (true) { | |
//poll database | |
//send messages over XMPP connection | |
//take a nap | |
sleep(5); | |
} |
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 | |
//Initialize | |
$this->client = new JAXL(array( | |
'jid' => $this->senderId .'@gcm.googleapis.com', | |
'pass' => $this->googleApiKey, | |
'auth_type' => 'PLAIN', | |
'host' => $this->host, | |
'port' => $this->port, | |
'strict' => false, |
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
enum PAGE_STATE { INITIALIZING, LOADING, LOADED, NETWORK_ISSUES } | |
PAGE_STATE currentState = PAGE_STATE.INITIALIZING; |
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
new Handler(Looper.getMainLooper()).post(new Runnable() { | |
@Override | |
public void run() { | |
//stuff to run on the main thread | |
} | |
}); |
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
if (adapter == null) { | |
adapter = new PhotoAdapter(getChildFragmentManager()); | |
} | |
adapter.clearCache(); | |
pager.setAdapter(adapter); |
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
Boolean clearCache = false; | |
public void clearCache() { | |
mFragments.clear(); | |
clearCache = true; | |
} |
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
if (mAdapter != null) { | |
mAdapter.restoreState(ss.adapterState, ss.loader); | |
setCurrentItemInternal(ss.position, false, true); | |
} |