Skip to content

Instantly share code, notes, and snippets.

View vanleantking's full-sized avatar
🤣

Le Van vanleantking

🤣
  • U
  • Binh Thanh
View GitHub Profile
@vanleantking
vanleantking / gist:6d699f6945c35be3008737cd5eb936c5
Created July 15, 2018 08:18
Create custom value checkbox on Zend FrameWork
$this->add(array(
'name' => 'status',
'type' => 'Checkbox',
'options' => array(
'checked_value' => 'A',
'unchecked_value' => 'S'
),
'attributes' => array(
'id' => 'status',
'class' => 'form-control ',
@vanleantking
vanleantking / php-html-css-js-minifier.php
Created July 23, 2018 07:41 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
// Based on <https://github.com/mecha-cms/extend.minify>
define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\'');
define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/');
define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>');
define('MINIFY_COMMENT_JS', '//[^\n]*');
define('MINIFY_PATTERN_JS', '/[^\n]+?/[gimuy]*');
define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>');
@vanleantking
vanleantking / Create class autoloader Zend
Created July 28, 2018 06:06
Command line Create class autoloader Zend
1. cd module/mymodule
2. run this command:
../../vendor/zendframework/zendframework/bin/classmap_generator.php -w
This will auto search all class in the current module and make a map from class to real path in current project
@vanleantking
vanleantking / xampp_php7_xdebug.md
Created July 28, 2018 06:29 — forked from odan/xampp_php7_xdebug.md
Installing Xdebug for XAMPP

Installing Xdebug for XAMPP with PHP 7.x

Requirements

Setup

@vanleantking
vanleantking / gist:0b43fc35d63ef06d5522665bd24edce5
Created August 4, 2018 07:54
Remove inline styles in HTML file by using PHP
Use preg_replace function to make regex on HTML tag contain style
$value = preg_replace('/(<[^>]*) style=("[^"]+"|\'[^\']+\')([^>]*>)/i', '$1$3', $value);
Config virtual host from httpd.conf (or httpd-vhost.conf file)
Http
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/myproject/web"
ServerName www.myurl.com
<Directory "C:/xampp/htdocs/myproject/web">
Options All
AllowOverride All
Require all granted
@vanleantking
vanleantking / disable form element in zf2
Created August 10, 2018 11:09
disable form element in zf2
$form->get("username")->setAttribute('disabled', 'disabled');
@vanleantking
vanleantking / virtualenv backup python environtment using
Created August 12, 2018 08:00
virtualenv backup python environtment using
1.activate current env at your path
pyvenv-3.5 ~/Envs/thesis_python3/
source ~/Envs/thesis_python3/bin/activate
2. list all of modules using in the current environtment by using freeze
pip freeze > requirements.txt
(this command with generate txt file list all modules have installed)
3. create new env, and from this new env, install all modules have list in the txt file
pip install -r requirements.txt
@vanleantking
vanleantking / install fastText on Ubuntu 16.04 Python 3.5
Created August 12, 2018 09:28
install fastText on Ubuntu 16.04 Python 3.5
This library require some other dependencies as Scipy, numpy... and other library compile c library (gcc, python dev).
For Python ver 3.5, let's install python dev as command:
sudo apt-get install python3-dev
This will require some libs as: libpython3-dev libpython3.5-dev python3.5-dev
After clone fastText lib, cd to fastText folder and use pip instsall
pip install .
@vanleantking
vanleantking / error symlink on magento 2
Created August 20, 2018 16:44
error symlink on magento 2