Skip to content

Instantly share code, notes, and snippets.

View bagaskarala's full-sized avatar
👋
Halo Dunia!

Bagaskara LA bagaskarala

👋
Halo Dunia!
View GitHub Profile
var mh=Object.defineProperty,yh=Object.defineProperties;var bh=Object.getOwnPropertyDescriptors;var Ma=Object.getOwnPropertySymbols;var _h=Object.prototype.hasOwnProperty,vh=Object.prototype.propertyIsEnumerable;var La=Math.pow,Na=(Ce,fe,ue)=>fe in Ce?mh(Ce,fe,{enumerable:!0,configurable:!0,writable:!0,value:ue}):Ce[fe]=ue,Y=(Ce,fe)=>{for(var ue in fe||(fe={}))_h.call(fe,ue)&&Na(Ce,ue,fe[ue]);if(Ma)for(var ue of Ma(fe))vh.call(fe,ue)&&Na(Ce,ue,fe[ue]);return Ce},st=(Ce,fe)=>yh(Ce,bh(fe));var G=(Ce,fe,ue)=>new Promise((te,Xe)=>{var Ie=Le=>{try{Ye(ue.next(Le))}catch(le){Xe(le)}},or=Le=>{try{Ye(ue.throw(Le))}catch(le){Xe(le)}},Ye=Le=>Le.done?te(Le.value):Promise.resolve(Le.value).then(Ie,or);Ye((ue=ue.apply(Ce,fe)).next())});(function(){"use strict";var Ce=document.createElement("style");Ce.textContent=`p{margin:0;padding:0}.mantap{color:red;font-size:24px;font-weight:700}.spotlight[data-v-8842d7a0]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient
@bagaskarala
bagaskarala / fhci-bumn-job.json
Created March 23, 2024 09:14
RBB FHCI BUMN jobs 2024
This file has been truncated, but you can view the full file.
[
{
"vacancy_id": "A2BB5F1CBD67772C9969AA06EB251590",
"tenant_id": "D1A22EE407325571D847AD68AFBE355F",
"vacancy_name": "General Banking Staff",
"tenant_name": "PT Bank Tabungan Negara (Persero) Tbk",
"vacancy_base_url": "https://rekrutmenbersama2024.fhcibumn.id/",
"jenjang": null,
"stream_name": "Bisnis Niaga / Pemasaran",
"jurusan_name": null,
@bagaskarala
bagaskarala / satisfies.ts
Created January 2, 2024 16:08
Typescript snippets
// annotation - keep wide
const scores: Record<string,number> = {}
scores.maths = 99 // no autocomplete
// satisfies - keep narrow
const configs = {
width: '100px',
isDark: true
} satisfies Record<string, string | boolean>
@bagaskarala
bagaskarala / discriminating-union.ts
Last active December 22, 2023 17:25
Typescript snippet example
// Select matched object
// Bad implementation
// type ApiResponse {
// state: 'success' | 'failed'
// data?: { name: string }
// error?: { message: string }
// }
type ApiResponseSuccess = {
@bagaskarala
bagaskarala / types-snippet.ts
Created October 12, 2023 12:24
typescript generic snippet
// mapping
enum Words {
One = 'one',
Two = 'two',
Three = 'three',
}
enum Numbers {
One = 1,
Two = 2,
@bagaskarala
bagaskarala / index.js
Last active December 1, 2022 08:34
Get nested object value in javascript or JSON
const getValue = (path, obj) => {
const newPath = path.replace(/\]/g, '');
const arrayPath = newPath.split(/[\[\.]+/) || newPath;
return arrayPath.reduce((obj, k) => (obj ? obj[k] : obj), obj);
};
const doFilterObject = (rawData, filterKey) =>
filterKey.reduce((acc, cur) => {
const isNested = new RegExp(/\[|\./, 'g').test(cur);
const newData = isNested ? getValue(cur, rawData) : rawData[cur];
@bagaskarala
bagaskarala / index.js
Last active August 4, 2022 09:34
Telegram broadcast multiple groups using bot
const chatIdList = ['xxx','yyy','zzz'];
const botToken = 'xxx';
const message = 'your message here';
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
(async () => {
for (let i = 0; i < chatIdList.length; i++) {
fetch(`https://api.telegram.org/bot${botToken}/sendMessage?chat_id=${chatIdList[i]}&text=${message}&parse_mode=markdown`)
.then(response => response.json())
.then(response => {
console.log({ status: `${chatIdList[i]}: ${response.ok}` });
@bagaskarala
bagaskarala / settings.json
Last active April 27, 2021 09:16
vue javascript vscode settings
// place it on your workspace .vscode folder
{
// EDITOR
// ----------------------------------------
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
"[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
"[vue]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
"[scss]": { "editor.defaultFormatter": "stylelint.vscode-stylelint" },
"[css]": { "editor.defaultFormatter": "stylelint.vscode-stylelint" },