Skip to content

Instantly share code, notes, and snippets.

View tofikhidayatxyz's full-sized avatar
🏠
Working With Cofee

Tofik Hidayat tofikhidayatxyz

🏠
Working With Cofee
View GitHub Profile
@tofikhidayatxyz
tofikhidayatxyz / wise-google-script.gs
Created June 14, 2023 16:44
Get wise currency using google script
function getWiseAPI(fromCurrency='EUR', toCurrency='IDR', price=1) {
if(typeof fromCurrency != 'string') {
fromCurrency = 'EUR'
}
if(typeof toCurrency != 'string') {
toCurrency = 'EUR'
}
https://forum.xda-developers.com/attachments/tlink-1-9-5-apk.5632621/
@tofikhidayatxyz
tofikhidayatxyz / cdn.js
Created February 10, 2023 04:29
Cloudflare Worker Bypass For CDN
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
return await fetch(`https://S3_URL_HERE${url.pathname}`)
}
This file has been truncated, but you can view the full file.
[
{
"UNB": {
"SYNTAXIDENTIFIER_1": {
"SyntaxIdentifier_1": "UNOA",
"SyntaxVersionNumber_2": "1"
},
"INTERCHANGESENDER_2": {
"InterchangeSenderIdentification_1": "DHLEUAPGW",
"IdentificationCodeQualifier_2": "DHLE"
@tofikhidayatxyz
tofikhidayatxyz / Select2.alpine.js
Last active January 5, 2023 13:35
Rendering and watch select2 using alpine.js
class Select2Alpine {
constructor(el) {
this.el = document.querySelector(el);
if (!this.el) {
throw `Element ${el} not found`;
}
}
init() {
this.render();
@tofikhidayatxyz
tofikhidayatxyz / random-text-pattern.js
Created December 6, 2022 12:46
Generate random text pattern for any use case
// [a/A] alpha numeric
// [la] Lowercase alpha numeric
// [ua] Uppercase alpha numeric
// [w] words
// [lw] Lowercase words
// [uw] uppercase word
// [n] number
// [p] symbol
// [r] random all
// [lr] random lowercase
@tofikhidayatxyz
tofikhidayatxyz / countdount.js
Created May 13, 2022 01:36
Countdount Formula
const now = moment().utc();
const origin = moment(this.dropAt);
const diffDay = origin.diff(now, "days");
const diffHour = origin.diff(now, "hours");
const diffMinutes = origin.diff(now, "minutes");
const diffSeconds = origin.diff(now, "seconds");
let finalWeek = Math.floor(diffDay / 7);
let finalDay = diffDay - finalWeek * 7;
let finalHours = diffHour - diffDay * 24;
@tofikhidayatxyz
tofikhidayatxyz / object-picker.js
Created March 10, 2022 01:02
Dynamic Array and Object picker
// sample
/**
pick data from object and array
this.$pick(SOURCE)
this.$pick(SOURCE, DATA_TO_PIC, DATA_TO_PIC, DATA_TO_PIC)
this.$pick(SOURCE, [SOURCE, TRANFORM_FUNCTION])
this.$pick(SOURCE, [DATA_TO_PIC, NEW_NAME, TRANFORM_FUNCTION])
const firsVal = 'harum'
const secondVal = 'rumah'
const isAnagram = (firstVal, secondVal) => {
firstVal = firstVal
.toLowerCase()
.split(' ')
.join('')
.split('')
.sort()
@tofikhidayatxyz
tofikhidayatxyz / benih-jagung.c
Last active October 30, 2020 15:56
Menghitung berat benih jagung bersarkan luas lahan
#include <stdio.h>
int main(int argc, const char * argv[]) {
float beratBenih = .15; // as gram
int lebar = 3; // as meter
int panjang = 4; // as meter
// lebar di kurang (jarak 1 meter di kali 2) (jarak pingir)