Skip to content

Instantly share code, notes, and snippets.

View wichaksono's full-sized avatar
🤔
Coding Is Fun.. Right ?

Wakhid Wichaksono wichaksono

🤔
Coding Is Fun.. Right ?
View GitHub Profile
@wichaksono
wichaksono / simple-regex-cedeen.php
Last active September 17, 2022 09:57
CDN statically
View simple-regex-cedeen.php
<?php
/**
* Taruh di functions.php paling bawah
*/
/**
* Mengubah Semua URL image di konten menjadi berCDN
*/
function cdn_on_the_fly($content) {
$pattern = '#(\-(\d+)x(\d+))?\.((?:jpg|gif|png|webp|jpeg))#';
return preg_replace($pattern, '.$4?format=webp&quality=80&w=$2&h=$3', $content);
View dimox_breadcrumbs.php
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
View anti-adsblock.txt
<script>
document.addEventListener('DOMContentLoaded', init, false);
function init(){
adsBlocked(function(blocked){
if(blocked){
var adblocker = document.getElementById('adblocker-detected');
adblocker.classList.add('show');
}
})
View function-two-digit.php
<?php
#.... ubah 4 jadi 04. dan seterusnya selama 1 digit, jika dua digit
# seperti 10, tidak akan berubah jadi 010 tapi tetap 10
function two_digit($string)
{
return sprintf('%02d', $string);
}
View countdown-time-complete.php
<?php
/**
* Sample Countdown Timer JS PHP
*/
$date_start = '10-10-2018 20:40:00';
$date_end = '11-10-2018 20:40:00';
$dateStart = new Datetime($date_start);
$dateEnd = new Datetime($date_end);
$interval = $dateStart->diff($dateEnd);
// var_dump( $intervale );
View countdown-timer.php
<?php
/**
* Sample Countdown Timer JS PHP
*/
$date_start = '10-10-2018 20:40:00';
$date_end = '11-10-2018 20:40:00';
$dateStart = new Datetime($date_start);
$dateEnd = new Datetime($date_end);
View tanpa-db.php
<?php
session_start();
require 'config.php';
if (
isset($_POST['username']) &&
$_POST['username'] == 'admin' &&
isset($_POST['password']) &&
$_POST['password'] == '12345'
) {
$_SESSION['user_login'] = 'admin';
View functions.php
<?php
/**
*/
require_once get_theme_file_path('class-list-member.php');
function addMenuMembers()
{
add_menu_page('Memberss', 'Memberss', 'manage_options', 'customer', 'MembersHtml');
}
add_action('admin_menu', 'addMenuMembers', 1);
View class-list-member.php
<?php
if ( ! class_exists('WP_List_Table') ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
/**
* Class memberLists Handle Table Lists
*/
class memberLists extends WP_List_Table
{
public function __construct()
@wichaksono
wichaksono / ob-map.js
Created May 13, 2018 16:28 — forked from pentagonal/ob-map.js
Resolve Google Map v3 without API Key
View ob-map.js
/*
* Resolve Google Map v3 without API Key
* since june 22 2016
* Put on body and load before map render
*/
(function (window) {
if (!window.document) {
return;
}