Skip to content

Instantly share code, notes, and snippets.

View umutyerebakmaz's full-sized avatar
:octocat:
I'm available, please open an issue on the subject.

Umut Yerebakmaz umutyerebakmaz

:octocat:
I'm available, please open an issue on the subject.
View GitHub Profile
@umutyerebakmaz
umutyerebakmaz / killmail.json
Created April 8, 2024 10:09
Eve Online Example Killmail with hashcode from ingame
{
"attackers": [
{
"alliance_id": 99004804,
"character_id": 96780701,
"corporation_id": 215297637,
"damage_done": 1817,
"final_blow": true,
"security_status": 0.1,
"ship_type_id": 49710,
@umutyerebakmaz
umutyerebakmaz / request-user.entity.ts
Created January 11, 2024 09:29
TypeORM @manytomany, establish a two-sided `CASCADE` structure for the ManyToMany relationship.
// You can set up the structure without creating this entity, but when the project grows,
// you will need the entity for leftJoin.
import { BaseEntity, Entity, PrimaryColumn } from 'typeorm';
@Entity()
export class RequestUser extends BaseEntity {
@PrimaryColumn('uuid')
requestId: string;
@PrimaryColumn('uuid')
@umutyerebakmaz
umutyerebakmaz / yoga-express-middleware.example.ts
Created October 13, 2023 12:32
yoga-express-middleware.example.ts
#!/usr/bin / env node
import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import '@lib/env';
import { authChecker } from './auth-checker';
import environmentErrorReporter from '@lib/environmentErrorReporter';
import { appDataSource } from '@server/datasource';
import { buildSchema } from 'type-graphql';
import { resolvers } from './modules/resolvers';
@umutyerebakmaz
umutyerebakmaz / rxjs-time-based-functions.ts
Last active November 28, 2023 15:51
RXJS time based functions
// bir sayine sonra bir değer üretir
const timer$ = timer(1000);
timer$.subscribe(value => {
console.log(value); // 0
});
// her bir saniyede bir artan değer üretir
const interval$ = interval(1000);
interval$.subscribe(value => {
@umutyerebakmaz
umutyerebakmaz / server.ts
Last active August 14, 2023 15:00
Add your own JWT implementation for Apollo Server Express.
import bodyParser from 'body-parser';
import cors from 'cors';
import express from 'express';
import * as fs from 'fs';
import * as jwt from 'jsonwebtoken';
const accessKey = fs.readFileSync('src/keys/access_token_pkcs8.key', 'utf-8');
const refreshKey = fs.readFileSync('src/keys/refresh_token_pkcs8.key', 'utf-8');
const app = express();
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http';
import { Observable, BehaviorSubject } from 'rxjs';
import { catchError, filter, switchMap, take } from 'rxjs/operators';
import { AuthService } from '@services/auth.service';
import { Router } from '@angular/router';
import { TokenType } from '@app/graphql.module';
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
@umutyerebakmaz
umutyerebakmaz / keypair.py
Last active July 31, 2023 14:16
Generate 256bit keypair accessToken and refreshToken case
// Generate AccesToken keypair
openssl genrsa -out access_token.pem 2048
openssl rsa -in access_token.pem -pubout -out access_token_publickey.crt
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in access_token.pem -out access_token_pkcs8.key
// Generate RefreshToken keypair
openssl genrsa -out refresh_token.pem 2048
openssl rsa -in refresh_token.pem -pubout -out refresh_token_publickey.crt
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in refresh_token.pem -out refresh_token_pkcs8.key
<div x-data="{
value: {{ value }} ?? '',
displayValue: {{ value }} ?? '',
demaskValue(value) {
this.value = value.replaceAll('$', '').replaceAll(',', '')
}
}" class="-mr-2">
<input
type="text"
x-mask:dynamic="'$' + $money($input)"
@umutyerebakmaz
umutyerebakmaz / CustomSideBarContent.tsx
Last active July 14, 2023 19:30
React Native Drawer Navigation Custom Content with focused
import { DrawerContentScrollView, DrawerItemList } from '@react-navigation/drawer';
import React from 'react';
import { Image, Text, TouchableOpacity, View, Platform } from 'react-native';
import SideBarItem from './SideBarItem';
import Colors from 'tailwindcss/colors';
import { ArrowLeftOnRectangleIcon, ChatBubbleBottomCenterTextIcon } from 'react-native-heroicons/outline';
import classNames from 'classnames';
const CustomSideBarContent = (props: any) => {
const focused = props.state.index;
import 'package:biocidalmobile/components/bio_text_form_field.dart';
import 'package:flutter/material.dart';
class BioLoginForm extends StatefulWidget {
const BioLoginForm({super.key});
@override
BioLoginFormState createState() {
return BioLoginFormState();
}