This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( window ).focus( function(){ | |
this.document.body.style.zIndex -= 1; | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 ); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@dependencies | |
jQuery | |
*/ | |
(function( window, $, undefined ){ | |
var support = { | |
onLine: undefined === typeof window.navigator.onLine, | |
applicationCache: !!window.applicationCache | |
}, | |
app = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Model = Backbone.Model.extend({ | |
defaults:{ | |
title: "", | |
content: "", | |
crDate: new Date(), | |
isDone: false, | |
dueDate: null | |
}, | |
validate: function( attrs ){ | |
var errors = []; |
OlderNewer