Skip to content

Instantly share code, notes, and snippets.

View alfiankan's full-sized avatar
🐍
Linting

alfiankan alfiankan

🐍
Linting
View GitHub Profile
@alfiankan
alfiankan / vimline.sh
Created April 15, 2024 22:09
simple edit long shell command using vim/nvim
#!/bin/bash
set -e
LINE=$@
TEMP_FILENAME=`uuidgen`
echo $LINE > /tmp/$TEMP_FILENAME
@alfiankan
alfiankan / cloudflare_lightsail_vercel.md
Last active September 1, 2022 16:38
Cara setup domain ke Vercel dan AWS Lighsail

Yang diperlukan

  • Vercel
  • vm lightsail
  • cloudflare
  • akses setting name server domain

1. Setup domain ke cloudflare

pada clodflare tambahkan domain baru d1

package main
import (
"errors"
"log"
"testing"
"github.com/DATA-DOG/go-sqlmock"
"github.com/jmoiron/sqlx"
"github.com/stretchr/testify/assert"
@alfiankan
alfiankan / cluster-icon-client.js
Created April 25, 2022 02:40
render icon for cluster marker
const loading = document.getElementById('loading')
let isLoading = false
function getJSON(url, callback) {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.onload = function () {
@alfiankan
alfiankan / Clustering.ts
Created April 25, 2022 02:37
clustering use cae supercluster
import { Locations } from '../repositories/Locations'
import Supercluster = require('supercluster')
class LocationCluster {
private locationRepository: Locations
constructor(locationsRepository: Locations) {
this.locationRepository = locationsRepository
}
@alfiankan
alfiankan / basic-map.js
Created April 25, 2022 02:35
simple leaflet basic map
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([51.5, -0.09]).addTo(map)
.bindPopup('A pretty CSS3 popup.<br> Easily customizable.')
.openPopup();
@alfiankan
alfiankan / Locations.ts
Created April 25, 2022 02:34
Location repository
import { DatabaseError, Pool, QueryResult } from "pg";
import { Point } from "../entities/Point";
class Locations {
private db: Pool
constructor(pool: Pool) {
this.db = pool
}