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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / dasar_html5.html
Created March 16, 2017 03:20
Pola desain HTML5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> ... </title>
</head>
<body>
<header role="banner">
@muhfaris
muhfaris / wp-login.md
Created March 7, 2017 12:49
wp-login
  1. Buka wp-login.php, cari dan rubah 'wp-login.php' dengan alamat baru.php.
  2. Buka /wp-includes/general-template.php, cari script dibawah in dan ganti wp-login.php dengan alamat baru.php :
$logout_url = add_query_arg($args, site_url(‘wp-login.php‘, ‘login’));
@muhfaris
muhfaris / sftp-ubuntu.md
Created February 27, 2017 03:10 — forked from joshellington/sftp-ubuntu.md
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h