Skip to content

Instantly share code, notes, and snippets.

View muhfaris's full-sized avatar
:octocat:
Focusing

Muhammad Faris 'Afif muhfaris

:octocat:
Focusing
View GitHub Profile
@muhfaris
muhfaris / add_new.php
Last active April 14, 2017 06:13
Zen cart - add new banner in other page
/*
Selection with category page,
then newxt action
*/
if($current_category_id == '70'){
if (SHOW_BANNERS_GROUP_SET11 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET11)) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerNine" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
@muhfaris
muhfaris / README.txt
Last active April 14, 2017 06:25
Zen cart Before add code new banner to other page
- Check in Database
select * from configuration where configuration_key LIKE 'SHOW_BANNERS_GROUP_SET%';
- Insert new _BANNER_GROUP_ , before you must identification group_id
INSERT INTO `yourdatabasename`.`configuration` (
`configuration_id` ,
`configuration_title` ,
`configuration_key` ,
`configuration_value` ,
@muhfaris
muhfaris / Customize.txt
Created April 15, 2017 15:01
Multi category in home page section Viral theme
Viral: customizer.php (inc/customizer.php)
--------------------------------------------
from :
'category1' => array(
'type' => 'category',
--------------------------------------------
to :
'category1' => array(
@muhfaris
muhfaris / sunday.php
Last active April 18, 2017 00:51
Get all of sunday
<?php
$start = strtotime("now");
$end = strtotime("last day of a month");
$getMonday= array();
$datelistMonday="";
$Monday= strtotime("Sunday", $start);
while($Monday <= $end) {
$getMonday[] .=',"'.date("Y-m-d",$Monday).'"';
$Monday= strtotime("+1 weeks", $Monday);
}
@muhfaris
muhfaris / sort.php
Created April 18, 2017 00:50
Sort data
<?php
for ($i=1;$i<=sizeof($dateListGen_2)-1;$i++){
for ($j=$i;$j<sizeof($dateListGen_2);$j++){
if ($dateListGen_2[$i-1]>$dateListGen_2[$j]){
$temp = $dateListGen_2[$i-1];
$dateListGen_2[$i-1] = $dateListGen_2[$j];
$dateListGen_2[$j] = $temp;
}
}
}
@muhfaris
muhfaris / file.txt
Last active April 30, 2017 01:25
Recovery password n linux
[ubuntu]
- boot, tekan e
- di 'ro' ganti menjadi 'rw init=/bin/bash'
[_ Ubuntu 14.04 and above _]
# apt list --installed
[_ Older Versions _]
# dpkg --get-selections | grep -v deinstall
@muhfaris
muhfaris / limitfield.js
Last active July 27, 2017 01:35
Batasi input field ketika di ketikkan
function textLength(text,value){
var maxLength;
if(text == 'cc'){
maxLength = 16;
}else if(text == 'ccc') {
maxLength = 4;
}
if(value.length > maxLength) return false;
return true;
}
@muhfaris
muhfaris / log.php
Created August 26, 2017 21:26
save log into filw zencart
$define("DIR_FS_LOGS","logs")
$log folder = DIR_FS_LOGS . '/';
$debug_file = 'name_file_log' . time();
file_put_contents($log_folder . $debug_file . '_' . 'text' . '.txt', $json_response, FILE_APPEND);
@muhfaris
muhfaris / ssh_keygen.txt
Created October 26, 2017 08:29
ssh keygen
- hubungkan ssh dengan terminal
> eval $(ssh-agent -s)
- pilih ssh key
> ssh-add ~/.ssh/id_rsa
#bukan public tapi private
#akses privat 600
@muhfaris
muhfaris / regular-expression_pattern.txt
Created October 31, 2017 02:17
Pattern regular expression
Scape slashes is simply use \ before / and it will be escaped. (\/=> /).
Otherwise you're regex DD/MM/YYYY could be next:
/^[0-9]{2}[\/]{1}[0-9]{2}[\/]{1}[0-9]{4}$/g
Explanation:
[0-9]: Just Numbers
{2} or {4}: Length 2 or 4. You could do {2,4} as well to length between two numbers (2 and 4 in this case)