Skip to content

Instantly share code, notes, and snippets.

View kadiraydinli's full-sized avatar
:atom:

Kadir Aydınlı kadiraydinli

:atom:
View GitHub Profile

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@kadiraydinli
kadiraydinli / imageAdjustSize.ts
Created August 4, 2021 15:10
It is used to give scalable image size for React Native.
import { Dimensions } from "react-native";
const { width: windowWidth, height: windowHeight } = Dimensions.get("window");
export const adjustSize = (sourceWidth: number, sourceHeight: number) => {
let ratio = 1;
if (windowWidth && windowHeight) {
ratio = Math.min(windowWidth / sourceWidth, windowHeight / sourceHeight);
}
@kadiraydinli
kadiraydinli / country-codes.ts
Created June 17, 2021 11:15
Country names, isoCodes and country codes in JSON form.
export const countries = [
{
country: "Afghanistan",
countryCode: "93",
isoCode: "AF"
},
{
country: "Albania",
countryCode: "355",
isoCode: "AL"
@kadiraydinli
kadiraydinli / device-screen-properties.ts
Last active April 11, 2022 07:07
For React Native, the phone aspect ratio tells you whether the phone is 16:9 larger.
import { Dimensions } from "react-native"
export const isDeviceScreenLarge = (): boolean => {
return aspectRatio() >= (19.5 / 9)
}
export const isScreen16_9 = (): boolean => {
return aspectRatio() <= 16 / 9
}
@kadiraydinli
kadiraydinli / SplashActivity.java
Created April 8, 2021 11:48
Java file for splash screen in project development with React Native.
package com.xxxxx;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
public class SplashActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {