Añadir slash al final de URLs en NEXTJS 14

Al poner **trailingSlash** como **true**, se añadira el slash al final de las URLs.

Archivo: next.config.mjs

```js
/** @type {import('next').NextConfig} */
const nextConfig = {
    trailingSlash: true,
};

export default nextConfig;
```

Baby wolf codes - advanced JS tips

// Destructure into multiple variables
const obj = { val: 1 };
const { val: a, val: b, val } = obj;

console.log(a); // -> 1
console.log(b); // -> 1
console.log(val); // ->



// Chaining catch in Promise
const somePromise = async () => Promise.reject('error');
somePromise()
    .then(e => {
        //
    })
    .catch(e => {
        throw new Error('error happened');
    })
    .catch(e => {
        console.log('hi ' + e); // hi Error
    });


// Multiple handlers for 

SQL Syntaxes for auto-increment for primary keys

Different SQL database management systems have their own mechanisms and syntax 
for automatically incrementing primary keys:

## 1. SQLite: Uses `AUTOINCREMENT` with `INTEGER PRIMARY KEY`
```sql
CREATE TABLE table_name (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    ...
);
```

## 2. MySQL uses `AUTO_INCREMENT` with `INT`
```sql
CREATE TABLE table_name (
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (id),
    ...
);
```

## 3. PostgreSQL uses serial types like `SERIAL` for auto-incrementin

SQL-Constraints

Here's a sum up of relevant syntax examples of constraints, hierarchically classed.

# 1. `PRIMARY KEY`
## Basic Boilerplate
```sql
CREATE TABLE Employees (
    EmployeeID int NOT NULL,
    FirstName varchar(255),
    LastName varchar(255),
    Email varchar(255),
    HireDate date,
    PRIMARY KEY (EmployeeID)
);
```

## Composite Primary Key
A primary key can consist of more than one column. This is known as **composite
primary key**.

It is useful **when no single column uniquely identifies a

Install tailwind in a new project

# initial install
npm install -D tailwindcss

# create TW config file
npx tailwindcss init

# update TW config
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    extend: {},
  },
  plugins: [],
}

# place in main css file
@tailwind base;
@tailwind components;
@tailwind utilities;

# start TW cli css service
npx tailwindcss -i ./src/`input`.css -o ./src/`output`.css --watch

# test
<!doctype html>
<html>
<head>
  <meta charset="UTF-8

786. K-th Smallest Prime Fraction

/**
 * @param {number[]} arr
 * @param {number} k
 * @return {number[]}
 */
// Define the function that takes an array and a number k as input
var kthSmallestPrimeFraction = function(arr, k) {
    // Initialize a new max priority queue
    let newarr  =  new MaxPriorityQueue();
    
    // Loop through each element in the array
    for(let i = 0; i < arr.length; i++){
        // For each element, loop through the rest of the array
        for(let j = i + 1; j < arr.length; j++){
            // E

Button with value within a form

<!-- The value attribute specifies the initial value for a <button> in an HTML form. In a form, the button and its value is only submitted if the button itself was used to submit the form. -->

<form action="/action_page.php" method="get">
  Choose your favorite subject:
  <button name="subject" type="submit" value="fav_HTML">HTML</button>
  <button name="subject" type="submit" value="fav_CSS">CSS</button>
</form>

Separate coverage plot graphs

# Creating the plot
ggplot(master_sample, aes(x = pos, y = depth)) +
    geom_line() +  # Draws the line graph
    scale_y_log10() +
    labs(x = "Position", y = "Log10 Depth", title = "Depth Profile") +
    facet_grid(vars(sample))
  
gen_graph <- 
    ggplot(master_sample_gen, aes(x = pos, y = depth)) +
        geom_line() +  # Draws the line graph
        scale_y_log10() +
        labs(x = "Position", y = "Log10 Depth", title = "Genome depth profile")
        # facet_grid(sample ~

Latte component

<!-- component definition  -->
{define badge, bool $show = true, string $title = '', $class = null}
	<span class="badge ms-2 font-size-small {$class ?? 'bg-body-secondary text-body'}" n:if="$show" title="{$title}">
		{block content}{/block}
	</span>
{/define}


<!-- usage -->
{embed badge, $client !== null, 'Uhrazeno'}
	{block content}
		<i class="mdi mdi-check text-success"></i>
		{$client->totalInvoicePricePaid|price:0}
	{/block}
{/embed}

pytest essentials

# Basic Commands
`python -m pytest`, or, more briefly `pytest`...

Will search for 
- folders beginning with `test`, then...
- files beginning with `test`, then...
- functions beginning with `test`,
- classes beginning with `Test`,
- methods beginning with `test`

> **NOTE**
>
> Using classes can be useful to group tests.

- `pytest -q`: quiet mode
- `pytest -v`: verbose mode
- `pytest -vv`: very verbose mode

> **TRY them to compare**

# Marks
Marks work with decorators and are a mechanism to g

card

aaaaaaaaaa

10052024

inicio{
"host":"70E35CD863DF4C3D1E363C5DE748",
"porta":"0E0276FE51C1"
}fim

シングルトン とは。。

使用したいそれぞれのファイルで、 CustomScriptEditor2 の新しいインスタンスを作成する代わりに、 これらのインスタンスを一度だけ、ここで作成し、 これを、他のすべてのファイルの場所で再利用することをお勧めします。 これは一つの方法であり、 当ファイルのように、別の Pythonファイル(例えば singleton.py )を作成し、 その中で、CustomScriptEditor2 のインスタンスを作成することです。 これにより、CustomScriptEditor2 のインスタンスは一度だけ作成され、 例えば、 SampleA_cmdsUI.py と SampleB_pymelUI.py の両方で共有されるようになります。 これがシングルトンパターンの一般的な実装方法です。
# -*- coding: utf-8 -*-

u"""
singleton.py

:Author:
    oki yoshihiro
    okiyoshihiro.job@gmail.com
:Version: -1.0-
:Date: 2024/05/10

.. note:: 当コード記述時の環境

    - Maya2022 python3系
    - Python version: 3.7.7
    - PySide2 version: 5.15.2

概要(overview):
    シングルトンパターンを実装するためのモジュールです
詳細(details):
    使用したいそれぞれのファイルで、
        CustomScriptEditor2 の新しいインスタンスを作成する代わりに、
            これらのインスタンスを一度だけ、ここで作成し、
                これを、他のすべてのファイルの場所で再利用することをお勧めします。
    これは一つの方法であり、
   

Dynamic Vue.js component in runtime

<template>
  <h1>test</h1>
  <component :is="dynamicComponent" />
</template>


<script setup>
import { computed} from 'vue'

const dynamicComponent = computed(() => {

  let template = `
    <h3>Toto je dynamic component</h3>
    <p>Nejaky text</p>
  `

  return { template }

})
</script>

<!--/* musi to byt jako bundle vue .. build, ne runtime vue   */-->

Django model relations

class User(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4)
    email = models.CharField(unique=True, null=False, blank=False)
    password_hash = models.CharField(max_length=255, null=True, blank=False)

    @property
    def pending_articles_count(self):
        return self.articles.filter(state__in=['pending_content', 'pending_translation']).count()

    class Meta:
        db_table = "users"

class Article(models.Model):
    id = models.UUIDField(primary_key=Tru