Skip to content

Instantly share code, notes, and snippets.

View aliaramli's full-sized avatar
🎯
Focusing

alia aliaramli

🎯
Focusing
  • Malaysia
View GitHub Profile
//javascript
var developer = <?php echo $parsed_array_to_json; ?>;
//access the value.
console.log(developer.name, developer.age, developer.job);
$parsed_array_to_json = json_decode($developer);
$developer = array("name"=>"alia", "job"=>"freelancer", "age"=>"30");
@aliaramli
aliaramli / bash-create-wordpress-uploads-folders.sh
Created January 13, 2020 09:08
Steps to create Wordpress uploads folders using bash command Linux
# 1. create the folder of the year in your wordpress project folder
mkdir -p /project_folder/wp-content/uploads/2020
# 2. then create child folders for every month!!!!!
#this is for 01-09
for i in {1..9}; do mkdir -p /project_folder/wp-content/uploads/2020/0$i; done
#this is for 10-12
for i in {0..2}; do mkdir -p /project_folder/wp-content/uploads/2020/1$i; done
@aliaramli
aliaramli / sample-intl-tel-input.php
Last active January 13, 2020 09:10
Example of intl-tel-input initialization on wordpress custom plugin and handling on wc-ajax=checkout_update_order_review
function init_tel(){
$utils_url = plugins_url('/js/utils.js', __FILE__);
?>
<script>
var input = document.querySelector("#phone");
var iti = window.intlTelInput(input,{
utilsScript: "<?php echo $utils_url; ?>",
// the countries at the top of the list. defaults to united states and united kingdom
preferredCountries: [ "my", "us", "gb" ],
autoPlaceholder: null,