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:5171582
Created March 15, 2013 17:27
gmap input
lat =-6.90163175029847 ;
longi = 107.618712186813;
var marker = new GMarker(new GLatLng(lat,longi),{draggable : true });var map;
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(lat,longi),14);
map.addOverlay(marker);
GEvent.addListener(
@samsonasik
samsonasik / gist:5219461
Created March 22, 2013 06:50
archive git updated only
git archive -o update.zip HEAD $(git diff --name-only HEAD^)
@samsonasik
samsonasik / gist:5370196
Created April 12, 2013 07:28
using simplepie
1. copy to vendor folder.
2. edit index.php
chdir(dirname(__DIR__));
// Setup autoloading
require 'init_autoloader.php';
//require the simplepie
require './vendor/SimplePie/autoloader.php';
<?php
namespace My\Modules\Authentication\Form;
use Zend\Form\Form;
use Zend\InputFilter\InputFilterProviderInterface;
class ChangePassword extends Form implements InputFilterProviderInterface
{
public function __construct()
@samsonasik
samsonasik / gist:5504627
Created May 2, 2013 19:16
mobile redirect if user agent is mobile
$browser = $_SERVER['HTTP_USER_AGENT'];
if( (preg_match('/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$browser)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo
@samsonasik
samsonasik / gist:5611544
Created May 20, 2013 10:40
module specific setting in ZF1
1. create Controller Plugin that has routeShutdown(Zend_Controller_Request_Abstract $request)
class Zfgen_Controller_Boot extends Zend_Controller_Plugin_Abstract
{
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$frontController = Zend_Controller_Front::getInstance();
$bootstrap = $frontController->getParam('bootstrap');
$activeModuleName = $request->getModuleName();
$moduleList = $bootstrap->modules;
@samsonasik
samsonasik / gist:5612427
Created May 20, 2013 14:03
Mac filesystem trick
sudo chown -R 1:1 x2crm/ <-- set user id the folder
@samsonasik
samsonasik / gist:5749316
Created June 10, 2013 14:49
get param value of route from ServiceManage
//by servicelocator
$this->getServiceLocator()->get('Router')
->match($this->getServiceLocator()->get('Request'))
->getParam('controller');
//by servicemanager
$sm->get('Router')
->match($sm->get('Request'))
->getParam('paramName')
@samsonasik
samsonasik / gist:5895710
Created June 30, 2013 15:58
join table strategy ?
Join Table scenario Proposal
----------------------------
We have two table named *Album* and *Track* that joined at some function at *Album* table model or *Track* table model.
We can't make a standarditation of where join should comes, because the answer is 'depend' of the case.
so, we need a better scenario that unique, simple, and standardize at this project.
1. create an Album class model
class Album
{
@samsonasik
samsonasik / gist:5939331
Created July 6, 2013 09:11
xdebug on mac
export CFLAGS="-arch i386 $CFLAGS"
export CCFLAGS="-arch i386 $CCFLAGS"
export CXXFLAGS="-arch i386 $CXXFLAGS"
export LDFLAGS="-arch i386 $LDFLAGS"
/usr/local/zend/bin/pear config-set php_ini /usr/local/zend/etc/php.ini
/usr/local/zend/bin/pecl install xdebug