Skip to content

Instantly share code, notes, and snippets.

Avatar

Róbert Oroszi oroce

  • vernsurance
  • Budapest, Hungary
View GitHub Profile
@oroce
oroce / gist:1035546
Created Jun 20, 2011
parameter validation
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!"
@oroce
oroce / gist:1043498
Created Jun 23, 2011
opera repaint bug workaround
View gist:1043498
$( window ).focus( function(){
this.document.body.style.zIndex -= 1;
})
@oroce
oroce / gist:1097327
Created Jul 21, 2011
sqlite db connection
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 );
@oroce
oroce / gist:1097358
Created Jul 21, 2011
listing tables in appcelerator app
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();
@oroce
oroce / app.js
Created Aug 1, 2011 — forked from kwhinnery/app.js
Faking Long Touch on Android in Titanium Mobile
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
});
@oroce
oroce / _for iOS users
Created Nov 2, 2011
Appcelerator share to native facebook, twitter
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/
@oroce
oroce / simple-with-close-event.js
Created Nov 23, 2011
open jQuery Mobile Dialog from javascript with close event
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 );
};
@oroce
oroce / is-online.js
Created Nov 23, 2011
ideas to check browser is online
View is-online.js
/*
@dependencies
jQuery
*/
(function( window, $, undefined ){
var support = {
onLine: undefined === typeof window.navigator.onLine,
applicationCache: !!window.applicationCache
},
app = {
@oroce
oroce / backbone-model-collection.js
Created Nov 24, 2011
An idea (it means: i haven't tested yet) how to use Backbone.sync with appcelerator (Ti.Database)
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 = [];