Skip to content

Instantly share code, notes, and snippets.

View araneta's full-sized avatar

araneta

View GitHub Profile
@araneta
araneta / gist:072fc3676a63ac14c7a0
Created May 11, 2014 12:34
Joomla: Get Menu Parameter of active menu
$app = JFactory::getApplication();
$menuitem = $app->getMenu()->getActive(); // get the active item
$params = $menuitem->params; // get the params
@araneta
araneta / gist:65dfb27dff65e9bb100e
Created May 11, 2014 12:39
Joomla: get current (absolute) url
$uri = &JURI::getInstance();
$myabsoluteurl = $uri->toString(array('path'));
@araneta
araneta / gist:2570f66422af7b1197b8
Created May 11, 2014 12:40
Joomla: get article by article id
$db = &JFactory::getDBO();
$sql = "SELECT introtext FROM #__content WHERE id = ".intval($articleId);
$db->setQuery($sql);
$fullArticle = $db->loadResult();
if(!strlen(trim($fullArticle)))
  $fullArticle = "Article is empty ";
@araneta
araneta / gist:53a7d3a2f89bebd34bff
Created May 11, 2014 12:41
Joomla: render module from template
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_related_items');
$attribs['style'] = 'xhtml';
echo JModuleHelper::renderModule( $module, $attribs );
@araneta
araneta / gist:ee3de8e23f6b59824e7f
Created May 11, 2014 12:42
Joomla: fix global $mainframe variable:
//old code
  global $mainframe;
  $params = &$mainframe->getParams();
//in joomla 1.7/2.5
  $app = &JFactory::getApplication();
  $params = $app->getParams();
@araneta
araneta / gist:d7f20694025aa72ef798
Created May 11, 2014 12:44
Joomla: set page title:
$document = JFactory::getDocument();
$document->setTitle($this->escape($title));
@araneta
araneta / gist:95b51660dc8a07d1a797
Created May 11, 2014 12:46
Joomla: detect whether in front page
$uri = &JURI::getInstance();
$myabsoluteurl = $uri->toString(array('path'));   
if($myabsoluteurl==JURI::base(true).'/')
  $front_page = TRUE;
@araneta
araneta / gist:ba17bdc7d63c0b57c7bc
Created May 11, 2014 12:49
Joomla: get article id from joomla template index.php
$article_id  = JFactory::getApplication()->input->get('id');
@araneta
araneta / main.cpp
Created November 30, 2015 06:55 — forked from nikotan/main.cpp
face detection sample code for OpenCV
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv/ml.h>
void doMosaic(IplImage* in, int x, int y,
int width, int height, int size);
int main (int argc, char **argv)
{
int i, c;
@araneta
araneta / jwt
Created December 25, 2016 15:52
http://andreinc.net/2016/09/10/simple-authentication-with-spring-boot-and-jwt-tokens/