This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$records = array( | |
array('name' => '田中 太郎', 'sex' => 1), | |
array('name' => '田中 花子', 'sex' => 2), | |
array('name' => '鈴木 太郎', 'sex' => 1), | |
array('name' => '鈴木 花子', 'sex' => 2) | |
); | |
$filter = create_function('$record', 'return $record["sex"] == 1;'); //1 | |
$male_only = array_filter($records, $filter); //2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$str = "12345123456712"; #固定長テキスト | |
@lengths = (5,7,2); #分割する長さの指定 | |
$format = ''; #フォーマット | |
#フォーマットの作成 | |
foreach $length(@lengths) { | |
$format .= "A$length"; | |
} | |
@outs = unpack $format, $str; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = "12345123456712"; //固定長テキスト | |
$lengths = array(5,7,2); //分割する長さの指定 | |
$format = ''; //フォーマット | |
$cursor = 0; //カーソル位置のカウント | |
//フォーマットの作成 | |
foreach($lengths as $length) { | |
if($cursor != 0) { | |
//PHPの場合、2番目以降は x数値 を使用して開始位置を指定する |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// | |
// 画面出力時に、テンプレートをUTF-8からSJISに変換する。 | |
// | |
function filterUTF8ToSJIS($buff, &$smarty) { | |
return mb_convert_encoding($buff,"SJIS","UTF-8"); | |
} | |
$smarty= new Smarty(); //Smartyオブジェクト生成 | |
$smarty->register_outputfilter("filterUTF8ToSJIS"); //フィルターの登録 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="fl"><?php next_posts_link(__('« Older Entries'),woothemes); ?></div> | |
<div class="fl"><?php next_posts_link(__('« Older Entries',woothemes)); ?></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface CustomViewController : UIViewController <UITextViewDelegate> { | |
UITextView *_textView; //対象となるテキストビュー。UIViewControllerのサブビューとして追加する。 | |
} | |
@property (nonatomic, retain) IBOutlet UITextView *_textView; | |
@end | |
@implementation CustomViewController | |
- (void)viewDidLoad { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init --template ~/Dropbox/Documents/git-core/templates/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer