Skip to content

Instantly share code, notes, and snippets.

View iqbalfasri's full-sized avatar
🤓
🙃 🛵

Muhammad Iqbal Fasri iqbalfasri

🤓
🙃 🛵
View GitHub Profile
class Dice {
topSideval;
getTopSideVal() {
return this.topSideval
}
roll() {
this.topSideval = Math.floor(Math.random() * 6) + 1
return this;
@iqbalfasri
iqbalfasri / webp-convert-directory.sh
Created July 2, 2021 07:56 — forked from tabrindle/webp-convert-directory.sh
Convert all files in directory to webp, with default params, or standard cwebp params passed from command
#!/bin/bash
PARAMS=('-m 6 -q 70 -mt -af -progress')
if [ $# -ne 0 ]; then
PARAMS=$@;
fi
cd $(pwd)
const arr1 = [1, 7, 13, 15];
const arr2 = [1, 4, 5, 9, 20];
const merge = (arr1, arr2) => {
let merged = [];
let index1 = 0;
let index2 = 0;
let current = 0;
while(current < (arr1.length + arr2.length)) {
const array = [4, 2, 1, 5];
const maxDiff = array => {
let result = 0;
for(let i = 0; i < array.length; i++) {
for(let j = i+1; j < array.length; j++) {
if(array[i] < array[j] && i < j) {
result = array[j] - array[i]
@iqbalfasri
iqbalfasri / toRupiah.js
Last active November 8, 2019 10:35
Simple format for Indonesian Rupiah (curency)
export const toRupiah = price => {
return Math.abs(price)
.toString()
.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1.');
};
/**
*
* example return