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 | |
$path[] = '/Users/tikitikipoo/Pictures/scansnap/*'; | |
while(count($path) != 0) | |
{ | |
$v = array_shift($path); | |
foreach(glob($v) as $item) | |
{ | |
if (is_dir($item)) | |
$path[] = $item . '/*'; |
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
import android.content.Context; | |
import android.view.Display; | |
import android.view.WindowManager; | |
public static class ScreenSize { | |
public static int getScreenWidth(Context context) { | |
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); | |
Display display = manager.getDefaultDisplay(); |
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
import java.io.File; | |
import android.os.Environment; | |
// ここではDBの名前がdatabase.dbを例にとる | |
File file = new File(Environment.getDataDirectory().getPath() | |
+ "/data/" + context.getPackageName()+ "/databases/database.db"); | |
if (! file.exists()) { | |
// do something | |
} |
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
import android.content.res.Configuration; | |
import android.content.res.Resources; | |
public static String getCountry(Context context) { | |
Resources rs = context.getResources(); | |
Configuration cf = rs.getConfiguration(); | |
String country = cf.locale.getCountry(); | |
return country; | |
} |
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
$rss_pub_date = "Sat, 07 Jan 2012 05:00:51 -0800"; | |
$mydate = date("Y/m/d", strtotime($rss_pub_date)); | |
echo $mydate; | |
// 出力 2012/01/07 |
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
// | |
// CYMainViewController.h | |
// IdoAvg | |
// | |
// Created by tikitikipoo on 11/12/12. | |
// Copyright (c) 2011 __MyCompanyName__. All rights reserved. | |
// | |
#import "CYFlipsideViewController.h" |
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
UIView * circleView = [[UIView alloc] initWithFrame:CGRectMake(0,0,SIZE,SIZE)]; | |
[circleView setBackgroundColor:[UIColor blackColor]]; | |
circleView.layer.cornerRadius = SIZE / 2; | |
[self.view addSubview:circleView]; |
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
// 例: | |
// 目標:以下の文字列の中から_m.jpgで終わるURLを取得 | |
// 表題に合わせると「(左から数えて)_m.jpgの直近にあるhttpから取得する」 | |
// 参考:http://www.geocities.jp/oraclesqlpuzzle/regex/regex-4-28.html | |
var tmp = 'http://f.hatena.ne.jp/memi811/20120124082636<a href="http://f.hatena.ne.jp/memi811/20120124082636"><img src="http://cdn-ak.f.st-hatena.com/images/fotolife/m/memi811/20120124/20120124082636_m.jpg" alt="20120124082636"></a><a href="http://f.hatena.ne.jp/memi811/20120124082636"><img src="http://cdn-ak.f.st-hatena.com/images/fotolife/m/memi811/20120124/20120124082636.jpg" alt="20120124082636"></a>2012-01-24T08:26:36+09:00http://cdn-ak.f.st-hatena.com/images/fotolife/m/memi811/20120124/20120124082636.jpghttp://cdn-ak.f.st-hatena.com/images/fotolife/m/memi811/20120124/20120124082636_m.jpghttp://cdn-ak.f.st-hatena.com/images/fotolife/m/memi811/20120124/20120124082636_120.jpg'; | |
console.log( tmp.match(/http(.(?!http))*_m\.jpg/)[0] ); |
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
// javascript | |
var url = "http://jsdo.it/img/common/side/bnr_html5_01.png"; | |
var image = document.getElementsByTagName('img')[0]; | |
image.src = url; | |
image.onload = function() { | |
// for safari, firefox | |
// その他のブラウザは別途対応お願いします |
OlderNewer