Skip to content

Instantly share code, notes, and snippets.

View tazarov's full-sized avatar

Trayan Azarov tazarov

View GitHub Profile
@tazarov
tazarov / http-to-https-location-post.lua
Last active June 17, 2022 12:53
Kong pre/post-function collection
-- Problem: sometimes the remote server will return a http:// url and browser gets redirected to a non-https url even though it is accessing https endpoint
-- This post-function snippet in Kong helps you overwrite the http part in Location header.
if kong.response.get_status() == 302 and kong.response.get_header("location") ~= "^http" then
local new_loc = kong.response.get_header("Location"):gsub("http","https")
kong.response.set_header("Location",new_loc)
end
@tazarov
tazarov / GeneratePythonSQLModel.groovy
Last active January 26, 2022 21:11
Convert Schema Table To Python SQLModel classes
import com.intellij.database.model.DasTable
import com.intellij.database.util.Case
import com.intellij.database.util.DasUtil
/*
* Available context bindings:
* SELECTION Iterable<DasObject>
* PROJECT project
* FILES files helper
*/
@tazarov
tazarov / app.py
Created January 12, 2022 11:34
FastAPI with React App
import logging
from fastapi import FastAPI
from starlette.responses import RedirectResponse
from starlette.staticfiles import StaticFiles
app = FastAPI()
@app.get("/")
@tazarov
tazarov / string-utils.js
Created October 12, 2017 15:55 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
return str.toLowerCase();