Skip to content

Instantly share code, notes, and snippets.

View ozcanzaferayan's full-sized avatar
⚛️
Overreacting

Özcan Zafer AYAN ozcanzaferayan

⚛️
Overreacting
View GitHub Profile
@ozcanzaferayan
ozcanzaferayan / README.MD
Last active August 30, 2024 20:09
React Native SVGR Usage

SVG file (./src/images/ic_youtube.svg):

<?xml version="1.0" ?>
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
  <path d="M21.582,6.186c-0.23,-0.86 -0.908,-1.538 -1.768,-1.768C18.254,4 12,4 12,4S5.746,4 4.186,4.418c-0.86,0.23 -1.538,0.908 -1.768,1.768C2,7.746 2,12 2,12s0,4.254 0.418,5.814c0.23,0.86 0.908,1.538 1.768,1.768C5.746,20 12,20 12,20s6.254,0 7.814,-0.418c0.861,-0.23 1.538,-0.908 1.768,-1.768C22,16.254 22,12 22,12S22,7.746 21.582,6.186zM10,15.464V8.536L16,12L10,15.464z" fill="#000000FF"/>
</svg>

CLI usage:

svgr ./src/images -d ./src/svg --native --icon --svg-props "width=24,height=24"
@ozcanzaferayan
ozcanzaferayan / withJvmHeap.js
Created August 26, 2024 07:50
Changes JVM heap size in Expo projects
const { withGradleProperties } = require("expo/config-plugins");
// This plugin sets the JVM heap size to 4GB
module.exports = (config) => {
config = withGradleProperties(config, (config) => {
const projectGradle = config.modResults;
// Find index of org.gradle.jvmargs
const index = projectGradle.findIndex(
(x) => x.key === "org.gradle.jvmargs",
);
@ozcanzaferayan
ozcanzaferayan / Roadmap.md
Last active August 17, 2024 19:33
Frontend Roadmap

Algoritmalar

  • Atama Operatörü (Assignment operator) =
    • x + y = z (Yasak)
    • x = 2
    • x = y + z
  • Algoritma adımları
1. Başla
2. X'i olustur
3. X'e 3 degerini ata
import { useState } from "react";
const HayaletSevgilim = () => {
const [ceza, setCeza] = useState("Ceza mı bu");
const [cile, setCile] = useState("Çektiğim çile mi");
const [nobet, setNobet] = useState("Yıllardır tuttuğum nöbet bitmeyecek mi?");
const [karTanesi, setKarTanesi] = useState("Bir küçük kar tanesi gibiyim");
const [don, setDon] = useState("Avucunda eriyen dön bebeğim");
const [gosyasi, setGozyasi] = useState("Gözyaşlarını görürsem");
const [kanatlarim, setKanatlarim] = useState("Erir kanatlarım");
@ozcanzaferayan
ozcanzaferayan / redis.js
Created March 22, 2024 01:17
Ev yapımı Redis tarifi
const redis = {
// Anahtar-değer çiftleri
"anahtar1": "değer1",
"anahtar2": "değer2",
// Bir liste benzetimi
"listeAnahtarı": ["eleman1", "eleman2", "eleman3"],
// Bir set benzetimi (JavaScript Set kullanarak)
"setAnahtarı": new Set(["eleman1", "eleman2"]),
@ozcanzaferayan
ozcanzaferayan / app.config.ts
Created February 25, 2024 09:55
Expo create custom plugin
import type { ConfigContext, ExpoConfig } from "@expo/config";
const defineConfig = (_: ConfigContext): ExpoConfig => ({
name: "My project",
slug: "my-project",
plugins: [
["./plugins/mylibrary.plugin.js"],
],
});
@ozcanzaferayan
ozcanzaferayan / myProject.code-snippets
Last active February 23, 2024 13:30
React Create Component Snippet
{
"Component": {
"prefix": ["comp"],
"body": [
"import { View, Text } from 'react-native'",
"import React from 'react'",
"",
"type Props = {}",
"",
"const ${TM_FILENAME_BASE} = (props: Props) => {",
@ozcanzaferayan
ozcanzaferayan / useTabPress.ts
Created February 10, 2024 12:14
useTabPress.ts
import { useNavigation } from "expo-router";
import { useEffect } from "react";
import { FlatList } from "react-native";
export const useTabPressScroll = <T>(ref: React.RefObject<FlatList<T>>) => {
const navigation = useNavigation();
useEffect(() => {
// @ts-expect-error tabPress is not in the type
const unsub = navigation.addListener("tabPress", (evt) => {
if (navigation.isFocused()) {
@ozcanzaferayan
ozcanzaferayan / App.tsx
Last active January 26, 2024 13:39
React Native Donut Chart with react-native-svg
import React from 'react';
import { View } from 'react-native';
export const App: React.FC = () => {
return (
<View style={{flexDirection: 'row', justifyContent:'center'}}>
<DonutChart radius={15} percentage={25} width={100}/>
<DonutChart radius={15} percentage={65} width={100}/>
<DonutChart radius={15} percentage={70} width={100}/>
@ozcanzaferayan
ozcanzaferayan / pasta.jpeg
Last active December 7, 2023 18:12
Pasta
pasta.jpeg