Author Archives: Yash

capture QKeySequence from QKeyEvent

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 if (event->type() … Continue reading

Posted in Qt

Static cast : Pass QWidget and grab Custom class out that

/* Pass QWidget and grab MainWindow out that */   Pane::Pane(QWidget *parent) : QFrame (parent){    mainWindow = static_cast<MainWindow*>(parent);   }

Posted in Qt

HTML 5 Framework for game development

Posted in Featured, HTML5, Javascript

Find actual javascript size of array

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 //find value in associative array for (i in tmpArr) {     console.log(i+’:'+tmpArr[i]+’, ‘); // outputs: one:First, two:Second, three:Third }   … Continue reading

Posted in Javascript

Dynamic base url : CodeIgniter and Zend Framework

1 2 3 $base_url = ((isset($_SERVER[’HTTPS’]) && $_SERVER[’HTTPS’] == "on") ? "https" : "http"); $base_url .= "://".$_SERVER[’HTTP_HOST’]; $base_url .= str_replace(basename($_SERVER[’SCRIPT_NAME’]),"",$_SERVER[’SCRIPT_NAME’]);  

Posted in CodeIgniter, PHP, Zend Framework

Javascript: checking if a function exists

It’s typeof to the rescue (again)! To check if a function exists before you try and call it (and get a nasty javasscript error), use typeof to check. Heres something I prepared earlier: 1 2 3 4 if(typeof window.myFunction == … Continue reading

Posted in Javascript

Calling a JavaScript function using JavaScript variable

Functions are first-class objects, so they can be properties of an object (in which case they are called methods) or even elements of arrays. If you aren’t choosing the object a function belongs to, it belongs to the global scope. … Continue reading

Posted in Javascript, MooTools

Jquery Live alternate/replacement in MooTools

1 2 3 4 5 6 7 8 9 10 11    $(’base-id’).addEvent(’dblclick:relay(childelement)’, function(event,clicked) {   }   //example   $(’selected_modules’).addEvent(’dblclick:relay(option)’, function(event,clicked) {   }         

Posted in Javascript, MooTools

Dynamic Height using Fx.Slide element with Mootools

this.step_3 = new Fx.Slide(’step_3′, { onComplete: function(){   this.wrapper.setStyle(’height’, null); //or this.wrapper.setStyle(’height’, ‘auto’);   } });

Posted in Javascript, MooTools

Remove style attribute using MooTools

element.setStyle(‘somestyle’, null); element.setStyle(‘border’,”//empty string

Posted in Javascript, MooTools