This file contains hidden or 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
webView.addEventListener('load',function(e){ | |
webView.evalJS( ' $("a:contains(\'上野駅\')").text("蒲田駅"); ' ); | |
}); |
This file contains hidden or 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
# use tmux for every session. | |
P_PROC=`ps aux | grep $PPID | grep sshd | awk '{ print $11 }'` | |
if [ "$P_PROC" = sshd: ]; then | |
/usr/local/bin/tmux -u attach || /usr/local/bin/tmux -u | |
# exit | |
fi |
This file contains hidden or 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 | |
$KCODE='utf8' | |
require 'time' | |
require 'logger' | |
def usage(error=nil) | |
STDERR.print <<-EOS | |
sleep until the wakeup time. | |
[usage] sleep wakeuptime | |
-d |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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
// 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 hidden or 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 hidden or 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
var win = Titanium.UI.createWindow({ | |
navBarHidden : true, | |
exitOnClose:true | |
}); | |
var webView = Ti.UI.createWebView({ | |
width:'100%' | |
}); | |
webView.addEventListener('beforeload',function(e){ | |
if (e.url.match(/^file:\/\//) ){ |
This file contains hidden or 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 hidden or 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 |