Skip to content

Instantly share code, notes, and snippets.

View contactjavas's full-sized avatar
🎯
Focusing on MapSteps

Bagus contactjavas

🎯
Focusing on MapSteps
View GitHub Profile
@contactjavas
contactjavas / is_gutenberg_active.php
Created January 5, 2024 03:24 — forked from mihdan/is_gutenberg_active.php
Function to check if Gutenberg is active.
/**
* Check if Gutenberg is active.
* Must be used not earlier than plugins_loaded action fired.
*
* @return bool
*/
private function is_gutenberg_active() {
$gutenberg = false;
$block_editor = false;
@contactjavas
contactjavas / ChangePassword.java
Created August 17, 2023 14:49 — forked from zach-klippenstein/ChangePassword.java
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall (rsdio@metastatic.org), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@contactjavas
contactjavas / main.dart
Last active July 13, 2022 11:35
easy_load_more demo
import 'dart:developer';
/// begin_library_part
///
/// When writing this example, DartPad didn't support (many/almost all) custom packages
/// If you want to directly check for the related code (not the library),
/// then please search (in this DartPad) for this keyword: begin_example_part
import 'dart:async';
@contactjavas
contactjavas / main.dart
Last active July 14, 2022 23:51
easy_loading_button demo
import 'package:flutter/material.dart';
/// begin_library_part
///
/// When writing this example, DartPad didn't support (many/almost all) custom packages
/// If you want to directly check for the related code (not the library),
/// then please search (in this DartPad) for this keyword: begin_example_part
enum EasyButtonState {
idle,
@contactjavas
contactjavas / get-fa5-unicodes.js
Created August 28, 2020 12:48
Get Font Awesome 5 Unicodes
/**
* Font Awesome Free
*
* https://fontawesome.com/cheatsheet/free/solid
* https://fontawesome.com/cheatsheet/free/regular
* https://fontawesome.com/cheatsheet/free/brands
*
* Visit pages above, paste this code to the console and enter.
* Copy the result and beautify it in https://codebeautify.org/jsonviewer
*/
@contactjavas
contactjavas / .editorconfig
Created October 8, 2019 07:10
.editorconfig for WordPress project
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
[*.{php,html}]
indent_size = 4
@contactjavas
contactjavas / phpcs-wpcs-on-windows.md
Last active October 9, 2023 23:38
Install phpcs (PHP_CodeSniffer) + wpcs (WordPress Coding Standards) on Windows

Setup CLI

Install PHPCS via Composer

composer global require "squizlabs/php_codesniffer=*"

Install WPCS via Composer

composer global require "wp-coding-standards/wpcs"

Add WPCS to PHPCS

phpcs --config-set installed_paths %APPDATA%\Composer\vendor\wp-coding-standards\wpcs

@contactjavas
contactjavas / borndigital-manager-capabilities.php
Created March 27, 2018 07:49
Born Digital's WordPress manager capabilities
<?php
$manager_role = [
// 'switch_themes' => true,
// 'edit_themes' => true,
// 'activate_plugins' => true,
// 'edit_plugins' => true,
'edit_users' => true,
// 'edit_files' => true,
// 'manage_options' => true,
'moderate_comments' => true,
@contactjavas
contactjavas / wordpress-admin-capabilities.php
Last active March 27, 2018 07:39
Default WordPress admin capabilities
<?php
$admin_role = [
'switch_themes' => true,
'edit_themes' => true,
'activate_plugins' => true,
'edit_plugins' => true,
'edit_users' => true,
'edit_files' => true,
'manage_options' => true,
'moderate_comments' => true,
@contactjavas
contactjavas / change_admin_submenu_url.php
Last active October 8, 2019 07:27
WordPress: Change admin submenu's url
<?php
$menu_key = 'edit.php?post_type=contact_form';
// Submenu's slug to be replaced.
$search = 'contact_submission';
// Url to replace the slug.
$replace = 'edit.php?post_type=contact_submission';
add_action( 'admin_menu', 'change_admin_submenu_url' );