Skip to content

Instantly share code, notes, and snippets.

@wagyu298
wagyu298 / gist:5802089
Created June 18, 2013 01:58
This is a code snippet to control UITextView's contentInset.bottom and scrollIndicatorInset.bottom when iPhone's keyboard status is changed to visible or hide.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated
{
@wagyu298
wagyu298 / gist:5810889
Created June 19, 2013 00:58
didSelectItemAtIndexPath of MainViewController.m from iPhone flat design UI http://www.appdesignvault.com/iphone-flat-ui-design-patterns/.
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
StoryboardInfo* storyboardInfo = self.storyboards[indexPath.section];
ControllerInfo* controllerInfo = storyboardInfo.controllers[indexPath.row];
self.currentViewController = [self getControllerFromStoryboardInfo:storyboardInfo andControllerInfo:controllerInfo];
UIViewController* controller = self.currentViewController;
controller.view.frame = CGRectMake(0, 0, controller.view.frame.size.width, controller.view.frame.size.height);
@wagyu298
wagyu298 / gist:5810926
Created June 19, 2013 01:06
UISwipeGestureRecognizer event handler from iPhone Flat Design UI http://www.appdesignvault.com/iphone-flat-ui-design-patterns/.
- (void)swipedScreen:(UISwipeGestureRecognizer*)gesture {
UIView* view = gesture.view;
CATransition *transition = [CATransition animation];
transition.duration = 0.75;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype =kCATransitionFromLeft;
transition.delegate = self;
@wagyu298
wagyu298 / gist:5822032
Created June 20, 2013 11:36
didFinishLaunchingWithOptions to kick ViewController.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_window.rootViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[_window makeKeyAndVisible];
return YES;
}
@wagyu298
wagyu298 / gist:6328430
Created August 24, 2013 14:22
1/30秒に1ピクセルMKMapViewを右にスクロールさせるサンプル
#import <MapKit/MapKit.h>
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (strong, nonatomic) NSTimer *timer;
@end
@wagyu298
wagyu298 / mergeacknowledgements.py
Created October 23, 2016 06:22
Merge iOS Acknowledgements.plist files with CocoaPods
#!/usr/bin/env python
# Merge extra iOS App's Acknowledgements.plist into CocoaPods generated
# Acknowledgements.plist.
# Run "pip install dpath", s/MyApp/YourAppName/g, and replace extra_plist
# before use this script.
from __future__ import print_function
import operator
import plistlib
import sys
APP_VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" MyApp/Info.plist
BUILD_NUMBER=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" MyApp/Info.plist
/usr/libexec/PlistBuddy \
-c "Set :CFBundleShortVersionString $APP_VERSION" \
-c "Set :CFBundleVersion $BUILD_NUMBER" \
MyExtension/Info.plist
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Usage:
# 1. Google Spread Sheet を開く
# https://docs.google.com/spreadsheets/d/1EKw-FI-zB_dPnIH-HM0OwlLwVkHluVlrGRyKIKtVMwg/edit?usp=sharing
# 2. Hero シートをコピーして hero.tsv に貼り付ける
# (TSV: Tab Separated Volume で)
# 3. Item シートをコピーして item.tsv に貼り付ける
# 4. Ability シートをコピーして ability.tsv に貼り付ける
@wagyu298
wagyu298 / Podfile
Last active October 6, 2018 03:39
Adding local patch to Podfile
platform :ios, '8.0'
# Add this line to the headding of the Podfile
require './pod_patch'
target 'YourProject' do
pod 'PodNameForPatch'
# And add the patch instructions
pod 'PodNameForPatch'
@wagyu298
wagyu298 / docker_cleanup.sh
Created April 24, 2017 00:40
Cleanup all docker local copies
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls -q)