Skip to content

Instantly share code, notes, and snippets.

View gokhantaskan's full-sized avatar
🎯
Focusing

Gökhan Taşkan gokhantaskan

🎯
Focusing
View GitHub Profile
# Setting up PostgreSQL SSL in Coolify
This guide walks you through enabling SSL for PostgreSQL databases in Coolify.
## Step 1: Enable SSL in Coolify
1. Go to your PostgreSQL resource in Coolify
2. Scroll to **SSL Configuration**
3. Check **Enable SSL**
4. Click **Save**
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
DRY_RUN=false
AUTO_YES=false
usage() {
@gokhantaskan
gokhantaskan / useAxios.ts
Last active June 1, 2024 08:45
Axios + Firebase interceptor for authentication
import _axios, { type AxiosRequestConfig } from "axios";
import defu from "defu";
import { FB_EXPIRATION_DATE, IS_DEV } from "@/constants/globals";
import { useBearerToken } from "./useBearerToken";
export function useAxios<T, D = any>(url: string, options?: Omit<AxiosRequestConfig<D>, "url">) {
const { bearerToken, getIdTokenResult } = useBearerToken();
@gokhantaskan
gokhantaskan / rte.vue
Last active August 30, 2023 07:37
TipTap WYSIWYG editor | Vue 3 + VeeValidate
<script setup lang="ts">
import CharacterCount from "@tiptap/extension-character-count";
import Link from "@tiptap/extension-link";
import Subscript from "@tiptap/extension-subscript";
import Superscript from "@tiptap/extension-superscript";
import StarterKit from "@tiptap/starter-kit";
import { Editor, EditorContent } from "@tiptap/vue-3";
const {
name,
@gokhantaskan
gokhantaskan / App.vue
Last active August 11, 2023 06:49
Basic fake radio group with buttons - experimental
...
<template>
...
<RadioGroup
v-model="value"
@option-click="next" // or @change
>
<template
v-for="(item, i) in isOwnedData"
@gokhantaskan
gokhantaskan / index.ts
Last active February 11, 2023 09:50
Find the first focusable element inside a DOM element
export function findFirstFocusableElement(
element: HTMLElement | null,
tags: string = "",
{ withDefaults } = { withDefaults: false }
) {
if (!element) return;
const defaults =
"a[href], button, input, textarea, select, details, [tabindex]:not([tabindex='-1'])";
@gokhantaskan
gokhantaskan / format-balance.ts
Last active January 18, 2023 10:40
Metamask style balance formatter
import { BigNumber } from "@ethersproject/bignumber";
import { formatUnits, parseUnits } from "@ethersproject/units";
/**
* @param balance Token balance in BigNumber format
* @param decimals Token decimals
* @param fixed The number of decimal places to show
* @returns string representation of the balance
*/
export function bigNumberToTrimmed(
@gokhantaskan
gokhantaskan / useBreakpoints.ts
Last active January 17, 2023 12:29
Vue breakpoint composable
import { computed, onMounted, onUnmounted, ref } from 'vue';
export default function useBreakpoints() {
const windowWidth = ref(window.innerWidth);
const onWidthChange = () => (windowWidth.value = window.innerWidth);
onMounted(() => window.addEventListener('resize', onWidthChange));
onUnmounted(() => window.removeEventListener('resize', onWidthChange));
const bp = computed(() => {
@gokhantaskan
gokhantaskan / tippy.ts
Last active February 20, 2023 07:06
Simple Vue `v-tippy` directive
import "tippy.js/dist/tippy.css";
import "tippy.js/animations/scale.css";
import tippy, {
type DefaultProps as DefaultTippyProps,
type Props as TippyProps,
} from "tippy.js";
import type { Directive } from "vue";
const defaultProps: Partial<DefaultTippyProps> = {
@gokhantaskan
gokhantaskan / date.spec.ts
Last active January 16, 2023 14:08
testing date-related functions
/**
* @jest-environment jsdom
* @jest-environment-options {"url": "https://website.com"}
*/
import { defaultPeriod } from "../../src/utils/date";
let windowSpy: ReturnType<typeof jest.spyOn>;
describe("test date.ts", () => {