Snippets Collections
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Student Birthday Board</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    overflow-x: hidden;
    text-align: center;
}

.container {
    max-width: 600px;
    margin: 80px auto;
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    z-index: 2;
}

h1 {
    color: #d81b60;
}

.student-card {
    background: #fff3e0;
    padding: 20px;
    margin: 15px 0;
    border-radius: 15px;
    animation: pop 0.5s ease-in-out;
}

.student-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 4px solid #ff4081;
}

@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.no-birthday {
    color: red;
    font-weight: bold;
    font-size: 18px;
}

/* 🎈 Balloons */
.balloon {
    width: 50px;
    height: 70px;
    border-radius: 50%;
    position: absolute;
    bottom: -100px;
    animation: float 8s infinite ease-in;
}

.balloon:before {
    content: "";
    width: 2px;
    height: 60px;
    background: #555;
    position: absolute;
    left: 50%;
    top: 70px;
}

@keyframes float {
    0% { transform: translateY(0) translateX(0); }
    100% { transform: translateY(-110vh) translateX(30px); }
}
</style>
</head>

<body>

<div class="container">
    <h1>πŸŽ‚ Today's Birthday πŸŽ‰</h1>
    <div id="birthdayList">Loading...</div>
</div>

<script>

// 🎈 Balloon Animation
function createBalloons() {
    const colors = ["#ff4d4d", "#4da6ff", "#66ff66", "#ffcc00", "#cc66ff"];
    for(let i = 0; i < 15; i++){
        let balloon = document.createElement("div");
        balloon.className = "balloon";
        balloon.style.left = Math.random() * 100 + "vw";
        balloon.style.background = colors[Math.floor(Math.random() * colors.length)];
        balloon.style.animationDuration = (5 + Math.random() * 5) + "s";
        document.body.appendChild(balloon);
    }
}
createBalloons();

// πŸ”— Your Script URL
const url = "https://script.google.com/macros/s/AKfycby0GeN0gj6gsJp8y0Csqrb3gpLQFVBsdUzL8l9nRcHFPCuJUHh45msaEVNQSG3kzGT1Ig/exec";

fetch(url)
.then(res => res.json())
.then(data => {

    const today = new Date();
    const todayMonth = today.getMonth();
    const todayDate = today.getDate();

    let output = "";
    let birthdayFound = false;

    data.forEach(student => {

        if(student.month === todayMonth && student.day === todayDate){
            birthdayFound = true;

            let photoURL = student.photo ? student.photo : "https://via.placeholder.com/130";

            output += `
                <div class="student-card">
                    <img src="${photoURL}" 
                         class="student-photo"
                         onerror="this.src='https://via.placeholder.com/130'">
                    <h2>πŸŽ‰ ${student.name}</h2>
                    <p>${student.class}</p>
                </div>
            `;
        }
    });

    if(!birthdayFound){
        output = `<div class="no-birthday">🎈 No birthdays today</div>`;
    }

    document.getElementById("birthdayList").innerHTML = output;

});
</script>

</body>
</html>
cat scripts/tavily_search.py  | nc termbin.com 9999
curl -F "file=@file.md" https://temp.sh/upload

Easy file uploads for up to 4GB, returns the address to download it as well
Taking an image of a disk, skipping errors:


pv -EEpa /dev/nvme0n1 > /media/mint/Backups/nvme0n1.disk

Writing an image back to a disk:

              pv disk-image.img > /dev/your/disk/device

       Zeroing a disk:

              pv < /dev/zero > /dev/your/disk/device
(Linux only): Watching file descriptor 3 opened by another process 1234:

              pv -d 1234:3

       (Linux only): Watching all file descriptors used by process 1234:

              pv -d 1234
Some suggested common switch combinations:

       pv -ptebar
              Show a progress bar, elapsed time, estimated completion time, byte counter, average rate, and current rate.

       pv -betlap
              Show a progress bar, elapsed time, estimated completion time, line counter, and average rate, counting lines instead of bytes.

       pv -t  Show only the elapsed time - useful as a simple timer, e.g.  sleep 10m | pv -t.

       pv -pterb
              The default behaviour: progress bar, elapsed time, estimated completion time, current rate, and byte counter.

ISO 28000 Certification in San Jose helps organizations strengthen supply chain security by identifying and managing risks related to transportation, logistics, and international trade. The standard provides a structured framework for protecting goods, infrastructure, and supply chain operations from disruptions or threats. Businesses in San Jose adopt ISO 28000 to improve risk management, enhance operational efficiency, and ensure secure supply chain processes while demonstrating commitment to safety, compliance, and reliable global trade practices.
SELECT
		 'In' as "Type",
		 "Stock In Flow Table"."Stock In Flow ID" as "PK",
		 "Stock In Flow Table"."Product ID" as "Product ID",
		 "Stock In Flow Table"."Transaction Date" as "Transaction Date",
		 "Stock In Flow Table"."Quantity Physically Tracked" as "Physical Quantity",
		 "Stock In Flow Table"."Warehouse ID" as "Warehouse ID",
		 "Stock In Flow Table"."Total (BCY)" as "Amount",
		 0 as "Commited Stock"
FROM  "Stock In Flow Table" 
WHERE	 "Stock In Flow Table"."EntityType"  != 'transfer_order'
UNION ALL
 SELECT
		 'Out' as "Type",
		 "Stock Out Flow Table"."Stock Out Flow ID",
		 "Stock Out Flow Table"."Product ID",
		 "Stock Out Flow Table"."Transaction Date",
		 -1 * "Stock Out Flow Table"."Quantity Physically Tracked",
		 "Stock Out Flow Table"."Warehouse ID" as "Warehouse ID",
		 -1 * sum("FIFO Mapping Table"."Total (BCY)"),
		 0
FROM  "Stock Out Flow Table"
LEFT JOIN "FIFO Mapping Table" ON "Stock Out Flow Table"."Stock Out Flow ID"  = "FIFO Mapping Table"."Stock Out Flow ID"  
WHERE	 "Stock Out Flow Table"."EntityType"  != 'transfer_order'
GROUP BY 1,
	 2,
	 3,
	 4,
	 5,
	  6 
UNION ALL
 SELECT
		 'Purchase' as "Type",
		 "Purchase Order Items"."Item ID",
		 "Purchase Order Items"."Product ID",
		 "Purchase Orders"."Purchase Order Date",
		 "Purchase Order Items"."Quantity Received" + "Purchase Order Items"."Quantity Manually Received",
		 "Purchase Order Items"."Warehouse ID",
		 sum("Purchase Order Items"."Total (BCY)"),
		 0
FROM  "Purchase Order Items"
LEFT JOIN "Purchase Orders" ON "Purchase Orders"."Purchase Order ID"  = "Purchase Order Items"."Purchase Order ID"  
GROUP BY 1,
	 2,
	 3,
	 4,
	 5,
	  6 
UNION ALL
 SELECT
		 'Sales' as "Type",
		 "Sales Order Items"."Item ID",
		 "Sales Order Items"."Product ID",
		 "Sales Orders"."Order Date",
		 -1 * ("Sales Order Items"."Quantity Shipped" + "Manually Fulfilled Quantity"),
		 "Sales Order Items"."Warehouse ID",
		 sum("Sales Order Items"."Total (BCY)"),
		 ifnull(ifnull(SUM("Sales Order Items"."Quantity"), 0) -ifnull(SUM("Sales Order Items"."Manually Fulfilled Quantity"), 0) -ifnull(SUM("Sales Order Items"."Quantity Cancelled"), 0) -ifnull(SUM("Sales Order Items"."Invoiced Quantity Cancelled"), 0) -ifnull(SUM("Sales Order Items"."Quantity Shipped"), 0), 0) as "Commited Stock"
FROM  "Sales Order Items"
LEFT JOIN "Sales Orders" ON "Sales Orders"."Sales order ID"  = "Sales Order Items"."Sales order ID"  
WHERE	 "Sales Orders"."Status"  not in ( 'draft'  , 'void'  , 'pending_approval'  , 'approved'  )
GROUP BY 1,
	 2,
	 3,
	 4,
	 5,
	  6 
UNION ALL
 SELECT
		 'SR',
		 "Sales Return Receive Items"."Item ID",
		 "Sales Return Items"."Product ID",
		 "Sales Return Receive"."Date",
		 "Sales Return Receive Items"."Quantity Received",
		 "Sales Return Items"."Warehouse ID",
		 0,
		 0
FROM  "Sales Return Items"
LEFT JOIN "Sales Return Receive Items" ON "Sales Return Receive Items"."Sales Return Item ID"  = "Sales Return Items"."Item ID" 
LEFT JOIN "Sales Return Receive" ON "Sales Return Receive"."Sales Return Receive ID"  = "Sales Return Receive Items"."Sales Return Receive ID"  
UNION ALL
 SELECT
		 'Transfer' as "Type",
		 "Transfer Order Items"."Item ID",
		 "Transfer Order Items"."Product ID",
		 "Transfer Order"."Date",
		 if("Transfer Order Items"."Transferred Quantity"  < 0, "Transfer Order Items"."Transferred Quantity", if("Transfer Order"."Status"  in ( 'transferred'  , 'Transferred'  ), "Transfer Order Items"."Transferred Quantity", 0)),
		 "Transfer Order Items"."Warehouse ID",
		 "Transfer Order Items"."Cost Price",
		 0
FROM  "Transfer Order"
LEFT JOIN "Transfer Order Items" ON "Transfer Order"."Transfer Order ID"  = "Transfer Order Items"."Transfer Order ID"  
WHERE	 "Transfer Order"."Status"  not in ( 'draft'  , 'void'  ) /* UNION ALL 
SELECT
		 'comm',
		 "Invoice Items"."Item ID",
		 "Invoice Items"."Product ID",
		 "Invoices"."Invoice Date",
		 0,
		 0,0,
		 -1 * "Invoice Items"."Quantity"
FROM  "Invoice Items"
JOIN "Invoices" ON "Invoices"."Invoice ID"  = "Invoice Items"."Invoice ID"  
WHERE	 "Invoice Items"."SO ItemID"  IS NOT NULL
 AND	("Invoices"."Invoice Status"  NOT IN ( 'Draft'  , 'Void'  ))*/
 
 
 
 
 
Using Pandoc to generate PDFs from Markdown
on a Mac running macOS 10.13.4
To install the needed components you can use Homebrew

Two Components are needed:
Pandoc
PDFLaTex
Install instructions:
Use Homebrew to install pandoc:

brew install pandoc
 Save
Then use Homebrew to install the PDFLaTex program.

brew install --cask basictex
 Save
You should now have all the needed components but it won't work until the pdflatex executable is available in your PATH environment variable. To configure this my technique is to sym link the executable to a directory already in my PATH.

ln -s -v /Library/TeX/texbin/pdflatex /usr/local/bin/pdflatex
 Save
Now if I enter which pdflatex on the command line the system responds:

/usr/local/bin/pdflatex

And now I'm able to generate a PDF from my Markdown file with this command:

pandoc file.md -s -o file.pdf
A multichain crypto wallet is a digital wallet designed to support assets across multiple blockchain networks in one place. Instead of managing separate wallets for different chains, users can store, send, receive, and manage various cryptocurrencies and tokens through a single interface. 

At Hivelance, our multichain crypto wallet development solutions are designed to help businesses launch reliable and future-ready wallet platforms. From consultation and planning to development and deployment, our team focuses on building secure and user-centric wallets that simplify crypto asset management across multiple blockchain networks.

Know More:

Visit – https://www.hivelance.com/cryptocurrency-wallet-development
WhatsApp - +918438595928
Telegram - Hivelance
Mail - sales@hivelance.com
Get Free Demo - https://www.hivelance.com/contact-us
add_filter(
    'wpcp_max_input_bar_value',
    function ( $value ) {
        return 4000;
    }
);
import React, { Component } from "react";

// Child component

class Child extends Component {

  render() {

    return <button onClick={() => this.props.handleClick("Manasi")}>Say Hello</button>;

  }

}

// Parent component demonstrating lifecycle

class App extends Component {

  constructor() {

    super();

    this.state = { count: 0 };

  }

  componentDidMount() {

    console.log("App Mounted");

  }

  componentDidUpdate() {

    console.log("App Updated");

  }

  componentWillUnmount() {

    console.log("App Will Unmount");

  }

  handleClick = (name) => {

    alert(`Hello, ${name}!`);

    this.setState({ count: this.state.count + 1 });

  };

  render() {

    return (

      <div>

        <h2>React Function Argument & Lifecycle</h2>

        <p>Button clicked {this.state.count} times</p>

        <Child handleClick={this.handleClick} />

      </div>

    );

  }

}

export default App;
App.module.css

.title {

  color: green;

  font-weight: bold;

}

App.css

.buttonStyle {

  background-color: lightblue;

  padding: 5px 10px;

  border: none;

  cursor: pointer;

}

App. is

import React, { Component } from "react";

import "./App.css";

import styles from "./App.module.css";

class Child extends Component {

  render() {

    return <button style={{color:"white", background:"orange"}} onClick={() => this.props.sayHello("Manasi")}>Say Hello</button>;

  }

}

class App extends Component {

  state = { count:0 };

  componentDidMount(){ console.log("App Mounted"); }

  handleClick = name => { alert(`Hello, ${name}!`); this.setState({count: this.state.count+1}); }

  render() {

    return (

      <div>

        <h2 className={styles.title}>React CSS & Lifecycle</h2>

        <Child sayHello={this.handleClick} />

        <button className="buttonStyle" onClick={()=>this.setState({count:this.state.count+1})}>Increase</button>

        <p>Count: {this.state.count}</p>

      </div>

    );

  }

}

export default App;
import React, { Component } from "react";

class App extends Component {

  state = { items: ["Apple","Banana"], newItem: "" };

  add = () => this.state.newItem && this.setState({ items:[...this.state.items,this.state.newItem], newItem:"" });

  remove = i => this.setState({ items: this.state.items.filter((_,idx)=>idx!==i) });

  render() {

    return (

      <div>

        <h2>List Example</h2>

        <input value={this.state.newItem} onChange={e=>this.setState({newItem:e.target.value})} placeholder="Add item"/>

        <button onClick={this.add}>Add</button>

        <ul>

          {this.state.items.map((item,i)=><li key={i}>{item} <button onClick={()=>this.remove(i)}>X</button></li>)}

        </ul>

      </div>

    );

  }

}

export default App;
import React, { Component } from "react";

class App extends Component {

  constructor() {

    super();

    this.state = { count: 0, name: "" };

  }

  handleChange = (e) => {

    this.setState({ name: e.target.value });

  };

  increment = () => {

    this.setState({ count: this.state.count + 1 });

  };

  render() {

    return (

      <div>

        <h2>React Class State Example</h2>

        Name: <input value={this.state.name} onChange={this.handleChange} placeholder="Enter name" /><br/>

        Hello, {this.state.name || "Guest"}!<br/><br/>

        Count: {this.state.count} <button onClick={this.increment}>Increase</button>

      </div>

    );

  }

}

export default App;
import React from "react";

function Child({ onClick }) {

  return <button onClick={() => onClick("Manasi")}>Say Hello</button>;

}

function App() {

  const handleClick = (name) => alert(`Hello, ${name}!`);

  return (

    <div>

      <h2>Function Argument Example</h2>

      <Child onClick={handleClick} />

    </div>

  );

}

export default App;
import React from "react";

import "./App.css";

function App() {

  const handleSubmit = (e) => {

    e.preventDefault();

    const name = e.target.name.value;

    const password = e.target.password.value;

    alert(`Name: ${name}\nPassword: ${password}`);

    e.target.reset(); // Clear form

  };

  return (

    <div className="App">

      <h2>Login Form</h2>

      <form onSubmit={handleSubmit}>

        <p>

          Name: <input type="text" name="name" placeholder="Enter name" required />

        </p>

        <p>

          Password: <input type="password" name="password" placeholder="Enter password" required />

        </p>

        <button type="submit">Submit</button>

      </form>

    </div>

  );

}

export default App;
<!DOCTYPE html>

<html ng-app="myApp">

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

  <script src="controller.js"></script>

  <title>External Controller</title>

</head>

<body ng-controller="MyCtrl">

Name: <input ng-model="name" placeholder="Enter name"><br>

<p>{{name}} β€” Count: {{count}}</p>

<button ng-click="increment()">+</button>

</body>

</html>

angular.module('myApp', [])

.controller('MyCtrl', function($scope){

    $scope.name="";

    $scope.count=0;

    $scope.increment=function(){ $scope.count++; };

});
<!DOCTYPE html>

<html ng-app="myApp">

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

</head>

<body ng-controller="MyCtrl">

Name: <input ng-model="name" placeholder="Enter name"><br>

<p>Hello, {{name}}! Count: {{count}}</p>

<button ng-click="count++">Increase</button>

<script>

angular.module('myApp', [])

.controller('MyCtrl', function($scope){

  $scope.name="";

  $scope.count=0;

});

</script>

</body>

</html>
<!DOCTYPE html>

<html ng-app>

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

  <style>

    table, th, td { border:1px solid black; border-collapse:collapse; padding:5px; }

    tr:nth-child(odd){background:#f2f2f2;}

  </style>

</head>

<body>

Name: <input ng-model="s.name" placeholder="Name">

Age: <input type="number" ng-model="s.age" placeholder="Age"><br><br>

<table>

  <tr><th>Name</th><th>Age</th></tr>

  <tr><td>{{s.name}}</td><td>{{s.age}}</td></tr>

</table>

</body>

</html>
<!DOCTYPE html>

<html ng-app>

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

  <title>Input Table</title>

</head>

<body>

<h2>Enter Student Info</h2>

Name: <input ng-model="student.name" placeholder="Name">

Age: <input type="number" ng-model="student.age" placeholder="Age"><br><br>

<table border="1">

  <tr>

    <th>Name</th>

    <th>Age</th>

  </tr>

  <tr>

    <td>{{student.name}}</td>

    <td>{{student.age}}</td>

  </tr>

</table>

</body>

</html>
<!DOCTYPE html>

<html ng-app>

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

  <title>Simple Events</title>

</head>

<body>

<h2>AngularJS Events</h2>

<!-- Click Event -->

<button ng-click="msg='Button Clicked!'">Click Me</button>

<p>{{msg}}</p>

<!-- Blur Event -->

<input ng-model="name" ng-blur="msg2='Input Lost Focus: '+name" placeholder="Type name">

<p>{{msg2}}</p>

</body>

</html>
<!DOCTYPE html>

<html ng-app>

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

  <title>AngularJS Filter Input</title>

</head>

<body>

<h2>Enter Name and Amount</h2>

Name: <input ng-model="name" placeholder="Enter name"><br>

Amount: <input type="number" ng-model="amount" placeholder="Enter amount"><br><br>

<p>Uppercase: {{name | uppercase}}</p>

<p>Lowercase: {{name | lowercase}}</p>

<p>Currency: {{amount | currency}}</p>

</body>

</html>
<!DOCTYPE html>

<html ng-app>

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

  <title>Simple Input MVC</title>

</head>

<body>

<h2>Enter Student Info</h2>

<div>

  Name: <input ng-model="student.name" placeholder="Enter name"><br>

  Age: <input ng-model="student.age" type="number" placeholder="Enter age"><br><br>

  <strong>Preview:</strong><br>

  Name: {{student.name}} <br>

  Age: {{student.age}}

</div>

</body>

</html>

<!DOCTYPE html>

<html ng-app>

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>

</head>

<body>

<h2>Simple Form</h2>

<form ng-submit="submitted=true">

  Name: <input ng-model="user.name" required><br>

  Email: <input type="email" ng-model="user.email" required><br>

  <button type="submit">Submit</button>

</form>

<div ng-if="submitted">

  <p>Name: {{ user.name }}</p>

  <p>Email: {{ user.email }}</p>

</div>

</body>

</html>
Practical 2

<!DOCTYPE html>

<html>

<head>

    <title>Welcome Example</title>

    <!-- PyScript CSS -->

    <link rel="stylesheet" href="https://pyscript.net/releases/2025.8.1/pyscript.css" />

    <!-- PyScript JS -->

    <script src="https://pyscript.net/releases/2025.8.1/pyscript.js"></script>

</head>

<body>

<h2>Welcome Example</h2>

<py-script>

print("Welcome")

</py-script>

</body>

</html>
<!DOCTYPE html>

<html>

<head>

    <title>Good Morning</title>

</head>

<body>

    <h1>Good Morning!</h1>

</body>

</html>
<!DOCTYPE html>

<html>

<head>

    <title>Simple JSON Example</title>

</head>

<body>

<h2>JSON Example</h2>

<script>

    // Create a simple JSON object

    let student = {

        "name": "Manasi",

        "age": 17

    };

    // Display on console

    console.log(student);

    // Display on web page

    document.write("Name: " + student.name + "<br>");

    document.write("Age: " + student.age);

</script>

</body>

</html>
<!DOCTYPE html>

<html>

<head>

    <title>Hello World Example</title>

</head>

<body>

<h2>Check console, page, and alert!</h2>

<script>

    // 1️⃣ Display in browser console

    console.log("Hello World");

    // 2️⃣ Display on web page

    document.write("Hello World<br>");

    // 3️⃣ Display in alert box

    alert("Hello World");

</script>

</body>

</html>
Β‘Perfecto! Ahora entiendo lo que necesitas. Quieres una base completa y fΓ‘cil de memorizar para crear proyectos Laravel rΓ‘pidamente, combinando:

Comandos de Laravel que ya existen para generar cΓ³digo

SubmΓ³dulos de Git para reutilizar tus propios bloques

Vamos a crear un sistema en 3 niveles que podrΓ‘s memorizar fΓ‘cilmente:

πŸ“š NIVEL 1: BASE LARAVEL (Comandos que YA existen)
Crear proyecto nuevo (2 formas)
bash
# OpciΓ³n 1: Con composer (la mΓ‘s universal)
composer create-project laravel/laravel nombre-proyecto

# OpciΓ³n 2: Con installer (mΓ‘s interactivo)
laravel new nombre-proyecto
Comandos CRUCIALES para generar cΓ³digo (MEMORIZA ESTOS)
bash
# 1. Modelo + MigraciΓ³n + Factory + Seeder + Controlador (Β‘TODO EN UNO!)
php artisan make:model Post -mfs --api

# -m  β†’ migration
# -f  β†’ factory  
# -s  β†’ seeder
# --api β†’ controlador API

# 2. Solo controlador (con recursos)
php artisan make:controller PostController --api --model=Post

# 3. Solo migraciΓ³n
php artisan make:migration create_posts_table

# 4. Solo seeder
php artisan make:seeder PostSeeder

# 5. Solo factory
php artisan make:factory PostFactory --model=Post

# 6. Middleware
php artisan make:middleware AdminMiddleware

# 7. Request (validaciΓ³n)
php artisan make:request StorePostRequest
ΒΏVes? Con UNA lΓ­nea creas 5 archivos relacionados. Esto es lo que Laravel ya te da gratis.

🧱 NIVEL 2: TU BASE REUTILIZABLE (Lo que construyes UNA VEZ)
Estructura de tus repositorios base
Crea estos repositorios en GitHub (solo una vez en tu vida):

text
tus-repos-base/
β”œβ”€β”€ base-core/              # 🌟 SIEMPRE lo usas
β”œβ”€β”€ base-auth/              # πŸ” Si necesita login
β”œβ”€β”€ base-admin/             # πŸŽ›οΈ Si necesita panel
β”œβ”€β”€ base-api/                # πŸ”Œ Si es API
└── base-theme/              # 🎨 Si tiene vistas
Contenido de base-core (el mΓ‘s importante)
Este repositorio lo usarΓ‘s en TODOS tus proyectos. Contiene:

text
base-core/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Traits/
β”‚   β”‚   β”œβ”€β”€ ApiResponseTrait.php    # Respuestas JSON estandarizadas
β”‚   β”‚   β”œβ”€β”€ UploadTrait.php          # Subida de archivos
β”‚   β”‚   └── UuidTrait.php            # UUIDs en lugar de IDs
β”‚   β”œβ”€β”€ Interfaces/
β”‚   β”‚   └── RepositoryInterface.php
β”‚   └── Helpers/
β”‚       └── helpers.php
β”œβ”€β”€ app/Base/
β”‚   β”œβ”€β”€ BaseController.php           # Con mΓ©todos success(), error()
β”‚   β”œβ”€β”€ BaseModel.php                 # Con timestamps, softDeletes
β”‚   β”œβ”€β”€ BaseRepository.php            # CRUD genΓ©rico
β”‚   └── BaseService.php                # LΓ³gica de negocio
β”œβ”€β”€ config/
β”‚   └── core.php
└── composer.json
Ejemplo de BaseController.php (para que veas el poder)
php
<?php
namespace Core\Base;

use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;

abstract class BaseController extends Controller
{
    protected $service;
    protected $resource;
    
    public function index(): JsonResponse
    {
        $items = $this->service->all();
        return $this->success($items);
    }
    
    public function show($id): JsonResponse
    {
        $item = $this->service->find($id);
        return $this->success($item);
    }
    
    public function store(Request $request): JsonResponse
    {
        $data = $request->validate($this->rules());
        $item = $this->service->create($data);
        return $this->success($item, 'Creado con Γ©xito', 201);
    }
    
    protected function success($data, $message = 'OK', $code = 200): JsonResponse
    {
        return response()->json([
            'success' => true,
            'message' => $message,
            'data' => $data
        ], $code);
    }
    
    protected function error($message, $code = 400): JsonResponse
    {
        return response()->json([
            'success' => false,
            'message' => $message
        ], $code);
    }
    
    abstract protected function rules(): array;
}
πŸš€ NIVEL 3: FLUJO DE TRABAJO (Lo que haces en CADA proyecto)
Fase 1: Crear proyecto nuevo (2 minutos)
bash
# 1. Crear proyecto Laravel
composer create-project laravel/laravel mi-nuevo-proyecto
cd mi-nuevo-proyecto
git init
git add .
git commit -m "Laravel base"

# 2. AΓ±adir tu core (siempre)
git submodule add https://github.com/tu-usuario/base-core.git core

# 3. AΓ±adir otros mΓ³dulos segΓΊn necesidad
git submodule add https://github.com/tu-usuario/base-auth.git auth  # ΒΏLogin?
git submodule add https://github.com/tu-usuario/base-api.git api    # ΒΏAPI?
git submodule add https://github.com/tu-usuario/base-theme.git theme # ΒΏVistas?

# 4. Configurar composer.json
Fase 2: Configurar composer.json (editar una vez)
json
{
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Core\\": "core/app/",
            "Auth\\": "auth/app/",
            "Api\\": "api/app/",
            "Theme\\": "theme/app/"
        },
        "files": [
            "core/app/Helpers/helpers.php"
        ]
    }
}
bash
composer dump-autoload
Fase 3: Crear PRIMER modelo (usando tu base)
bash
# 1. Generar modelo con Laravel
php artisan make:model Product -mfs --api

# 2. Editar el modelo para que use tu BaseModel
php
// app/Models/Product.php
<?php

namespace App\Models;

use Core\Base\BaseModel;  // 🎯 En lugar de usar Model

class Product extends BaseModel  // 🎯 Extiende de tu base
{
    protected $fillable = ['name', 'price', 'description'];
    
    // Β‘Ya tienes timestamps, softDeletes, UUIDs si los configuraste!
}
Fase 4: Crear controlador (2 lΓ­neas)
bash
# 1. Generar controlador
php artisan make:controller ProductController --api --model=Product
php
// app/Http/Controllers/ProductController.php
<?php

namespace App\Http\Controllers;

use Core\Base\BaseController;  // 🎯 Tu base
use App\Models\Product;
use App\Services\ProductService;
use App\Http\Resources\ProductResource;

class ProductController extends BaseController  // 🎯 Extiende de tu base
{
    public function __construct(ProductService $service)
    {
        $this->service = $service;
        $this->resource = ProductResource::class;
    }
    
    // No necesitas escribir index, show, store...
    // Β‘Ya los heredas de BaseController!
    
    protected function rules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'price' => 'required|numeric|min:0',
            'description' => 'nullable|string'
        ];
    }
}
Fase 5: Usar en rutas
php
// routes/api.php
Route::apiResource('products', ProductController::class);
Β‘Ya tienes CRUD completo con 0 lΓ­neas de lΓ³gica!

πŸ“‹ RESUMEN PARA MEMORIZAR (Lo ÚNICO que necesitas recordar)
DÍA 1: Preparar tus bases (hacerlo UNA VEZ)
bash
# Crear repos base en GitHub
mkdir base-core && cd base-core
# ... crear estructura
git init && git add . && git commit -m "Core"
git remote add origin https://github.com/tu-org/base-core.git
git push

# Repite para: base-auth, base-api, base-theme...
CADA NUEVO PROYECTO (lo que repites)
bash
# 1. Crear proyecto
composer create-project laravel/laravel mi-proyecto
cd mi-proyecto

# 2. Git init
git init
git add .
git commit -m "Base Laravel"

# 3. AΓ±adir submΓ³dulos (Β‘Solo 3 comandos!)
git submodule add https://github.com/tu-org/base-core.git core
git submodule add https://github.com/tu-org/base-auth.git auth  # si toca
git submodule add https://github.com/tu-org/base-api.git api    # si toca

# 4. Configurar autoload (editar composer.json)
# AΓ±adir "Core\\": "core/app/" etc.

composer dump-autoload

# 5. Β‘A programar!
php artisan make:model Product -mfs --api
# Editas modelo para extender BaseModel
# Editas controlador para extender BaseController
# Β‘Listo!
Comandos de Laravel que SIEMPRE usas
bash
# Para crear cosas nuevas
php artisan make:model Nombre -mfs --api     # Β‘EL REY!
php artisan make:controller Nombre --api --model=Nombre
php artisan make:migration crear_tabla
php artisan make:seeder NombreSeeder
php artisan make:middleware Nombre

# Para correr
php artisan serve
php artisan migrate
php artisan db:seed
php artisan make:cast  # Para tipos personalizados
Comandos de Git que SIEMPRE usas
bash
# Al empezar proyecto
git submodule add URL carpeta

# Al clonar proyecto con submΓ³dulos
git clone URL
git submodule update --init --recursive

# Para actualizar submΓ³dulos
git submodule foreach git pull origin main
🎯 EJEMPLO COMPLETO RÁPIDO
Imagina que hoy te piden hacer una API de tareas:

bash
# 1. Crear proyecto
composer create-project laravel/laravel task-api
cd task-api

# 2. Git y submΓ³dulos
git init
git add . && git commit -m "Base"
git submodule add https://github.com/tu-org/base-core.git core
git submodule add https://github.com/tu-org/base-api.git api

# 3. Editar composer.json (aΓ±adir Core\ y Api\)
# "Core\\": "core/app/",
# "Api\\": "api/app/",

composer dump-autoload

# 4. Crear modelo Task
php artisan make:model Task -mfs --api

# 5. Editar app/Models/Task.php
# use Core\Base\BaseModel;
# class Task extends BaseModel

# 6. Editar migrations (aΓ±adir campos)
# $table->string('title');
# $table->text('description')->nullable();
# $table->boolean('completed')->default(false);

# 7. Crear controlador
php artisan make:controller TaskController --api --model=Task

# 8. Editar app/Http/Controllers/TaskController.php
# use Core\Base\BaseController;
# class TaskController extends BaseController

# 9. Definir reglas de validaciΓ³n
# protected function rules() { return ['title' => 'required']; }

# 10. Rutas
# routes/api.php: Route::apiResource('tasks', TaskController::class);

# 11. Migrar
php artisan migrate

# Β‘API lista! Con index, show, store, update, delete funcionando
ΒΏVes? En menos de 10 minutos tienes una API completa gracias a:

Laravel: Genera modelos, controladores, migraciones

Tus submΓ³dulos: Aportan la lΓ³gica base (respuestas JSON, CRUD genΓ©rico)

πŸ“ TU HOJA DE TRUCO (Para imprimir y pegar en la pared)
text
πŸš€ NUEVO PROYECTO LARAVEL EN 5 PASOS:

1. composer create-project laravel/laravel nombre
2. cd nombre && git init
3. git submodule add URL_CORE core
4. git submodule add URL_AUTH auth  (si toca)
5. composer dump-autoload

πŸ—οΈ CREAR NUEVO RECURSO:

1. php artisan make:model Recurso -mfs --api
2. Editar modelo β†’ extiende BaseModel
3. Editar migraciΓ³n β†’ aΓ±adir campos
4. php artisan make:controller RecursoController --api --model=Recurso
5. Editar controller β†’ extiende BaseController
6. php artisan migrate

πŸ”„ ACTUALIZAR SUBMΓ“DULOS:

git submodule foreach git pull origin main

πŸ“‹ COMANDOS ÚTILES:

php artisan serve
php artisan tinker
php artisan route:list
php artisan make:middleware
php artisan make:request
php artisan make:cast
ΒΏTiene mΓ‘s sentido ahora? La clave estΓ‘ en:

Laravel te da los comandos make:model, make:controller, etc.

Tus submΓ³dulos te dan las clases base (BaseController, BaseModel)

TΓΊ solo conectas ambas cosas (extender tus bases y definir reglas)
import jenkins.model.*

instance = Jenkins.getInstance()
globalNodeProperties = instance.getGlobalNodeProperties()

myParam = 'Not Set'

globalNodeProperties.each {
  envVars = it.getEnvVars()
  if (envVars.get('ENV_VAR_NAME') != null) {
    myParam = envVars.get('ENV_VAR_NAME');
  }
}


if (myParam) {
    // Assuming the environment variable is a comma-separated string like "option1,option2,option3"
    return myParam.split(',').collect{ it.trim() }
} else {
    return ["Environment variable not set or empty"]
}
import cv2
import numpy as np
from PIL import Image

# ==========================
# CONFIG
# ==========================
ROOM_IMAGE  = r"E:\xampp\htdocs\python\jan_jatra_improvement\Gemini_Generated_Image_rct6syrct6syrct6.png"
TILE_IMAGE  = r"E:\xampp\htdocs\python\jan_jatra_improvement\img_002.jpg"
OUTPUT      = "final_grid_engine.png"
GROUT_WIDTH = 3
GROUT_COLOR = (160, 160, 160)

# ==========================
# GLOBALS
# ==========================
original_img     = None
room_img         = None
tile_img         = None

vertical_lines   = []
horizontal_lines = []
obstacles        = []

current_points   = []
obstacle_points  = []
mouse_pos        = None
mode             = "vertical"
show_grid        = True
grout_on         = True
tile_cols        = 5     # user adjustable with +/-
tile_rows_offset = 0     # fine-tune rows with [ / ]


# ==========================
# IMAGE LOADING
# ==========================
def load_image(path):
    pil = Image.open(path).convert("RGB")
    return cv2.cvtColor(np.array(pil), cv2.COLOR_RGB2BGR)


# ==========================
# LINE MATH
# ==========================
def line_intersect(l1, l2):
    x1, y1, x2, y2 = map(float, l1)
    x3, y3, x4, y4 = map(float, l2)
    denom = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4)
    if abs(denom) < 1e-8:
        return None
    px = ((x1*y2 - y1*x2)*(x3-x4) - (x1-x2)*(x3*y4 - y3*x4)) / denom
    py = ((x1*y2 - y1*x2)*(y3-y4) - (y1-y2)*(x3*y4 - y3*x4)) / denom
    return (int(round(px)), int(round(py)))


def extend_line(line, scale=10000):
    x1, y1, x2, y2 = line
    dx, dy = x2 - x1, y2 - y1
    L = max(np.hypot(dx, dy), 1e-6)
    ux, uy = dx / L, dy / L
    return (int(x1 - ux*scale), int(y1 - uy*scale),
            int(x2 + ux*scale), int(y2 + uy*scale))


def sort_vertical(lines, img_h):
    def x_at_mid(l):
        x1, y1, x2, y2 = l
        if abs(y2 - y1) < 1e-6: return (x1 + x2) / 2
        t = (img_h / 2 - y1) / (y2 - y1)
        return x1 + t * (x2 - x1)
    return sorted(lines, key=x_at_mid)


def sort_horizontal(lines, img_w):
    def y_at_mid(l):
        x1, y1, x2, y2 = l
        if abs(x2 - x1) < 1e-6: return (y1 + y2) / 2
        t = (img_w / 2 - x1) / (x2 - x1)
        return y1 + t * (y2 - y1)
    return sorted(lines, key=y_at_mid)


# ==========================
# CORNER ORDERING (from reference code β€” prevents stretching)
# ==========================
def order_points_perspective(pts):
    """
    Order 4 points as: TL, TR, BR, BL
    Same method as reference code β€” guaranteed correct ordering.
    """
    pts = np.array(pts, dtype=np.float32)
    rect = np.zeros((4, 2), dtype=np.float32)
    s = pts.sum(axis=1)          # x + y
    d = np.diff(pts, axis=1)[:, 0]  # x - y
    rect[0] = pts[np.argmin(s)]  # top-left     (smallest x+y)
    rect[2] = pts[np.argmax(s)]  # bottom-right (largest x+y)
    rect[1] = pts[np.argmax(d)]  # top-right    (largest x-y)
    rect[3] = pts[np.argmin(d)]  # bottom-left  (smallest x-y)
    return rect


# ==========================
# GRID FROM LINES
# ==========================
def compute_line_grid():
    """Compute intersection grid from drawn lines (for visualization)."""
    h, w = original_img.shape[:2]
    v_sorted = sort_vertical(vertical_lines, h)
    h_sorted = sort_horizontal(horizontal_lines, w)
    grid = []
    for hl in h_sorted:
        row = []
        for vl in v_sorted:
            pt = line_intersect(vl, hl)
            if pt is not None:
                row.append(pt)
        grid.append(row)
    return grid


def get_outer_corners():
    """Extract and properly order the 4 outer corners from grid."""
    grid = compute_line_grid()
    if not grid or len(grid) < 2:
        return None
    n_cols = min(len(row) for row in grid)
    if n_cols < 2:
        return None

    tl = grid[0][0]
    tr = grid[0][n_cols - 1]
    br = grid[-1][n_cols - 1]
    bl = grid[-1][0]

    # KEY FIX: use reference code's ordering method
    return order_points_perspective(np.float32([tl, tr, br, bl]))


# ==========================
# TILE COUNT COMPUTATION (aspect-ratio preserving)
# ==========================
def compute_tile_counts(corners):
    """
    Auto-compute num_rows so tiles maintain their aspect ratio.
    num_cols = user-set tile_cols
    num_rows = computed from floor proportions + tile aspect ratio
    """
    h_t, w_t = tile_img.shape[:2]

    # Measure floor quad dimensions in screen space
    top_w    = np.linalg.norm(corners[1] - corners[0])
    bottom_w = np.linalg.norm(corners[2] - corners[3])
    left_h   = np.linalg.norm(corners[3] - corners[0])
    right_h  = np.linalg.norm(corners[2] - corners[1])

    avg_w = (top_w + bottom_w) / 2
    avg_h = (left_h + right_h) / 2

    num_cols = max(1, tile_cols)

    # KEY: auto-compute rows to preserve tile aspect ratio
    # We want: (num_cols * w_t) / (num_rows * h_t) β‰ˆ avg_w / avg_h
    # β†’ num_rows = num_cols * w_t * avg_h / (h_t * avg_w)
    num_rows = max(1, int(round(
        num_cols * (avg_h / max(avg_w, 1)) * (w_t / max(h_t, 1))
    )))

    # Apply user fine-tune offset
    num_rows = max(1, num_rows + tile_rows_offset)

    return num_cols, num_rows


# ==========================
# TILE PLACEMENT (reference code's place_grid method)
# ==========================
def apply_tiles():
    """
    Exact same approach as reference code's place_grid():
    1. Build rectangular tiled texture at NATIVE tile resolution
    2. Single perspective warp to floor quad
    3. Mask + composite
    """
    global room_img

    corners = get_outer_corners()
    if corners is None:
        print("  ⚠  Need at least 2 vertical + 2 horizontal lines!")
        return

    h, w = original_img.shape[:2]
    h_t, w_t = tile_img.shape[:2]
    result = original_img.copy()

    num_cols, num_rows = compute_tile_counts(corners)
    print(f"  Tiles: {num_cols} cols Γ— {num_rows} rows = {num_cols * num_rows}")
    print(f"  Tile size: {w_t}Γ—{h_t}px")

    # ── Step 1: Build tiled texture (reference code style) ──
    width_rect  = num_cols * w_t
    height_rect = num_rows * h_t

    tiled = np.zeros((height_rect, width_rect, 3), dtype=np.uint8)
    for row in range(num_rows):
        for col in range(num_cols):
            tiled[row * h_t : (row + 1) * h_t,
                  col * w_t : (col + 1) * w_t] = tile_img

    # ── Step 1b: Bake grout lines into texture ──
    if grout_on and GROUT_WIDTH > 0:
        gw = max(1, GROUT_WIDTH)
        for r in range(1, num_rows):
            y = r * h_t
            tiled[max(0, y - gw):min(height_rect, y + gw), :] = GROUT_COLOR
        for c in range(1, num_cols):
            x = c * w_t
            tiled[:, max(0, x - gw):min(width_rect, x + gw)] = GROUT_COLOR

    # ── Step 2: Perspective warp (EXACTLY like reference code) ──
    src_pts = np.float32([
        [0,          0          ],   # TL
        [width_rect, 0          ],   # TR
        [width_rect, height_rect],   # BR
        [0,          height_rect]    # BL
    ])

    M = cv2.getPerspectiveTransform(src_pts, corners)

    warped = cv2.warpPerspective(
        tiled, M, (w, h),
        flags=cv2.INTER_LANCZOS4,
        borderMode=cv2.BORDER_CONSTANT,
        borderValue=(0, 0, 0)
    )

    # ── Step 3: Mask (floor quad minus obstacles) ──
    mask = np.zeros((h, w), dtype=np.uint8)
    cv2.fillPoly(mask, [corners.astype(np.int32).reshape(-1, 1, 2)], 255)

    for obs in obstacles:
        if len(obs) >= 3:
            cv2.fillPoly(mask, [np.array(obs, np.int32).reshape(-1, 1, 2)], 0)

    # ── Step 4: Composite (same as reference) ──
    mask3 = cv2.merge([mask, mask, mask])
    room_img = np.where(mask3 == 255, warped, result).astype(np.uint8)

    print(f"  βœ“  Done! No stretch β€” tile aspect ratio preserved.")


# ==========================
# TILE PREVIEW GRID (computed from transform matrix)
# ==========================
def compute_tile_preview():
    """
    Show where tiles will ACTUALLY go (not grid line intersections).
    Uses the perspective transform matrix to project tile boundaries.
    """
    corners = get_outer_corners()
    if corners is None:
        return None

    h_t, w_t = tile_img.shape[:2]
    num_cols, num_rows = compute_tile_counts(corners)

    width_rect  = num_cols * w_t
    height_rect = num_rows * h_t

    src_pts = np.float32([
        [0, 0], [width_rect, 0],
        [width_rect, height_rect], [0, height_rect]
    ])
    M = cv2.getPerspectiveTransform(src_pts, corners)

    # Project each tile corner through the transform
    preview = []
    for r in range(num_rows + 1):
        row = []
        for c in range(num_cols + 1):
            pt = np.float64([c * w_t, r * h_t, 1.0])
            t = M @ pt
            if abs(t[2]) > 1e-8:
                t /= t[2]
                row.append((int(t[0]), int(t[1])))
            else:
                row.append(None)
        preview.append(row)
    return preview, num_cols, num_rows


# ==========================
# MOUSE
# ==========================
def mouse_cb(event, x, y, flags, param):
    global current_points, mouse_pos, obstacle_points

    if event == cv2.EVENT_MOUSEMOVE:
        mouse_pos = (x, y)

    elif event == cv2.EVENT_LBUTTONDOWN:
        if mode in ("vertical", "horizontal"):
            current_points.append((x, y))
            if len(current_points) == 2:
                line = (*current_points[0], *current_points[1])
                if mode == "vertical":
                    vertical_lines.append(line)
                    print(f"  + V-line #{len(vertical_lines)}")
                else:
                    horizontal_lines.append(line)
                    print(f"  + H-line #{len(horizontal_lines)}")
                current_points = []
        elif mode == "obstacle":
            obstacle_points.append((x, y))

    elif event == cv2.EVENT_RBUTTONDOWN:
        current_points  = []
        obstacle_points = []


# ==========================
# OVERLAY
# ==========================
def draw_overlay():
    img  = room_img.copy()
    h, w = img.shape[:2]

    # ── V lines (green) ──
    for l in vertical_lines:
        el = extend_line(l)
        cv2.line(img, (el[0],el[1]), (el[2],el[3]), (0,140,0), 1, cv2.LINE_AA)
        cv2.line(img, (l[0],l[1]), (l[2],l[3]), (0,255,0), 2, cv2.LINE_AA)
        cv2.circle(img, (l[0],l[1]), 5, (255,255,255), -1)
        cv2.circle(img, (l[2],l[3]), 5, (255,255,255), -1)

    # ── H lines (orange) ──
    for l in horizontal_lines:
        el = extend_line(l)
        cv2.line(img, (el[0],el[1]), (el[2],el[3]), (140,60,0), 1, cv2.LINE_AA)
        cv2.line(img, (l[0],l[1]), (l[2],l[3]), (255,120,0), 2, cv2.LINE_AA)
        cv2.circle(img, (l[0],l[1]), 5, (255,255,255), -1)
        cv2.circle(img, (l[2],l[3]), 5, (255,255,255), -1)

    # ── Tile preview grid (where tiles ACTUALLY go) ──
    if show_grid and len(vertical_lines) >= 2 and len(horizontal_lines) >= 2:
        result = compute_tile_preview()
        if result:
            preview, nc, nr = result
            for i in range(len(preview) - 1):
                for j in range(len(preview[i]) - 1):
                    quad = [preview[i][j],   preview[i][j+1],
                            preview[i+1][j+1], preview[i+1][j]]
                    if all(p is not None for p in quad):
                        pts = np.array(quad, np.int32)
                        cv2.polylines(img, [pts], True,
                                      (0, 255, 255), 1, cv2.LINE_AA)

            # Corner dots
            for row in preview:
                for pt in row:
                    if pt and -50 <= pt[0] < w+50 and -50 <= pt[1] < h+50:
                        cv2.circle(img, pt, 4, (0,255,255), -1)
                        cv2.circle(img, pt, 4, (0,0,0), 1)

            # Highlight 4 outer corners
            corners = get_outer_corners()
            if corners is not None:
                for i, c in enumerate(corners):
                    ci = (int(c[0]), int(c[1]))
                    cv2.circle(img, ci, 8, (0,0,255), 2)
                    labels = ["TL","TR","BR","BL"]
                    cv2.putText(img, labels[i], (ci[0]+12, ci[1]-5),
                                cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0,0,255), 2)

    # ── Live line preview ──
    if len(current_points) == 1 and mouse_pos:
        c = ((0,255,0) if mode == "vertical"
             else (255,120,0) if mode == "horizontal"
             else (0,0,255))
        cv2.line(img, current_points[0], mouse_pos, c, 2, cv2.LINE_AA)
        cv2.circle(img, current_points[0], 5, (255,255,255), -1)

    # ── Finished obstacles ──
    for obs in obstacles:
        ov = img.copy()
        cv2.fillPoly(ov, [np.array(obs, np.int32)], (0,0,180))
        img = cv2.addWeighted(ov, 0.25, img, 0.75, 0)
        cv2.polylines(img, [np.array(obs, np.int32)], True,
                      (0,0,255), 2, cv2.LINE_AA)

    # ── Obstacle in progress ──
    if obstacle_points:
        for p in obstacle_points:
            cv2.circle(img, p, 4, (0,0,255), -1)
        if len(obstacle_points) > 1:
            cv2.polylines(img, [np.array(obstacle_points)],
                          False, (0,0,255), 2)
        if mouse_pos:
            cv2.line(img, obstacle_points[-1], mouse_pos,
                     (0,0,200), 1, cv2.LINE_AA)

    # ── Tile thumbnail ──
    thumb_h = 80
    th_o, tw_o = tile_img.shape[:2]
    thumb_w = int(thumb_h * tw_o / th_o)
    thumb = cv2.resize(tile_img, (thumb_w, thumb_h), interpolation=cv2.INTER_AREA)
    tx, ty = w - thumb_w - 10, 10
    if tx > 0:
        img[ty:ty+thumb_h, tx:tx+thumb_w] = thumb
        cv2.rectangle(img, (tx-1, ty-1),
                      (tx+thumb_w, ty+thumb_h), (255,255,255), 1)
        cv2.putText(img, f"{tw_o}x{th_o}", (tx, ty+thumb_h+16),
                    cv2.FONT_HERSHEY_SIMPLEX, 0.4, (255,255,255), 1)

    # ── HUD ──
    ov = img.copy()
    cv2.rectangle(ov, (0, 0), (540, 95), (30, 30, 30), -1)
    img = cv2.addWeighted(ov, 0.7, img, 0.3, 0)

    mc = {"vertical":(0,255,0), "horizontal":(255,120,0), "obstacle":(0,0,255)}
    cv2.putText(img, f"Mode: {mode.upper()}", (10, 22),
                cv2.FONT_HERSHEY_SIMPLEX, 0.65, mc[mode], 2)

    # Tile count info
    corners = get_outer_corners()
    if corners is not None:
        nc, nr = compute_tile_counts(corners)
        info = (f"V:{len(vertical_lines)}  H:{len(horizontal_lines)}  "
                f"Tiles:{nc}x{nr}={nc*nr}  "
                f"Cols(+/-):{tile_cols}  RowAdj([/]):{tile_rows_offset:+d}")
    else:
        info = f"V:{len(vertical_lines)}  H:{len(horizontal_lines)}  (need 2V + 2H)"

    cv2.putText(img, info, (10, 48),
                cv2.FONT_HERSHEY_SIMPLEX, 0.38, (220, 220, 220), 1)
    cv2.putText(img,
        f"Grid:{'ON' if show_grid else 'OFF'}  "
        f"Grout:{'ON' if grout_on else 'OFF'}  "
        f"|  ENTER=place  +/-=cols  [/]=rows",
        (10, 72), cv2.FONT_HERSHEY_SIMPLEX, 0.38, (180, 180, 180), 1)

    return img


# ==========================
# MAIN
# ==========================
def main():
    global original_img, room_img, tile_img, mode
    global current_points, obstacle_points, obstacles
    global vertical_lines, horizontal_lines
    global show_grid, grout_on, tile_cols, tile_rows_offset

    original_img = load_image(ROOM_IMAGE)
    room_img     = original_img.copy()
    tile_img     = load_image(TILE_IMAGE)

    cv2.namedWindow("GRID ENGINE", cv2.WINDOW_NORMAL)
    cv2.resizeWindow("GRID ENGINE", 1200, 800)
    cv2.setMouseCallback("GRID ENGINE", mouse_cb)

    print("""
  ╔════════════════════════════════════════════════════╗
  β•‘     TILE GRID ENGINE v4  (No-Stretch Edition)      β•‘
  ╠════════════════════════════════════════════════════╣
  β•‘  V            β†’ Vertical-line mode                 β•‘
  β•‘  H            β†’ Horizontal-line mode               β•‘
  β•‘  O            β†’ Obstacle mode                      β•‘
  β•‘  Click Γ—2     β†’ Add line (auto)                    β•‘
  β•‘  Right-click  β†’ Cancel current drawing             β•‘
  β•‘  C            β†’ Close obstacle polygon             β•‘
  β•‘  Z            β†’ Undo last action                   β•‘
  β•‘  X            β†’ Clear all                          β•‘
  β•‘  R            β†’ Reset image (keep lines)           β•‘
  β•‘  G            β†’ Toggle grid preview                β•‘
  β•‘  T            β†’ Toggle grout                       β•‘
  β•‘  + / -        β†’ Adjust tile COLUMNS                β•‘
  β•‘  [ / ]        β†’ Fine-tune tile ROWS                β•‘
  β•‘  ENTER        β†’ Place tiles (no stretch!)          β•‘
  β•‘  S            β†’ Save result                        β•‘
  β•‘  ESC          β†’ Exit                               β•‘
  β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
    """)

    while True:
        display = draw_overlay()
        cv2.imshow("GRID ENGINE", display)
        key = cv2.waitKey(20) & 0xFF

        if key == 27:
            break

        elif key == ord('v'):
            mode = "vertical"; current_points = []
            print("  β†’ Vertical-line mode")

        elif key == ord('h'):
            mode = "horizontal"; current_points = []
            print("  β†’ Horizontal-line mode")

        elif key == ord('o'):
            mode = "obstacle"; current_points = []
            print("  β†’ Obstacle mode  (click pts, C to close)")

        elif key == ord('c'):
            if mode == "obstacle" and len(obstacle_points) >= 3:
                obstacles.append(obstacle_points.copy())
                obstacle_points = []
                print(f"  βœ“ Obstacle #{len(obstacles)} closed")

        elif key == ord('z'):
            if mode == "vertical" and vertical_lines:
                vertical_lines.pop(); print("  ↩ Undid V-line")
            elif mode == "horizontal" and horizontal_lines:
                horizontal_lines.pop(); print("  ↩ Undid H-line")
            elif mode == "obstacle":
                if obstacle_points: obstacle_points.pop()
                elif obstacles: obstacles.pop(); print("  ↩ Undid obstacle")

        elif key == ord('x'):
            vertical_lines.clear(); horizontal_lines.clear()
            obstacles.clear(); obstacle_points.clear(); current_points.clear()
            room_img = original_img.copy()
            tile_rows_offset = 0
            print("  βœ— Cleared all")

        elif key == ord('r'):
            room_img = original_img.copy()
            print("  ↻ Image reset (lines kept)")

        elif key == ord('g'):
            show_grid = not show_grid
            print(f"  Grid: {'ON' if show_grid else 'OFF'}")

        elif key == ord('t'):
            grout_on = not grout_on
            print(f"  Grout: {'ON' if grout_on else 'OFF'}")

        elif key in (ord('+'), ord('=')):
            tile_cols = min(tile_cols + 1, 50)
            print(f"  Cols: {tile_cols}")

        elif key in (ord('-'), ord('_')):
            tile_cols = max(tile_cols - 1, 1)
            print(f"  Cols: {tile_cols}")

        elif key == ord(']'):
            tile_rows_offset += 1
            print(f"  Row offset: {tile_rows_offset:+d}")

        elif key == ord('['):
            tile_rows_offset -= 1
            print(f"  Row offset: {tile_rows_offset:+d}")

        elif key == 13:  # ENTER
            print("  Placing tiles …")
            apply_tiles()

        elif key == ord('s'):
            cv2.imwrite(OUTPUT, room_img)
            print(f"  πŸ’Ύ Saved β†’ {OUTPUT}")

    cv2.destroyAllWindows()


if __name__ == "__main__":
    main()
print("--- MY BMI CALCULATOR ---")
print(" 1 for Kilograms and Meters")
print("2 for Pounds and Inches")
unit_type = input("Choose 1 or 2: ")
if unit_type == "1":
    w = float(input("place your weight in kg: "))
    h = float(input("place your height in meters: "))
    result = w / (h * h)
if unit_type == "2":
    w = float(input("Enter weight in lbs: "))
    h = float(input("Enter height in inches: "))
    result = (w / (h * h)) * 703
print("Your BMI is:")
print(result)
if result < 18.5:
    print("Status: Stick man.com")
elif result < 25:
    print("Status:majembe")
elif result < 30:
    print("Status: nicocado avocado")
else:
    print("Status: you are huge")
Generar CRUD

# 1. Instalar
composer require ibex/crud-generator --dev

# 2. Publicar
php artisan vendor:publish --tag=crud

# 3. Generar CRUD
php artisan make:crud NombreModelo --fields="campo1:tipo, campo2:tipo"

# 4. Migrar
php artisan migrate

# 5. Servir
php artisan serve

# 6. Visitar
http://localhost:8000/nombre-modelos

Cabe decir que no crea las rutas del proyecyo y hay que agregarlas a mano y que hay una opcion para personalizar las plantillas:
php artisan vendor:publish --tag=crud

Generar el diagrama ER

Instalacion:

1- instalar el siguiente programa
sudo apt-get install graphviz

2-(IMPORTANTE) Ejecutar el siguiente comando dentro del proyecto para instalar la extension por composer:
composer require beyondcode/laravel-er-diagram-generator --dev

3-Dentro del proyecto ejecutar el siguiente comando para generar el graph.png el cual sera el diagrama modelo entidad relacion:
php artisan generate:erd

Generar Migrations
1️⃣ kitloong/laravel-migrations-generator (recomendado)


Genera solo migraciones a partir de una base de datos existente.
_____________________________
Compatible con Laravel 10+.

Detecta:

Columnas y tipos

Índices (unique, index)

Foreign keys

Tablas pivote
______________________________
1.
InstalaciΓ³n
composer require --dev kitloong/laravel-migrations-generator
______________________________
2.
Uso bΓ‘sico
php artisan migrate:generate


Esto genera todas las migraciones de tu DB en database/migrations/.
______________________________
OPCIONAL
Opcional: solo algunas tablas:

php artisan migrate:generate users,posts,comments


Ignorar tablas:

php artisan migrate:generate --ignore-tables=migrations,failed_jobs
tapiceria-odami/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Console/
β”‚   β”‚   └── Commands/
β”‚   β”‚       β”œβ”€β”€ BackupAutomatico.php
β”‚   β”‚       β”œβ”€β”€ ComprimirFotosAntiguas.php
β”‚   β”‚       β”œβ”€β”€ VerificarEspacioDisco.php
β”‚   β”‚       └── LimpiarRespaldosAntiguos.php
β”‚   β”œβ”€β”€ Exceptions/
β”‚   β”‚   β”œβ”€β”€ BackupException.php
β”‚   β”‚   β”œβ”€β”€ FacturacionException.php
β”‚   β”‚   └── FotoException.php
β”‚   β”œβ”€β”€ Http/
β”‚   β”‚   β”œβ”€β”€ Controllers/
β”‚   β”‚   β”‚   β”œβ”€β”€ Auth/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ LoginController.php
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ RegisterController.php
β”‚   β”‚   β”‚   β”‚   └── ProfileController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ Admin/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardController.php
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ UserController.php
β”‚   β”‚   β”‚   β”‚   └── SystemController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ BackupController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ ClienteController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ FacturaController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ FotoTrabajoController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ MaterialController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ PagoController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ ReporteController.php
β”‚   β”‚   β”‚   β”œβ”€β”€ TrabajoController.php
β”‚   β”‚   β”‚   └── ClausulaController.php
β”‚   β”‚   β”œβ”€β”€ Middleware/
β”‚   β”‚   β”‚   β”œβ”€β”€ CheckRole.php
β”‚   β”‚   β”‚   β”œβ”€β”€ CheckFacturaStatus.php
β”‚   β”‚   β”‚   └── LogBackupActivity.php
β”‚   β”‚   └── Requests/
β”‚   β”‚       β”œβ”€β”€ ClienteRequest.php
β”‚   β”‚       β”œβ”€β”€ TrabajoRequest.php
β”‚   β”‚       β”œβ”€β”€ FacturaRequest.php
β”‚   β”‚       β”œβ”€β”€ FotoTrabajoRequest.php
β”‚   β”‚       β”œβ”€β”€ PagoRequest.php
β”‚   β”‚       β”œβ”€β”€ MaterialRequest.php
β”‚   β”‚       └── BackupRequest.php
β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   β”œβ”€β”€ User.php
β”‚   β”‚   β”œβ”€β”€ Role.php
β”‚   β”‚   β”œβ”€β”€ BackupLog.php
β”‚   β”‚   β”œβ”€β”€ Cliente.php
β”‚   β”‚   β”œβ”€β”€ ControlFactura.php
β”‚   β”‚   β”œβ”€β”€ Factura.php
β”‚   β”‚   β”œβ”€β”€ FotoTrabajo.php
β”‚   β”‚   β”œβ”€β”€ Trabajo.php
β”‚   β”‚   β”œβ”€β”€ Material.php
β”‚   β”‚   β”œβ”€β”€ Clausula.php
β”‚   β”‚   β”œβ”€β”€ Pago.php
β”‚   β”‚   └── Configuracion.php
β”‚   β”œβ”€β”€ Services/
β”‚   β”‚   β”œβ”€β”€ BackupService.php
β”‚   β”‚   β”œβ”€β”€ FacturacionService.php
β”‚   β”‚   β”œβ”€β”€ FotoService.php
β”‚   β”‚   β”œβ”€β”€ ReporteService.php
β”‚   β”‚   β”œβ”€β”€ EstadisticaService.php
β”‚   β”‚   β”œβ”€β”€ PagoService.php
β”‚   β”‚   β”œβ”€β”€ CompresionService.php
β”‚   β”‚   └── EspacioDiscoService.php
β”‚   β”œβ”€β”€ Traits/
β”‚   β”‚   β”œβ”€β”€ GeneraNumeroFactura.php
β”‚   β”‚   β”œβ”€β”€ ManejaFotos.php
β”‚   β”‚   β”œβ”€β”€ CalculaCostos.php
β”‚   β”‚   └── BackupTrait.php
β”‚   β”œβ”€β”€ Observers/
β”‚   β”‚   β”œβ”€β”€ FacturaObserver.php
β”‚   β”‚   β”œβ”€β”€ TrabajoObserver.php
β”‚   β”‚   └── FotoTrabajoObserver.php
β”‚   β”œβ”€β”€ Providers/
β”‚   β”‚   β”œβ”€β”€ AppServiceProvider.php
β”‚   β”‚   β”œβ”€β”€ AuthServiceProvider.php
β”‚   β”‚   └── BackupServiceProvider.php
β”‚   └── Rules/
β”‚       β”œβ”€β”€ NumeroFacturaUnico.php
β”‚       β”œβ”€β”€ EspacioDiscoSuficiente.php
β”‚       └── FormatoSerieFactura.php
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ app.php
β”‚   β”œβ”€β”€ auth.php
β”‚   β”œβ”€β”€ database.php
β”‚   β”œβ”€β”€ filesystems.php
β”‚   β”œβ”€β”€ backup.php
β”‚   β”œβ”€β”€ facturacion.php
β”‚   β”œβ”€β”€ roles.php
β”‚   └── compresion.php
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ migrations/
β”‚   β”‚   β”œβ”€β”€ 2014_10_12_000000_create_users_table.php
β”‚   β”‚   β”œβ”€β”€ 2014_10_12_100000_create_password_reset_tokens_table.php
β”‚   β”‚   β”œβ”€β”€ 2014_10_12_200000_create_roles_table.php
β”‚   β”‚   β”œβ”€β”€ 2014_10_12_300000_create_role_user_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000000_create_clientes_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000001_create_trabajos_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000002_create_materiales_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000003_create_facturas_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000004_create_clausulas_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000005_create_fotos_trabajos_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000006_create_backup_logs_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000007_create_control_facturas_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000008_create_pagos_table.php
β”‚   β”‚   β”œβ”€β”€ 2024_01_01_000009_create_configuraciones_table.php
β”‚   β”‚   └── 2024_01_01_000010_create_trabajo_material_table.php
β”‚   β”œβ”€β”€ seeders/
β”‚   β”‚   β”œβ”€β”€ DatabaseSeeder.php
β”‚   β”‚   β”œβ”€β”€ RolesSeeder.php
β”‚   β”‚   β”œβ”€β”€ UsersSeeder.php
β”‚   β”‚   β”œβ”€β”€ ClientesSeeder.php
β”‚   β”‚   β”œβ”€β”€ TrabajosSeeder.php
β”‚   β”‚   β”œβ”€β”€ MaterialesSeeder.php
β”‚   β”‚   β”œβ”€β”€ FacturasSeeder.php
β”‚   β”‚   β”œβ”€β”€ FotosTrabajosSeeder.php
β”‚   β”‚   β”œβ”€β”€ ClausulasSeeder.php
β”‚   β”‚   β”œβ”€β”€ PagosSeeder.php
β”‚   β”‚   └── ConfiguracionesSeeder.php
β”‚   └── factories/
β”‚       β”œβ”€β”€ UserFactory.php
β”‚       β”œβ”€β”€ ClienteFactory.php
β”‚       β”œβ”€β”€ TrabajoFactory.php
β”‚       β”œβ”€β”€ FacturaFactory.php
β”‚       └── FotoTrabajoFactory.php
β”œβ”€β”€ resources/
β”‚   β”œβ”€β”€ views/
β”‚   β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   β”‚   β”œβ”€β”€ app.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.blade.php
β”‚   β”‚   β”‚   └── admin.blade.php
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   β”œβ”€β”€ login.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ register.blade.php
β”‚   β”‚   β”‚   └── verify.blade.php
β”‚   β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ users/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ edit.blade.php
β”‚   β”‚   β”‚   β”‚   └── show.blade.php
β”‚   β”‚   β”‚   └── system/
β”‚   β”‚   β”‚       β”œβ”€β”€ configuracion.blade.php
β”‚   β”‚   β”‚       └── estadisticas.blade.php
β”‚   β”‚   β”œβ”€β”€ clientes/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ edit.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ show.blade.php
β”‚   β”‚   β”‚   └── partials/
β”‚   β”‚   β”‚       β”œβ”€β”€ search.blade.php
β”‚   β”‚   β”‚       └── filtros.blade.php
β”‚   β”‚   β”œβ”€β”€ trabajos/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ edit.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ show.blade.php
β”‚   β”‚   β”‚   └── tipos/
β”‚   β”‚   β”‚       β”œβ”€β”€ silla.blade.php
β”‚   β”‚   β”‚       β”œβ”€β”€ sofa.blade.php
β”‚   β”‚   β”‚       └── personalizado.blade.php
β”‚   β”‚   β”œβ”€β”€ facturas/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ edit.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ show.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ pdf/
β”‚   β”‚   β”‚   β”‚   └── factura.blade.php
β”‚   β”‚   β”‚   └── series/
β”‚   β”‚   β”‚       β”œβ”€β”€ serie-a.blade.php
β”‚   β”‚   β”‚       β”œβ”€β”€ serie-b.blade.php
β”‚   β”‚   β”‚       └── serie-c.blade.php
β”‚   β”‚   β”œβ”€β”€ pagos/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ edit.blade.php
β”‚   β”‚   β”‚   └── show.blade.php
β”‚   β”‚   β”œβ”€β”€ fotos/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ show.blade.php
β”‚   β”‚   β”‚   └── galeria.blade.php
β”‚   β”‚   β”œβ”€β”€ materiales/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ edit.blade.php
β”‚   β”‚   β”‚   └── show.blade.php
β”‚   β”‚   β”œβ”€β”€ clausulas/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ create.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ edit.blade.php
β”‚   β”‚   β”‚   └── show.blade.php
β”‚   β”‚   β”œβ”€β”€ backups/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ logs.blade.php
β”‚   β”‚   β”‚   └── crear.blade.php
β”‚   β”‚   β”œβ”€β”€ reportes/
β”‚   β”‚   β”‚   β”œβ”€β”€ facturacion.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ trabajos.blade.php
β”‚   β”‚   β”‚   β”œβ”€β”€ pagos.blade.php
β”‚   β”‚   β”‚   └── clientes.blade.php
β”‚   β”‚   └── components/
β”‚   β”‚       β”œβ”€β”€ alertas.blade.php
β”‚   β”‚       β”œβ”€β”€ sidebar.blade.php
β”‚   β”‚       β”œβ”€β”€ navbar.blade.php
β”‚   β”‚       β”œβ”€β”€ buscador.blade.php
β”‚   β”‚       β”œβ”€β”€ filtros.blade.php
β”‚   β”‚       └── paginacion.blade.php
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   β”œβ”€β”€ app.js
β”‚   β”‚   β”œβ”€β”€ dashboard.js
β”‚   β”‚   β”œβ”€β”€ facturacion.js
β”‚   β”‚   β”œβ”€β”€ fotos.js
β”‚   β”‚   β”œβ”€β”€ buscador.js
β”‚   β”‚   └── componentes/
β”‚   β”‚       β”œβ”€β”€ Modal.js
β”‚   β”‚       β”œβ”€β”€ UploadFotos.js
β”‚   β”‚       └── CalculadoraCostos.js
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ app.css
β”‚   β”‚   β”œβ”€β”€ dashboard.css
β”‚   β”‚   β”œβ”€β”€ facturas.css
β”‚   β”‚   β”œβ”€β”€ galeria.css
β”‚   β”‚   └── responsive.css
β”‚   └── lang/
β”‚       └── es/
β”‚           β”œβ”€β”€ auth.php
β”‚           β”œβ”€β”€ pagination.php
β”‚           β”œβ”€β”€ passwords.php
β”‚           β”œβ”€β”€ validation.php
β”‚           └── messages.php
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ web.php
β”‚   β”œβ”€β”€ api.php
β”‚   β”œβ”€β”€ auth.php
β”‚   β”œβ”€β”€ admin.php
β”‚   └── console.php
β”œβ”€β”€ storage/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ backups/
β”‚   β”‚   β”‚   β”œβ”€β”€ automaticos/
β”‚   β”‚   β”‚   β”œβ”€β”€ manuales/
β”‚   β”‚   β”‚   └── logs/
β”‚   β”‚   β”œβ”€β”€ fotos/
β”‚   β”‚   β”‚   β”œβ”€β”€ originales/
β”‚   β”‚   β”‚   β”œβ”€β”€ comprimidas/
β”‚   β”‚   β”‚   β”œβ”€β”€ miniaturas/
β”‚   β”‚   β”‚   └── temporales/
β”‚   β”‚   β”œβ”€β”€ facturas/
β”‚   β”‚   β”‚   └── pdf/
β”‚   β”‚   └── public/
β”‚   β”‚       β”œβ”€β”€ documentos/
β”‚   β”‚       └── reportes/
β”‚   β”œβ”€β”€ framework/
β”‚   └── logs/
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.php
β”‚   β”œβ”€β”€ .htaccess
β”‚   β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ js/
β”‚   β”œβ”€β”€ images/
β”‚   └── storage -> ../storage/app/public
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ Unit/
β”‚   β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   β”œβ”€β”€ Services/
β”‚   β”‚   └── Traits/
β”‚   β”œβ”€β”€ Feature/
β”‚   β”‚   β”œβ”€β”€ Auth/
β”‚   β”‚   β”œβ”€β”€ Clientes/
β”‚   β”‚   β”œβ”€β”€ Trabajos/
β”‚   β”‚   β”œβ”€β”€ Facturas/
β”‚   β”‚   β”œβ”€β”€ Fotos/
β”‚   β”‚   └── Backups/
β”‚   └── TestCase.php
β”œβ”€β”€ app/
β”‚   └── Console/
β”‚       └── Kernel.php
β”œβ”€β”€ config/
β”œβ”€β”€ database/
β”œβ”€β”€ resources/
β”œβ”€β”€ routes/
β”œβ”€β”€ storage/
β”œβ”€β”€ tests/
β”œβ”€β”€ vendor/
β”œβ”€β”€ .env
β”œβ”€β”€ .env.example
β”œβ”€β”€ composer.json
β”œβ”€β”€ package.json
β”œβ”€β”€ artisan
└── README.md

CaracterΓ­sticas Organizadas en Orden LΓ³gico Ascendente
1. Infraestructura Base del Sistema
βœ… Sistema de autenticaciΓ³n con roles admin, tapicero, cliente
βœ… Interfaz moderna, responsive y amigable con colores y iconos alucivos a tapiceria
βœ… Dashboard con estadΓ­sticas

2. GestiΓ³n Central de Datos
βœ… Directorio completo de clientes con buscador
βœ… GestiΓ³n completa de clientes con buscador
βœ… BΓΊsqueda y filtros avanzados

3. NΓΊcleo del Negocio - Trabajos
βœ… Sistema completo de gestiΓ³n de trabajos
βœ… Sistema de trabajos con mΓΊltiples tipos
βœ… GestiΓ³n de materiales y costos
βœ… ClΓ‘usulas y tΓ©rminos legales

4. DocumentaciΓ³n Visual
βœ… Sistema completo de fotos (antes, durante, despuΓ©s)
βœ… GestiΓ³n de fotos de trabajos
βœ… Sistema completo de gestiΓ³n de fotos
βœ… Subida mΓΊltiple de fotos con compresiΓ³n
βœ… Miniaturas automΓ‘ticas
βœ… Marcar fotos como principales

5. Sistema Financiero
βœ… Sistema completo de pagos
βœ… Sistema de facturaciΓ³n completo
βœ… Sistema de facturaciΓ³n
βœ… Sistema de facturaciΓ³n con nΓΊmeros ΓΊnicos y correlativos
βœ… Control automΓ‘tico de numeraciΓ³n
βœ… MΓΊltiples series de facturaciΓ³n (A, B, C)
βœ… MΓΊltiples facturas por cliente
βœ… GestiΓ³n de estados de factura
βœ… Historial de facturas por cliente
βœ… CancelaciΓ³n de facturas

6. AnΓ‘lisis y Reportes
βœ… Reportes de facturaciΓ³n
βœ… EstadΓ­sticas y reportes
βœ… EstadΓ­sticas de uso de espacio

7. OptimizaciΓ³n y Mantenimiento
βœ… CompresiΓ³n automΓ‘tica de fotos antiguas
βœ… VerificaciΓ³n de espacio en disco

8. Seguridad y Respaldo
βœ… Respaldos en seeders con facil importaciΓ³n/exportaciΓ³n
βœ… Respaldos tambiΓ©n en archivo fΓ­sico en ruta especΓ­fica
βœ… Respaldos programados
βœ… Logs de respaldos y restauraciones
βœ… Logs detallados de respaldos
βœ… Limpieza automΓ‘tica de respaldos antiguos

armado: 

Plan de Desarrollo Paso a Paso - Sistema de TapicerΓ­a Odami
Te proporcionarΓ© un orden lΓ³gico para desarrollar el proyecto, dividido en fases manejables:

FASE 1: INFRAESTRUCTURA BASE (Semana 1)
Paso 1: ConfiguraciΓ³n Inicial
1. Configurar .env y conexiΓ³n a base de datos
2. Instalar dependencias: composer install, npm install
3. Configurar archivos bΓ‘sicos de configuraciΓ³n
   - config/app.php
   - config/auth.php
   - config/database.php
   - config/filesystems.php
Paso 2: Sistema de AutenticaciΓ³n y Roles

4. Crear migraciΓ³n de roles (2014_10_12_200000_create_roles_table.php)
5. Crear migraciΓ³n role_user (2014_10_12_300000_create_role_user_table.php)
6. Crear modelos: Role.php y User.php
7. Crear seeder: RolesSeeder.php (admin, tapicero, cliente)
8. Crear seeder: UsersSeeder.php
9. Configurar AuthServiceProvider.php con Gates/Policies
10. Crear middleware: CheckRole.php
11. Configurar rutas de autenticaciΓ³n: routes/auth.php
Paso 3: Layouts y Vistas Base

12. Crear layouts:
    - resources/views/layouts/app.blade.php
    - resources/views/layouts/admin.blade.php
    - resources/views/layouts/auth.blade.php
13. Crear componentes comunes:
    - resources/views/components/sidebar.blade.php
    - resources/views/components/navbar.blade.php
    - resources/views/components/alertas.blade.php
FASE 2: GESTIΓ“N DE DATOS BÁSICOS (Semana 2)
Paso 4: Sistema de Clientes

14. Crear migraciΓ³n de clientes (2024_01_01_000000_create_clientes_table.php)
15. Crear modelo: Cliente.php
16. Crear request: ClienteRequest.php
17. Crear controlador: ClienteController.php
18. Crear vistas clientes (index, create, edit, show)
19. Crear factory: ClienteFactory.php
20. Crear seeder: ClientesSeeder.php
Paso 5: Sistema de Materiales

21. Crear migraciΓ³n de materiales (2024_01_01_000002_create_materiales_table.php)
22. Crear modelo: Material.php
23. Crear request: MaterialRequest.php
24. Crear controlador: MaterialController.php
25. Crear vistas materiales
26. Crear seeder: MaterialesSeeder.php
FASE 3: NÚCLEO DEL NEGOCIO (Semana 3)
Paso 6: Sistema de Trabajos

27. Crear migraciΓ³n trabajos (2024_01_01_000001_create_trabajos_table.php)
28. Crear migraciΓ³n trabajo_material (tabla pivote)
29. Crear modelo: Trabajo.php (con relaciones)
30. Crear request: TrabajoRequest.php
31. Crear controlador: TrabajoController.php
32. Crear trait: CalculaCostos.php
33. Crear vistas trabajos
34. Crear vistas de tipos especΓ­ficos (silla, sofa, personalizado)
35. Crear observer: TrabajoObserver.php
Paso 7: Sistema de Fotos

36. Crear migraciΓ³n fotos_trabajos (2024_01_01_000005_create_fotos_trabajos_table.php)
37. Crear modelo: FotoTrabajo.php
38. Crear request: FotoTrabajoRequest.php
39. Crear controlador: FotoTrabajoController.php
40. Crear trait: ManejaFotos.php
41. Crear servicio: FotoService.php
42. Crear vistas fotos
43. Configurar almacenamiento de fotos
FASE 4: SISTEMA FINANCIERO (Semana 4)
Paso 8: Sistema de FacturaciΓ³n

44. Crear migraciΓ³n facturas (2024_01_01_000003_create_facturas_table.php)
45. Crear migraciΓ³n control_facturas (2024_01_01_000007_create_control_facturas_table.php)
46. Crear modelo: Factura.php
47. Crear modelo: ControlFactura.php
48. Crear request: FacturaRequest.php
49. Crear controlador: FacturaController.php
50. Crear trait: GeneraNumeroFactura.php
51. Crear reglas: NumeroFacturaUnico.php, FormatoSerieFactura.php
52. Crear servicio: FacturacionService.php
53. Crear vistas facturas
54. Crear vistas series (serie-a, serie-b, serie-c)
55. Crear plantilla PDF
Paso 9: Sistema de Pagos

56. Crear migraciΓ³n pagos (2024_01_01_000008_create_pagos_table.php)
57. Crear modelo: Pago.php
58. Crear request: PagoRequest.php
59. Crear controlador: PagoController.php
60. Crear servicio: PagoService.php
61. Crear vistas pagos
Paso 10: ClΓ‘usulas Legales

62. Crear migraciΓ³n clausulas (2024_01_01_000004_create_clausulas_table.php)
63. Crear modelo: Clausula.php
64. Crear controlador: ClausulaController.php
65. Crear vistas clausulas
FASE 5: ADMINISTRACIΓ“N Y REPORTES (Semana 5)
Paso 11: Dashboard y EstadΓ­sticas

66. Crear controlador: DashboardController.php
67. Crear servicio: EstadisticaService.php
68. Crear vista dashboard.blade.php
69. Crear JS dashboard.js
70. Crear CSS dashboard.css
Paso 12: Sistema de Reportes
text
71. Crear controlador: ReporteController.php
72. Crear servicio: ReporteService.php
73. Crear vistas reportes
74. Configurar grΓ‘ficos y estadΓ­sticas
Paso 13: GestiΓ³n de Usuarios

75. Crear controlador: UserController.php (en Admin)
76. Crear vistas de usuarios
77. Configurar permisos y roles
FASE 6: SEGURIDAD Y RESPALDOS (Semana 6)
Paso 14: Sistema de Backups

78. Crear migraciΓ³n backup_logs (2024_01_01_000006_create_backup_logs_table.php)
79. Crear modelo: BackupLog.php
80. Crear controlador: BackupController.php
81. Crear servicio: BackupService.php
82. Crear trait: BackupTrait.php
83. Crear middleware: LogBackupActivity.php
84. Crear vistas backups
85. Configurar archivo: config/backup.php
Paso 15: Comandos Programados

86. Crear comando: BackupAutomatico.php
87. Crear comando: ComprimirFotosAntiguas.php
88. Crear comando: VerificarEspacioDisco.php
89. Crear comando: LimpiarRespaldosAntiguos.php
90. Configurar Kernel.php para programar tareas
FASE 7: OPTIMIZACIΓ“N Y SERVICIOS (Semana 7)
Paso 16: Servicios Avanzados

91. Crear servicio: CompresionService.php
92. Crear servicio: EspacioDiscoService.php
93. Crear excepciones personalizadas
94. Crear observers adicionales
95. Crear reglas personalizadas
Paso 17: ConfiguraciΓ³n del Sistema

96. Crear migraciΓ³n configuraciones (2024_01_01_000009_create_configuraciones_table.php)
97. Crear modelo: Configuracion.php
98. Crear seeder: ConfiguracionesSeeder.php
99. Crear controlador: SystemController.php
100. Crear vista de configuraciΓ³n
FASE 8: PRUEBAS Y DEPURACIΓ“N (Semana 8)
Paso 18: Testing

101. Crear tests unitarios para modelos
102. Crear tests de feature para mΓ³dulos principales
103. Crear tests para servicios
104. Configurar entorno de testing
Paso 19: OptimizaciΓ³n Final

105. Optimizar consultas de base de datos
106. Implementar cachΓ© donde sea necesario
107. Optimizar assets (CSS/JS)
108. Configurar .htaccess y optimizaciones
109. Crear documentaciΓ³n bΓ‘sica
RECOMENDACIONES DE DESARROLLO:
Orden Priorizado por Dependencias:
Primero: Modelos y Migraciones (base de datos)

Segundo: Controladores y LΓ³gica de Negocio

Tercero: Vistas y Frontend

Cuarto: Servicios y Funcionalidades Avanzadas

Quinto: Seguridad y Backups

MΓ³dulos que Pueden Desarrollarse en Paralelo:
AutenticaciΓ³n + Roles

Clientes + Materiales

Trabajos + Fotos

FacturaciΓ³n + Pagos

Backups + Comandos

Archivos CrΓ­ticos que Necesitan AtenciΓ³n Temprana:
DatabaseSeeder.php - Configurar orden de seeders

AppServiceProvider.php - Configurar bindings

Kernel.php - Programar tareas automΓ‘ticas

.env - Variables de configuraciΓ³n

Checklist de Progreso Diario:
Migraciones creadas y probadas

Modelos con relaciones definidas

Controladores con mΓ©todos CRUD

Vistas bΓ‘sicas funcionando

Validaciones implementadas

Permisos y roles configurados

Pruebas bΓ‘sicas funcionando

#include "DIPs.h"

#include "Constants.h"

#include "Image.h"



#include <string.h>

#include <stdlib.h>

#include <time.h>

#include <stdio.h>

#include <assert.h>




/* hw2 FILTERS                                  */



/* Black & White */

IMAGE *BlackNWhite(IMAGE *image) {

    assert(image);



    for (int y = 0; y < ImageHeight(image); y++) {

        for (int x = 0; x < ImageWidth(image); x++) {

            int gray = (GetPixelR(image, x, y) +

                        GetPixelG(image, x, y) +

                        GetPixelB(image, x, y)) / 3;



            SetPixelR(image, x, y, gray);
            SetPixelG(image, x, y, gray);
            SetPixelB(image, x, y, gray);

        }

    }

    return image;

}



/* Negative */

IMAGE *Negative(IMAGE *image) {

    assert(image);



    for (int y = 0; y < ImageHeight(image); y++) {

        for (int x = 0; x < ImageWidth(image); x++) {

            SetPixelR(image, x, y, MAX_PIXEL - GetPixelR(image, x, y));

            SetPixelG(image, x, y, MAX_PIXEL - GetPixelG(image, x, y));

            SetPixelB(image, x, y, MAX_PIXEL - GetPixelB(image, x, y));

        }

    }

    return image;

}



/* Color Filter */

IMAGE *ColorFilter(IMAGE *image, int target_r, int target_g, int target_b,

                    int threshold, int replace_r, int replace_g, int replace_b) {

    assert(image);



    for (int y = 0; y < ImageHeight(image); y++) {

        for (int x = 0; x < ImageWidth(image); x++) {

            if (abs(GetPixelR(image, x, y) - target_r) <= threshold &&

                abs(GetPixelG(image, x, y) - target_g) <= threshold &&

                abs(GetPixelB(image, x, y) - target_b) <= threshold) {



                SetPixelR(image, x, y, replace_r);
                SetPixelG(image, x, y, replace_g);
                SetPixelB(image, x, y, replace_b);

            }

        }

    }

    return image;

}



/* Edge Detection */

IMAGE *Edge(IMAGE *image) {

    assert(image);



    int width = ImageWidth(image);

    int height = ImageHeight(image);



    IMAGE *tmp = CopyImage(image);

    assert(tmp);



    for (int y = 1; y < height - 1; y++) {

        for (int x = 1; x < width - 1; x++) {



            int sumR = 8 * GetPixelR(tmp, x, y)

                - GetPixelR(tmp, x-1, y-1) - GetPixelR(tmp, x, y-1) - GetPixelR(tmp, x+1, y-1)

                - GetPixelR(tmp, x-1, y)   - GetPixelR(tmp, x+1, y)

                - GetPixelR(tmp, x-1, y+1) - GetPixelR(tmp, x, y+1) - GetPixelR(tmp, x+1, y+1);



            int sumG = 8 * GetPixelG(tmp, x, y)

                - GetPixelG(tmp, x-1, y-1) - GetPixelG(tmp, x, y-1) - GetPixelG(tmp, x+1, y-1)

                - GetPixelG(tmp, x-1, y)   - GetPixelG(tmp, x+1, y)

                - GetPixelG(tmp, x-1, y+1) - GetPixelG(tmp, x, y+1) - GetPixelG(tmp, x+1, y+1);



            int sumB = 8 * GetPixelB(tmp, x, y)

                - GetPixelB(tmp, x-1, y-1) - GetPixelB(tmp, x, y-1) - GetPixelB(tmp, x+1, y-1)

                - GetPixelB(tmp, x-1, y)   - GetPixelB(tmp, x+1, y)

                - GetPixelB(tmp, x-1, y+1) - GetPixelB(tmp, x, y+1) - GetPixelB(tmp, x+1, y+1);



            sumR = (sumR > 255) ? 255 : (sumR < 0 ? 0 : sumR);

            sumG = (sumG > 255) ? 255 : (sumG < 0 ? 0 : sumG);

            sumB = (sumB > 255) ? 255 : (sumB < 0 ? 0 : sumB);



            SetPixelR(image, x, y, sumR);
            SetPixelG(image, x, y, sumG);
            SetPixelB(image, x, y, sumB);

        }

    }



    DeleteImage(tmp);

    return image;

}



/* Vertical Mirror */

IMAGE *VMirror(IMAGE *image) {

    assert(image);



    int height = ImageHeight(image);



    for (int y = 0; y < height / 2; y++) {

        for (int x = 0; x < ImageWidth(image); x++) {

            int yy = height - 1 - y;



            unsigned char r = GetPixelR(image, x, y);

            unsigned char g = GetPixelG(image, x, y);

            unsigned char b = GetPixelB(image, x, y);



            SetPixelR(image, x, y, GetPixelR(image, x, yy));

            SetPixelG(image, x, y, GetPixelG(image, x, yy));

            SetPixelB(image, x, y, GetPixelB(image, x, yy));



            SetPixelR(image, x, yy, r);
            SetPixelG(image, x, yy, g);
            SetPixelB(image, x, yy, b);

        }

    }

    return image;

}




/* PART 2: ASSIGNMENT 3  */



/* Shuffle */

IMAGE *Shuffle(IMAGE *image) {

    assert(image);



    int width = ImageWidth(image);

    int height = ImageHeight(image);

    int block_width = width / SHUFF_WIDTH_DIV;

    int block_height = height / SHUFF_HEIGHT_DIV;



    srand(time(NULL));



    for (int i = 0; i < SHUFF_NUM; i++) {

        int block1 = rand() % (SHUFF_WIDTH_DIV * SHUFF_HEIGHT_DIV);

        int block2 = rand() % (SHUFF_WIDTH_DIV * SHUFF_HEIGHT_DIV);



        int x1 = (block1 % SHUFF_WIDTH_DIV) * block_width;

        int y1 = (block1 / SHUFF_WIDTH_DIV) * block_height;



        int x2 = (block2 % SHUFF_WIDTH_DIV) * block_width;

        int y2 = (block2 / SHUFF_WIDTH_DIV) * block_height;



        for (int y = 0; y < block_height; y++) {

            for (int x = 0; x < block_width; x++) {

                unsigned char r = GetPixelR(image, x1 + x, y1 + y);

                unsigned char g = GetPixelG(image, x1 + x, y1 + y);

                unsigned char b = GetPixelB(image, x1 + x, y1 + y);



                SetPixelR(image, x1 + x, y1 + y, GetPixelR(image, x2 + x, y2 + y));

                SetPixelG(image, x1 + x, y1 + y, GetPixelG(image, x2 + x, y2 + y));

                SetPixelB(image, x1 + x, y1 + y, GetPixelB(image, x2 + x, y2 + y));



                SetPixelR(image, x2 + x, y2 + y, r);
                SetPixelG(image, x2 + x, y2 + y, g);
                SetPixelB(image, x2 + x, y2 + y, b);

            }

        }

    }



    return image;

}



/* Add Border */

IMAGE *AddBorder(IMAGE *image, char color[SLEN], int border_width) {

    assert(image);



    int r = 0, g = 0, b = 0;



    if (strcmp(color, "black") == 0)       { r = g = b = 0;   }

    else if (strcmp(color, "white") == 0)  { r = g = b = 255; }

    else if (strcmp(color, "red") == 0)    { r = 255; g = 0;   b = 0;   }

    else if (strcmp(color, "green") == 0)  { r = 0;   g = 255; b = 0;   }

    else if (strcmp(color, "blue") == 0)   { r = 0;   g = 0;   b = 255; }

    else if (strcmp(color, "yellow") == 0) { r = 255; g = 255; b = 0;   }

    else if (strcmp(color, "cyan") == 0)   { r = 0;   g = 255; b = 255; }

    else if (strcmp(color, "pink") == 0)   { r = 255; g = 0;   b = 255; }



    for (int y = 0; y < ImageHeight(image); y++) {

        for (int x = 0; x < ImageWidth(image); x++) {

            if (x < border_width || x >= ImageWidth(image) - border_width ||

                y < border_width || y >= ImageHeight(image) - border_width) {

                SetPixelR(image, x, y, r);
                SetPixelG(image, x, y, g);
                SetPixelB(image, x, y, b);

            }

        }

    }



    return image;

}
#include "Image.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>

/* Function to create a new image */
Image *NewImage(unsigned int Width, unsigned int Height) {
    // Allocate memory for the main Image struct
    Image *image = malloc(sizeof(Image));
    
    // Check if malloc worked
    if (image == NULL) {
        return NULL;
    }

    // Set the width and height
    image->W = Width;
    image->H = Height;

    // Allocate memory for Red, Green, and Blue arrays
    // Each one needs Width * Height amount of space
    image->R = malloc(sizeof(unsigned char) * Width * Height);
    image->G = malloc(sizeof(unsigned char) * Width * Height);
    image->B = malloc(sizeof(unsigned char) * Width * Height);

    // If any of the color arrays failed, we need to clean up and exit
    if (image->R == NULL || image->G == NULL || image->B == NULL) {
        DeleteImage(image);
        return NULL;
    }

    return image;
}

/* Function to free all the memory we used */
void DeleteImage(Image *image) {
    // Make sure the image actually exists before freeing
    if (image != NULL) {
        // Free the color arrays first
        if (image->R != NULL) {
            free(image->R);
        }
        if (image->G != NULL) {
            free(image->G);
        }
        if (image->B != NULL) {
            free(image->B);
        }

        // Set pointers to NULL so we don't use them by accident
        // (This is required for the assignment)
        image->R = NULL;
        image->G = NULL;
        image->B = NULL;

        // Finally free the image struct itself
        free(image);
    }
}

/* Get and Set functions for RED */
unsigned char GetPixelR(const Image *image, unsigned int x, unsigned int y) {
    assert(image != NULL);
    assert(x < image->W);
    assert(y < image->H);
    // Formula for 1D index: x + (y * Width)
    int index = x + (y * image->W);
    return image->R[index];
}

void SetPixelR(Image *image, unsigned int x, unsigned int y, unsigned char r) {
    assert(image != NULL);
    assert(x < image->W);
    assert(y < image->H);
    int index = x + (y * image->W);
    image->R[index] = r;
}

/* Get and Set functions for GREEN */
unsigned char GetPixelG(const Image *image, unsigned int x, unsigned int y) {
    assert(image != NULL);
    assert(x < image->W);
    assert(y < image->H);
    int index = x + (y * image->W);
    return image->G[index];
}

void SetPixelG(Image *image, unsigned int x, unsigned int y, unsigned char g) {
    assert(image != NULL);
    assert(x < image->W);
    assert(y < image->H);
    int index = x + (y * image->W);
    image->G[index] = g;
}

/* Get and Set functions for BLUE */
unsigned char GetPixelB(const Image *image, unsigned int x, unsigned int y) {
    assert(image != NULL);
    assert(x < image->W);
    assert(y < image->H);
    int index = x + (y * image->W);
    return image->B[index];
}

void SetPixelB(Image *image, unsigned int x, unsigned int y, unsigned char b) {
    assert(image != NULL);
    assert(x < image->W);
    assert(y < image->H);
    int index = x + (y * image->W);
    image->B[index] = b;
}

/* Functions to get Width and Height */
unsigned int ImageWidth(const Image *image) {
    assert(image != NULL);
    return image->W;
}

unsigned int ImageHeight(const Image *image) {
    assert(image != NULL);
    return image->H;
}
.grid {
  columns: 18rem;
  gap: 1rem;
  counter-reset: grid;
}

.item + .item {
  margin-top: 1rem;
}

.item {
  break-inside: avoid;
  aspect-ratio: 4 / 3;
  background: pink;
  padding: 1rem;
  border-radius: 0.75rem;
}

.item::before {
  counter-increment: grid;
  content: counter(grid);
}

.item:nth-child(3n) {
  aspect-ratio: 1;
  background: lavender;
}

.item:nth-child(3n - 1) {
  aspect-ratio: 2 / 3;
  background: lightblue;
}
Looking to build a scalable app like Amazon? 75way Technologies delivers performance-driven Amazon Clone app development services, built on a secure architecture, with an intuitive UX, and advanced vendor management. Our solution is optimized for startups and enterprises targeting global growth.  Partner with 75way Technologies for your next Amazon Clone app.
import readline from 'readline'
function input(question){
  return new Promise((resolve) => {
    const rl = readline.createInterface({
      input: process.stdin,
      output: process.stdout
    })
    rl.question(question, (ans) => {
      rl.close();
      resolve(ans)
    })
  })
}

const name = await input("what's the name? ")
console.log("Hello: "+name)
star

Mon Mar 16 2026 12:59:53 GMT+0000 (Coordinated Universal Time) https://www.touchcrypto.org/blog/hft-trading-bot-development

@pambeeslyiam #hft #hfttradingbot

star

Fri Mar 13 2026 12:40:27 GMT+0000 (Coordinated Universal Time)

@master00001

star

Fri Mar 13 2026 11:17:59 GMT+0000 (Coordinated Universal Time) https://www.learnentityframeworkcore.com/migrations/update-database

@darkoeller

star

Thu Mar 12 2026 12:26:33 GMT+0000 (Coordinated Universal Time)

@v1ral_ITS

star

Thu Mar 12 2026 11:10:50 GMT+0000 (Coordinated Universal Time)

@v1ral_ITS

star

Thu Mar 12 2026 09:16:40 GMT+0000 (Coordinated Universal Time)

@v1ral_ITS

star

Wed Mar 11 2026 09:47:10 GMT+0000 (Coordinated Universal Time) https://www.b2bcert.com/iso-28000-certification-in-san-jose/

@Thulasisree

star

Tue Mar 10 2026 13:38:17 GMT+0000 (Coordinated Universal Time)

@RehmatAli2024

star

Tue Mar 10 2026 12:54:00 GMT+0000 (Coordinated Universal Time) https://gist.github.com/ilessing/7ff705de0f594510e463146762cef779

@teressider

star

Tue Mar 10 2026 12:10:16 GMT+0000 (Coordinated Universal Time) https://www.hivelance.com/top-features-to-implement-in-multichain-crypto-wallet

@stevejohnson #walletdevelopment

star

Tue Mar 10 2026 03:41:28 GMT+0000 (Coordinated Universal Time)

@Pulak

star

Sat Mar 07 2026 11:54:36 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:53:31 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:52:57 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:52:17 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:51:38 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:50:46 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:50:23 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:49:54 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:49:22 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:48:53 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:48:07 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:47:32 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:46:53 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:40:16 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 11:39:25 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 10:45:25 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 10:29:15 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Sat Mar 07 2026 10:14:17 GMT+0000 (Coordinated Universal Time)

@Manasi123 #html

star

Thu Mar 05 2026 11:12:43 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/polymarket-clone-script

@Mayajamison #crypto #blockchain #polymarketclone

star

Tue Mar 03 2026 16:09:38 GMT+0000 (Coordinated Universal Time)

@jrg_300i

star

Sat Feb 28 2026 10:33:56 GMT+0000 (Coordinated Universal Time)

@LavenPillay #jenkins #build #parameter

star

Sat Feb 28 2026 08:48:28 GMT+0000 (Coordinated Universal Time) https://www.addustechnologies.com/cryptocurrency-wallet-development-company

@corasmith #cryptowallet development #walletdevelopment services #cryptowallet development company

star

Sat Feb 28 2026 06:45:23 GMT+0000 (Coordinated Universal Time)

@kuldeep

star

Fri Feb 27 2026 11:01:46 GMT+0000 (Coordinated Universal Time) https://www.softean.com/crypto-trading-bot-development

@softean

star

Fri Feb 27 2026 04:32:07 GMT+0000 (Coordinated Universal Time) made it myself

@82michael.codes #bmi

star

Thu Feb 26 2026 19:11:21 GMT+0000 (Coordinated Universal Time)

@jrg_300i

star

Thu Feb 26 2026 19:08:42 GMT+0000 (Coordinated Universal Time)

@jrg_300i

star

Thu Feb 26 2026 14:42:26 GMT+0000 (Coordinated Universal Time) https://www.softean.com/cryptocurrency-wallet-development

@softean

star

Thu Feb 26 2026 13:43:02 GMT+0000 (Coordinated Universal Time) https://www.softean.com/cryptocurrency-exchange-development

@softean

star

Thu Feb 26 2026 10:53:04 GMT+0000 (Coordinated Universal Time) https://www.thecryptoape.com/uniswap-clone-script

@Davidbrevis

star

Wed Feb 25 2026 18:14:16 GMT+0000 (Coordinated Universal Time)

@emelyb2

star

Wed Feb 25 2026 15:40:53 GMT+0000 (Coordinated Universal Time)

@emelyb2

star

Wed Feb 25 2026 11:55:35 GMT+0000 (Coordinated Universal Time)

@marcopinero #css #html

star

Wed Feb 25 2026 11:50:38 GMT+0000 (Coordinated Universal Time) https://www.addustechnologies.com/blog/best-copy-trading-platforms

@corasmith #blockchain #copy #trading #crypto

star

Wed Feb 25 2026 08:17:51 GMT+0000 (Coordinated Universal Time) https://www.addustechnologies.com/crypto-futures-prop-trading-platform-development

@brucebanner #prop #trading #crypto

star

Tue Feb 24 2026 18:58:49 GMT+0000 (Coordinated Universal Time) https://75way.com/amazon-clone

@amazonclone #amazon #clone #app #development #usa #script

star

Tue Feb 24 2026 14:51:06 GMT+0000 (Coordinated Universal Time)

@Muhammadcodes #javascript

star

Tue Feb 24 2026 13:36:14 GMT+0000 (Coordinated Universal Time) https://www.amraskinclinic.com/services/aesthetic-dermatology-clinic-in-madurai

@jamesbritto

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension