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 / default.vcl
Created July 27, 2016 04:34 — forked from bjornjohansen/default.vcl
Varnish 4.0 VCL for WordPress
vcl 4.0;
import std;
import directors;
backend server1 { # Define one backend
.host = "localhost";
.port = "8080";
.max_connections = 300;
@muhfaris
muhfaris / variabel_mysql_5.6.txt
Last active July 29, 2016 07:19
variabel_mysql_5.6
+---------------------------------+------------------------------------------+
| Variable_name | Value |
+---------------------------------+------------------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| automatic_sp_privileges | ON |
| back_log | 50 |
| basedir | / |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
@muhfaris
muhfaris / my.cnf_mysql5.6.txt
Last active July 29, 2016 02:34
mysql my.cnf - VPS Ram 1gb swap 1gb
[mysql]
# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
# GENERAL #
user = mysql
default-storage-engine = InnoDB
@muhfaris
muhfaris / httpd_conf.txt
Last active July 29, 2016 02:34
apache 2.4 httpd.conf - vps ram 1gb swap 1gb
Timeout 150
TraceEnable Off
ServerSignature Off
ServerTokens ProductOnly
FileETag None
StartServers 3
<IfModule prefork.c>
MinSpareServers 5
MaxSpareServers 10
</IfModule>
@muhfaris
muhfaris / read_time
Last active August 13, 2016 01:55
Waktu baca, bisa untuk wordpress
/*
Buat file dengan nama read_time.php
taruh di dalam main theme
/themes/<nama theme>/
*/
<?php
$post = get_post();
$mycontent = $post->post_content;
$word = str_word_count(strip_tags($mycontent));
$m = floor($word / 200); $s = floor($word % 200 / (200 / 60));
@muhfaris
muhfaris / Maintenance.txt
Created August 7, 2016 04:32
Maintenance with htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !/repair.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /repair.html [R=302,L]
</IfModule>
#repair.html adalah halaman untuk menampilkan pemberitahuan bahwa situs maintenance
@muhfaris
muhfaris / erro_feelbox.txt
Last active August 20, 2016 16:56
Solved error T Function plugin error in wordpress
/*
@author by Faris
@php version php 5.4.24
@wordpress 4.5
@plugin FL3R FeelBox Version 8.0
Error
Parse error: syntax error, unexpected T_FUNCTION in /fl3r-feelbox/feelbox-admin.php on line 246
*/
/*
error at line 246
@muhfaris
muhfaris / jetpack_ifnitie_load.txt
Created August 27, 2016 01:36
jetpack plugin double post, function theme
function jetpack_infinite_scroll_query_args( $args ) {
$args['order'] = 'ASC';
$args['orderby'] = 'name';
return $args;
}
add_filter( 'infinite_scroll_query_args', 'jetpack_infinite_scroll_query_args' );
@muhfaris
muhfaris / exclude_category.php
Created October 11, 2016 04:19
Exclude Category - Menyembunyikan beberapa kategori, menggunakan fungsi
<?php
//Pilihan_Atas : 11
//Pilihan_Bawah : 12
//Featured : 13
//Function mode
//
function the_category_filter($thelist,$separator='') {
if(!defined('WP_ADMIN')) {
//list exclude
@muhfaris
muhfaris / Konversi_angka.php
Created October 11, 2016 04:23
Konversi angka ke text, misal K dan M
/*
Konversi angka,
nah angka disini yaitu 1000 dan 1000000..
untuk angka 1000 menjadi 1K
nah untuk 1000000 menjadi 1M
*/
// konversi
function round_numb($totalshares){
if( $totalshares > 1000000 ) {
$totalshares = round( $totalshares / 1000000, 1 ) . 'M';