Skip to content

Instantly share code, notes, and snippets.

@zizizak
zizizak / functions.php
Created February 17, 2022 15:27 — forked from maddisondesigns/functions.php
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@zizizak
zizizak / php-html-css-js-minifier.php
Created October 27, 2021 16:38 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@zizizak
zizizak / wp-upload-image-from-url.php
Created October 13, 2021 14:49 — forked from RadGH/rs_upload_from_url.php
Upload an image to WordPress media gallery from URL
<?php
/**
* Retrieves an image from a URL and uploads it using ld_handle_upload_from_path. See that function for more details.
*
* Note: This function should also work for local file paths as well, but the implementation is slightly different than ld_handle_upload_from_path.
*
* @param $image_url
* @param int $attach_to_post
* @param bool|true $add_to_media
@zizizak
zizizak / MauticCronjob.txt
Created November 2, 2020 15:12
Mautic Cronjob
# Cron jobs for Mautic 2
#* * * * * php /var/www/html/app/console mautic:segments:update
#* * * * * php /var/www/html/app/console mautic:campaigns:update
#* * * * * php /var/www/html/app/console mautic:campaigns:trigger
# Cron jobs for Mautic 3
* * * * * php /var/www/html/bin/console mautic:segments:update
* * * * * php /var/www/html/bin/console mautic:campaigns:update
* * * * * php /var/www/html/bin/console mautic:campaigns:trigger
@zizizak
zizizak / Google view.html
Created May 9, 2019 02:54
Google view cổng TTĐT Bắc Giang
Mẫu
<iframe height="920"
src="https://drive.google.com/viewerng/viewer?url=https://yendung.bacgiang.gov.vn/documents/22815/7173479/1557369706658_gm-5-2019-1.signed-yedung.pdf/101e0b0c-3d45-4177-ba81-6bda676f8c9d?pid=explorer&amp;efh=false&amp;a=v&amp;chrome=false&amp;embedded=true"
style="border: none;" width="710">
</iframe>
<iframe height="920"
src="https://drive.google.com/viewerng/viewer?url={domain}{documentLink}?pid=explorer&amp;efh=false&amp;a=v&amp;chrome=false&amp;embedded=true"
style="border: none;" width="710">
</iframe>
@zizizak
zizizak / portal-setup-wizard.properties
Created June 9, 2018 02:31
portal-setup-wizard.properties
[email protected]
admin.email.from.name=Test Test
liferay.home=/home/portal
setup.wizard.enabled=false
jdbc.default.username=***
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.password=****
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
@zizizak
zizizak / convert.sql
Last active September 19, 2017 06:36
Converting non-utf8 database to utf-8 ( MySQL )
/** Convert Syntax **/
select CONVERT(BINARY(CONVERT(tengiaovien USING latin1)) USING utf8) from adoosite_giaovien
/** Article Category **/
select
catid ArticleCatId,
CONVERT(BINARY(CONVERT(title USING latin1)) USING utf8) ArticleCatName,
parent ParentID
from adoosite_news_cat WHERE active = 1
ORDER BY parent
@zizizak
zizizak / Linux Static IP
Created August 11, 2017 04:22 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@zizizak
zizizak / ASSETS PUBLISHERS TEMPLATE.vm
Last active August 29, 2017 01:35
LIFERAY - ASSETS PUBLISHERS TEMPLATE (Velocity)
#if (!$entries.isEmpty())
<div class="danhsach-tin-lienthong">
#foreach ($entry in $entries)
#set($renderer = $entry.getAssetRenderer() )
#set($className = $renderer.getClassName() )
#if( $className == "com.liferay.portlet.journal.model.JournalArticle" )
#set( $journalArticle = $renderer.getArticle() )
#set( $link = $renderer.getURLViewInContext($renderRequest, $renderResponse, '') )
#set( $entryId = $entry.getEntryId() + "" )
@zizizak
zizizak / HostNameRouter.php
Created December 5, 2016 08:41 — forked from chill117/HostNameRouter.php
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
Example:
If you had the following domain/sub-domain style for your site:
your-domain.com