Skip to content

Instantly share code, notes, and snippets.

View ardamutlu's full-sized avatar

Arda ardamutlu

  • Istanbul, Turkey
View GitHub Profile
@ardamutlu
ardamutlu / .postcssrc.json
Created April 10, 2026 23:41
nx-graph-to-tailwind
{
"plugins": {
"tools/nx-tailwind-graph-plugin/index.js": {},
"@tailwindcss/postcss": {}
}
}
@ardamutlu
ardamutlu / RouterHelpers.ts
Last active July 6, 2023 18:29
Utility Functions
export function getCurrentUrl(pathname: string) {
return pathname.split(/[?#]/)[0]
}
export function checkIsActive(pathname: string, url: string) {
const current = getCurrentUrl(pathname)
if (!current || !url) {
return false
}
import { useState } from 'react'
type CopiedValue = string | null
type CopyFn = (text: string) => Promise<boolean> // Return success
export function useCopyToClipboard(): [CopiedValue, CopyFn] {
const [copiedText, setCopiedText] = useState<CopiedValue>(null)
const copy: CopyFn = async text => {
if (!navigator?.clipboard) {
@ardamutlu
ardamutlu / file-size.pipe.ts
Last active July 11, 2023 19:46
Useful Pipes
import { Pipe, PipeTransform } from '@angular/core';
/**
* A pipe for human readable file size representation.
*/
@Pipe({
name: 'filesize'
})
export class FileSizePipe implements PipeTransform {
@ardamutlu
ardamutlu / take.until.destroy.decorator.ts
Created January 2, 2020 16:45
Take Until Destroy Decorator
import { Subject } from "rxjs";
export function TakeUntilDestroyDecorator(blackList: string[] = []) {
return function(constructor) {
let originalDestroy = constructor.prototype.ngOnDestroy;
if (typeof originalDestroy !== "function") {
console.warn(
`${constructor.name} is using @TakeUntilDestroy but does not implement OnDestroy`
);
@ardamutlu
ardamutlu / react-native-transition-config.ts
Last active July 28, 2019 16:14
React Native Transition Config
import { Animated, Easing } from "react-native";
export const bottomToUp = (index: any, sceneProps: any) => {
const { layout, position, scene } = sceneProps;
const height = layout.initHeight;
const translateY = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [height, 0, 0]
});
const opacity = position.interpolate({