Skip to content

Instantly share code, notes, and snippets.

Avatar

iReka Soft irekasoft

View GitHub Profile
View TransitionManager
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
isPresenting = true
return self
}
View gist:550710108751d4bed9d4fbd08d6eb339
/**
* Remove the slug from published post permalinks. Only affect our custom post type, though.
*/
function gp_remove_cpt_slug( $post_link, $post, $leavename ) {
if ( 'race' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
View gist:82f0420eddab7e81faf5e8da847f4e89
{
"destination_addresses" : [
"Mid Valley Megamall, 75, Lingkaran Syed Putra, Mid Valley City, 58000 Kuala Lumpur, Wilayah Persekutuan Kuala Lumpur, Malaysia"
],
"origin_addresses" : [ "Unnamed Road, 26700 Muadzam Shah, Pahang, Malaysia" ],
"rows" : [
{
"elements" : [
{
"distance" : {
@irekasoft
irekasoft / FirstViewController.h
Created Mar 5, 2016
Collection View with draggable cell. 5px padding each.
View FirstViewController.h
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegate>{
CGSize cellSize;
}
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
View gist:10673689
Intent intent = new
Intent(getApplicationContext(),SecondActivity.class);
intent.putExtra("myKey",AnyValue);
startActivity(intent);
Now you can get the passed values by...
Bundle extras = intent.getExtras();
String tmp = extras.getString("myKey");
@irekasoft
irekasoft / gist:10009289
Created Apr 6, 2014
Setup customized tab bar for ios 7
View gist:10009289
- (void)setupTabBar
{
// Assign tab bar item with titles
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = tabBar.items[0];
UITabBarItem *tabBarItem2 = tabBar.items[1];
UITabBarItem *tabBarItem3 = tabBar.items[2];