Skip to content

Instantly share code, notes, and snippets.

View amrikarisma's full-sized avatar
💭
I may be slow to respond.

Amri amrikarisma

💭
I may be slow to respond.
View GitHub Profile
@amrikarisma
amrikarisma / Javascript Format NPWP
Created April 4, 2023 04:57 — forked from yudapc/Javascript Format NPWP
Javascript Format NPWP. NPWP is ID tax each people of indonesian. Specificly in frontend need to format NPWP before render to user
//
// Javascript Format NPWP
//
function formatNpwp(value) {
if (typeof value === 'string') {
return value.replace(/(\d{2})(\d{3})(\d{3})(\d{1})(\d{3})(\d{3})/, '$1.$2.$3.$4-$5.$6');
}
}
@amrikarisma
amrikarisma / functions.php
Created January 24, 2023 10:31 — forked from ChrisLTD/functions.php
Fix so you can preview ACF field changes in Wordpress admin
<?php
/*
Debug preview with custom fields
Taken from: http://support.advancedcustomfields.com/forums/topic/preview-solution/
See also: http://support.advancedcustomfields.com/forums/topic/2nd-every-other-post-preview-throws-notice/
*/
add_filter('_wp_post_revision_fields', 'add_field_debug_preview');
function add_field_debug_preview($fields){
$fields["debug_preview"] = "debug_preview";
return $fields;
@amrikarisma
amrikarisma / spintax.php
Created September 3, 2017 15:31 — forked from irazasyed/spintax.php
PHP: Text Spinner Class - Nested spinning supported.
<?PHP
/**
* Spintax - A helper class to process Spintax strings.
* @name Spintax
* @author Jason Davis - https://www.codedevelopr.com/
* Tutorial: https://www.codedevelopr.com/articles/php-spintax-class/
*/
class Spintax
{
public function process($text)
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:text="Guest List"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />