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
# -*- encoding: utf-8 -*- | |
require "singleton" | |
require "uri" | |
require 'lib/debugLog.rb' | |
#WEBページを取得するための基底クラス | |
class ScraperException < StandardError; end | |
class ScraperPageNotFoundException < ScraperException; end | |
class Scraper |
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
util = {} | |
//thanks to http://blog.xole.net/article.php?id=612 | |
util.TraceLog = function (){ | |
this.startTime = -1; | |
}; | |
util.TraceLog.prototype = { | |
start: function(message){ | |
this.startTime = new Date().getTime(); | |
Ti.API.debug('[' + message + '] has started'); | |
}, |
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
/** 文字列の前後の空白を削除 */ | |
String.prototype.trim = function() { | |
return this.replace(/^\s+|\s+$/g, ""); | |
} | |
/** 文字列の改行を削除 */ | |
String.prototype.trim_newline = function(){ | |
return this.toString().replace(/\n/g, ''); | |
} | |
/** 最後が特定の文字で終わるようにした文字列を返す。 | |
主に、パス名が/で終わることを強制するのに使う |
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
require 'RMagick' | |
include Magick | |
BKCOLOR_SPLASH = '#0000FF' | |
BKCOLOR_ICON = '#0000FF' | |
def mkAppIcon(iconfile,size,bkColor='#000000') | |
canvas = Image.new(size,size){ | |
self.background_color = bkColor | |
self.format = 'png' |
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
# -*- encoding: utf-8 -*- | |
require 'net/smtp' | |
require 'kconv' | |
require "open-uri" | |
require "json" | |
#メール関連の設定。 プログラムを使う人の環境に応じて適切に書き換えてください | |
from_addr = '※※※※' # 送信元のメールアドレスを設定。 | |
mailserver={} |
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 | |
# -*- encoding: utf-8 -*- | |
require "open-uri" | |
require "json" | |
#引数の取得 | |
lat,lng=ARGV[0].to_f,ARGV[1].to_f if (ARGV.size>1) | |
if !(lat&&lng) | |
STDERR.puts("lat lngがないので、仮に大阪の梅田駅周辺を表示します") | |
lat,lng= 34.70288,135.49863 |
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
Titanium.UI.setBackgroundColor('#000'); | |
var win1 = Titanium.UI.createWindow({ | |
title:'電源コンパス', | |
backgroundColor:'#fff' | |
}); | |
var compass = Ti.UI.createImageView({ | |
image:'/arrow.png', | |
width:Ti.UI.SIZE, | |
height:Ti.UI.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
// An idea to implement menu like google+ android app with TitaniumMobile. | |
// convert dp to pixel. | |
function dpToPixel(dp) { | |
return ~~( parseInt(dp) * (Titanium.Platform.displayCaps.dpi / 160)); | |
} | |
// convert pixel to dp. | |
function pixelToDp(px) { | |
return ~~( parseInt(px) / (Titanium.Platform.displayCaps.dpi / 160))+'dp'; |
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
diff --git Classes/ZipFileModule.m Classes/ZipFileModule.m | |
index cd85b07..b8b0cff 100644 | |
--- Classes/ZipFileModule.m | |
+++ Classes/ZipFileModule.m | |
@@ -84,12 +84,32 @@ | |
//} | |
} | |
+/* | |
+ * Convert file url into absolute path (file://localhost/a/b.png -> /a/b.png) |
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 | |
#create backup file with current date,like hoge.20120106_231651 | |
#file backup command | |
if [ $# -lt 1 ] | |
then | |
echo "usage: bk files.." | |
echo "create backup files with date string." | |
exit 0; | |
fi |