Skip to content

Instantly share code, notes, and snippets.

View dorman99's full-sized avatar
🎯
Focusing

Muhammad Hafizh Abdillah AR dorman99

🎯
Focusing
View GitHub Profile
@dorman99
dorman99 / remove_duplicate_str.js
Created September 6, 2021 11:44
remove duplicate string
const fs = require("fs");
const file = fs.readFileSync("str.txt", "utf-8");
const removeDuplicateChar = (str) => {
return str.filter((v, idx) => {
const f = str.lastIndexOf(v);;
if (f && idx !== f) {
str.splice(f, 1);
}
return v;
});
@dorman99
dorman99 / list_of_6_factor.js
Created September 6, 2021 13:15
Find Factor Min 6
const list = [];
class Factor {
constructor(factor, total) {
this.factor = factor;
this.total = total || [];
this._findTotalFactor()
}
_findTotalFactor() {
for(let i = 1; i <= this.factor; i++) {
@dorman99
dorman99 / psql_distance_calcualte.sql
Created October 20, 2021 17:39
method to generate amount of distance between 2 position on km
CREATE OR REPLACE FUNCTION distance(lat1 FLOAT, lon1 FLOAT, lat2 FLOAT, lon2 FLOAT) RETURNS FLOAT AS $$
DECLARE
x float = 111.12 * (lat2 - lat1);
y float = 111.12 * (lon2 - lon1) * cos(lat1 /92.215);
BEGIN
RETURN sqrt(x * x + y * y);
END
$$ LANGUAGE plpgsql; // km
@dorman99
dorman99 / CryptoJs & Golang
Created May 22, 2022 15:46 — forked from xsephiroth/CryptoJs & Golang
AES decrypt encrypt with CryptoJs & Golang
<template>
<div>
</div>
</template>
<script>
import CryptoJs from "crypto-js"
export default {
name: "",
data(){
package main
import (
"fmt"
"sort"
)
// var listInts []int = []int{9, 4, 5, 6, 7}
var Pages = [][]string{
@dorman99
dorman99 / nested_object.js
Created May 22, 2023 04:32
nested object handler
// "Given any JSON object. Please write a function to convert it to dot-notation object.
// {
// ""key"": {
// ""value1"": 100,
// ""value2"": 200,
// ""nested"": {
// ""inside"": true
// }
// }