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/local/bin/ruby | |
# | |
# Need "nokogiri" for xml parse | |
# | |
require "nokogiri" | |
file = File.open(ARGV[0]) | |
xml_doc = Nokogiri::XML(file) | |
array = xml_doc.xpath("//string") |
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
/** | |
* android snippet | |
* Force set forcus to View object.Somtimes this is not effected | |
* | |
* @param v View instance object of set forcus | |
*/ | |
public void foceSetFocus(View v) { | |
v.setFocusable(true); | |
v.setFocusableInTouchMode(true); | |
if (!v.requestFocus()) { |
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
# export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig:$PKG_CONFIG_PATH | |
# C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/ | |
# gem install rmagick |
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
#Create squre thumbnail from bytedata by RMagick | |
def thumbnail(size=128) | |
image = Magick::Image.from_blob(self.binary_contents).shift | |
image_width = image.columns | |
image_height = image.rows | |
if image_width > image_height | |
crap_size = image_width -image_height # 正方形にするため、カットするpixcel数 | |
thumbnail = image.crop(crap_size /2, 0, image_width - crap_size , image_height).resize(size, size) |
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
package jp.co.so_da.android.extension; | |
import android.util.Log; | |
/** | |
* ファイル名 + 行番号付きで、Log出力を行うUtility クラス<br> | |
* <h4>使い方</h4> | |
* アプリ起動時に、Logger{@link #tag}とLogger{@link #logDebug}に必要な値を設定して下さい。 | |
* @author Takuya Inoue | |
* | |
*/ |
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
Time.now.getlocal.to_s => "2013-02-08 02:25:46 +0900" |
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
#ifndef DEBUG | |
#define NSLog( m, args... ) | |
#endif |
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
public satic boolean isAirPlaneMode() { | |
Settings.System.getInt(getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1 | |
} |
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 | |
# | |
# check Home Local LAN or other place, wifi or company office | |
# if access from home LAN, out Home LAN IP address, otherwise return global IP addrress | |
# Author Takuya Inoue | |
#GROBAL IP address | |
IP_ADDR=xxx.xxx.xxx.xxx | |
# network is 192.168.0.0/24 |
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
//Logging macro | |
//if release mode, undfeine this macro | |
#ifdef DEBUG | |
#define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#else | |
#define NSLog(fmt, ...) | |
#endif | |
//assertion macro |
OlderNewer