Skip to content

Instantly share code, notes, and snippets.

View reynadan's full-sized avatar
👑
Focusing

Daniel Reynaud reynadan

👑
Focusing
View GitHub Profile
@reynadan
reynadan / server_api_endpoint.ts
Created June 20, 2024 11:29
Translation server side nuxt
import { createI18n } from 'vue-i18n'
import it from '~/config/i18n/it.json'
import en from '~/config/i18n/en.json'
import fr from '~/config/i18n/fr.json'
export default defineEventHandler(async (event) => {
const { locale } = getQuery<{ locale?: string }>(event)
const i18n = createI18n({
locale,
@reynadan
reynadan / TabsContainer.vue
Created May 6, 2024 12:07
Nav tab bar Vuejs 3 composition API + Vuetify + Typescript
<script lang="ts" setup>
import { ref } from 'vue'
export interface Tab {
value: string;
label: string;
data?: any;
disabled?: boolean;
}
@reynadan
reynadan / TabsContainer.vue
Created April 15, 2024 08:39
tab bar vuetify vueJS composition API typescript
<script lang="ts" setup>
/*
Example of use :
<TabsContainer
style="min-height: 80vh;"
:tabs="[
{ label: 'Tab 1', value: 'tab-1' },
{ label: 'Tab 2', value: 'tab-2' },
{ label: 'Tab 3', value: 'tab-3', data: {test1: 'Test 1'} },
@reynadan
reynadan / src_ApiResource_TrailerFees_Top10.php
Created March 25, 2024 10:08
api platform DTO example SF 6.4
<?php
namespace App\ApiResource\TrailerFees;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use App\State\TrailerFees\Top10Provider;
#[ApiResource(
operations: [
@reynadan
reynadan / TooOldException.php
Created March 5, 2024 10:36
Add custom Exception to symfony
#src/Exception/TooOldException.php
<?php
namespace App\Exception;
class TooOldException extends \Exception
{
public function __construct(int $age)
{
parent::__construct(sprintf('You are %d years old, boomers are not accepted',
@reynadan
reynadan / api platform custom endpoint.md
Created March 4, 2024 08:23
Use API Platform for custom endpoint

Add your provider inside your class

ex : src/Entity/distribution/v1/XApiTF.php

use App\State\TrailerFees\Top10Provider;
#[ApiResource(
    operations: [
      new GetCollection(
          uriTemplate: 'tf/top10/v1',
@reynadan
reynadan / tockenExchangeSF.md
Created February 7, 2024 10:50
Implement token exchange authentication on API with Keycloack and Symfony 6.3

Add oauth client library

composer require stevenmaguire/oauth2-keycloak

Configure token provider for token exchange

Add services in config/services.yaml

    app.auth.grant_factory:
      class: 'League\OAuth2\Client\Grant\GrantFactory'
      calls:
@reynadan
reynadan / getRatios.py
Created December 13, 2022 14:42
Calculates and displays profitability, liquidity, and leverage ratios as charts for a given ticker using data using yFinance, python3
"""
Python 3 program that asks the user for a ticker and then calculates and displays
the profitability, liquidity, and leverage ratios as charts for the given ticker using data using Yahoo Finance.
@author: https://github.com/reynadan
"""
# Raw Package
import numpy as np
import pandas as pd
@reynadan
reynadan / _instanceof.md
Last active December 13, 2022 10:23
Symfony 6 does not apply the _defaults and _instanceof options to services defined in other files

Hello Symfony Developers! Suppose we have this project:

|─ src/
|  └─Services/
|     └─ CsvWriter.php
|     └─ JsonWriter.php
|     └─ Logger.php
|     └─ WriterInterface.php
@reynadan
reynadan / Security_training.md
Last active December 8, 2022 16:32
Application security training