Skip to content

Instantly share code, notes, and snippets.

View yagitoshiro's full-sized avatar

yagi_ yagitoshiro

View GitHub Profile
@yagitoshiro
yagitoshiro / tipy
Created August 24, 2013 10:47
/usr/local/bin/tipy 最新版が正義
#!/usr/bin/env ruby
dir = "#{ENV['HOME']}/Library/Application\ Support/Titanium/mobilesdk/osx/*GA"
sdk = "#{Dir.glob(dir).sort.last}/titanium.py"
exec "#{sdk.gsub(/ /, '\ ')} #{ARGV.join(" ")}"
@yagitoshiro
yagitoshiro / tiapp.xml
Last active December 16, 2015 06:49
AppIdが「app.gcmtest.android」だった場合のGCMのtiapp.xmlの設定
<!--前略-->
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>8</tool-api-level>
<manifest android:versionCode="1" android:versionName="1.0" package="com.activate.mohh">
<supports-screens android:anyDensity="true"/>
<uses-sdk android:minSdkVersion="8"/>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
@yagitoshiro
yagitoshiro / gist:5392658
Created April 16, 2013 01:27
キリトリ
button.addEventListener('click', function(e){
Ti.Media.openPhotoGallery({
error: function(){},
cancel: function(){},
success: function(e){
var size = Math.min(e.media.width, e.media.height) / 2;
var image = e.media.imageAsCropped({
x: 0,
y: 0,
width: size,
@yagitoshiro
yagitoshiro / gist:3039968
Last active October 19, 2015 05:50
Titanium Mobile用のSQLiteを扱うクラス・第二形態 update: 更新も保存もsaveに統一
# モデルがこれだけで作れたら素敵じゃないか
# entry.coffee
Database = require('libs/database')
class Entry extends Database
initialize:()->
@property 'title', 'text'
@property 'body', 'text'
super
module.exports = new Entry('entries')
@yagitoshiro
yagitoshiro / ApplicationWindow.js
Created October 10, 2012 14:22
地名や住所を指定すると現在位置から見た方位角を大雑把に出してその地点まで直線を引いてコンパスを動かすサンプル
function ApplicationWindow(title) {
var self = Ti.UI.createWindow({
title:title,
backgroundColor:'white'
});
var compass = Ti.UI.createImageView({
image:'/images/arrow.gif',
width:Ti.UI.SIZE,
height:Ti.UI.SIZE,
@yagitoshiro
yagitoshiro / RecordingVideo.js
Created September 30, 2012 14:14 — forked from dawsontoth/RecordingVideo.js
How to record video, then share or save it. Using Appcelerator Titanium!
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@yagitoshiro
yagitoshiro / StupidimagereaderModule.java
Created August 12, 2012 17:12
画像ファイルを読ませると幅と高さを持ったTiBlobを返す
/**
* This file was auto-generated by the Titanium Module SDK helper for Android
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* var mod = require('org.selfkleptomaniac.ti.mod.stupidimagereader');
* var image = "washingmachine.jpg";
*
@yagitoshiro
yagitoshiro / gist:3285771
Created August 7, 2012 14:22
emulate home button on android:back event
win.addEventListener('android:back', ()->
intent = Ti.Android.createIntent
action: Ti.Android.ACTION_MAIN
intent.addCategory Ti.Android.CATEGORY_HOME
Ti.Android.currentActivity.startActivity intent
return
)
@yagitoshiro
yagitoshiro / app.js
Created June 21, 2012 04:34 — forked from ryugoo/app.js
WebView "Event to fire more than once" fix (removeEventListener)
// Global Background Color
Ti.UI.setBackgroundColor("#000000");
// Namespace
var APP = {};
// Running
(function () {
// Window
var win = Ti.UI.createWindow({
@yagitoshiro
yagitoshiro / gist:1247519
Created September 28, 2011 09:54
Titanium Mobile (Android) sample -- save file to sdcard and register to photo gallery.
save_button.addEventListener('click', ()->
if Ti.Filesystem.isExternalStoragePresent
save_image = Ti.Filesystem.getFile(path).read()
new_path = Titanium.Filesystem.externalStorageDirectory + Date.now().toString() + ".png"
f = Ti.Filesystem.getFile(new_path)
result = f.write(save_image)
unless result
return null