Skip to content

Instantly share code, notes, and snippets.

View junpluse's full-sized avatar

Jun Tanaka junpluse

View GitHub Profile
@junpluse
junpluse / Espresso tutti colori with Coffee.css
Created May 10, 2012 12:35
My minor changed default theme for Espresso. Good for CoffeeScript.
/* --------------------------------------------
Espresso tutti colori with Coffee.css
Version: 0.0.4
Author: Jun Tanaka
URL: https://gist.github.com/2652784
Copyright: 2012 Jun Tanaka
@theme Espresso tutti colori with Coffeeby Jun Tanaka
@junpluse
junpluse / Espresso.sss
Created May 24, 2012 08:14
Espresso theme for Coda 2
/* --------------------------------------------
Espresso.sss
Espresso theme for Coda 2
Version: 0.0.3
Author: Jun Tanaka
URL: https://gist.github.com/2780176
Copyright: 2012 Jun Tanaka
@junpluse
junpluse / Xcode.sss
Created May 25, 2012 02:44
Xcode default theme for Coda 2
/* --------------------------------------------
Xcode.sss
Xcode default theme for Coda 2
Version: 0.0.1
Author: Jun Tanaka
URL: https://gist.github.com/2785451
Copyright: 2012 Jun Tanaka
@junpluse
junpluse / UIScrollViewDelegate.m
Last active October 9, 2015 02:28
How to optimize content inset of UIScrollView when zoom out.
- (void)scrollViewDidZoom:(UIScrollView *)scrollView
{
UIEdgeInsets inset = self.originalInset;
if (scrollView.zoomScale < 1) {
inset.top += scrollView.bounds.size.height - scrollView.contentSize.height;
inset.left += scrollView.bounds.size.width - scrollView.contentSize.width;
inset.bottom += scrollView.bounds.size.height - scrollView.contentSize.height;
inset.right += scrollView.bounds.size.width - scrollView.contentSize.width;
}
@junpluse
junpluse / SwipeNavigationController.h
Last active April 26, 2024 08:15
Simple implementation for swipe-to-back/forward UINavigationController
#import <UIKit/UIKit.h>
@interface SwipeNavigationController : UINavigationController <UIGestureRecognizerDelegate>
@property (nonatomic, readonly) NSArray *poppedViewControllers;
- (void)clearPoppedViewControllers;
@property (nonatomic, readonly) UISwipeGestureRecognizer *leftSwipeGestureRecognizer;
@junpluse
junpluse / KeyedOperationQueue.h
Created December 5, 2012 14:38
Keyed NSOperationQueue
#import <Foundation/Foundation.h>
extern id KeyedOperationQueueCreateUniqueKey();
@interface KeyedOperationQueue : NSOperationQueue
@property (nonatomic, readonly) NSDictionary *operationsForKeys;
- (void)addOperation:(NSOperation *)operation forKey:(id)key;
@junpluse
junpluse / UIView+Export.h
Created April 25, 2013 12:51
Instant UIView exporter
#import <UIKit/UIKit.h>
@interface UIView (Export)
- (UIImage *)exportAsImageWithScale:(CGFloat)scale;
@end
#import <Foundation/Foundation.h>
@interface NSObject (ResponderBlock)
- (id)responderBlockForSelector:(SEL)selector;
- (void)setResponderBlock:(id)block forSelector:(SEL)selector;
@end
@junpluse
junpluse / BumpBuildNumberWhenArchived
Created June 7, 2013 11:07
Xcode: Bump Build Number When Archived
if [ $CONFIGURATION == Release ]; then
echo "Bumping build number..."
plist=${PROJECT_DIR}/${INFOPLIST_FILE}
# increment the build number (ie 115 to 116)
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
@junpluse
junpluse / automator
Last active August 29, 2015 14:17
Convert .mov to .gif using ffmpeg
for file in "$@"
do
ffmpeg -i "$file" -pix_fmt rgb24 -f gif - | gifsicle --optimize=3 --delay=3 > "${file%.*}.gif"
done