View gist:1035546
my %fields = ( | |
name => { | |
required => 1, | |
test => qr!\w+!, | |
nope => "Name field is required, it shouldn't be empty!" | |
}, | |
bplace => { | |
required => 1, | |
test => qr!\w+!, | |
nope => "Birth place field is required, it shouldn't be empty!" |
View gist:1043498
$( window ).focus( function(){ | |
this.document.body.style.zIndex -= 1; | |
}) |
View gist:1097327
/* | |
this file is in Resources/tabs/search.js | |
and the sqlite file is in Resources/db/imenetrend_new.sqlite | |
the database is called as "main" | |
*/ | |
var db = Ti.Database.install( "../db/imenetrend_new.sqlite", "main" ), | |
letters = ( letters||"" ) + "%"; | |
var rows = db.execute( "SELECT * FROM stations WHERE station_deaccent LIKE ? LIMIT 50", letters ); |
View gist:1097358
var db = Ti.Database.install( "../db/imenetrend_new.sqlite", "main" ), | |
_rows = db.execute( "select * from sqlite_master" ); | |
while( _rows.isValidRow() ){ | |
Ti.API.info( "TableName: " + _rows.fieldByName( "name" ) + " - " + _rows.fieldByName( "tbl_name" ) + " - " + _rows.fieldByName( "sql" ) ); | |
_rows.next(); | |
} | |
/* | |
it shows: |
View gist:1104010
$(document).ready(function () { | |
$("#droplist").dropList({ | |
style: "green", | |
width: 220, | |
target: "self", | |
speed: 500 | |
}) | |
$("#droplist").siblings(".dropList-box").trigger("click"); | |
$(".color").click(function (e) { | |
e.preventDefault(); |
View app.js
//The table view row just has to have a full height view in order | |
//to trigger the TableView touchstart | |
function LongTouchTableViewRow(_title) { | |
var row = Ti.UI.createTableViewRow({ | |
height:50 | |
}); | |
var v = Ti.UI.createView({ | |
height:50 | |
}); |
View _for iOS users
This gist is only for Android. | |
If you would like launch native apps | |
on iPhone, iPad, you can find information about it in Appcelerator Docs: | |
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.canOpenURL-method.html | |
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.openURL-method.html | |
More info about iOS URL Schemes: http://handleopenurl.com/ |
View simple-with-close-event.js
//unfortunately the jQuery mobile team removed option, to attaching custom event handler, | |
//so i'm just overriding close event, and using jQuery Widget Library _trigger method | |
$.mobile.dialog.prototype._close = $.mobile.dialog.prototype.close; | |
$.mobile.dialog.prototype.close = function(){ | |
var args = Array.prototype.slice.call( arguments, 0 ); | |
this._trigger( "close" ); | |
this._close.apply( this, args ); | |
}; |
View is-online.js
/* | |
@dependencies | |
jQuery | |
*/ | |
(function( window, $, undefined ){ | |
var support = { | |
onLine: undefined === typeof window.navigator.onLine, | |
applicationCache: !!window.applicationCache | |
}, | |
app = { |
View backbone-model-collection.js
var Model = Backbone.Model.extend({ | |
defaults:{ | |
title: "", | |
content: "", | |
crDate: new Date(), | |
isDone: false, | |
dueDate: null | |
}, | |
validate: function( attrs ){ | |
var errors = []; |
OlderNewer