Skip to content

Instantly share code, notes, and snippets.

View ryugoo's full-sized avatar

Ryutaro Miyashita ryugoo

View GitHub Profile
@ryugoo
ryugoo / app.coffee
Created September 2, 2012 11:52
ImageView Test (2.1.2)
Globals = {}
do ->
# Window
win = Ti.UI.createWindow
title: "Tweet"
backgroundColor: "#FFFFFF"
tabBarHidden: true
imageView = Ti.UI.createImageView
image: "http://pbs.twimg.com/media/A1yF3hLCUAAcy5u.jpg:small"
hires: true
@ryugoo
ryugoo / yum-devtools.md
Created September 4, 2012 15:08
Yum development tools install memo.
yum groupinstall "Development Tools"
yum install openssl-devel readline-devel zlib-devel curl-devel\
ImageMagick ImageMagick-devel glib-devel gd-devel libxml2-devel\
libxslt-devel pcre-devel perl-devel perl-ExtUtils-Embed w3m bind-utils
cd /opt
curl -O http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzf yaml-0.1.4.tar.gz
cd yaml-0.1.4

./configure && make && make install

@ryugoo
ryugoo / rhel6x_Python266to273.md
Created September 9, 2012 14:26
CentOS (Scientific Linux) 6.x 系の Python を 2.7.3 に入れ替えるメモ

Python 2.7.x にする

デフォルトでインストールされている Python は 2.6.6 なので、これを 2.7 系にする。
これを書いている時点の 2 系最新版は 2.7.3 なので、それをデフォルトの Python にする。

ダウンロードからインストールまで

作業は全て /opt 以下で行う。作業は root 権限を持つユーザで行う。ここでは root で行う。

cd /opt
@ryugoo
ryugoo / delete_string.py
Created September 14, 2012 11:11
文字列から特定の文字を削除するスクリプト
import string
source_str = ""
delete_str = ""
my_str = source_str.translate(string.maketrans("", ""), delete_str)
@ryugoo
ryugoo / app.js
Created September 17, 2012 23:11
TableViewのタイトルを次のWindowに引き継ぐ
(function () {
// トップレベルコンテナ
var wrapper = Ti.UI.createWindow();
// はじめのウィンドウ
var first_win = Ti.UI.createWindow({
backgroundColor: "#FFFFFF",
title: "NavGroup"
});
first_win.add(Ti.UI.createLabel({
text: "First Window",
@ryugoo
ryugoo / app.js
Created October 2, 2012 07:40
HTTP Client (Callback pattern)
(function () {
var getContent = function (paramsObj) {
// HTTP Client
var xhr = Ti.Network.createHTTPClient();
// Onload handler
xhr.onload = function () {
// 今回は Twitter のタイムライン情報 (JSON) を取ってくるので、 responseText を使う
paramsObj.success(xhr.responseText);
};
// Error handler
@ryugoo
ryugoo / app.js
Created October 2, 2012 07:54
HTTP Client (Event fire pattern)
(function () {
Ti.App.addEventListener("app:getContentFire", function (listenEvt) {
var data = JSON.parse(listenEvt.data);
alert("データの取得に成功しました!");
alert(data);
});
var wrapper = Ti.UI.createWindow();
var base = Ti.UI.createWindow({
title: "Base",
backgroundColor: "#FFFFFF"
@ryugoo
ryugoo / app.js
Created October 2, 2012 16:34
TypeScript for Titanium Mobile test application
var MyTabGroup = (function () {
function MyTabGroup() {
this.tabGroup = Ti.UI.createTabGroup();
}
MyTabGroup.prototype.appendTab = function (params) {
for(var i = 0, l = params.length; i < l; i++) {
this.tabGroup.addTab(Ti.UI.createTab(params[i]));
}
};
MyTabGroup.prototype.open = function () {
@ryugoo
ryugoo / app.js
Created October 31, 2012 02:06
iOS TableViewRow longpress event emulation (Titanium Mobile)
(function () {
// Base window
var base = Ti.UI.createWindow({
backgroundColor: "#FFFFFF",
title: "Long Press"
});
// TableView
var tableView = Ti.UI.createTableView({
data: [],
@ryugoo
ryugoo / app.coffee
Created November 8, 2012 15:57
マルチコンテキストでウィンドウを開く
do ->
# Main window
win = Ti.UI.createWindow
url: "win1.js"
# Tab
tab = Ti.UI.createTab
title: "Apps"
icon: "KS_nav_ui.png"
window: win
tabGroup = Ti.UI.createTabGroup()