Skip to content

Instantly share code, notes, and snippets.

@mogya
mogya / gist:1194823
Created Sep 5, 2011
show various buttons without any images.
View gist:1194823
var tabGroup = Titanium.UI.createTabGroup();
var view = Titanium.UI.createView({
});
view.layout = 'vertical';
var win = Titanium.UI.createWindow({
title:'non-image buttons',
font:{fontFamily:'AppleGothic'},
tabBarHidden:true,
backgroundColor:'#fff'
@mogya
mogya / build.py
Created Sep 25, 2011
build.py(1.6.2) modification to suppress CFBundleVersion modification
View build.py
if not simulator:
version = ti.properties['version']
# we want to make sure in debug mode the version always changes
o.write("[INFO] mogya. skip version modification.") # mogya
# version = "%s.%d" % (version,time.time())
ti.properties['version']=version
pp = os.path.expanduser("~/Library/MobileDevice/Provisioning Profiles/%s.mobileprovision" % appuuid)
provisioning_profile = read_provisioning_profile(pp,o)
@mogya
mogya / gist:1417382
Created Dec 1, 2011
俺ブラウザ
View gist:1417382
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'俺ブラウザ',
backgroundColor:'#fff'
});
win1.tabBarHidden = true;
var webView = Titanium.UI.createWebView( {
url: "http://oasis.mogya.com/iphone/"
});
@mogya
mogya / gist:1417427
Created Dec 1, 2011
俺ブラウザのスパイス
View gist:1417427
webView.addEventListener('load',function(e){
webView.evalJS( ' $("a:contains(\'上野駅\')").text("蒲田駅"); ' );
});
@mogya
mogya / .bash_profile
Created Dec 14, 2011
run tmux at startup.
View .bash_profile
# 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
View sleepUntil.rb
#!/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
@mogya
mogya / bk.sh
Created Jan 6, 2012
bk - create backup file with current date.
View bk.sh
#!/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
@mogya
mogya / zipfile.patch
Created Jul 26, 2012
patch for the issue TermiT / ZipFile doesn't work with ti1.7.2 and after.
View zipfile.patch
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)
@mogya
mogya / app.js
Created Sep 25, 2012
An idea to implement menu like google+ android app with TitaniumMobile.
View app.js
// 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';
@mogya
mogya / app.js
Created Oct 9, 2012
電源コンパス
View app.js
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,
You can’t perform that action at this time.