Skip to content

Instantly share code, notes, and snippets.

I am doing very fast fix 🚀, sponsor me 💖

Abdul Malik Ikhsan samsonasik

I am doing very fast fix 🚀, sponsor me 💖
View GitHub Profile
samsonasik / zf2slcaller
Created Sep 19, 2012
ZF2 Service Locator caller
View zf2slcaller
In Controller : $this->getServiceLocator()
In Controller Plugin : $this->getController()->getServiceLocator()
View formselectinzf2
namespace SampleModule\Form;
use Zend\Form\Form;
class SampleForm extends Form
public function __construct($name = null)
parent::__construct('Sample Form');
samsonasik / gist:3985339
Created Oct 31, 2012
Install pecl install uploadprogress
View gist:3985339
CFLAGS="-arch i386" ./pecl install uploadprogress (this 'forces' a 32 bit install of the extension)
samsonasik / gist:3988701
Created Oct 31, 2012
Send HTML Mail Using ZF2
View gist:3988701
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mime\Message as MimeMessage;
use Zend\Mime\Part as MimePart;
use Zend\Mail\Transport\SmtpOptions;
$message = new Message();
samsonasik / gist:3988822
Created Oct 31, 2012
Set Global Read-only false in Mysql
View gist:3988822
Directory my mac :
grant all on *.* to 'root'@'%'
mysql> set GLOBAL read_only = false;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.07 sec)
samsonasik / gist:4171219
Created Nov 29, 2012
set #zf2 in shared hosting ( .htaccess )
View gist:4171219
RewriteCond %{HTTP_HOST} ^$ [NC,OR]
RewriteCond %{REQUEST_URI} !yourapp/public
RewriteRule (.*) /yourapp/public/$1 [L]
place it at your public_html (shared hosting 'root' directory ).
if you call so you will point out to public_html/yourapp/public/index.php
View gist:4344029
Group -> Order -> Limit
View Sort associative array
function sortingAssoc($array, $sortby = "id",$sortir="asc")
$temp = array();
foreach($array as $key=>$row)
$temp[$key] = $row[$sortby];
if ($sortir=="asc") sort($temp); else rsort($temp);
samsonasik / zenddbselectjoinunittest
Last active Dec 14, 2015 — forked from robertbasic/gist:5047567
Unit Test select Join Zend\Db
View zenddbselectjoinunittest
assume, i have a method in AlbumTable class like the following :
public function fetchAll()
$sqlSelect = $this->tableGateway->getSql()
->select()->columns(array('artist', 'title', 'id'))
->join('track', 'track.album_id =', array(), 'left');
return $this->tableGateway->select($sqlSelect);
samsonasik / session_start
Last active Dec 14, 2015
session_start() conflict for ZF2 and your other App with session_start()
View session_start
require 'init_autoloader.php';
Zend\Mvc\Application::init(require 'config/application.config.php');