Skip to content

Instantly share code, notes, and snippets.

View zahra-ove's full-sized avatar

zahra oveyedzade zahra-ove

View GitHub Profile
@zahra-ove
zahra-ove / go.md
Last active November 27, 2025 17:03

33:

for creating a golang project:

  1. create a directory with any name (e.g. session33)
  2. create a file with .go prefix in it (e.g. main.go)
  3. by typing this command in terminal create a go.mod file:
  1. dirrectent

nodes can take on various roles, including data nodes that store and execute queries, master nodes that manage cluster-wide operations, and coordinating nodes that forward requests to the appropriate nodes. Each node runs independently and communicates with other nodes to form a cluster.

  • Master Node (Cluster management (not data handling))
  • Data Node (Stores and manages data (the actual indices and shards))
  • Ingest Node (Preprocess documents before indexing)

Elasticsearch In action Books ... important notes

  1. what is elasticsearch?
    Elasticsearch is a powerful and popular open source distributed search and analytics engine.

  2. Structured vs. unstructured (full-text) data
    Data predominantly comes in two flavors: structured and unstructured. The fundamental differentiator between these two categories is the way the data is stored and analyzed. Structured data follows a predefined schema/model, while unstructured data is free-form, unorganized, and schema-free

redis config file:\

/etc/redis.conf

remove all keys in redis:

flushall

from book: Elasticsearch: The definitive guide

  1. Test it out by opening another terminal window and running the following:\
curl http://localhost:9200/?pretty
  1. A node is a running instance of Elasticsearch. A cluster is a group

PHQL

  1. PHQL (Phalcon Query Language) in the Phalcon framework is a high-level, object-oriented SQL dialect designed to interact with databases through Phalcon's ORM.

  2. Relationship Handling:

Simplifies joins using predefined model relationships. For example, if User is related to Post, you can write:

  1. using array_filter without callback function:

In PHP, the array_filter function is used to filter elements of an array using a callback function. However, if no callback function is provided, it will filter out falsy values by default. Behavior of array_filter($categoryIds) without a callback

If array_filter is used without a callback, it removes elements that evaluate to false in a Boolean context. Specifically, it filters out:

false
0 (integer and string "0")

null

Growing object oriented software guided by test Notes

  1. test drive development (p. 17)

  2. Alan Kay’s1 concept of objects being similar to biological cells that send each other messages.

  3. let the tests guide development.

  4. We use the tests to clarify our ideas about what we want the code to do. (p. 5)

  5. When we’re implementing a feature, we start by writing an acceptance test, which exercises the functionality we want to build. While it’s failing, an acceptance

important notes from book: "Unit testing Principles, Practices and Patterns by Viladimir Khorikov"

  1. AAA (Arrange, Act, Assert) or Given-When-Then

  2. A unit in unit testing is a unit of behavior, not a unit of code. A single unit of behavior can exhibit multiple outcomes, and it’s fine to evaluate them all in one test. (p. 69)

  3. Having that said, you need to watch out for assertion sections that grow too large: it could be a sign of a missing abstraction in the production code. (p. 69)