Skip to content

Instantly share code, notes, and snippets.

View dataich's full-sized avatar
😀

Taichiro Yoshida dataich

😀
View GitHub Profile
@dataich
dataich / gist:950532
Created May 1, 2011 14:23
get application's identifiers which can open http scheme
NSArray *identifiers = (NSArray*)LSCopyAllHandlersForURLScheme((CFStringRef)@"http");
@dataich
dataich / create_dmg.sh
Created May 1, 2011 13:50
create .dmg image after built on Xcode
set -ex
[ "$ACTION" = build ] || exit 0
[ "$BUILD_VARIANTS" = "normal" ] || exit 0
[ "$CONFIGURATION" = "Release" ] || exit 0
dir="$TEMP_FILES_DIR/disk"
dmg="$HOME/Desktop/$PROJECT_NAME.dmg"
rm -rf "$dir"
@dataich
dataich / ip-up
Last active February 13, 2019 12:19
adding rooting through specific interface to network
#!/bin/sh
if [ "$1" = "ppp0" ]; then
/sbin/route -nv add -net 192.168.13 -interface ppp0
/sbin/route -nv add -net 192.168.15 -interface ppp0
fi
git init --template ~/Dropbox/Documents/git-core/templates/
@dataich
dataich / commit-msg
Created December 4, 2010 13:46
短すぎるコミットログを禁止、自分への戒め!
#!/usr/bin/env ruby
#place this file in .git/hooks/commit-msg
MIN_LENGTH = 10
log = File.readlines(ARGV[0]).grep(/^[^#].+/)
length = log.to_s.split(//u).size - 1
if length < MIN_LENGTH
test1
@interface CustomViewController : UIViewController <UITextViewDelegate> {
UITextView *_textView; //対象となるテキストビュー。UIViewControllerのサブビューとして追加する。
}
@property (nonatomic, retain) IBOutlet UITextView *_textView;
@end
@implementation CustomViewController
- (void)viewDidLoad {
<div class="fl"><?php next_posts_link(__('&laquo; Older Entries'),woothemes); ?></div>
<div class="fl"><?php next_posts_link(__('&laquo; Older Entries',woothemes)); ?></div>
<?php
//
// 画面出力時に、テンプレートをUTF-8からSJISに変換する。
//
function filterUTF8ToSJIS($buff, &$smarty) {
return mb_convert_encoding($buff,"SJIS","UTF-8");
}
$smarty= new Smarty(); //Smartyオブジェクト生成
$smarty->register_outputfilter("filterUTF8ToSJIS"); //フィルターの登録
<?php
$str = "12345123456712"; //固定長テキスト
$lengths = array(5,7,2); //分割する長さの指定
$format = ''; //フォーマット
$cursor = 0; //カーソル位置のカウント
//フォーマットの作成
foreach($lengths as $length) {
if($cursor != 0) {
//PHPの場合、2番目以降は x数値 を使用して開始位置を指定する