Skip to content

Instantly share code, notes, and snippets.

View axquired24's full-sized avatar
😎

Albert Septiawan axquired24

😎
View GitHub Profile
@axquired24
axquired24 / middleware.ts
Created December 2, 2022 09:31
Nextjs Middleware Proxy
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
const vcnApi = process.env.BACKEND_URL
const bridgePath = '/api/internal'
const bridgeToApi = (request: NextRequest):string => {
const path = request.nextUrl.pathname;
let newUrl = path.replace(bridgePath, vcnApi)
if(request.nextUrl.search) {
newUrl += request.nextUrl.search
@axquired24
axquired24 / gitalias.sh
Created September 9, 2022 03:37
Git Alias
#!/usr/bin/env sh
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --decorate --color"
git config --global alias.bu "commit --allow-empty -am \"bump update\""
git config --global alias.fixup "commit -am fixup"
git config --global alias.crp cherry-pick
@axquired24
axquired24 / ProxyController.php
Created March 20, 2019 10:23
html2canvas-proxy-laravel.php
<?php
namespace App\Http\Controllers\API;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\API\ContentHub\{ListRequest, RemoveRequest};
class ContentHubController extends Controller
{
-- Ambil Provinsi
SELECT kode, nama as provinsi
FROM wilayah
WHERE CHAR_LENGTH(kode) = 2
-- Ambil Kab/Kota
SELECT
kode as kodewil,
nama as 'kab/kota',
(SELECT nama FROM wilayah WHERE kode = LEFT(kodewil, 2)) as provinsi
@axquired24
axquired24 / vueuploadsingleimage.html
Created March 27, 2018 09:23
Vue Upload Single Image
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Upload Vue | Image</title>
</head>
<body>
@axquired24
axquired24 / index.html
Last active March 27, 2018 09:20
Vue Upload Image Preview base64 | JS Bin// source https://jsbin.com/xumikutisu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="app">
@axquired24
axquired24 / maintenance.html
Created February 9, 2018 08:17 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@axquired24
axquired24 / fileupload.html
Created February 2, 2018 03:32
Contoh file upload tester sederhana, langsung override di console
<form action="http://local-dev-mc2.ansvia.com/web-internal/api/user/upload-photo?max_size=200000" id="formku11">
<input type="file" id="fileku11">
</form>
<script>
$("#fileku11").change(function(e){
var data = new FormData();
$.each(e.target.files, function(key, value)
{
@axquired24
axquired24 / README.md
Last active January 17, 2018 10:37
[Bash] Database Importer for Postgresql

Database Importer for Postgresql

Simple bash command to import your .sql to spesific database

How To

# Change USER to your postgresql username
# Change PASSWORD to your postgresql password

# Important: SQL File must be on same folder with dbrunner.sh
./dbrunner.sh -d yourdatabasename -f yourfile.sql
@axquired24
axquired24 / postgres-cheatsheet.md
Created January 13, 2018 16:34 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)