Skip to content

Instantly share code, notes, and snippets.

@araneta
araneta / Create C# Class from MySQL classes
Created Oct 7, 2017
This code create c# class of your Mysql table.
View Create C# Class from MySQL classes
set @schema := 'schema_name';
set @table := 'table_name';
SET group_concat_max_len = 2048;
SELECT
concat('public class ', @table, '\n{\n', GROUP_CONCAT(a.property_ SEPARATOR '\n'), '\n}') class_
FROM
(select
CONCAT(
'\tpublic ',
case
@araneta
araneta / ProvinsiKota.php
Created Feb 23, 2017 — forked from achunk17/ProvinsiKota.php
Daftar Provinsi dan kota / kab. di Indonesia
View ProvinsiKota.php
<?php
/**
* @Nama : Daftar Provinsi di Indonesia beserta Kota/Kab.
* @Pembuat : Achunk JealousMan
* @Link : http://fb.me/achunks
* @Dibuat : 04 Juni 2014
* @Sumber : http://id.wikipedia.org
*/
View jwt
http://andreinc.net/2016/09/10/simple-authentication-with-spring-boot-and-jwt-tokens/
@araneta
araneta / main.cpp
Created Nov 30, 2015 — forked from nikotan/main.cpp
face detection sample code for OpenCV
View main.cpp
#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 / gist:ba17bdc7d63c0b57c7bc
Created May 11, 2014
Joomla: get article id from joomla template index.php
View gist:ba17bdc7d63c0b57c7bc
$article_id  = JFactory::getApplication()->input->get('id');
@araneta
araneta / gist:95b51660dc8a07d1a797
Created May 11, 2014
Joomla: detect whether in front page
View gist:95b51660dc8a07d1a797
$uri = &JURI::getInstance();
$myabsoluteurl = $uri->toString(array('path'));   
if($myabsoluteurl==JURI::base(true).'/')
  $front_page = TRUE;
View gist:d7f20694025aa72ef798
$document = JFactory::getDocument();
$document->setTitle($this->escape($title));
@araneta
araneta / gist:ee3de8e23f6b59824e7f
Created May 11, 2014
Joomla: fix global $mainframe variable:
View gist:ee3de8e23f6b59824e7f
//old code
  global $mainframe;
  $params = &$mainframe->getParams();
//in joomla 1.7/2.5
  $app = &JFactory::getApplication();
  $params = $app->getParams();
@araneta
araneta / gist:53a7d3a2f89bebd34bff
Created May 11, 2014
Joomla: render module from template
View gist:53a7d3a2f89bebd34bff
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_related_items');
$attribs['style'] = 'xhtml';
echo JModuleHelper::renderModule( $module, $attribs );
@araneta
araneta / gist:2570f66422af7b1197b8
Created May 11, 2014
Joomla: get article by article id
View gist:2570f66422af7b1197b8
$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 ";
You can’t perform that action at this time.