Skip to content

Instantly share code, notes, and snippets.

@xmsi
xmsi / windows_xmsi.md
Created March 21, 2025 16:41
Windows

How to format and clean usb flash in Windows

  1. Powershell ->
  2. diskpart

  3. list disk

  4. select disk

  5. clean

  6. create partion primary

  7. format fs=ntfs

@xmsi
xmsi / movedns_xmsi.md
Created February 18, 2025 10:33
Move DNS domain from hostinger to digitalOcean

How to move domain from Hostinger to DigitalOcean

  1. I couldn't use CNAME for root domain (it doesn't works), so decided to get all dns names from hostinger to digitalOcean
  2. Also you should configure email profiles in Hostinger:
  3. Go to the DigitalOcean Control Panel and navigate to the Networking section.
  4. Select your domain to view and edit its DNS records. Add dns records. These records can be seen from Hostinger's Email management section.
@xmsi
xmsi / postgresql_xmsi.md
Created January 13, 2025 10:42
PostgreSQL_xmsi
@xmsi
xmsi / repository_strategy_xmsi.md
Created January 3, 2025 10:43
Repository and Strategy Patterns

Author: GPT-4o

In Laravel, Service Pattern and Repository Pattern are two common design patterns used to structure the business logic and data layer. Each pattern has its purpose and responsibilities, and they can even complement each other.

1. Service Pattern

The Service Pattern is used to encapsulate business logic, making it reusable and independent of the controller or other layers. This is where you place the "what needs to be done" logic, such as calculations, complex workflows, or coordination of multiple repositories or APIs.

Key Characteristics:

  • Focuses on business logic.
  • Keeps controllers thin by moving complex logic out.
@xmsi
xmsi / debounce_xmsi.md
Created January 1, 2025 15:06
debounce for API limits

Debounce

Author: GPT-4o

Lodash's debounce function is used to limit how often a function is executed over time, even if it's called frequently. It's particularly helpful when you want to avoid unnecessarily calling a function multiple times in quick succession. This is especially useful for improving performance and user experience.

Example Scenario: Searching While Typing

Imagine you have a search bar where users type a query, and for each keystroke, a search request is sent to a server. If a user types "hello," five separate requests would be sent: one for "h," another for "he," then "hel," "hell," and "hello." This can overload the server and create lag.

@xmsi
xmsi / serialization_xmsi.md
Created December 30, 2024 04:59
Serialization

Author: Gemini

Think of it like this:

Imagine building a Lego car. You have all the different bricks and pieces put together to form the car. Serialization is like taking that Lego car apart and putting all the bricks into a box. You can then ship that box to someone else, and they can use the instructions (the serialization format) to rebuild the exact same car from the bricks.

Common uses of serialization

Saving objects to files: You can serialize objects and save them to files on your hard drive, allowing you to load them back into your program later. Sending objects over a network: Serialization is essential for sending objects between different computers or applications, such as in web services or distributed systems.

@xmsi
xmsi / vue.md
Last active December 21, 2024 05:43
Vue cheatsheet

nextTick

Author: Gemini

Vue.js uses a reactivity system to efficiently update the DOM when your component's data changes. However, these DOM updates aren't immediate; they happen asynchronously to optimize performance. This means there's a tiny delay between when you change data and when the browser reflects that change.

Why nextTick?

nextTick lets you run code after Vue has finished updating the DOM in response to data changes. This is crucial when you need to:

@xmsi
xmsi / Php_xmsi.md
Last active March 6, 2025 05:51
Code sheat

Null Coalescing (??) vs Ternary (?:) operators

  • Null coalescing - check for null and performs next (?? ??=)
  • Ternary - check for false and performs next (?:)

Testing

Functional and Unit testing

  • Functional tests only in and out. Your soft becomes black-box, it kind of user behavior simulation
@xmsi
xmsi / docker.md
Last active March 5, 2025 09:28
Docker helper

Docker Engine, Compose, Portainer on Ubuntu 22

Docker Engine, Compose and Portainer installation on ubuntu 22. Optional: how to change default docker root folder (where images and containers are stored)

Install docker engine

tutorial video tested it works To install on Ubuntu 22 you should type these commands in your CLI

  1. $ curl -fsSl https://get.docker.com -o get-docker.sh
  2. $ sudo sh get-docker.sh
  3. $ sudo groupadd docker