Skip to content

Instantly share code, notes, and snippets.

View turtlepod's full-sized avatar
🎧
Working from home

David Chandra Purnama turtlepod

🎧
Working from home
View GitHub Profile
@turtlepod
turtlepod / gist:5203512
Last active February 17, 2020 16:56
Settings Class with Metabox
<?php
/* Prevent loading this file directly and/or if the class is already defined */
if ( ! defined( 'ABSPATH' ) || class_exists( 'MYFX_Settings_Class' ) )
return;
/**
* Settings with Meta Boxes
* Helper class to easily create settings page for plugin or theme with Meta Box API.
*
@turtlepod
turtlepod / export.js
Last active April 8, 2020 15:49
Export-Import GitHub Labels
/**
* Export Github Labels
****************************************************
*
* FIREFOX STEP BY STEP:
* 1. Open the labels manage page e.g github.com/user/repo/lebels
* 2. Open Scratch Pad (SHIFT + F4)
* 3. Paste the code below and run
* 4. Inspect Element > Console ( To read console log)
* 5. Copy it the console.log results
<?php
add_action( 'init', function() {
// Add field:
add_action( 'add_meta_boxes', function() {
add_meta_box(
'my_meta_box',
'My Meta Box',
function( $post ) {
wp_nonce_field( __FILE__, '_my_data_nonce' );
?>
@turtlepod
turtlepod / composer.json
Created September 26, 2020 10:03
Contoh Composer dari tutorial youtube.
{
"name": "test-plugin-wpcs",
"description": "Plugin with WPCS",
"authors": [
{
"name": "Author",
"email": "david@shellcreeper.com"
}
],
"require": {
@turtlepod
turtlepod / add-wpcli.sh
Created December 30, 2021 23:00 — forked from ladislavsulc/add-wpcli.sh
Add WP CLI to Laragon
cd C:\laragon\usr\bin && curl -L -O https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && echo @ECHO OFF > wp.bat && echo php "%~dp0wp-cli.phar" %* >> wp.bat
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 3650 -out %domain%\server.crt
echo.
echo -----
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]