Skip to content

Instantly share code, notes, and snippets.

View ggagosh's full-sized avatar

Giorgi Gagoshidze ggagosh

View GitHub Profile
@ggagosh
ggagosh / sse.ts
Created May 5, 2023 17:17
SSE warning example
@Sse('sse')
sse() {
const subject = new Subject();
setTimeout(() => {
Array.from(Array(1000).keys()).forEach((i) => {
subject.next({
data: {
message: `Message #${i}`,
},
/**
* Validates the entity against its configuration.
*
* @return bool
* TRUE if the entity is valid, FALSE otherwise.
*/
public function validate(): bool {
foreach ($this->config as $type => $type_config) {
// Check if the entity has any days of this type.
if (!isset($this->data[$type])) {
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
@ggagosh
ggagosh / .editorconfig
Created May 6, 2017 20:31
.editorconfig files for Symfony project
# Symfony editor configuration normalization
# @see http://editorconfig.org/
; top-most EditorConfig file
root = true
; Unix-style newlines
[*]
end_of_line = lf
charset = utf-8
@ggagosh
ggagosh / .editorconfig
Created May 6, 2017 20:31
.editorconfig files for Drupal project
# Drupal editor configuration normalization
# @see http://editorconfig.org/
# This is the top-most .editorconfig file; do not search in parent directories.
root = true
# All files.
[*]
end_of_line = LF
indent_style = space
@ggagosh
ggagosh / SiteSettingsForm.php
Created March 11, 2017 18:18
SiteSettingsForm
<?php
/**
* @file
* Contains \Drupal\module_name\SiteSettingsForm.
*/
namespace Drupal\module_name\Form;
use Drupal\Core\Form\ConfigFormBase;
<?php
function db_select($table,$query) {
$pdo = new PDO('mysql:host='.DB_HOST.';'.'dbname='.DB_NAME.'', '.DB_USER.', '');
$quey_key = array_keys($query);
$query_values = array_values($query);
$sql_query_condition = "";
for($i = 0; $i < count($quey_key); $i++){
if(!$quey_key[$i+1]){
$sql_query_condition .= $quey_key[$i] . "=?";