Skip to content

Instantly share code, notes, and snippets.

View yagitoshiro's full-sized avatar

yagi_ yagitoshiro

View GitHub Profile
@yagitoshiro
yagitoshiro / my appcelerator backtrace
Created January 20, 2011 19:55
my appcelerator backtrace
0 CoreFoundation 0x0234457c __exceptionPreprocess + 156
1 libobjc.A.dylib 0x02498313 objc_exception_throw + 44
2 CoreFoundation 0x0233a1bc -[__NSArrayI objectAtIndex:] + 236
3 MyApp 0x0010719b -[InnerScrollView viewForZoomingInScrollView:] + 66
4 UIKit 0x008c75a0 -[UIScrollView _getDelegateZoomView] + 117
5 UIKit 0x008c9d75 -[UIScrollView _centerContentIfNecessary] + 36
6 UIKit 0x008c8aea -[UIScrollView layoutSubviews] + 72
7 QuartzCore 0x019e8c6a -[CALayer layoutSublayers] + 181
8 QuartzCore 0x019eafec CALayerLayoutIfNeeded + 220
9 QuartzCore 0x01990400 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
@yagitoshiro
yagitoshiro / transport.py
Created February 7, 2011 09:32
マルチバイトのディレクトリ名が混ざっていても動作するようにした
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Make an iOS project transportable so that it can be zipped and
# sent to another machine
#
import os, sys, shutil, codecs, glob
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
@yagitoshiro
yagitoshiro / gist:1130949
Created August 7, 2011 23:55
simple sqlite script(excerpt) for titanium mobile
// Before proceeding, you must create sqlite database "test.db" in Resources directory.
Ti.Database.install('test.db', 'tests'),
function insert(data){
var sql = "INSERT INTO samples (id, title, sample) VALUES (?, ?, ?)";
try{
this.db.execute(sql, data.id, data.title, data.sample);
}catch(e){
Ti.API.info('insert error:' + sql);
}
@yagitoshiro
yagitoshiro / push_notifications.js
Last active August 13, 2016 17:29
apple push notification sample (Titanium Mobile)
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)
@yagitoshiro
yagitoshiro / gist:1228967
Created September 20, 2011 12:25
coffee script sample testing...
//app.js
(function() {
var person, syrup;
syrup = require('syrup');
syrup.include('/model/entity');
syrup.include('/model/person');
person = new MYAPP.Model.Person('Coffee syrup');
person.sayHello();
}).call(this);
@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
@yagitoshiro
yagitoshiro / app.js
Created January 29, 2012 15:17
Titanium m3u audio streaming test
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
@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: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 / 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
)