Skip to content

Instantly share code, notes, and snippets.

View junpluse's full-sized avatar

Jun Tanaka junpluse

View GitHub Profile
@junpluse
junpluse / index.html
Last active March 29, 2016 08:45
Format multi-line text for ES5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Multiline Text Formatter for ES5</title>
<style>
body {
margin: 24px;
font-family: sans-serif;
@junpluse
junpluse / Designing for Google Cardboard.md
Last active August 29, 2015 14:22
Designing for Google Cardboard の日本語訳(途中)

Designing for Google Cardboard

日本語訳: 原文

新たな次元へ

VR における素晴らしいユーザーインターフェースをデザインすることは、従来の 2D 向けにデザインすることに比べて、大きく異なります。この資料におけるベストプラクティスは、Google Cardboard デザインチームによって作成された初期の VR アプリケーションやプロトタイプから得られた知見に基づいています。人体感覚・認識の基礎を身につけることは、あらゆるプラットフォームに向けて VR アプリケーションをデザインする助けとなるでしょう。

Google のデザインチームはこの領域での調査を引き続き行っており、この資料は VR デザインのための包括的なリソースとなります。インタラクティブ、バーチャル、そしてモーショングラフィックスデザイナーにとって、今はまさにエキサイティングな時代です。

@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
@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
#import <Foundation/Foundation.h>
@interface NSObject (ResponderBlock)
- (id)responderBlockForSelector:(SEL)selector;
- (void)setResponderBlock:(id)block forSelector:(SEL)selector;
@end
@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
@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 / 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 / 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 / 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