Skip to content

Instantly share code, notes, and snippets.

View samsonasik's full-sized avatar
🔥
I am doing very fast fix 🚀, sponsor me 💖 https://github.com/sponsors/samsonasik

Abdul Malik Ikhsan samsonasik

🔥
I am doing very fast fix 🚀, sponsor me 💖 https://github.com/sponsors/samsonasik
View GitHub Profile
@samsonasik
samsonasik / gist:5939388
Created July 6, 2013 09:36
install xdebug from source
phpize
sudo MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -g -Os -pipe" CXXFLAGS="-arch i386 -g -Os -pipe" LDFLAGS="-arch i386 -bind_at_load" ./configure
make && make install
@samsonasik
samsonasik / gist:6002146
Created July 15, 2013 18:17
install GIT on centos
1. download GIT version Control
wget http://git-core.googlecode.com/files/git-1.7.9.tar.gz
2. extract the tarball file
tar -xzvf git-1.7.9.tar.gz
3. install compatibility softwares
yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel
4. install GIT, go to extracted tarball folder, and run :
<?php
namespace MyFunnyValentine;
// Detect if the currently matched route belongs to this module.
// The assumption is that the controller name includes the module namespace.
class Module
{
public function onBootstrap($e)
@samsonasik
samsonasik / gist:7104489
Last active December 26, 2015 05:59
translate form label
$translator = new Zend\I18n\Translator\Translator();
$translator->addTranslationFile('phparray',
'./module/SanAuthWithDbSaveHandler/language/indonesia.php');
$this->formlabel()->setTranslator($translator);
echo $this->formLabel()->getTranslator()->translate( $this->formLabel($form->get('elementname') ));
<?php
use Zend\Db\Sql\Select;
// basic table
$select0 = new Select;
$select0->from('foo');
// 'SELECT "foo".* FROM "foo"';
<?php
copy(__DIR__ . '/music.db.original', __DIR__ . '/music.db');
include 'vendor/autoload.php';
return new Zend\Db\Adapter\Adapter(array(
// Sqlite Configuration
'driver' => 'Pdo',
'dsn' => 'sqlite:' . __DIR__ . '/music.db',
@samsonasik
samsonasik / gist:8056573
Last active March 15, 2016 14:27
zf2 handle fatal error
1. create a file under public/ folder named fatalerrorhandler.php
<?php
//adapt from http://stackoverflow.com/questions/277224/how-do-i-catch-a-php-fatal-error
define('E_FATAL', E_ERROR | E_USER_ERROR | E_PARSE | E_CORE_ERROR |
E_COMPILE_ERROR | E_RECOVERABLE_ERROR);
//Custom error handling vars
define('DISPLAY_ERRORS', TRUE);
define('ERROR_REPORTING', E_ALL | E_STRICT);
@samsonasik
samsonasik / gist:9067872
Created February 18, 2014 09:59
uniq loop file do command
for f in *.sql; do mysql -u root databasename < $f; done;
@samsonasik
samsonasik / gist:9475960
Created March 10, 2014 22:38
always use getSqlStringForSqlObject with sql object
use Zend\Db\Sql;
$sql = new Sql\Sql;
$select = $sql->select($table);
$select->offset(10);
echo $sql->getSqlStringForSqlObject($select);
@samsonasik
samsonasik / gist:9759243
Created March 25, 2014 10:52
git archive changed file
tar czf changed-files.tar.gz `git diff --name-only HEAD`